Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
moab::Element::LinearTet Class Reference

Shape function space for a linear tetrahedron, obtained by a pushforward of the canonical affine shape functions. More...

#include <ElemUtil.hpp>

+ Inheritance diagram for moab::Element::LinearTet:
+ Collaboration diagram for moab::Element::LinearTet:

Public Member Functions

 LinearTet (const std::vector< CartVect > &vertices)
 
 LinearTet ()
 
virtual ~LinearTet ()
 
virtual CartVect evaluate (const CartVect &xi) const
 Evaluate the map on \(x_i\) (calculate \(\vec x = F($\vec \xi)\) ) More...
 
virtual CartVect ievaluate (const CartVect &x, double tol=1e-6, const CartVect &x0=CartVect(0.0)) const
 Evaluate the inverse map (calculate \(\vec \xi = F^-1($\vec x)\) to given tolerance) More...
 
virtual Matrix3 jacobian (const CartVect &) const
 Evaluate the map's Jacobi matrix. More...
 
virtual Matrix3 ijacobian (const CartVect &) const
 Evaluate the inverse of the Jacobi matrix. More...
 
virtual double det_jacobian (const CartVect &) const
 Evaluate the determinate of the Jacobi matrix. More...
 
virtual double det_ijacobian (const CartVect &) const
 Evaluate the determinate of the inverse Jacobi matrix. More...
 
virtual double evaluate_scalar_field (const CartVect &xi, const double *field_vertex_values) const
 Evaluate a scalar field at a point given field values at the vertices. More...
 
virtual double integrate_scalar_field (const double *field_vertex_values) const
 Integrate a scalar field over the element given field values at the vertices. More...
 
virtual void set_vertices (const std::vector< CartVect > &v)
 Set vertices.
More...
 
virtual bool inside_nat_space (const CartVect &xi, double &tol) const
 decide if within the natural param space, with a tolerance More...
 
- Public Member Functions inherited from moab::Element::Map
 Map (const std::vector< CartVect > &v)
 Construct a Map defined by the given std::vector of vertices. More...
 
 Map (const unsigned int n)
 Construct a Map defined by n vertices. More...
 
virtual ~Map ()
 
unsigned int size ()
 Size of the vertices vector. More...
 
const std::vector< CartVect > & get_vertices ()
 Retrieve vertices. More...
 
virtual bool inside_box (const CartVect &xi, double &tol) const
 

Protected Attributes

Matrix3 T
 
Matrix3 T_inverse
 
double det_T
 
double det_T_inverse
 
- Protected Attributes inherited from moab::Element::Map
std::vector< CartVectvertex
 

Static Protected Attributes

static const double corner [4][3] = { { 0, 0, 0 }, { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } }
 

Detailed Description

Shape function space for a linear tetrahedron, obtained by a pushforward of the canonical affine shape functions.

Definition at line 197 of file ElemUtil.hpp.

Constructor & Destructor Documentation

◆ LinearTet() [1/2]

moab::Element::LinearTet::LinearTet ( const std::vector< CartVect > &  vertices)
inline

Definition at line 200 of file ElemUtil.hpp.

200  : Map( vertices )
201  {
202  set_vertices( vertex );
203  };

References set_vertices().

◆ LinearTet() [2/2]

moab::Element::LinearTet::LinearTet ( )

Definition at line 892 of file ElemUtil.cpp.

892 : Map( 0 ), det_T( 0.0 ), det_T_inverse( 0.0 ) {} // LinearTet::LinearTet()

◆ ~LinearTet()

moab::Element::LinearTet::~LinearTet ( )
virtual

Definition at line 894 of file ElemUtil.cpp.

894 {}

Member Function Documentation

◆ det_ijacobian()

virtual double moab::Element::LinearTet::det_ijacobian ( const CartVect xi) const
inlinevirtual

Evaluate the determinate of the inverse Jacobi matrix.

Reimplemented from moab::Element::Map.

Definition at line 224 of file ElemUtil.hpp.

225  {
226  return this->det_T_inverse;
227  };

References det_T_inverse.

◆ det_jacobian()

virtual double moab::Element::LinearTet::det_jacobian ( const CartVect xi) const
inlinevirtual

Evaluate the determinate of the Jacobi matrix.

Reimplemented from moab::Element::Map.

Definition at line 220 of file ElemUtil.hpp.

221  {
222  return this->det_T;
223  };

References det_T.

◆ evaluate()

virtual CartVect moab::Element::LinearTet::evaluate ( const CartVect xi) const
inlinevirtual

Evaluate the map on \(x_i\) (calculate \(\vec x = F($\vec \xi)\) )

Implements moab::Element::Map.

Definition at line 207 of file ElemUtil.hpp.

208  {
209  return this->vertex[0] + this->T * xi;
210  };

References T.

◆ evaluate_scalar_field()

double moab::Element::LinearTet::evaluate_scalar_field ( const CartVect xi,
const double *  field_vertex_values 
) const
virtual

Evaluate a scalar field at a point given field values at the vertices.

Implements moab::Element::Map.

Definition at line 907 of file ElemUtil.cpp.

908  {
909  double f0 = field_vertex_value[0];
910  double f = f0;
911  for( unsigned i = 1; i < 4; ++i )
912  {
913  f += ( field_vertex_value[i] - f0 ) * xi[i - 1];
914  }
915  return f;
916  } // LinearTet::evaluate_scalar_field()

◆ ievaluate()

CartVect moab::Element::LinearTet::ievaluate ( const CartVect x,
double  tol = 1e-6,
const CartVect x0 = CartVect( 0.0 ) 
) const
virtual

Evaluate the inverse map (calculate \(\vec \xi = F^-1($\vec x)\) to given tolerance)

Reimplemented from moab::Element::Map.

Definition at line 918 of file ElemUtil.cpp.

919  {
920  return this->T_inverse * ( x - this->vertex[0] );
921  } // LinearTet::ievaluate

References T_inverse.

Referenced by moab::Coupler::nat_param().

◆ ijacobian()

virtual Matrix3 moab::Element::LinearTet::ijacobian ( const CartVect xi) const
inlinevirtual

Evaluate the inverse of the Jacobi matrix.

Reimplemented from moab::Element::Map.

Definition at line 216 of file ElemUtil.hpp.

217  {
218  return this->T_inverse;
219  };

References T_inverse.

◆ inside_nat_space()

bool moab::Element::LinearTet::inside_nat_space ( const CartVect xi,
double &  tol 
) const
virtual

decide if within the natural param space, with a tolerance

Implements moab::Element::Map.

Definition at line 933 of file ElemUtil.cpp.

934  {
935  // linear tet space is a tetra with vertices (0,0,0), (1,0,0), (0,1,0), (0, 0, 1)
936  // first check if outside bigger box, then below the plane x+y+z=1
937  return ( xi[0] >= -tol ) && ( xi[1] >= -tol ) && ( xi[2] >= -tol ) && ( xi[0] + xi[1] + xi[2] < 1.0 + tol );
938  }

Referenced by moab::Coupler::nat_param().

◆ integrate_scalar_field()

double moab::Element::LinearTet::integrate_scalar_field ( const double *  field_vertex_values) const
virtual

Integrate a scalar field over the element given field values at the vertices.

Implements moab::Element::Map.

Definition at line 923 of file ElemUtil.cpp.

924  {
925  double I( 0.0 );
926  for( unsigned int i = 0; i < 4; ++i )
927  {
928  I += field_vertex_values[i];
929  }
930  I *= this->det_T / 24.0;
931  return I;
932  } // LinearTet::integrate_scalar_field()

References det_T.

◆ jacobian()

virtual Matrix3 moab::Element::LinearTet::jacobian ( const CartVect xi) const
inlinevirtual

Evaluate the map's Jacobi matrix.

Implements moab::Element::Map.

Definition at line 212 of file ElemUtil.hpp.

213  {
214  return this->T;
215  };

References T.

◆ set_vertices()

void moab::Element::LinearTet::set_vertices ( const std::vector< CartVect > &  v)
virtual

Set vertices.

Reimplemented from moab::Element::Map.

Definition at line 896 of file ElemUtil.cpp.

897  {
898  this->Map::set_vertices( v );
899  this->T =
900  Matrix3( v[1][0] - v[0][0], v[2][0] - v[0][0], v[3][0] - v[0][0], v[1][1] - v[0][1], v[2][1] - v[0][1],
901  v[3][1] - v[0][1], v[1][2] - v[0][2], v[2][2] - v[0][2], v[3][2] - v[0][2] );
902  this->T_inverse = this->T.inverse();
903  this->det_T = this->T.determinant();
904  this->det_T_inverse = ( this->det_T < 1e-12 ? std::numeric_limits< double >::max() : 1.0 / this->det_T );
905  } // LinearTet::set_vertices()

References det_T, det_T_inverse, moab::Matrix3::determinant(), moab::Matrix3::inverse(), moab::Element::Map::set_vertices(), T, and T_inverse.

Referenced by LinearTet().

Member Data Documentation

◆ corner

const double moab::Element::LinearTet::corner = { { 0, 0, 0 }, { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } }
staticprotected

Definition at line 238 of file ElemUtil.hpp.

◆ det_T

double moab::Element::LinearTet::det_T
protected

Definition at line 240 of file ElemUtil.hpp.

Referenced by det_jacobian(), integrate_scalar_field(), and set_vertices().

◆ det_T_inverse

double moab::Element::LinearTet::det_T_inverse
protected

Definition at line 240 of file ElemUtil.hpp.

Referenced by det_ijacobian(), and set_vertices().

◆ T

Matrix3 moab::Element::LinearTet::T
protected

Definition at line 239 of file ElemUtil.hpp.

Referenced by evaluate(), jacobian(), and set_vertices().

◆ T_inverse

Matrix3 moab::Element::LinearTet::T_inverse
protected

Definition at line 239 of file ElemUtil.hpp.

Referenced by ievaluate(), ijacobian(), and set_vertices().


The documentation for this class was generated from the following files: