Mesh Oriented datABase  (version 5.5.0)
An array-based unstructured mesh library
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)\) ) More...
 
virtual bool inside_nat_space (const CartVect &xi, double &tol) const
 decide if within the natural param space, with a tolerance More...
 
virtual Matrix3 jacobian (const CartVect &xi) const
 Evaluate the map's Jacobi matrix. 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...
 
- Public Member Functions inherited from moab::Element::Map
 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 ()
 
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 ijacobian (const CartVect &xi) const
 Evaluate the inverse of the Jacobi matrix. More...
 
virtual double det_jacobian (const CartVect &xi) const
 Evaluate the determinate of the Jacobi matrix. More...
 
virtual double det_ijacobian (const CartVect &xi) const
 Evaluate the determinate of the inverse Jacobi matrix. More...
 
unsigned int size ()
 Size of the vertices vector. More...
 
const std::vector< CartVect > & get_vertices ()
 Retrieve vertices. More...
 
virtual void set_vertices (const std::vector< CartVect > &v)
 Set vertices.
More...
 
virtual bool inside_box (const CartVect &xi, double &tol) const
 

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
 

Additional Inherited Members

- Protected Attributes inherited from moab::Element::Map
std::vector< CartVectvertex
 

Detailed Description

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

Definition at line 284 of file ElemUtil.hpp.

Constructor & Destructor Documentation

◆ LinearQuad() [1/2]

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

Definition at line 287 of file ElemUtil.hpp.

287 : Map( vertices ){};

◆ LinearQuad() [2/2]

moab::Element::LinearQuad::LinearQuad ( )

Definition at line 1146 of file ElemUtil.cpp.

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

◆ ~LinearQuad()

moab::Element::LinearQuad::~LinearQuad ( )
virtual

Definition at line 1148 of file ElemUtil.cpp.

1148 {}

Member Function Documentation

◆ evaluate()

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

1157  {
1158  CartVect x( 0.0 );
1159  for( unsigned i = 0; i < LinearQuad::corner_count; ++i )
1160  {
1161  const double N_i = ( 1 + xi[0] * corner[i][0] ) * ( 1 + xi[1] * corner[i][1] );
1162  x += N_i * this->vertex[i];
1163  }
1165  return x;
1166  } // LinearQuad::evaluate

References corner, and corner_count.

◆ evaluate_scalar_field()

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

1189  {
1190  double f( 0.0 );
1191  for( unsigned i = 0; i < LinearQuad::corner_count; ++i )
1192  {
1193  const double N_i = ( 1 + xi[0] * corner[i][0] ) * ( 1 + xi[1] * corner[i][1] );
1194  f += N_i * field_vertex_value[i];
1195  }
1197  return f;
1198  } // LinearQuad::evaluate_scalar_field()

References corner, and corner_count.

Referenced by integrate_scalar_field().

◆ inside_nat_space()

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

1219  {
1220  // just look at the box+tol here
1221  return ( xi[0] >= -1. - tol ) && ( xi[0] <= 1. + tol ) && ( xi[1] >= -1. - tol ) && ( xi[1] <= 1. + tol );
1222  }

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

◆ integrate_scalar_field()

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

1201  {
1202  double I( 0.0 );
1203  for( unsigned int j1 = 0; j1 < this->gauss_count; ++j1 )
1204  {
1205  double x1 = this->gauss[j1][1];
1206  double w1 = this->gauss[j1][0];
1207  for( unsigned int j2 = 0; j2 < this->gauss_count; ++j2 )
1208  {
1209  double x2 = this->gauss[j2][1];
1210  double w2 = this->gauss[j2][0];
1211  CartVect x( x1, x2, 0.0 );
1212  I += this->evaluate_scalar_field( x, field_vertex_values ) * w1 * w2 * this->det_jacobian( x );
1213  }
1214  }
1215  return I;
1216  } // LinearQuad::integrate_scalar_field()

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

◆ jacobian()

Matrix3 moab::Element::LinearQuad::jacobian ( const CartVect xi) const
virtual

Evaluate the map's Jacobi matrix.

Implements moab::Element::Map.

Definition at line 1168 of file ElemUtil.cpp.

1169  {
1170  // this basically ignores the z component: xi[2] or vertex[][2]
1171  Matrix3 J( 0.0 );
1172  for( unsigned i = 0; i < LinearQuad::corner_count; ++i )
1173  {
1174  const double xi_p = 1 + xi[0] * corner[i][0];
1175  const double eta_p = 1 + xi[1] * corner[i][1];
1176  const double dNi_dxi = corner[i][0] * eta_p;
1177  const double dNi_deta = corner[i][1] * xi_p;
1178  J( 0, 0 ) += dNi_dxi * vertex[i][0];
1179  J( 1, 0 ) += dNi_dxi * vertex[i][1];
1180  J( 0, 1 ) += dNi_deta * vertex[i][0];
1181  J( 1, 1 ) += dNi_deta * vertex[i][1];
1182  }
1183  J( 2, 2 ) = 1.0; /* to make sure the Jacobian determinant is non-zero */
1185  return J;
1186  } // LinearQuad::jacobian()

References corner, and corner_count.

Member Data Documentation

◆ corner

const double moab::Element::LinearQuad::corner = { { -1, -1, 0 }, { 1, -1, 0 }, { 1, 1, 0 }, { -1, 1, 0 } }
staticprotected

Definition at line 300 of file ElemUtil.hpp.

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

◆ corner_count

const unsigned int moab::Element::LinearQuad::corner_count = 4
staticprotected

Definition at line 302 of file ElemUtil.hpp.

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

◆ gauss

const double moab::Element::LinearQuad::gauss = { { 2.0, 0.0 } }
staticprotected

Definition at line 301 of file ElemUtil.hpp.

Referenced by integrate_scalar_field().

◆ gauss_count

const unsigned int moab::Element::LinearQuad::gauss_count = 1
staticprotected

Definition at line 303 of file ElemUtil.hpp.

Referenced by integrate_scalar_field().


The documentation for this class was generated from the following files: