Manicore
Library to implement schemes on n-dimensionnal manifolds.
|
Manicore - Library to implement schemes on n-dimensional manifolds.
The sources are available at https://github.com/mlhanot/Manicore.
This library stem from the HArD::Core library (https://github.com/jdroniou/HArDCore) and the generalization of the Polytopal Exterior Calculus (https://doi.org/10.48550/arXiv.2303.11093) to manifolds with general Riemannian metric. The name come from Manifold and HArDCore.
You will find on this page the following sections:
The project uses a fairly minimal set of dependency. The only one required to compile the code is Eigen library version 3.4 or later. This is the version available on Debian Bookworm (Debian 12), where it can be installed by running
This is an header only library and it can also be installed extracting the sources anywhere CMake can find them.
Internally, Manicore also uses the json library from nlohmann, quadrature rules from John Burkardt and various functions from the HArDCore library. However, these dependency are copied into this repository and do not need to be installed individually.
A recent compiler with support for c++20 is also required to compile the library.
Once the dependency is installed, this library can be build running the following from the repository root:
To use the library, some component of the mesh must also be compiled as a shared library. This can be done independently and will be linked at runtime.
Although the current version only support the dimension 2, the library aimed to be usable in any dimension. The target dimension is set at compile time by the macro MAX_DIMENSION. It should be sufficient on ulterior version, but for now one must also provide quadrature rules, a support for the triangulation and adapt the mesh interface.
It is possible to build the test case enabling the option BUILD_TEST in CMake. This can be used to verify the installation and gives some examples on the usage.
The type of build (Release; RelWithDebInfo; Debug; Debugall) can be set in CMake. It defaults to Release.
In a flat space, we can describe a mesh using only the location of the vertices and the topological data. In general, we must also specify the shape of each cell.
In Manicore, the mesh is given in two parts:
To ease the description of the geometrical data, one can include some parameters to the json file that will be passed to the functions of the shared library. This allows to reuse the same code for several cells.
The manifold is viewed through an atlas, and the cells are always mapped to a chart of this atlas. For the flat cell, the library can generate the mapping by itself. However, it must be provided in the shared library for the curved cells.
The format for the json file is described here. The top level fields are:
The field Map serves to describe the atlas. It contains:
Even if the extra arguments are not mandatory, there are used to determined the number of charts. Moreover, the charts are implicitly indexed by their order of appearance in this array. If extra arguments are not needed for some chart, pass 'null' instead of nothing.
The field Dimension is just a number. It is the intrinsic dimension of the manifold (e.g. 2 for a sphere in \(\mathbb{R}^3\)).
The field Cells describe the mesh. It is an array of array of cell. The n-th element of Cell is the list of (n-1)-cells. The description of 0-cells (or vertices) is different, it contains only two informations:
The description of n-cells (n > 0) contains:
As for the chart, the cells are implicitly indexed by there order of appearance in the array. To summarize, the indices are generated as follows:
An element is flat if its Mappings is [0]
and it boundary is also flat. To implement more efficiently the flat elements, it is required that a flat element belongs to a single chart. If an element if flat in several charts, then a trivial mapping must be manually implemented.
The interface for the shared library is given here. See also here for related functions. The code given in the library will be executed without any check or security measure.
The main interface is a function, taking an index as argument and returning the appropriate structure. It will usually be a simple switch statement. The structures are described here. The _extra member is set at runtime from the data in the json file and allows to parametrize the functions.
There is three types of function to implement in the library:
For now, there is three main classes in the library:
To use the DDR construction in a scheme, the setup takes only a few line:
The operator can then be used directly. For example, to compute the differential of an interpolate, one can do:
The various available components are summarized in the following diagram: