moab
|
Shape function space for bilinear quadrilateral, obtained from the canonical linear (affine) functions. More...
#include <ElemUtil.hpp>
Public Member Functions | |
LinearQuad (const std::vector< CartVect > &vertices) | |
LinearQuad () | |
virtual | ~LinearQuad () |
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 [4][3] |
static const double | gauss [1][2] = { { 2.0, 0.0 } } |
static const unsigned int | corner_count = 4 |
static const unsigned int | gauss_count = 1 |
Shape function space for bilinear quadrilateral, obtained from the canonical linear (affine) functions.
Definition at line 229 of file ElemUtil.hpp.
moab::Element::LinearQuad::LinearQuad | ( | const std::vector< CartVect > & | vertices | ) | [inline] |
Definition at line 231 of file ElemUtil.hpp.
: Map(vertices){};
Definition at line 1009 of file ElemUtil.cpp.
: Map(0) { }// LinearQuad::LinearQuad()
moab::Element::LinearQuad::~LinearQuad | ( | ) | [virtual] |
Definition at line 1013 of file ElemUtil.cpp.
{}
CartVect moab::Element::LinearQuad::evaluate | ( | const CartVect & | xi | ) | const [virtual] |
Evaluate the map on (calculate $ x = F($ )$ )
Implements moab::Element::Map.
Definition at line 1022 of file ElemUtil.cpp.
{ 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 1051 of file ElemUtil.cpp.
{ 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 1077 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) ; }
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 1062 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]; 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 1034 of file ElemUtil.cpp.
{ 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()
const double moab::Element::LinearQuad::corner [static, protected] |
{ { -1, -1, 0 }, { 1, -1, 0 }, { 1, 1, 0 }, { -1, 1, 0 } }
Definition at line 244 of file ElemUtil.hpp.
const unsigned int moab::Element::LinearQuad::corner_count = 4 [static, protected] |
Definition at line 246 of file ElemUtil.hpp.
const double moab::Element::LinearQuad::gauss = { { 2.0, 0.0 } } [static, protected] |
Definition at line 245 of file ElemUtil.hpp.
const unsigned int moab::Element::LinearQuad::gauss_count = 1 [static, protected] |
Definition at line 247 of file ElemUtil.hpp.