1 #ifndef LINEAR_TET_HPP
2 #define LINEAR_TET_HPP
3 /**\brief Shape function space for trilinear tetrahedron, obtained by a pushforward of the canonical
4 * linear (affine) functions. */
5
6 #include "moab/ElemEvaluator.hpp"
7 #include "moab/CN.hpp"
8
9 namespace moab
10 {
11
12 class LinearTet
13 {
14 public:
15 /** \brief Forward-evaluation of field at parametric coordinates */
16 static ErrorCode evalFcn( const double* params,
17 const double* field,
18 const int ndim,
19 const int num_tuples,
20 double* work,
21 double* result );
22
23 /** \brief Reverse-evaluation of parametric coordinates at physical space position */
24 static ErrorCode reverseEvalFcn( EvalFcn eval,
25 JacobianFcn jacob,
26 InsideFcn ins,
27 const double* posn,
28 const double* verts,
29 const int nverts,
30 const int ndim,
31 const double iter_tol,
32 const double inside_tol,
33 double* work,
34 double* params,
35 int* is_inside );
36
37 /** \brief Evaluate the normal at a specified facet*/
38 static ErrorCode normalFcn( const int ientDim,
39 const int facet,
40 const int nverts,
41 const double* verts,
42 double normal[3] );
43
44 /** \brief Evaluate the jacobian at a specified parametric position */
45 static ErrorCode jacobianFcn( const double* params,
46 const double* verts,
47 const int nverts,
48 const int ndim,
49 double* work,
50 double* result );
51
52 /** \brief Forward-evaluation of field at parametric coordinates */
53 static ErrorCode integrateFcn( const double* field,
54 const double* verts,
55 const int nverts,
56 const int ndim,
57 const int num_tuples,
58 double* work,
59 double* result );
60
61 /** \brief Initialize this EvalSet */
62 static ErrorCode initFcn( const double* verts, const int nverts, double*& work );
63
64 /** \brief Function that returns whether or not the parameters are inside the natural space of
65 * the element */
66 static int insideFcn( const double* params, const int ndim, const double tol );
67
68 static ErrorCode evaluate_reverse( EvalFcn eval,
69 JacobianFcn jacob,
70 InsideFcn inside_f,
71 const double* posn,
72 const double* verts,
73 const int nverts,
74 const int ndim,
75 const double iter_tol,
76 const double inside_tol,
77 double* work,
78 double* params,
79 int* inside );
80
81 static EvalSet eval_set()
82 {
83 return EvalSet( evalFcn, reverseEvalFcn, normalFcn, jacobianFcn, integrateFcn, initFcn, insideFcn );
84 }
85
86 static bool compatible( EntityType tp, int numv, EvalSet& eset )
87 {
88 if( tp == MBTET && numv >= 4 )
89 {
90 eset = eval_set();
91 return true;
92 }
93 else
94 return false;
95 }
96
97 protected:
98 static const double corner[4][3];
99 }; // class LinearTet
100
101 } // namespace moab
102
103 #endif