Skip to content

Commit a50a8d4

Browse files
committed
fem: make base isoparametric segment class a template of the dimension
1 parent e171f15 commit a50a8d4

5 files changed

Lines changed: 9 additions & 87 deletions

File tree

lib/mito/fem/elements/IsoparametricEmbeddedSegment.h

Lines changed: 0 additions & 77 deletions
This file was deleted.

lib/mito/fem/elements/IsoparametricSegment.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@
99

1010
// DESIGN NOTES
1111
// Class {IsoparametricSegment} represents a first order simplex (segment) equipped with parametric
12-
// coordinates.
12+
// coordinates. The template parameter D specifies the dimension of the physical space in which
13+
// the segment lives (D=1 for a segment in 1D, D=2 for a segment embedded in 2D, etc.).
1314

1415

1516
namespace mito::fem {
1617

18+
template <int dim>
1719
class IsoparametricSegment : public utilities::Invalidatable {
1820
public:
19-
// the dimension of the physical space
20-
static constexpr int dim = 1;
2121
// the discretization node type
2222
using discretization_node_type = discrete::discretization_node_t;
2323
// the underlying cell type
2424
using cell_type = geometry::segment_t<dim>;
2525

2626
protected:
27-
// cartesian coordinates in 1D
27+
// cartesian coordinates in dim dimensions
2828
using coordinates_type = geometry::coordinates_t<dim, geometry::CARTESIAN>;
2929
// the coordinate system type
3030
using coordinate_system_type = geometry::coordinate_system_t<coordinates_type>;

lib/mito/fem/elements/public.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
// classes implementation
2020
#include "IsoparametricSegment.h"
2121
#include "IsoparametricTriangle.h"
22-
#include "IsoparametricEmbeddedSegment.h"
2322
#include "Discretizer.h"
2423

2524
// library of finite elements

lib/mito/fem/elements/seg1/IsoparametricSegmentP1.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
namespace mito::fem {
1616

17-
class IsoparametricSegmentP1 : public IsoparametricSegment {
17+
class IsoparametricSegmentP1 : public IsoparametricSegment<1> {
1818

1919
public:
2020
// the degree of the finite element
@@ -38,7 +38,7 @@ namespace mito::fem {
3838
inline IsoparametricSegmentP1(
3939
const cell_type & geometric_simplex, const coordinate_system_type & coord_system,
4040
const connectivity_type & connectivity) :
41-
IsoparametricSegment(geometric_simplex, coord_system),
41+
IsoparametricSegment<1>(geometric_simplex, coord_system),
4242
_connectivity(connectivity)
4343
{}
4444

lib/mito/fem/elements/seg1_embedded/IsoparametricEmbeddedSegmentP1.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88

99

1010
// DESIGN NOTES
11-
// Class {IsoparametricEmbeddedSegmentP1} represents a first order simplex (segment) living in 2D
11+
// Class {IsoparametricEmbeddedSegmentP1} represents a first order simplex (segment) embedded in 2D
1212
// cartesian space, equipped with linear shape functions defined in the 1D parametric space.
1313
// The key difference from IsoparametricSegmentP1 is the non-square Jacobian (2x1 matrix) and
1414
// the gradient computation that accounts for the embedded geometry.
1515

1616

1717
namespace mito::fem {
1818

19-
class IsoparametricEmbeddedSegmentP1 : public IsoparametricEmbeddedSegment {
19+
class IsoparametricEmbeddedSegmentP1 : public IsoparametricSegment<2> {
2020

2121
public:
2222
// the degree of the finite element
@@ -40,7 +40,7 @@ namespace mito::fem {
4040
inline IsoparametricEmbeddedSegmentP1(
4141
const cell_type & geometric_simplex, const coordinate_system_type & coord_system,
4242
const connectivity_type & connectivity) :
43-
IsoparametricEmbeddedSegment(geometric_simplex, coord_system),
43+
IsoparametricSegment<2>(geometric_simplex, coord_system),
4444
_connectivity(connectivity)
4545
{}
4646

0 commit comments

Comments
 (0)