![]() |
Mesh Oriented datABase
(version 5.4.1)
Array-based unstructured mesh datastructure
|
Class representing a map (diffeomorphism) F parameterizing a 3D element by its canonical preimage. More...
#include <ElemUtil.hpp>
Classes | |
class | ArgError |
class | EvaluationError |
Public Member Functions | |
Map (const std::vector< CartVect > &v) | |
Construct a Map defined by the given std::vector of vertices. | |
Map (const unsigned int n) | |
Construct a Map defined by n vertices. | |
virtual | ~Map () |
virtual CartVect | evaluate (const CartVect &xi) const =0 |
Evaluate the map on \(x_i\) (calculate \(\vec x = F($\vec \xi)\) ) | |
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) | |
virtual bool | inside_nat_space (const CartVect &xi, double &tol) const =0 |
decide if within the natural param space, with a tolerance | |
virtual Matrix3 | jacobian (const CartVect &xi) const =0 |
Evaluate the map's Jacobi matrix. | |
virtual Matrix3 | ijacobian (const CartVect &xi) const |
Evaluate the inverse of the Jacobi matrix. | |
virtual double | det_jacobian (const CartVect &xi) const |
Evaluate the determinate of the Jacobi matrix. | |
virtual double | det_ijacobian (const CartVect &xi) const |
Evaluate the determinate of the inverse Jacobi matrix. | |
virtual double | evaluate_scalar_field (const CartVect &xi, const double *field_vertex_values) const =0 |
Evaluate a scalar field at a point given field values at the vertices. | |
virtual double | integrate_scalar_field (const double *field_vertex_values) const =0 |
Integrate a scalar field over the element given field values at the vertices. | |
unsigned int | size () |
Size of the vertices vector. | |
const std::vector< CartVect > & | get_vertices () |
Retrieve vertices. | |
virtual void | set_vertices (const std::vector< CartVect > &v) |
Set vertices. | |
virtual bool | inside_box (const CartVect &xi, double &tol) const |
Protected Attributes | |
std::vector< CartVect > | vertex |
Class representing a map (diffeomorphism) F parameterizing a 3D element by its canonical preimage.
Definition at line 51 of file ElemUtil.hpp.
moab::Element::Map::Map | ( | const std::vector< CartVect > & | v | ) | [inline] |
Construct a Map defined by the given std::vector of vertices.
Definition at line 55 of file ElemUtil.hpp.
References set_vertices().
{
this->vertex.resize( v.size() );
this->set_vertices( v );
};
moab::Element::Map::Map | ( | const unsigned int | n | ) | [inline] |
Construct a Map defined by n vertices.
Definition at line 61 of file ElemUtil.hpp.
{
this->vertex = std::vector< CartVect >( n );
};
moab::Element::Map::~Map | ( | ) | [virtual] |
Definition at line 396 of file ElemUtil.cpp.
{}
virtual double moab::Element::Map::det_ijacobian | ( | const CartVect & | xi | ) | const [inline, virtual] |
Evaluate the determinate of the inverse Jacobi matrix.
Reimplemented in moab::Element::LinearTri, and moab::Element::LinearTet.
Definition at line 92 of file ElemUtil.hpp.
References moab::Matrix3::determinant(), moab::Matrix3::inverse(), and jacobian().
{
return this->jacobian( xi ).inverse().determinant();
};
virtual double moab::Element::Map::det_jacobian | ( | const CartVect & | xi | ) | const [inline, virtual] |
Evaluate the determinate of the Jacobi matrix.
Reimplemented in moab::Element::LinearTri, and moab::Element::LinearTet.
Definition at line 85 of file ElemUtil.hpp.
References moab::Matrix3::determinant(), and jacobian().
Referenced by moab::Element::LinearHex::integrate_scalar_field(), moab::Element::LinearQuad::integrate_scalar_field(), and moab::Element::LinearEdge::integrate_scalar_field().
{
return this->jacobian( xi ).determinant();
};
virtual CartVect moab::Element::Map::evaluate | ( | const CartVect & | xi | ) | const [pure virtual] |
Evaluate the map on \(x_i\) (calculate \(\vec x = F($\vec \xi)\) )
Implemented in moab::Element::SpectralQuad, moab::Element::LinearEdge, moab::Element::LinearTri, moab::Element::LinearQuad, moab::Element::SpectralHex, moab::Element::LinearTet, moab::Element::QuadraticHex, and moab::Element::LinearHex.
Referenced by ievaluate().
virtual double moab::Element::Map::evaluate_scalar_field | ( | const CartVect & | xi, |
const double * | field_vertex_values | ||
) | const [pure virtual] |
Evaluate a scalar field at a point given field values at the vertices.
Implemented in moab::Element::SpectralQuad, moab::Element::LinearEdge, moab::Element::LinearTri, moab::Element::LinearQuad, moab::Element::SpectralHex, moab::Element::LinearTet, moab::Element::QuadraticHex, and moab::Element::LinearHex.
Referenced by moab::Coupler::interp_field().
const std::vector< CartVect > & moab::Element::Map::get_vertices | ( | ) | [inline] |
Retrieve vertices.
Definition at line 398 of file ElemUtil.cpp.
References vertex.
{
return this->vertex;
}
CartVect moab::Element::Map::ievaluate | ( | const CartVect & | x, |
double | tol = 1e-6 , |
||
const CartVect & | x0 = CartVect( 0.0 ) |
||
) | const [virtual] |
Evaluate the inverse map (calculate \(\vec \xi = F^-1($\vec x)\) to given tolerance)
Reimplemented in moab::Element::SpectralQuad, moab::Element::SphericalTri, moab::Element::LinearTri, moab::Element::SphericalQuad, moab::Element::SpectralHex, and moab::Element::LinearTet.
Definition at line 421 of file ElemUtil.cpp.
References moab::Matrix3::determinant(), evaluate(), moab::Matrix3::inverse(), and jacobian().
Referenced by moab::Coupler::nat_param(), test_hex(), and test_hex_nat_coords().
{
// TODO: should differentiate between epsilons used for
// Newton Raphson iteration, and epsilons used for curved boundary geometry errors
// right now, fix the tolerance used for NR
tol = 1.0e-10;
const double error_tol_sqr = tol * tol;
double det;
CartVect xi = x0;
CartVect delta = evaluate( xi ) - x;
Matrix3 J;
int iters = 0;
while( delta % delta > error_tol_sqr )
{
if( ++iters > 10 ) throw Map::EvaluationError( x, vertex );
J = jacobian( xi );
det = J.determinant();
if( det < std::numeric_limits< double >::epsilon() ) throw Map::EvaluationError( x, vertex );
xi -= J.inverse() * delta;
delta = evaluate( xi ) - x;
}
return xi;
} // Map::ievaluate()
virtual Matrix3 moab::Element::Map::ijacobian | ( | const CartVect & | xi | ) | const [inline, virtual] |
Evaluate the inverse of the Jacobi matrix.
Reimplemented in moab::Element::LinearTri, and moab::Element::LinearTet.
Definition at line 79 of file ElemUtil.hpp.
References moab::Matrix3::inverse(), and jacobian().
{
return this->jacobian( xi ).inverse();
};
bool moab::Element::Map::inside_box | ( | const CartVect & | xi, |
double & | tol | ||
) | const [virtual] |
Reimplemented in moab::Element::SphericalTri, and moab::Element::SphericalQuad.
Definition at line 412 of file ElemUtil.cpp.
References moab::CartVect::array(), and moab::BoundBox::contains_point().
Referenced by moab::Coupler::nat_param(), test_hex(), and test_linear_tri().
{
// bail out early, before doing an expensive NR iteration
// compute box
BoundBox box( this->vertex );
return box.contains_point( xi.array(), tol );
}
virtual bool moab::Element::Map::inside_nat_space | ( | const CartVect & | xi, |
double & | tol | ||
) | const [pure virtual] |
decide if within the natural param space, with a tolerance
Implemented in moab::Element::SpectralQuad, moab::Element::LinearEdge, moab::Element::LinearTri, moab::Element::LinearQuad, moab::Element::SpectralHex, moab::Element::LinearTet, moab::Element::QuadraticHex, and moab::Element::LinearHex.
virtual double moab::Element::Map::integrate_scalar_field | ( | const double * | field_vertex_values | ) | const [pure virtual] |
Integrate a scalar field over the element given field values at the vertices.
Implemented in moab::Element::SpectralQuad, moab::Element::LinearEdge, moab::Element::LinearTri, moab::Element::LinearQuad, moab::Element::SpectralHex, moab::Element::LinearTet, moab::Element::QuadraticHex, and moab::Element::LinearHex.
Referenced by moab::Coupler::get_group_integ_vals().
virtual Matrix3 moab::Element::Map::jacobian | ( | const CartVect & | xi | ) | const [pure virtual] |
Evaluate the map's Jacobi matrix.
Implemented in moab::Element::SpectralQuad, moab::Element::LinearEdge, moab::Element::LinearTri, moab::Element::LinearQuad, moab::Element::SpectralHex, moab::Element::LinearTet, moab::Element::QuadraticHex, and moab::Element::LinearHex.
Referenced by det_ijacobian(), det_jacobian(), ievaluate(), and ijacobian().
void moab::Element::Map::set_vertices | ( | const std::vector< CartVect > & | v | ) | [virtual] |
Set vertices.
Reimplemented in moab::Element::LinearTri, and moab::Element::LinearTet.
Definition at line 403 of file ElemUtil.cpp.
Referenced by Map(), and test_spectral_quad().
{
if( v.size() != this->vertex.size() )
{
throw ArgError();
}
this->vertex = v;
}
unsigned int moab::Element::Map::size | ( | ) | [inline] |
Size of the vertices vector.
Definition at line 103 of file ElemUtil.hpp.
{
return this->vertex.size();
}
std::vector< CartVect > moab::Element::Map::vertex [protected] |
Definition at line 141 of file ElemUtil.hpp.
Referenced by get_vertices().