MOAB: Mesh Oriented datABase  (version 5.3.1)
moab::Element::LinearQuad Class Reference

Shape function space for bilinear quadrilateral, obtained from the canonical linear (affine) functions. More...

#include <ElemUtil.hpp>

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

Public Member Functions

 LinearQuad (const std::vector< CartVect > &vertices)
 LinearQuad ()
virtual ~LinearQuad ()
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 [4][3] = { { -1, -1, 0 }, { 1, -1, 0 }, { 1, 1, 0 }, { -1, 1, 0 } }
static const double gauss [1][2] = { { 2.0, 0.0 } }
static const unsigned int corner_count = 4
static const unsigned int gauss_count = 1

Detailed Description

Shape function space for bilinear quadrilateral, obtained from the canonical linear (affine) functions.

Definition at line 281 of file ElemUtil.hpp.


Constructor & Destructor Documentation

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

Definition at line 284 of file ElemUtil.hpp.

: Map( vertices ){};

Definition at line 1141 of file ElemUtil.cpp.

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

Definition at line 1143 of file ElemUtil.cpp.

{}

Member Function Documentation

CartVect moab::Element::LinearQuad::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 1151 of file ElemUtil.cpp.

References corner, and corner_count.

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

References corner, and corner_count.

Referenced by integrate_scalar_field().

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

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

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

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

    {
        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];
                CartVect x( x1, x2, 0.0 );
                I += this->evaluate_scalar_field( x, field_vertex_values ) * w1 * w2 * this->det_jacobian( x );
            }
        }
        return I;
    }  // LinearQuad::integrate_scalar_field()
Matrix3 moab::Element::LinearQuad::jacobian ( const CartVect xi) const [virtual]

Evaluate the map's Jacobi matrix.

Implements moab::Element::Map.

Definition at line 1163 of file ElemUtil.cpp.

References corner, and corner_count.

    {
        // this basically ignores the z component: xi[2] or vertex[][2]
        Matrix3 J( 0.0 );
        for( unsigned i = 0; i < LinearQuad::corner_count; ++i )
        {
            const double xi_p     = 1 + xi[0] * corner[i][0];
            const double eta_p    = 1 + xi[1] * corner[i][1];
            const double dNi_dxi  = corner[i][0] * eta_p;
            const double dNi_deta = corner[i][1] * xi_p;
            J( 0, 0 ) += dNi_dxi * vertex[i][0];
            J( 1, 0 ) += dNi_dxi * vertex[i][1];
            J( 0, 1 ) += dNi_deta * vertex[i][0];
            J( 1, 1 ) += dNi_deta * vertex[i][1];
        }
        J( 2, 2 ) = 1.0; /* to make sure the Jacobian determinant is non-zero */
        J /= LinearQuad::corner_count;
        return J;
    }  // LinearQuad::jacobian()

Member Data Documentation

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

Definition at line 297 of file ElemUtil.hpp.

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

const unsigned int moab::Element::LinearQuad::corner_count = 4 [static, protected]

Definition at line 299 of file ElemUtil.hpp.

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

const double moab::Element::LinearQuad::gauss = { { 2.0, 0.0 } } [static, protected]

Definition at line 298 of file ElemUtil.hpp.

Referenced by integrate_scalar_field().

const unsigned int moab::Element::LinearQuad::gauss_count = 1 [static, protected]

Definition at line 300 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