1 #ifndef SPECTRAL_HEX_HPP
2 #define SPECTRAL_HEX_HPP
3 /**\brief Shape function space for spectral hexahedron
4 */
5
6 #include "moab/ElemEvaluator.hpp"
7 #include "SpectralFuncs.hpp"
8
9 namespace moab
10 {
11
12 class SpectralHex
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 jacobian at a specified parametric position */
38 static ErrorCode jacobianFcn( const double* params,
39 const double* verts,
40 const int nverts,
41 const int ndim,
42 double* work,
43 double* result );
44
45 /** \brief Forward-evaluation of field at parametric coordinates */
46 static ErrorCode integrateFcn( const double* field,
47 const double* verts,
48 const int nverts,
49 const int ndim,
50 const int num_tuples,
51 double* work,
52 double* result );
53
54 /** \brief Initialize this EvalSet */
55 static ErrorCode initFcn( const double* verts, const int nverts, double*& work );
56
57 /** \brief Function that returns whether or not the parameters are inside the natural space of
58 * the element */
59 static int insideFcn( const double* params, const int ndim, const double tol );
60
61 static EvalSet eval_set()
62 {
63 return EvalSet( evalFcn, reverseEvalFcn, jacobianFcn, integrateFcn, initFcn );
64 }
65
66 static bool compatible( EntityType tp, int numv, EvalSet& eset )
67 {
68 if( tp != MBHEX ) return false;
69 int i;
70 for( i = 3; i * i * i == numv || i * i * i > numv; i++ )
71 ;
72 if( i * i * i != numv ) return false;
73 eset = eval_set();
74 return true;
75 }
76
77 protected:
78 static int _n;
79 static double* _z[3];
80 static lagrange_data _ld[3];
81 static opt_data_3 _data;
82 static double* _odwork; // work area
83 static bool init_;
84 }; // class SpectralHex
85
86 } // namespace moab
87
88 #endif