1 #ifndef INTREPID_HGRAD_TET_CN_FEM_ORTHDEF_HPP
2 #define INTREPID_HGRAD_TET_CN_FEM_ORTHDEF_HPP
54 template<
class Scalar,
class ArrayScalar>
57 this -> basisCardinality_ = (degree+1)*(degree+2)*(degree+3)/6;
58 this -> basisDegree_ = degree;
59 this -> basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Tetrahedron<4> >() );
60 this -> basisType_ = BASIS_FEM_HIERARCHICAL;
61 this -> basisCoordinates_ = COORDINATES_CARTESIAN;
62 this -> basisTagsAreSet_ =
false;
67 template<
class Scalar,
class ArrayScalar>
77 int *tags =
new int[tagSize * this->getCardinality()];
78 for (
int i=0;i<this->getCardinality();i++) {
82 tags[4*i+3] = this->getCardinality();
86 Intrepid::setOrdinalTagData(
this -> tagToOrdinal_,
87 this -> ordinalToTag_,
89 this -> basisCardinality_,
98 template<
class Scalar,
class ArrayScalar>
100 const ArrayScalar & inputPoints,
101 const EOperator operatorType)
const {
104 #ifdef HAVE_INTREPID_DEBUG
105 Intrepid::getValues_HGRAD_Args<Scalar, ArrayScalar>(outputValues,
108 this -> getBaseCellTopology(),
109 this -> getCardinality() );
111 const int deg = this->getDegree();
113 switch (operatorType) {
130 TEUCHOS_TEST_FOR_EXCEPTION(
true , std::invalid_argument,
131 ">>> ERROR (Basis_HGRAD_TET_Cn_FEM_ORTH): invalid or unsupported operator" );
137 template<
class Scalar,
class ArrayScalar>
139 const ArrayScalar & inputPoints,
140 const ArrayScalar & cellVertices,
141 const EOperator operatorType)
const {
142 TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::logic_error,
143 ">>> ERROR (Basis_HGRAD_TET_Cn_FEM_ORTH): FEM Basis calling an FVD member function");
146 template<
class Scalar,
class ArrayScalar>
149 const ArrayScalar &z )
151 const int np = z.dimension( 0 );
159 Teuchos::Array<Scalar> f1(np),f2(np),f3(np),f4(np),f5(np);
161 for (
int i=0;i<np;i++) {
162 f1[i] = 0.5 * ( 2.0 + 2.0*(2.0*z(i,0)-1.0) + (2.0*z(i,1)-1.0) + (2.0*z(i,2)-1.0) );
163 Scalar foo = 0.5 * ( (2.0*z(i,1)-1.0) + (2.0*z(i,2)-1.0) );
165 f3[i] = 0.5 * ( 1.0 + 2.0 * (2.0*z(i,1)-1.0) + (2.0*z(i,2)-1.0) );
166 f4[i] = 0.5 * ( 1.0 - (2.0*z(i,2)-1.0) );
167 f5[i] = f4[i] * f4[i];
172 for (
int i=0;i<np;i++) {
173 outputValues(idxcur,i) = 1.0 + z(i,0) - z(i,0) + z(i,1) - z(i,1) + z(i,2) - z(i,2);
180 for (
int i=0;i<np;i++) {
181 outputValues(idxcur,i) = f1[i];
185 for (
int p=1;p<deg;p++) {
186 Scalar a1 = (2.0 * p + 1.0) / ( p + 1.0);
187 Scalar a2 = p / ( p + 1.0 );
191 for (
int i=0;i<np;i++) {
192 outputValues(idxpp1,i) = a1 * f1[i] * outputValues(idxp,i) - a2 * f2[i] * outputValues(idxpm1,i);
196 for (
int p=0;p<deg;p++) {
199 for (
int i=0;i<np;i++) {
200 outputValues(idx1,i) = outputValues(idx0,i) * ( p * ( 1.0 + (2.0*z(i,1)-1.0) ) +
201 0.5 * ( 2.0 + 3.0 * (2.0*z(i,1)-1.0) + (2.0*z(i,2)-1.0) ) );
206 for (
int p=0;p<deg-1;p++) {
207 for (
int q=1;q<deg-p;q++) {
214 for (
int i=0;i<np;i++) {
215 outputValues(idxpqp1,i) = ( aq * f3[i] + bq * f4[i] ) * outputValues(idxpq,i)
216 - ( cq * f5[i] ) * outputValues(idxpqm1,i);
222 for (
int p=0;p<deg;p++) {
223 for (
int q=0;q<deg-p;q++) {
226 for (
int i=0;i<np;i++) {
227 outputValues(idxpq1,i) = outputValues(idxpq0,i) * ( 1.0 + p + q + ( 2.0 + q +
228 p ) * (2.0*z(i,2)-1.0) );
233 for (
int p=0;p<deg-1;p++) {
234 for (
int q=0;q<deg-p-1;q++) {
235 for (
int r=1;r<deg-p-q;r++) {
240 jrc(2.0*p+2.0*q+2.0, 0.0, r, ar, br, cr);
241 for (
int i=0;i<np;i++) {
242 outputValues(idxpqrp1,i) = (ar * (2.0*z(i,2)-1.0) + br) * outputValues( idxpqr , i ) - cr * outputValues(idxpqrm1,i);
250 for (
int p=0;p<=deg;p++) {
251 for (
int q=0;q<=deg-p;q++) {
252 for (
int r=0;r<=deg-p-q;r++) {
254 Scalar scal = sqrt( (p+0.5)*(p+q+1.0)*(p+q+r+1.5) );
255 for (
int i=0;i<np;i++) {
256 outputValues(idxcur,i) *= scal;
267 template<
typename Scalar,
typename ArrayScalar>
270 const ArrayScalar &z )
272 const int np = z.dimension(0);
273 const int card = outputValues.dimension(0);
275 for (
int i=0;i<np;i++) {
276 for (
int j=0;j<3;j++) {
277 dZ(i,j) = Sacado::Fad::DFad<Scalar>( z(i,j) );
287 for (
int i=0;i<card;i++) {
288 for (
int j=0;j<np;j++) {
289 for (
int k=0;k<3;k++) {
290 outputValues(i,j,k) = dResult(i,j).dx(k);
Basis_HGRAD_TET_Cn_FEM_ORTH(int degree)
Constructor.
void getValues(ArrayScalar &outputValues, const ArrayScalar &inputPoints, const EOperator operatorType) const
Evaluation of a FEM basis on a reference Tetrahedron cell.
Implementation of a templated lexicographical container for a multi-indexed scalar quantity...
void initializeTags()
Initializes tagToOrdinal_ and ordinalToTag_ lookup arrays.
This is an internal class with a static member function for tabulating derivatives of orthogonal expa...
static void tabulate(ArrayScalar &outputValues, const int deg, const ArrayScalar &inputPoints)
basic tabulate mathod evaluates the derivOrder^th derivatives of the basis functions at inputPoints i...