Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
cd653dd
operators: new namespace with differential operators
biancagi Feb 4, 2026
8aca843
utilities: add {unordered_map} stl header
biancagi Feb 4, 2026
f7d9294
geometry: rename (euclidean) metric into {euclidean_metric} throughout
biancagi Mar 22, 2026
295e58c
geometry: cleanup redundancy in {coordinates_t} definition in api
biancagi Mar 22, 2026
5ba5fee
geometry: add concept of metric being compatible with a type of coord…
biancagi Mar 22, 2026
6b02af0
fem: remove unused method {parametrization} of {IsoparametricSegmentP1}
biancagi Apr 27, 2026
f045343
manifolds: remove unused method {coordinates} of {Manifold} class
biancagi Apr 27, 2026
e75d529
coordinates: publish the size of the underlying array in Coordinates.h
Pawel024 Mar 31, 2026
213785e
tests/fem: adjust check of gradient vector in test gradient consistency
biancagi May 1, 2026
9ecf38e
tests/geometry: add test of euclidean metric in 1D
biancagi May 4, 2026
1cfaff8
tests/fem: remove test {localize_field}
biancagi May 4, 2026
95bd94d
fem: fix segment orientation by correcting parametric coordinate orde…
biancagi May 4, 2026
357cb68
tests/quadrature: minor fix
biancagi May 4, 2026
bb3715a
tensor: implement contraction of forms on tuple-like input
biancagi May 4, 2026
5b34647
tests/manifold: add test of segment embedded in 2D
biancagi May 4, 2026
bb799ea
geometry: implement free function {volume}, which computes volumes of…
biancagi May 4, 2026
6a9ce98
functions: consistency fix with ref. 34f7721
biancagi May 4, 2026
276ab50
tests/input: fix orientation of rectangle mesh
biancagi May 4, 2026
7243d1f
tests/mesh: move tests on volume calculation in Euclidean space to {m…
biancagi May 4, 2026
7adb4bd
tests/mesh: move tests on volume of single-element submanifolds out t…
biancagi May 4, 2026
5f3267c
tests/mesh: move tests on volume of meshes to {mesh} directory
biancagi May 4, 2026
6afd02e
tests/manifolds: temporarily remove tests of half sphere
biancagi May 4, 2026
e735d16
geometry: improve comment in {GeometricSimplex}
biancagi May 5, 2026
cf059bd
fem: redesign blocks and weakform integration
biancagi May 30, 2026
9534f28
manifolds: major redesign of class {Manifold}
biancagi May 5, 2026
9a2e96f
fem/elements: consistency edits across isoparametric elements, mostly…
biancagi Jun 2, 2026
982400a
fem/elements: major redesign of the finite elements implementation
biancagi Jun 22, 2026
a5ad833
tests: infer the reference simplex type for the quadrature rule from …
biancagi Jun 22, 2026
20ada6c
fem: in class {FunctionSpace} replace {element_type} with {finite_ele…
biancagi Jun 22, 2026
aaf9d26
fem/elements: in isoparametric element classes replace {element_type}…
biancagi Jun 22, 2026
c633547
geometry: remove obsolete method to instantiate a {GeometricSimplex}
biancagi Jun 22, 2026
8006c80
geometry: rename {area} to dimension-angostic {measure} in {Reference…
biancagi Jun 22, 2026
5883fdf
geometry: rename {metric_space} to {euclidean_metric_space} throughout
biancagi Jun 22, 2026
24b1ae1
geometry: in factory methods {segment}, {triangle}, and {tetrahedron}…
biancagi Jun 22, 2026
2383135
manifolds: remove unused method
biancagi Jun 22, 2026
7a155bb
manifolds: in class {Manifold} rename {volume_form} to {metric_volume…
biancagi Jun 22, 2026
7e08ab9
mito: consistency fix after rev. a9e3bfc
biancagi Jun 22, 2026
35ac669
fem/blocks: use uniform initializer in method {compute}
biancagi Jun 22, 2026
0ae5f25
fem/blocks: in {SourceTermBlock} replace {elementary_rhs} with {eleme…
biancagi Jun 22, 2026
e79e200
mito: consistency fix after rev. a9e3bfc
biancagi Jun 22, 2026
f7ecdb4
fem/blocks: add concept {element_of_type_c}
biancagi Jun 22, 2026
642c816
fem/blocks: clarify roles of {finiteElementT} and {elementT} in metho…
biancagi Jun 22, 2026
b33dafe
fem/blocks: readability improvements
biancagi Jun 22, 2026
9be085f
fem: require that isoparametric element are built on top of a paramet…
biancagi Jun 22, 2026
361bd60
fem: in function {finite_element} require that {finiteElementTraits} …
biancagi Jun 22, 2026
9bb31ea
fem: add compatibility check in {function_space}
biancagi Jun 22, 2026
6035906
manifolds: remove {manifold} factory function with implicit assumptio…
biancagi Jun 22, 2026
b96318c
tutorial: adjust tutorials to use {operator} namespace (rev. cd653dd)
biancagi Jun 22, 2026
c096d02
manifolds: remove addressed {TOFIX} (rev. 6035906)
biancagi Jun 22, 2026
a3e17b6
manifolds: remove unused {print} method
biancagi Jun 25, 2026
d794a33
manifolds: in class {ParametrizedElement} return cell, parametrizatio…
biancagi Jun 25, 2026
ef4380b
fem: remove redundant forward declaration
biancagi Jun 25, 2026
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
4 changes: 2 additions & 2 deletions .cmake/mito_benchmarks_mito_lib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ mito_benchmark_driver(benchmarks/mito.lib/tensor/wedge.cc)
# integration
mito_benchmark_driver(benchmarks/mito.lib/integration/integration.cc)

# fields
mito_benchmark_driver(benchmarks/mito.lib/fields/laplacian.cc)
# operators
mito_benchmark_driver(benchmarks/mito.lib/operators/laplacian.cc)

if(WITH_PETSC)
# poisson boundary value problem
Expand Down
34 changes: 19 additions & 15 deletions .cmake/mito_tests_mito_lib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ mito_test_driver(tests/mito.lib/geometry/barycenter_segment_3D.cc)
mito_test_driver(tests/mito.lib/geometry/barycenter_triangle_2D.cc)
mito_test_driver(tests/mito.lib/geometry/barycenter_triangle_3D.cc)
mito_test_driver(tests/mito.lib/geometry/barycenter_tetrahedron_3D.cc)
mito_test_driver(tests/mito.lib/geometry/segment_2D.cc)
mito_test_driver(tests/mito.lib/geometry/triangle_3D.cc)
mito_test_driver(tests/mito.lib/geometry/triangle_2D.cc)
mito_test_driver(tests/mito.lib/geometry/tetrahedron_3D.cc)
mito_test_driver(tests/mito.lib/geometry/cell_directors.cc)
mito_test_driver(tests/mito.lib/geometry/point.cc)
mito_test_driver(tests/mito.lib/geometry/euclidean_metric_1D.cc)
mito_test_driver(tests/mito.lib/geometry/euclidean_metric_2D.cc)
mito_test_driver(tests/mito.lib/geometry/euclidean_metric_3D.cc)
mito_test_driver(tests/mito.lib/geometry/euclidean_submanifold_metric_3D.cc)
Expand All @@ -53,7 +58,6 @@ mito_test_driver(tests/mito.lib/fem/shape_functions_triangle_construction.cc)
mito_test_driver(tests/mito.lib/fem/shape_functions_triangle_p1.cc)
mito_test_driver(tests/mito.lib/fem/shape_functions_triangle_p2.cc)
mito_test_driver(tests/mito.lib/fem/isoparametric_triangle.cc)
mito_test_driver(tests/mito.lib/fem/localize_field.cc)
mito_test_driver(tests/mito.lib/fem/fem_field.cc)
mito_test_driver(tests/mito.lib/fem/shape_functions_segment_p1.cc)
mito_test_driver(tests/mito.lib/fem/isoparametric_segment.cc)
Expand Down Expand Up @@ -96,27 +100,16 @@ mito_test_driver(tests/mito.lib/tensor/tensor_product_forms.cc)
# fields
mito_test_driver(tests/mito.lib/fields/fields.cc)
mito_test_driver(tests/mito.lib/fields/fields_traits.cc)
mito_test_driver(tests/mito.lib/fields/calculus_identities.cc)
mito_test_driver(tests/mito.lib/fields/calculus_scalar_field.cc)
mito_test_driver(tests/mito.lib/fields/calculus_vector_field.cc)
mito_test_driver(tests/mito.lib/fields/gradient_non_square.cc)
mito_test_driver(tests/mito.lib/fields/polar_metric_field.cc)
mito_test_driver(tests/mito.lib/fields/spherical_metric_field.cc)

# manifolds
mito_test_driver(tests/mito.lib/manifolds/manifold_elements_view.cc)
mito_test_driver(tests/mito.lib/manifolds/euclidean_gradient.cc)
mito_test_driver(tests/mito.lib/manifolds/polar_gradient.cc)
mito_test_driver(tests/mito.lib/manifolds/spherical_gradient.cc)
mito_test_driver(tests/mito.lib/manifolds/triangle_2D.cc)
mito_test_driver(tests/mito.lib/manifolds/triangle_3D.cc)
mito_test_driver(tests/mito.lib/manifolds/tetrahedron_3D.cc)
mito_test_driver(tests/mito.lib/manifolds/tetra_rectangle_2D.cc)
mito_test_driver(tests/mito.lib/manifolds/tetra_cube_3D.cc)
mito_test_driver(tests/mito.lib/manifolds/volume_half_ball.cc)
mito_test_driver(tests/mito.lib/manifolds/volume_disk_polar_cartesian.cc)
mito_test_driver(tests/mito.lib/manifolds/volume_disk_change_coordinates.cc)
mito_test_driver(tests/mito.lib/manifolds/surface_half_sphere_cartesian.cc)
mito_test_driver(tests/mito.lib/manifolds/surface_half_sphere_spherical.cc)
# mito_test_driver(tests/mito.lib/manifolds/surface_half_sphere_cartesian.cc)
# mito_test_driver(tests/mito.lib/manifolds/surface_half_sphere_spherical.cc)

# materials
mito_test_driver(tests/mito.lib/materials/gent.cc)
Expand All @@ -136,8 +129,13 @@ mito_test_driver(tests/mito.lib/mesh/tetra_triangle_3D.cc)
mito_test_driver(tests/mito.lib/mesh/tetra_tetrahedron_3D.cc)
mito_test_driver(tests/mito.lib/mesh/tetra_zero_subdivisions.cc)
mito_test_driver(tests/mito.lib/mesh/tetra_multiple_subdivisions.cc)
mito_test_driver(tests/mito.lib/mesh/tetra_rectangle_2D.cc)
mito_test_driver(tests/mito.lib/mesh/tetra_cube_3D.cc)
mito_test_driver(tests/mito.lib/mesh/erase_element.cc)
mito_test_driver(tests/mito.lib/mesh/sphere.cc)
mito_test_driver(tests/mito.lib/mesh/half_ball.cc)
mito_test_driver(tests/mito.lib/mesh/disk_polar_cartesian.cc)
mito_test_driver(tests/mito.lib/mesh/disk_change_coordinates.cc)
mito_test_driver(tests/mito.lib/mesh/summit_read_write.cc)

if(WITH_METIS)
Expand All @@ -151,6 +149,12 @@ if(WITH_METIS)
endif()
endif()

# operators
mito_test_driver(tests/mito.lib/operators/calculus_identities.cc)
mito_test_driver(tests/mito.lib/operators/calculus_scalar_field.cc)
mito_test_driver(tests/mito.lib/operators/calculus_vector_field.cc)
mito_test_driver(tests/mito.lib/operators/gradient_non_square.cc)

# topology
mito_test_driver(tests/mito.lib/topology/cell_edges.cc)
mito_test_driver(tests/mito.lib/topology/erase_element_check_vertices.cc)
Expand Down
4 changes: 3 additions & 1 deletion benchmarks/mito.lib/integration/integration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

// cartesian coordinates in 2D
using coordinates_t = mito::geometry::coordinates_t<2, mito::geometry::CARTESIAN>;
// the metric space type
using metric_space_t = mito::geometry::euclidean_metric_space<coordinates_t>;

// the function extracting the {x_0} components of a 2D vector
constexpr auto x_0 = mito::geometry::cartesian::x_0<2>;
Expand Down Expand Up @@ -67,7 +69,7 @@ main()
auto tetra_mesh = mito::mesh::tetra(mesh, coord_system, subdivisions);

// create manifold from the mesh
auto manifold = mito::manifolds::manifold(tetra_mesh, coord_system);
auto manifold = mito::manifolds::manifold(tetra_mesh, coord_system, metric_space_t::w);

// instantiate a scalar field
auto f = mito::functions::cos(x_0 * x_1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// get the benchmark library
#include <benchmark/benchmark.h>

// get the mito materials
#include <mito/fields.h>
// get the mito differential operators
#include <mito/operators.h>


// the type of coordinates
Expand Down Expand Up @@ -50,10 +50,10 @@ laplacian_mito(const coordinates_t & x)
constexpr auto f = mito::functions::pow<4>(x0 * x1);

// the gradient of {f}
constexpr auto gradient = mito::fields::gradient(f);
constexpr auto gradient = mito::operators::gradient(f);

// the laplacian (divergence of gradient)
constexpr auto laplacian = mito::fields::divergence(gradient);
constexpr auto laplacian = mito::operators::divergence(gradient);

// evaluate the laplacian at {x}
auto result = laplacian(x);
Expand Down
12 changes: 6 additions & 6 deletions benchmarks/mito.lib/pdes/poisson.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@

// cartesian coordinates in 2D
using coordinates_t = mito::geometry::coordinates_t<2, mito::geometry::CARTESIAN>;
// the metric space type
using metric_space_t = mito::geometry::euclidean_metric_space<coordinates_t>;

// simplicial cells in 2D
using cell_t = mito::geometry::triangle_t<2>;
// second degree finite elements
constexpr int degree = 2;
// assemble the finite element type
using finite_element_t = mito::fem::isoparametric_simplex_t<degree, cell_t>;
using finite_element_t = mito::fem::finite_element_family<cell_t, degree>;

// the reference simplex
using reference_simplex_t = mito::geometry::reference_triangle_t;
using reference_simplex_t = cell_t::reference_simplex_type;
// degree of exactness for the quadrature rule
constexpr int doe = 2;
// Gauss quadrature on triangles with degree of exactness 2
Expand Down Expand Up @@ -57,7 +59,7 @@ main()
// auto mesh = mito::mesh::tetra(original_mesh, coord_system, subdivisions);

// create the body manifold
auto manifold = mito::manifolds::manifold(mesh, coord_system);
auto manifold = mito::manifolds::manifold(mesh, coord_system, metric_space_t::w);

// get the boundary mesh
auto boundary_mesh = mito::mesh::boundary(mesh);
Expand All @@ -84,9 +86,7 @@ main()
mito::fem::blocks::source_term_block<finite_element_t, quadrature_rule_t>(f);

// create the weak form and populate it with the blocks
auto weakform = mito::fem::weakform<finite_element_t>();
weakform.add_block(fem_lhs_block);
weakform.add_block(fem_rhs_block);
auto weakform = mito::fem::weakform(fem_lhs_block, fem_rhs_block);

// the discrete system
auto discrete_system =
Expand Down
9 changes: 5 additions & 4 deletions extensions/mito/mito.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,11 @@ PYBIND11_MODULE(mito, m)
// done
;


// alias for a the euclidean metric space in 2D
using euclidean_metric_2D_t = mito::geometry::euclidean_metric_space<coordinates_2D_t>;
// alias for a manifold of triangles embedded in 2D
using manifold_triangle_2D_t = decltype(mito::manifolds::manifold(
std::declval<mesh_triangle_2D_t>(), std::declval<coordinate_system_2D_t>()));
using manifold_triangle_2D_t = mito::manifolds::manifold_t<
cell_2D_t, coordinates_2D_t, std::remove_cvref_t<decltype(euclidean_metric_2D_t::w)>>;
// the mito manifold interface
mito::py::class_<manifold_triangle_2D_t>(m, "ManifoldTriangle2D")
// the constructor
Expand All @@ -147,7 +148,7 @@ PYBIND11_MODULE(mito, m)
mito::py::init(
[](const mesh_triangle_2D_t & mesh, const coordinate_system_2D_t & coord_system) {
// create the manifold
return mito::manifolds::manifold(mesh, coord_system);
return mito::manifolds::manifold(mesh, coord_system, euclidean_metric_2D_t::w);
}))
// done
;
Expand Down
2 changes: 2 additions & 0 deletions lib/mito/coordinates/Coordinates.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ namespace mito::geometry {
using coordinates_type = Coordinates<D, coordT>;
// publish the dimension of the physical space
static constexpr int dim = D;
// publish the size of the underlying array
static constexpr int size = array_t::size;

public:
// default constructor
Expand Down
12 changes: 6 additions & 6 deletions lib/mito/fem/DiscreteSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ namespace mito::fem {
// extend the design to the case that there are multiple finite element discretizations that
// end up on the same linear system.

template <function_space_c functionSpaceT, class linearSystemT>
template <function_space_c functionSpaceT, class weakformT, class linearSystemT>
class DiscreteSystem {

private:
// the function space type
using function_space_type = functionSpaceT;
// the element type
using element_type = typename function_space_type::element_type;
// the weakform type
using weakform_type = weakform_t<element_type>;
using weakform_type = weakformT;
// the linear system type
using linear_system_type = linearSystemT;
// the label type
Expand All @@ -37,9 +35,11 @@ namespace mito::fem {
// the solution field type
using solution_field_type = tensor::scalar_t;
// the fem field type
using fem_field_type = fem_field_t<solution_field_type, function_space_type>;
using fem_field_type = fem_field_t<solution_field_type>;
// the element type
using finite_element_type = typename function_space_type::finite_element_type;
// the number of nodes per element
static constexpr int n_element_nodes = element_type::n_nodes;
static constexpr int n_element_nodes = finite_element_type::n_nodes;

public:
// constructor
Expand Down
21 changes: 10 additions & 11 deletions lib/mito/fem/FemField.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace mito::fem {

// TODO: implement higher-dimensional fields (e.g. vector fields, tensor fields, ...)

template <class fieldValueT, class functionSpaceT>
template <class fieldValueT>
class FemField {

private:
Expand All @@ -27,8 +27,6 @@ namespace mito::fem {
using nodal_field_type = discrete::nodal_field_t<field_value_type>;
// the node type
using node_type = typename nodal_field_type::input_type;
// the element type
using element_type = typename functionSpaceT::element_type;

public:
// constructor from temporary nodal field
Expand Down Expand Up @@ -63,18 +61,19 @@ namespace mito::fem {
auto nodal_values() const -> const nodal_field_type & { return _nodal_field; }

// localize the field on {element}
auto localize(const element_type & element) const -> auto
// TODO: concept {finite_element_c}
template <class elementT>
auto localize(const elementT & element) const -> auto
{
// get the connectivity table of the element
auto connectivity = element.connectivity();

// helper lambda to assemble the field localization on {element}
constexpr auto _assemble = []<int... a>(
const element_type & element,
const nodal_field_type & field,
tensor::integer_sequence<a...>) {
auto _assemble = [&]<int... a>(tensor::integer_sequence<a...>) {
// assemble the field localization from the shape functions
return ((element.template shape<a>() * field(element.connectivity()[a])) + ...);
return ((element.template shape<a>() * _nodal_field(connectivity[a])) + ...);
};
return _assemble(
element, _nodal_field, tensor::make_integer_sequence<element_type::n_nodes>{});
return _assemble(tensor::make_integer_sequence<elementT::traits::n_nodes>{});
}

// iterators on the nodal field
Expand Down
Loading
Loading