moab
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:
moab::Element::Map

List of all members.

Public Member Functions

 LinearHex (const std::vector< CartVect > &vertices)
 LinearHex ()
virtual ~LinearHex ()
virtual CartVect evaluate (const CartVect &xi) const
 Evaluate the map on (calculate $ x = F($ )$ )
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 [1][2] = { { 2.0, 0.0 } }
static const unsigned int corner_count = 8
static const unsigned int gauss_count = 1

Detailed Description

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

Definition at line 122 of file ElemUtil.hpp.


Constructor & Destructor Documentation

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

Definition at line 124 of file ElemUtil.hpp.

: Map(vertices){};

Definition at line 538 of file ElemUtil.cpp.

                       : Map(0) {

  }// LinearHex::LinearHex()

Definition at line 542 of file ElemUtil.cpp.

    {}

Member Function Documentation

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

Evaluate the map on (calculate $ x = F($ )$ )

Implements moab::Element::Map.

Definition at line 550 of file ElemUtil.cpp.

                                                         {
    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 585 of file ElemUtil.cpp.

                                                                                                    {
    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 616 of file ElemUtil.cpp.

  {
    // 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 597 of file ElemUtil.cpp.

                                                                                  {
    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 563 of file ElemUtil.cpp.

                                                        {
    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 138 of file ElemUtil.hpp.

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

Definition at line 140 of file ElemUtil.hpp.

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

Definition at line 139 of file ElemUtil.hpp.

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

Definition at line 141 of file ElemUtil.hpp.


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