moab
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:
moab::Element::LinearEdge moab::Element::LinearHex moab::Element::LinearQuad moab::Element::LinearTet moab::Element::QuadraticHex moab::Element::SpectralHex moab::Element::SpectralQuad

List of all members.

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 (calculate $ x = F($ )$ )
virtual CartVect ievaluate (const CartVect &x, double tol, const CartVect &x0=CartVect(0.0)) const
 Evaluate the inverse map (calculate $ = F^-1($ 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.

Protected Attributes

std::vector< CartVectvertex

Detailed Description

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

Definition at line 68 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 71 of file ElemUtil.hpp.

{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 73 of file ElemUtil.hpp.

{this->vertex = std::vector<CartVect>(n);};
moab::Element::Map::~Map ( ) [virtual]

Definition at line 422 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::LinearTet.

Definition at line 92 of file ElemUtil.hpp.

{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::LinearTet.

Definition at line 89 of file ElemUtil.hpp.

{return this->jacobian(xi).determinant();};
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 425 of file ElemUtil.cpp.

                                                        {
        return this->vertex;
      }
CartVect moab::Element::Map::ievaluate ( const CartVect x,
double  tol,
const CartVect x0 = CartVect(0.0) 
) const [virtual]

Evaluate the inverse map (calculate $ = F^-1($ x)$ to given tolerance)

Definition at line 437 of file ElemUtil.cpp.

                                                                                 {
    // 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();

      J = jacobian(xi);
      det = J.determinant();
      if (det < std::numeric_limits<double>::epsilon())
        throw Map::EvaluationError();
      xi -= J.inverse(1.0/det) * 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::LinearTet.

Definition at line 86 of file ElemUtil.hpp.

{return this->jacobian(xi).inverse();};
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::LinearTet.

Definition at line 429 of file ElemUtil.cpp.

                                                         {
        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 100 of file ElemUtil.hpp.

{return this->vertex.size();}

Member Data Documentation

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

Definition at line 118 of file ElemUtil.hpp.


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