Mesh Oriented datABase  (version 5.4.1)
Array-based unstructured mesh datastructure
moab::Element::LinearTri Class Reference

Shape function space for linear triangle, similar to linear tet. More...

#include <ElemUtil.hpp>

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

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)\) )
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)
virtual Matrix3 jacobian (const CartVect &) const
 Evaluate the map's Jacobi matrix.
virtual Matrix3 ijacobian (const CartVect &) const
 Evaluate the inverse of the Jacobi matrix.
virtual double det_jacobian (const CartVect &) const
 Evaluate the determinate of the Jacobi matrix.
virtual double det_ijacobian (const CartVect &) const
 Evaluate the determinate of the inverse Jacobi matrix.
virtual void set_vertices (const std::vector< CartVect > &v)
 Set vertices.
virtual bool inside_nat_space (const CartVect &xi, double &tol) const
 decide if within the natural param space, with a tolerance
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.
virtual double integrate_scalar_field (const double *field_vertex_values) const
 Integrate a scalar field over the element given field values at the vertices.

Protected Attributes

Matrix3 T
Matrix3 T_inverse
double det_T
double det_T_inverse

Static Protected Attributes

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

Detailed Description

Shape function space for linear triangle, similar to linear tet.

Definition at line 328 of file ElemUtil.hpp.


Constructor & Destructor Documentation

moab::Element::LinearTri::LinearTri ( const std::vector< CartVect > &  vertices) [inline]

Definition at line 331 of file ElemUtil.hpp.

References set_vertices().

                                                           : Map( vertices )
        {
            set_vertices( vertex );
        };

Definition at line 505 of file ElemUtil.cpp.

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

Definition at line 507 of file ElemUtil.cpp.

{}

Member Function Documentation

virtual double moab::Element::LinearTri::det_ijacobian ( const CartVect xi) const [inline, virtual]

Evaluate the determinate of the inverse Jacobi matrix.

Reimplemented from moab::Element::Map.

Definition at line 356 of file ElemUtil.hpp.

References det_T_inverse.

        {
            return this->det_T_inverse;
        };
virtual double moab::Element::LinearTri::det_jacobian ( const CartVect xi) const [inline, virtual]

Evaluate the determinate of the Jacobi matrix.

Reimplemented from moab::Element::Map.

Definition at line 352 of file ElemUtil.hpp.

References det_T.

        {
            return this->det_T;
        };
virtual CartVect moab::Element::LinearTri::evaluate ( const CartVect xi) const [inline, virtual]

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

Implements moab::Element::Map.

Definition at line 339 of file ElemUtil.hpp.

References T.

        {
            return this->vertex[0] + this->T * xi;
        };
double moab::Element::LinearTri::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 531 of file ElemUtil.cpp.

    {
        double f0 = field_vertex_value[0];
        double f  = f0;
        for( unsigned i = 1; i < 3; ++i )
        {
            f += ( field_vertex_value[i] - f0 ) * xi[i - 1];
        }
        return f;
    }  // LinearTri::evaluate_scalar_field()
CartVect moab::Element::LinearTri::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.

Reimplemented in moab::Element::SphericalTri.

Definition at line 526 of file ElemUtil.cpp.

References T_inverse.

Referenced by test_linear_tri().

    {
        return this->T_inverse * ( x - this->vertex[0] );
    }  // LinearTri::ievaluate
virtual Matrix3 moab::Element::LinearTri::ijacobian ( const CartVect xi) const [inline, virtual]

Evaluate the inverse of the Jacobi matrix.

Reimplemented from moab::Element::Map.

Definition at line 348 of file ElemUtil.hpp.

References T_inverse.

        {
            return this->T_inverse;
        };
bool moab::Element::LinearTri::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 519 of file ElemUtil.cpp.

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

    {
        // linear tri space is a triangle with vertices (0,0,0), (1,0,0), (0,1,0)
        // first check if outside bigger box, then below the line x+y=1
        return ( xi[0] >= -tol ) && ( xi[1] >= -tol ) && ( xi[2] >= -tol ) && ( xi[2] <= tol ) &&
               ( xi[0] + xi[1] < 1.0 + tol );
    }
double moab::Element::LinearTri::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 542 of file ElemUtil.cpp.

References det_T.

    {
        double I( 0.0 );
        for( unsigned int i = 0; i < 3; ++i )
        {
            I += field_vertex_values[i];
        }
        I *= this->det_T / 6.0;  // TODO
        return I;
    }  // LinearTri::integrate_scalar_field()
virtual Matrix3 moab::Element::LinearTri::jacobian ( const CartVect xi) const [inline, virtual]

Evaluate the map's Jacobi matrix.

Implements moab::Element::Map.

Definition at line 344 of file ElemUtil.hpp.

References T.

        {
            return this->T;
        };
void moab::Element::LinearTri::set_vertices ( const std::vector< CartVect > &  v) [virtual]

Set vertices.

Reimplemented from moab::Element::Map.

Definition at line 509 of file ElemUtil.cpp.

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

Referenced by LinearTri(), and moab::Element::SphericalTri::SphericalTri().

    {
        this->Map::set_vertices( v );
        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,
                                       v[1][2] - v[0][2], v[2][2] - v[0][2], 1 );
        this->T_inverse     = this->T.inverse();
        this->det_T         = this->T.determinant();
        this->det_T_inverse = ( this->det_T < 1e-12 ? std::numeric_limits< double >::max() : 1.0 / this->det_T );
    }  // LinearTri::set_vertices()

Member Data Documentation

const double moab::Element::LinearTri::corner = { { 0, 0, 0 }, { 1, 0, 0 }, { 0, 1, 0 } } [static, protected]

Definition at line 371 of file ElemUtil.hpp.

double moab::Element::LinearTri::det_T [protected]

Definition at line 373 of file ElemUtil.hpp.

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

Definition at line 373 of file ElemUtil.hpp.

Referenced by det_ijacobian(), and set_vertices().

Definition at line 372 of file ElemUtil.hpp.

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

Definition at line 372 of file ElemUtil.hpp.

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

List of all members.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines