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

Shape function space for trilinear hexahedron, obtained by a pushforward of the canonical linear (affine) functions. More...

#include <ElemUtil.hpp>

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

Public Member Functions

 LinearHex (const std::vector< CartVect > &vertices)
 LinearHex ()
virtual ~LinearHex ()
virtual CartVect evaluate (const CartVect &xi) const
 Evaluate the map on \(x_i\) (calculate \(\vec x = F($\vec \xi)\) )
virtual bool inside_nat_space (const CartVect &xi, double &tol) const
 decide if within the natural param space, with a tolerance
virtual Matrix3 jacobian (const CartVect &xi) const
 Evaluate the map's Jacobi matrix.
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.

Static Protected Attributes

static const double corner [8][3]
static const double gauss [2][2] = { { 1.0, -0.5773502691 }, { 1.0, 0.5773502691 } }
static const unsigned int corner_count = 8
static const unsigned int gauss_count = 2

Detailed Description

Shape function space for trilinear hexahedron, obtained by a pushforward of the canonical linear (affine) functions.

Definition at line 146 of file ElemUtil.hpp.


Constructor & Destructor Documentation

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

Definition at line 149 of file ElemUtil.hpp.

: Map( vertices ){};

Definition at line 685 of file ElemUtil.cpp.

: Map( 0 ) {}  // LinearHex::LinearHex()

Definition at line 687 of file ElemUtil.cpp.

{}

Member Function Documentation

CartVect moab::Element::LinearHex::evaluate ( const CartVect xi) const [virtual]

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

Implements moab::Element::Map.

Definition at line 699 of file ElemUtil.cpp.

References corner.

    {
        CartVect x( 0.0 );
        for( unsigned i = 0; i < 8; ++i )
        {
            const double N_i =
                ( 1 + xi[0] * corner[i][0] ) * ( 1 + xi[1] * corner[i][1] ) * ( 1 + xi[2] * corner[i][2] );
            x += N_i * this->vertex[i];
        }
        x *= 0.125;
        return x;
    }  // LinearHex::evaluate
double moab::Element::LinearHex::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 736 of file ElemUtil.cpp.

References corner.

Referenced by integrate_scalar_field().

    {
        double f( 0.0 );
        for( unsigned i = 0; i < 8; ++i )
        {
            const double N_i =
                ( 1 + xi[0] * corner[i][0] ) * ( 1 + xi[1] * corner[i][1] ) * ( 1 + xi[2] * corner[i][2] );
            f += N_i * field_vertex_value[i];
        }
        f *= 0.125;
        return f;
    }  // LinearHex::evaluate_scalar_field()
bool moab::Element::LinearHex::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 772 of file ElemUtil.cpp.

Referenced by moab::Coupler::nat_param(), and test_hex_nat_coords().

    {
        // just look at the box+tol here
        return ( xi[0] >= -1. - tol ) && ( xi[0] <= 1. + tol ) && ( xi[1] >= -1. - tol ) && ( xi[1] <= 1. + tol ) &&
               ( xi[2] >= -1. - tol ) && ( xi[2] <= 1. + tol );
    }
double moab::Element::LinearHex::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 749 of file ElemUtil.cpp.

References moab::Element::Map::det_jacobian(), evaluate_scalar_field(), gauss, and gauss_count.

Referenced by integrate_scalar_field_test().

    {
        double I( 0.0 );
        for( unsigned int j1 = 0; j1 < this->gauss_count; ++j1 )
        {
            double x1 = this->gauss[j1][1];
            double w1 = this->gauss[j1][0];
            for( unsigned int j2 = 0; j2 < this->gauss_count; ++j2 )
            {
                double x2 = this->gauss[j2][1];
                double w2 = this->gauss[j2][0];
                for( unsigned int j3 = 0; j3 < this->gauss_count; ++j3 )
                {
                    double x3 = this->gauss[j3][1];
                    double w3 = this->gauss[j3][0];
                    CartVect x( x1, x2, x3 );
                    I += this->evaluate_scalar_field( x, field_vertex_values ) * w1 * w2 * w3 * this->det_jacobian( x );
                }
            }
        }
        return I;
    }  // LinearHex::integrate_scalar_field()
Matrix3 moab::Element::LinearHex::jacobian ( const CartVect xi) const [virtual]

Evaluate the map's Jacobi matrix.

Implements moab::Element::Map.

Definition at line 712 of file ElemUtil.cpp.

References corner.

    {
        Matrix3 J( 0.0 );
        for( unsigned i = 0; i < 8; ++i )
        {
            const double xi_p      = 1 + xi[0] * corner[i][0];
            const double eta_p     = 1 + xi[1] * corner[i][1];
            const double zeta_p    = 1 + xi[2] * corner[i][2];
            const double dNi_dxi   = corner[i][0] * eta_p * zeta_p;
            const double dNi_deta  = corner[i][1] * xi_p * zeta_p;
            const double dNi_dzeta = corner[i][2] * xi_p * eta_p;
            J( 0, 0 ) += dNi_dxi * vertex[i][0];
            J( 1, 0 ) += dNi_dxi * vertex[i][1];
            J( 2, 0 ) += dNi_dxi * vertex[i][2];
            J( 0, 1 ) += dNi_deta * vertex[i][0];
            J( 1, 1 ) += dNi_deta * vertex[i][1];
            J( 2, 1 ) += dNi_deta * vertex[i][2];
            J( 0, 2 ) += dNi_dzeta * vertex[i][0];
            J( 1, 2 ) += dNi_dzeta * vertex[i][1];
            J( 2, 2 ) += dNi_dzeta * vertex[i][2];
        }
        return J *= 0.125;
    }  // LinearHex::jacobian()

Member Data Documentation

const double moab::Element::LinearHex::corner [static, protected]
Initial value:
 { { -1, -1, -1 }, { 1, -1, -1 }, { 1, 1, -1 }, { -1, 1, -1 },
                                             { -1, -1, 1 },  { 1, -1, 1 },  { 1, 1, 1 },  { -1, 1, 1 } }

Definition at line 163 of file ElemUtil.hpp.

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

const unsigned int moab::Element::LinearHex::corner_count = 8 [static, protected]

Definition at line 165 of file ElemUtil.hpp.

const double moab::Element::LinearHex::gauss = { { 1.0, -0.5773502691 }, { 1.0, 0.5773502691 } } [static, protected]

Definition at line 164 of file ElemUtil.hpp.

Referenced by integrate_scalar_field().

const unsigned int moab::Element::LinearHex::gauss_count = 2 [static, protected]

Definition at line 166 of file ElemUtil.hpp.

Referenced by integrate_scalar_field().

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