moab
moab::LinearQuad Class Reference

#include <LinearQuad.hpp>

List of all members.

Static Public Member Functions

static ErrorCode evalFcn (const double *params, const double *field, const int ndim, const int num_tuples, double *work, double *result)
 Forward-evaluation of field at parametric coordinates.
static ErrorCode reverseEvalFcn (EvalFcn eval, JacobianFcn jacob, InsideFcn ins, const double *posn, const double *verts, const int nverts, const int ndim, const double iter_tol, const double inside_tol, double *work, double *params, int *is_inside)
 Reverse-evaluation of parametric coordinates at physical space position.
static ErrorCode jacobianFcn (const double *params, const double *verts, const int nverts, const int ndim, double *work, double *result)
 Evaluate the jacobian at a specified parametric position.
static ErrorCode integrateFcn (const double *field, const double *verts, const int nverts, const int ndim, const int num_tuples, double *work, double *result)
 Forward-evaluation of field at parametric coordinates.
static int insideFcn (const double *params, const int ndim, const double tol)
 Function that returns whether or not the parameters are inside the natural space of the element.
static EvalSet eval_set ()
static bool compatible (EntityType tp, int numv, EvalSet &eset)

Static Protected Attributes

static const double corner [4][2]
static const double gauss [1][2] = { { 2.0, 0.0 } }
static const unsigned int corner_count = 4
static const unsigned int gauss_count = 1

Detailed Description

Definition at line 10 of file LinearQuad.hpp.


Member Function Documentation

static bool moab::LinearQuad::compatible ( EntityType  tp,
int  numv,
EvalSet eset 
) [inline, static]

Definition at line 39 of file LinearQuad.hpp.

      {
        if (tp == MBQUAD && numv == 4) {
          eset = eval_set();
          return true;
        }
        else return false;
      }
static EvalSet moab::LinearQuad::eval_set ( ) [inline, static]

Definition at line 34 of file LinearQuad.hpp.

      {
        return EvalSet(evalFcn, reverseEvalFcn, jacobianFcn, integrateFcn, NULL, insideFcn);
      }
ErrorCode moab::LinearQuad::evalFcn ( const double *  params,
const double *  field,
const int  ndim,
const int  num_tuples,
double *  work,
double *  result 
) [static]

Forward-evaluation of field at parametric coordinates.

Definition at line 39 of file LinearQuad.cpp.

                                                            {
      for (int i = 0; i < num_tuples; i++) result[i] = 0.0;
      for (unsigned i = 0; i < 4; ++i) {
        const double N_i = (1 + params[0]*corner[i][0])
            * (1 + params[1]*corner[i][1]);
        for (int j = 0; j < num_tuples; j++) result[j] += N_i * field[i*num_tuples+j];
      }
      for (int i = 0; i < num_tuples; i++) result[i] *= 0.25;

      return MB_SUCCESS;
    }
int moab::LinearQuad::insideFcn ( const double *  params,
const int  ndim,
const double  tol 
) [static]

Function that returns whether or not the parameters are inside the natural space of the element.

Definition at line 85 of file LinearQuad.cpp.

    {
      return EvalSet::inside_function(params, ndim, tol);
    }
ErrorCode moab::LinearQuad::integrateFcn ( const double *  field,
const double *  verts,
const int  nverts,
const int  ndim,
const int  num_tuples,
double *  work,
double *  result 
) [static]

Forward-evaluation of field at parametric coordinates.

Definition at line 52 of file LinearQuad.cpp.

                                                                                           {
      double tmp_result[4];
      ErrorCode rval = MB_SUCCESS;
      for (int i = 0; i < num_tuples; i++) result[i] = 0.0;
      CartVect x;
      Matrix3 J;
      for(unsigned int j1 = 0; j1 < LinearQuad::gauss_count; ++j1) {
        x[0] = LinearQuad::gauss[j1][1];
        double w1 = LinearQuad::gauss[j1][0];
        for(unsigned int j2 = 0; j2 < LinearQuad::gauss_count; ++j2) {
          x[1] = LinearQuad::gauss[j2][1];
          double w2 = LinearQuad::gauss[j2][0];
          rval = evalFcn(x.array(), field, ndim, num_tuples, NULL, tmp_result);
          if (MB_SUCCESS != rval) return rval;
          rval = jacobianFcn(x.array(), verts, nverts, ndim, work, J[0]);
          if (MB_SUCCESS != rval) return rval;
          double tmp_det =  w1*w2*J.determinant();
          for (int i = 0; i < num_tuples; i++) result[i] += tmp_result[i]*tmp_det;
        }
      }
      return MB_SUCCESS;
    } // LinearHex::integrate_vector()
ErrorCode moab::LinearQuad::jacobianFcn ( const double *  params,
const double *  verts,
const int  nverts,
const int  ndim,
double *  work,
double *  result 
) [static]

Evaluate the jacobian at a specified parametric position.

Definition at line 19 of file LinearQuad.cpp.

    {
      Matrix3 *J = reinterpret_cast<Matrix3*>(result);
      *J = Matrix3(0.0);
      for (unsigned i = 0; i < 4; ++i) {
        const double   xi_p = 1 + params[0]*corner[i][0];
        const double  eta_p = 1 + params[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   * verts[i*3+0];
        (*J)(1,0) += dNi_dxi   * verts[i*3+1];
        (*J)(0,1) += dNi_deta  * verts[i*3+0];
        (*J)(1,1) += dNi_deta  * verts[i*3+1];
      }
      (*J) *= 0.25;
      (*J)(2,2) = 1.0; /* to make sure the Jacobian determinant is non-zero */
      return MB_SUCCESS;
    }// LinearQuad::jacobian()
ErrorCode moab::LinearQuad::reverseEvalFcn ( EvalFcn  eval,
JacobianFcn  jacob,
InsideFcn  ins,
const double *  posn,
const double *  verts,
const int  nverts,
const int  ndim,
const double  iter_tol,
const double  inside_tol,
double *  work,
double *  params,
int *  is_inside 
) [static]

Reverse-evaluation of parametric coordinates at physical space position.

Definition at line 76 of file LinearQuad.cpp.

    {
      return EvalSet::evaluate_reverse(eval, jacob, ins, posn, verts, nverts, ndim, iter_tol, inside_tol, work, 
                                       params, is_inside);
    } 

Member Data Documentation

const double moab::LinearQuad::corner [static, protected]
Initial value:
 {{ -1, -1},
                                             {  1, -1},
                                             {  1,  1},
                                             { -1,  1} }

Definition at line 50 of file LinearQuad.hpp.

const unsigned int moab::LinearQuad::corner_count = 4 [static, protected]

Definition at line 52 of file LinearQuad.hpp.

const double moab::LinearQuad::gauss = { { 2.0, 0.0 } } [static, protected]

Definition at line 51 of file LinearQuad.hpp.

const unsigned int moab::LinearQuad::gauss_count = 1 [static, protected]

Definition at line 53 of file LinearQuad.hpp.


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