LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
Loading...
Searching...
No Matches
geometry_interface.cc
1/* @file geometry_interface.cc
2 * @brief implementation of functions operating on generic geometry objects
3 */
4
5#include "geometry_interface.h"
6
7#include "print_info.h"
8
9namespace lf::geometry {
10
11double Volume(const Geometry& geo) {
12 const lf::base::dim_t refdim = geo.DimLocal();
13
14 Eigen::Matrix<double, Eigen::Dynamic, 1> refc(refdim, 1);
15 double refvol = 1.0;
16 switch (geo.RefEl()) {
18 return 1.0;
19 }
21 refc << 0.5;
22 break;
23 }
25 refvol = 0.5;
26 refc << 1.0 / 3, 1.0 / 3;
27 break;
28 }
30 refc << 0.5, 0.5;
31 break;
32 }
33 default: {
34 LF_VERIFY_MSG(false,
35 "Volume not available for " << geo.RefEl().ToString());
36 }
37 } // end switch RefEl
38 return (refvol * ((geo.IntegrationElement(refc))[0]));
39}
40
41} // namespace lf::geometry
static constexpr RefEl kSegment()
Returns the (1-dimensional) reference segment.
Definition ref_el.h:153
static constexpr RefEl kPoint()
Returns the (0-dimensional) reference point.
Definition ref_el.h:144
static constexpr RefEl kTria()
Returns the reference triangle.
Definition ref_el.h:161
static constexpr RefEl kQuad()
Returns the reference quadrilateral.
Definition ref_el.h:169
std::string ToString() const
Return a string representation of this Reference element.
Definition ref_el.h:458
Interface class for shape information on a mesh cell in the spirit of parametric finite element metho...
virtual base::RefEl RefEl() const =0
The Reference element that defines the domain of this mapping.
virtual dim_t DimLocal() const =0
Dimension of the domain of this mapping.
virtual Eigen::VectorXd IntegrationElement(const Eigen::MatrixXd &local) const =0
The integration element (factor appearing in integral transformation formula, see below) at number of...
unsigned int dim_t
type for dimensions and co-dimensions and numbers derived from them
Definition types.h:32
Defines the Geometry interface and provides a number of classes that implement this interface + addit...
Definition compose.h:13
double Volume(const Geometry &geo)
Compute the (approximate) volume (area) of a shape.