Mesh Oriented datABase  (version 5.5.0)
An array-based unstructured mesh library
moab::Element::LinearEdge Class Reference

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

#include <ElemUtil.hpp>

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

Public Member Functions

 LinearEdge (const std::vector< CartVect > &vertices)
 
 LinearEdge ()
 
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 [2][3] = { { -1, 0, 0 }, { 1, 0, 0 } }
 
static const double gauss [1][2] = { { 2.0, 0.0 } }
 
static const unsigned int corner_count = 2
 
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 399 of file ElemUtil.hpp.

Constructor & Destructor Documentation

◆ LinearEdge() [1/2]

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

Definition at line 402 of file ElemUtil.hpp.

402 : Map( vertices ){};

◆ LinearEdge() [2/2]

moab::Element::LinearEdge::LinearEdge ( )

Definition at line 616 of file ElemUtil.cpp.

616 : Map( 0 ) {} // LinearEdge::LinearEdge()

Member Function Documentation

◆ evaluate()

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

625  {
626  CartVect x( 0.0 );
627  for( unsigned i = 0; i < LinearEdge::corner_count; ++i )
628  {
629  const double N_i = ( 1.0 + xi[0] * corner[i][0] );
630  x += N_i * this->vertex[i];
631  }
633  return x;
634  } // LinearEdge::evaluate

References corner, and corner_count.

◆ evaluate_scalar_field()

double moab::Element::LinearEdge::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 651 of file ElemUtil.cpp.

652  {
653  double f( 0.0 );
654  for( unsigned i = 0; i < LinearEdge::corner_count; ++i )
655  {
656  const double N_i = ( 1 + xi[0] * corner[i][0] ) * ( 1.0 + xi[1] * corner[i][1] );
657  f += N_i * field_vertex_value[i];
658  }
660  return f;
661  } // LinearEdge::evaluate_scalar_field()

References corner, and corner_count.

Referenced by integrate_scalar_field().

◆ inside_nat_space()

bool moab::Element::LinearEdge::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 676 of file ElemUtil.cpp.

677  {
678  // just look at the box+tol here
679  return ( xi[0] >= -1. - tol ) && ( xi[0] <= 1. + tol );
680  }

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

◆ integrate_scalar_field()

double moab::Element::LinearEdge::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 663 of file ElemUtil.cpp.

664  {
665  double I( 0.0 );
666  for( unsigned int j1 = 0; j1 < this->gauss_count; ++j1 )
667  {
668  double x1 = this->gauss[j1][1];
669  double w1 = this->gauss[j1][0];
670  CartVect x( x1, 0.0, 0.0 );
671  I += this->evaluate_scalar_field( x, field_vertex_values ) * w1 * this->det_jacobian( x );
672  }
673  return I;
674  } // LinearEdge::integrate_scalar_field()

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

◆ jacobian()

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

Evaluate the map's Jacobi matrix.

Implements moab::Element::Map.

Definition at line 636 of file ElemUtil.cpp.

637  {
638  Matrix3 J( 0.0 );
639  for( unsigned i = 0; i < LinearEdge::corner_count; ++i )
640  {
641  const double xi_p = 1.0 + xi[0] * corner[i][0];
642  const double dNi_dxi = corner[i][0] * xi_p;
643  J( 0, 0 ) += dNi_dxi * vertex[i][0];
644  }
645  J( 1, 1 ) = 1.0; /* to make sure the Jacobian determinant is non-zero */
646  J( 2, 2 ) = 1.0; /* to make sure the Jacobian determinant is non-zero */
648  return J;
649  } // LinearEdge::jacobian()

References corner, and corner_count.

Member Data Documentation

◆ corner

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

Definition at line 414 of file ElemUtil.hpp.

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

◆ corner_count

const unsigned int moab::Element::LinearEdge::corner_count = 2
staticprotected

Definition at line 416 of file ElemUtil.hpp.

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

◆ gauss

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

Definition at line 415 of file ElemUtil.hpp.

Referenced by integrate_scalar_field().

◆ gauss_count

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

Definition at line 417 of file ElemUtil.hpp.

Referenced by integrate_scalar_field().


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