Shape function space for linear triangle, similar to linear tet. More...
#include <ElemUtil.hpp>
Public Member Functions | |
LinearTri (const std::vector< CartVect > &vertices) | |
LinearTri () | |
virtual | ~LinearTri () |
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 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... | |
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... | |
![]() | |
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 |
![]() | |
std::vector< CartVect > | vertex |
Static Protected Attributes | |
static const double | corner [3][3] = { { 0, 0, 0 }, { 1, 0, 0 }, { 0, 1, 0 } } |
Shape function space for linear triangle, similar to linear tet.
Definition at line 328 of file ElemUtil.hpp.
|
inline |
Definition at line 331 of file ElemUtil.hpp.
331 : Map( vertices ) 332 { 333 set_vertices( vertex ); 334 };
References set_vertices().
moab::Element::LinearTri::LinearTri | ( | ) |
Definition at line 505 of file ElemUtil.cpp.
505 : Map( 0 ), det_T( 0.0 ), det_T_inverse( 0.0 ) {} // LinearTri::LinearTri()
|
virtual |
Definition at line 507 of file ElemUtil.cpp.
507 {}
|
inlinevirtual |
Evaluate the determinate of the inverse Jacobi matrix.
Reimplemented from moab::Element::Map.
Definition at line 356 of file ElemUtil.hpp.
357 {
358 return this->det_T_inverse;
359 };
References det_T_inverse.
|
inlinevirtual |
Evaluate the determinate of the Jacobi matrix.
Reimplemented from moab::Element::Map.
Definition at line 352 of file ElemUtil.hpp.
353 {
354 return this->det_T;
355 };
References det_T.
Evaluate the map on x_i (calculate \vec x = F($\vec \xi) )
Implements moab::Element::Map.
Definition at line 339 of file ElemUtil.hpp.
340 {
341 return this->vertex[0] + this->T * xi;
342 };
References T.
|
virtual |
Evaluate a scalar field at a point given field values at the vertices.
Implements moab::Element::Map.
Definition at line 531 of file ElemUtil.cpp.
532 {
533 double f0 = field_vertex_value[0];
534 double f = f0;
535 for( unsigned i = 1; i < 3; ++i )
536 {
537 f += ( field_vertex_value[i] - f0 ) * xi[i - 1];
538 }
539 return f;
540 } // LinearTri::evaluate_scalar_field()
|
virtual |
Evaluate the inverse map (calculate \vec \xi = F^-1($\vec x) to given tolerance)
Reimplemented from moab::Element::Map.
Reimplemented in moab::Element::SphericalTri.
Definition at line 526 of file ElemUtil.cpp.
527 {
528 return this->T_inverse * ( x - this->vertex[0] );
529 } // LinearTri::ievaluate
References T_inverse.
Referenced by moab::Element::SphericalTri::ievaluate(), and test_linear_tri().
Evaluate the inverse of the Jacobi matrix.
Reimplemented from moab::Element::Map.
Definition at line 348 of file ElemUtil.hpp.
349 {
350 return this->T_inverse;
351 };
References T_inverse.
|
virtual |
decide if within the natural param space, with a tolerance
Implements moab::Element::Map.
Definition at line 519 of file ElemUtil.cpp.
520 {
521 // linear tri space is a triangle with vertices (0,0,0), (1,0,0), (0,1,0)
522 // first check if outside bigger box, then below the line x+y=1
523 return ( xi[0] >= -tol ) && ( xi[1] >= -tol ) && ( xi[2] >= -tol ) && ( xi[2] <= tol ) &&
524 ( xi[0] + xi[1] < 1.0 + tol );
525 }
Referenced by moab::Coupler::nat_param().
|
virtual |
Integrate a scalar field over the element given field values at the vertices.
Implements moab::Element::Map.
Definition at line 542 of file ElemUtil.cpp.
543 {
544 double I( 0.0 );
545 for( unsigned int i = 0; i < 3; ++i )
546 {
547 I += field_vertex_values[i];
548 }
549 I *= this->det_T / 6.0; // TODO
550 return I;
551 } // LinearTri::integrate_scalar_field()
References det_T.
Evaluate the map's Jacobi matrix.
Implements moab::Element::Map.
Definition at line 344 of file ElemUtil.hpp.
345 {
346 return this->T;
347 };
References T.
|
virtual |
Set vertices.
Reimplemented from moab::Element::Map.
Definition at line 509 of file ElemUtil.cpp.
510 {
511 this->Map::set_vertices( v );
512 this->T = Matrix3( v[1][0] - v[0][0], v[2][0] - v[0][0], 0, v[1][1] - v[0][1], v[2][1] - v[0][1], 0,
513 v[1][2] - v[0][2], v[2][2] - v[0][2], 1 );
514 this->T_inverse = this->T.inverse();
515 this->det_T = this->T.determinant();
516 this->det_T_inverse = ( this->det_T < 1e-12 ? std::numeric_limits< double >::max() : 1.0 / this->det_T );
517 } // LinearTri::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 LinearTri(), and moab::Element::SphericalTri::SphericalTri().
|
staticprotected |
Definition at line 371 of file ElemUtil.hpp.
|
protected |
Definition at line 373 of file ElemUtil.hpp.
Referenced by det_jacobian(), integrate_scalar_field(), and set_vertices().
|
protected |
Definition at line 373 of file ElemUtil.hpp.
Referenced by det_ijacobian(), and set_vertices().
|
protected |
Definition at line 372 of file ElemUtil.hpp.
Referenced by evaluate(), jacobian(), and set_vertices().
|
protected |
Definition at line 372 of file ElemUtil.hpp.
Referenced by ievaluate(), ijacobian(), and set_vertices().