Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #90

Merged
merged 6 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
os: [ubuntu-20.04, ubuntu-22.04]
compiler: [gcc-8, clang-7]
build_type: ['Release', 'Debug']
thread_safe: ['ON', 'OFF']
multithreaded: ['ON', 'OFF']
fail-fast: false
env:
MAKEFLAGS: "-j2"
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
-DRODIN_USE_MCSS=OFF
-DRODIN_BUILD_SRC=ON
-DRODIN_BUILD_EXAMPLES=ON
-DRODIN_BUILD_THREAD_SAFE=${{ matrix.thread_safe }}
-DRODIN_BUILD_MULTITHREADED=${{ matrix.multithreaded }}
- name: Build
run: cmake --build ${{github.workspace}}/build
MacOS:
Expand All @@ -60,7 +60,7 @@ jobs:
matrix:
os: [macos-11, macos-12]
build_type: ['Release', 'Debug']
thread_safe: ['ON', 'OFF']
multithreaded: ['ON', 'OFF']
fail-fast: false
env:
MAKEFLAGS: "-j2"
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
-DRODIN_USE_MCSS=OFF
-DRODIN_BUILD_SRC=ON
-DRODIN_BUILD_EXAMPLES=ON
-DRODIN_BUILD_THREAD_SAFE=${{ matrix.thread_safe }}
-DRODIN_BUILD_MULTITHREADED=${{ matrix.multithreaded }}
- name: Build
run: cmake --build ${{github.workspace}}/build

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
os: [ubuntu-latest]
compiler: [gcc-8]
build_type: ['Debug']
thread_safe: ['ON', 'OFF']
multithreaded: ['ON', 'OFF']
fail-fast: false
env:
MAKEFLAGS: "-j2"
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
-DRODIN_BUILD_SRC=ON
-DRODIN_BUILD_UNIT_TESTS=ON
-DRODIN_CODE_COVERAGE=ON
-DRODIN_THREAD_SAFE=${{ matrix.thread_safe }}
-DRODIN_MULTITHREADED=${{ matrix.multithreaded }}
- name: Build
run: cmake --build ${{github.workspace}}/build
- name: Run tests
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ option(RODIN_CODE_COVERAGE "Compile with code coverage flags"
option(RODIN_LTO "Compile with link time optimization" OFF)
option(RODIN_FEATURE_SUMMARY "Print Rodin feature summary" ON)
option(RODIN_THREAD_SAFE "Enforces thread-safety." OFF)
option(RODIN_MULTITHREADED "Utilizes multithreading capabalities." OFF)

if (RODIN_MULTITHREADED)
set(RODIN_THREAD_SAFE ON CACHE BOOL "" FORCE)
endif()

set(RODIN_RESOURCES_DIR "${PROJECT_SOURCE_DIR}/resources/")
set(RODIN_THIRD_PARTY_DIR "${PROJECT_SOURCE_DIR}/third-party/")
Expand Down
4 changes: 2 additions & 2 deletions doc/Examples/PDEsIndex.dox
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
@page examples-pdes-index Variational methods and weak formulations
@brief Showcases the usage of the Rodin::Variational module
@page examples-pdes-index Partial differential equations
@brief Showcases how to use Rodin to solve PDEs

- @subpage examples-pdes-poisson
- @subpage examples-pdes-elasticity
Expand Down
10 changes: 9 additions & 1 deletion doc/ExamplesIndex.dox
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@

@subsection examples-index-pdes Solving PDEs

- @subpage examples-pdes-index
%Rodin can be used to solve partial differential equations of many types. To
start solving PDEs with Rodin, we recommend taking a look at the simplest
example which is how to solve the Poisson equation.

| Equation | Link to example |
| ----------------------------------------------- | --------------- |
| @f$ - \Delta u = f @f$ | @subpage examples-pdes-poisson |
| @f$ - \nabla \cdot \sigma (u ) = 0 @f$ | @subpage examples-pdes-elasticity |
| @f$ - \Delta u + u = f \text{ on } S^2 \subset \mathbb{R}^3 @f$ | @subpage examples-pdes-surface_meshes |

@subsection examples-index-solver Solving linear systems

Expand Down
10 changes: 10 additions & 0 deletions doc/Namespaces.dox
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@
variational expressions.
*/

/**
@dir Rodin/Threads
@brief Namespace @ref Rodin::Threads
*/

/**
@namespace Rodin::Threads
@brief Module containing various tools for working with threads.
*/

/**
@dir Rodin/Geometry/Euclidean
@brief Namespace @ref Rodin::Geometry::Euclidean
Expand Down
21 changes: 20 additions & 1 deletion doc/Notation.dox
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,26 @@
@page notation-index Notation
@brief Explanation of the notation used throughout the documentation.

- @f$ \mathcal{T}_h @f$ represents the discrete mesh.
Most of the notation follows the same principles as that of
@cite guermond2021finiteI.

@tableofcontents

## Notation regarding geometry

Please see the table below for a description of the symbols used for
geometric objects:

| Notation | Description |
| ----------------- | ------------------------------------------------------ |
| @f$ \Omega @f$ | Denotes a domain with Lipschitz domain. |
| @f$ \partial \Omega @f$ | Denotes the Lipschitz boundary of the Lipschitz domain @f$ \Omega @f$. |
| @f$ \mathcal{T}_h @f$ | Denotes a polyhedral complex which represents the domain @f$ \Omega @f$. |
| @f$ \mathcal{F}_h @f$ | Represents the faces of the domain @f$ \Omega @f$. |
| @f$ \mathcal{B}_h @f$ | Represents the boundary faces of the domain @f$ \Omega @f$. |
| @f$ \mathcal{I}_h @f$ | Represents the interfaces of the domain @f$ \Omega @f$. |

## Notation regarding variational methods

*/

22 changes: 8 additions & 14 deletions examples/Geometry/Connectivity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,26 @@
* (See accompanying file LICENSE or copy at
* https://www.boost.org/LICENSE_1_0.txt)
*/
#include <chrono>
#include <Rodin/Geometry.h>
#include <Rodin/Alert.h>

using namespace Rodin;
using namespace Geometry;


int main(int, char**)
{
Mesh mesh;
mesh = mesh.UniformGrid(Polytope::Type::Triangle, 6, 6);
mesh = mesh.UniformGrid(Polytope::Type::Triangle, 1024, 1024);

auto t0 = std::chrono::high_resolution_clock::now();
mesh.getConnectivity().compute(1, 2);
mesh.getConnectivity().compute(2, 1);
mesh.getConnectivity().compute(1, 1);

mesh.save("miaow.mesh", IO::FileFormat::MEDIT);

auto skin = mesh.skin();
const auto& inc = skin.getConnectivity().getIncidence(1, 1);
for (size_t i = 0; i < inc.size(); i++)
{
std::cout << i << ": ";
for (const Index s : inc[i])
std::cout << s << " ";
std::cout << std::endl;
}
skin.save("skin.mesh", IO::FileFormat::MEDIT);
auto t1 = std::chrono::high_resolution_clock::now();
auto d = t1 - t0;
std::cout << std::chrono::duration_cast<std::chrono::milliseconds>(d).count() << std::endl;
return 0;
}

2 changes: 1 addition & 1 deletion examples/PDEs/Poisson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ int main(int, char**)
{
// Build a mesh
Mesh mesh;
mesh = mesh.UniformGrid(Polytope::Type::Triangle, 32, 32);
mesh = mesh.UniformGrid(Polytope::Type::Triangle, 16, 16);
mesh.getConnectivity().compute(1, 2);

// Functions
Expand Down
21 changes: 10 additions & 11 deletions examples/Variational/P1/P1Potential.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,16 @@ int main(int, char**)
mesh.scale(2. / (n - 1));
mesh.displace(VectorFunction{-1, -1});

auto it = mesh.getCell();
// for (auto it = mesh.getVertex(); it; ++it)
// {
// const auto& coords = it->getCoordinates();
// const Scalar x = coords.x();
// const Scalar y = coords.y();
// const Scalar u = x * sqrt(x * x + y * y - x * x * y * y) / sqrt(x * x + y * y);
// const Scalar v = y * sqrt(x * x + y * y - x * x * y * y) / sqrt(x * x + y * y);
// mesh.setVertexCoordinates(it->getIndex(), u, 0);
// mesh.setVertexCoordinates(it->getIndex(), v, 1);
// }
for (auto it = mesh.getVertex(); it; ++it)
{
const auto& coords = it->getCoordinates();
const Scalar x = coords.x();
const Scalar y = coords.y();
const Scalar u = x * sqrt(x * x + y * y - x * x * y * y) / sqrt(x * x + y * y);
const Scalar v = y * sqrt(x * x + y * y - x * x * y * y) / sqrt(x * x + y * y);
mesh.setVertexCoordinates(it->getIndex(), u, 0);
mesh.setVertexCoordinates(it->getIndex(), v, 1);
}
MMG::Optimizer().setHMax(0.04).setHMin(0.002).optimize(mesh);

for (const Index& i : mesh.getRidges())
Expand Down
Loading
Loading