MOAB: Mesh Oriented datABase  (version 5.4.1)
moab::Element::Map Class Reference

Class representing a map (diffeomorphism) F parameterizing a 3D element by its canonical preimage. More...

#include <ElemUtil.hpp>

+ Inheritance diagram for moab::Element::Map:

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< CartVectvertex

Detailed Description

Class representing a map (diffeomorphism) F parameterizing a 3D element by its canonical preimage.

Definition at line 51 of file ElemUtil.hpp.


Constructor & Destructor Documentation

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.

{}

Member Function Documentation

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]
virtual double moab::Element::Map::evaluate_scalar_field ( const CartVect xi,
const double *  field_vertex_values 
) const [pure virtual]
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(), test_hex_nat_coords(), and time_reverse_eval().

    {
        // 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(), box(), 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]
virtual double moab::Element::Map::integrate_scalar_field ( const double *  field_vertex_values) const [pure virtual]
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();
        }

Member Data Documentation

std::vector< CartVect > moab::Element::Map::vertex [protected]

Definition at line 141 of file ElemUtil.hpp.

Referenced by get_vertices().

List of all members.


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