1 #ifndef SPECTRAL_QUAD_HPP
2 #define SPECTRAL_QUAD_HPP
3 /*\brief Shape function space for spectral quad
4 */
5
6 #include "moab/ElemEvaluator.hpp"
7 #include "SpectralFuncs.hpp"
8
9 namespace moab
10 {
11
12 class SpectralQuad
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 != MBQUAD ) return false;
69 int i;
70 for( i = 3; i * i == numv || i * i > numv; i++ )
71 ;
72 if( i * i != numv ) return false;
73 eset = eval_set();
74 return true;
75 }
76
77 protected:
78 static int _n;
79 static double* _z[2];
80 static lagrange_data _ld[2];
81 static opt_data_2 _data; // we should use only 2nd component
82 static double* _odwork; // work area
83
84 // flag for initialization of data
85 static bool _init;
86 static double* _glpoints; // it is a space we can use to store gl positions for elements
87 // on the fly; we do not have a tag yet for them, as in Nek5000 application
88 // also, these positions might need to be moved on the sphere, for HOMME grids
89 // do we project them or how do we move them on the sphere?
90 }; // class SpectralQuad
91
92 } // namespace moab
93
94 #endif