1 #ifndef INTREPID_HGRAD_TET_COMP12_FEMDEF_HPP 2 #define INTREPID_HGRAD_TET_COMP12_FEMDEF_HPP 54 template<
class Scalar,
class ArrayScalar>
57 this -> basisCardinality_ = 10;
58 this -> basisDegree_ = 1;
59 this -> basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Tetrahedron<11> >() );
60 this -> basisType_ = BASIS_FEM_DEFAULT;
61 this -> basisCoordinates_ = COORDINATES_CARTESIAN;
62 this -> basisTagsAreSet_ =
false;
66 template<
class Scalar,
class ArrayScalar>
76 int tags[] = { 0, 0, 0, 1,
90 this -> ordinalToTag_,
92 this -> basisCardinality_,
101 template<
class Scalar,
class ArrayScalar>
103 const ArrayScalar & inputPoints,
107 #ifdef HAVE_INTREPID_DEBUG 108 Intrepid::getValues_HGRAD_Args<Scalar, ArrayScalar>(outputValues,
111 this -> getBaseCellTopology(),
112 this -> getCardinality() );
116 int dim0 = inputPoints.dimension(0);
127 Teuchos::Array<int> pt_tets;
129 switch (operatorType) {
132 for (
int i0 = 0; i0 < dim0; i0++) {
133 x = inputPoints(i0, 0);
134 y = inputPoints(i0, 1);
135 z = inputPoints(i0, 2);
137 pt_tets = getLocalSubTetrahedra(x,y,z);
143 int subtet = pt_tets[0];
148 outputValues(0, i0) = 1. - 2. * (x + y + z);
149 outputValues(4, i0) = 2. * x;
150 outputValues(6, i0) = 2. * y;
151 outputValues(7, i0) = 2. * z;
154 outputValues(1, i0) = 2. * x - 1.;
155 outputValues(4, i0) = 2. - 2. * (x + y + z);
156 outputValues(5, i0) = 2. * y;
157 outputValues(8, i0) = 2. * z;
160 outputValues(2, i0) = 2. * y - 1.;
161 outputValues(5, i0) = 2. * x;
162 outputValues(6, i0) = 2. - 2. * (x + y + z);
163 outputValues(9, i0) = 2. * z;
166 outputValues(3, i0) = 2. * z - 1.;
167 outputValues(7, i0) = 2. - 2. * (x + y + z);
168 outputValues(8, i0) = 2. * x;
169 outputValues(9, i0) = 2. * y;
172 outputValues(4, i0) = 1. - 2. * (y + z);
173 outputValues(5, i0) = 2. * (x + y) - 1.;
174 outputValues(8, i0) = 2. * (x + z) - 1.;
178 outputValues(5, i0) = 1. - 2. * (x + y);
179 outputValues(8, i0) = 1. - 2. * (x + z);
180 outputValues(9, i0) = 2. * (y + z) - 1.;
181 aux = 4. - 4. * (x + y + z);
184 outputValues(7, i0) = 1. - 2. * (x + y);
185 outputValues(8, i0) = 2. * (x + z) - 1.;
186 outputValues(9, i0) = 2. * (y + z) - 1.;
190 outputValues(4, i0) = 1. - 2. * (y + z);
191 outputValues(7, i0) = 1. - 2. * (x + y);
192 outputValues(8, i0) = 2. * (x + z) - 1.;
196 outputValues(4, i0) = 1. - 2. * (y + z);
197 outputValues(5, i0) = 2. * (x + y) - 1.;
198 outputValues(6, i0) = 1. - 2. * (x + z);
202 outputValues(5, i0) = 2. * (x + y) - 1.;
203 outputValues(6, i0) = 1. - 2. * (x + z);
204 outputValues(9, i0) = 2. * (y + z) - 1.;
208 outputValues(6, i0) = 1. - 2. * (x + z);
209 outputValues(7, i0) = 1. - 2. * (x + y);
210 outputValues(9, i0) = 2. * (y + z) - 1.;
214 outputValues(4, i0) = 1. - 2. * (y + z);
215 outputValues(6, i0) = 1. - 2. * (x + z);
216 outputValues(7, i0) = 1. - 2. * (x + y);
217 aux = 4. * (x + y + z) - 2.;
220 outputValues(4, i0) += aux/6.0;
221 outputValues(5, i0) += aux/6.0;
222 outputValues(6, i0) += aux/6.0;
223 outputValues(7, i0) += aux/6.0;
224 outputValues(8, i0) += aux/6.0;
225 outputValues(9, i0) += aux/6.0;
234 outputValues.initialize(0.0);
238 int node, tet, pt, dim, bc1, bc2;
265 for (pt=0; pt < dim0; ++pt)
268 for (tet=0; tet < 12; ++tet)
269 for (bc1=0; bc1 < 4; ++bc1)
270 for (bc2=0; bc2 < 4; ++bc2)
271 a(bc1,bc2) += xJ(tet) * w(pt,tet) * lambda(pt,bc1) * lambda(pt,bc2);
274 for (tet=0; tet < 12; ++tet)
276 for (node=0; node < 10; ++node)
277 for (bc1=0; bc1 < 4; ++bc1)
278 for (dim=0; dim < 3; ++dim)
279 b(dim,bc1,node) += xJ(tet) * w(pt,tet) * lambda(pt,bc1) * dx(dim,node,tet);
282 for (node=4; node < 10; ++node)
283 for (bc1=0; bc1 < 4; ++bc1)
284 for (dim=0; dim < 3; ++dim)
285 b(dim,bc1,node) += xJ(tet) * w(pt,tet) * lambda(pt,bc1) * dx(dim,10,tet)/6;
293 for (node=0; node < 10; ++node)
294 for (bc1=0; bc1 < 4; ++bc1)
295 for (bc2=0; bc2 < 4; ++bc2)
296 for (dim=0; dim < 3; ++dim)
297 c(bc1,dim,node) += ai(bc1,bc2) * b(dim,bc2,node);
300 for (pt=0; pt < dim0; ++pt)
301 for (node=0; node < 10; ++node)
302 for (dim=0; dim < 3; ++dim)
303 for (bc1=0; bc1 < 4; ++bc1)
304 outputValues(node,pt,dim) += lambda(pt,bc1) * c(bc1,dim,node);
309 TEUCHOS_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_CURL), std::invalid_argument,
310 ">>> ERROR (Basis_HGRAD_TET_COMP12_FEM): CURL is invalid operator for rank-0 (scalar) functions in 3D");
314 TEUCHOS_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_DIV), std::invalid_argument,
315 ">>> ERROR (Basis_HGRAD_TET_COMP12_FEM): DIV is invalid operator for rank-0 (scalar) functions in 3D");
330 this -> basisCellTopology_.getDimension() );
331 for(
int dofOrd = 0; dofOrd <
this -> basisCardinality_; dofOrd++) {
332 for (
int i0 = 0; i0 < dim0; i0++) {
333 for(
int dkOrd = 0; dkOrd < DkCardinality; dkOrd++){
334 outputValues(dofOrd, i0, dkOrd) = 0.0;
342 ">>> ERROR (Basis_HGRAD_TET_COMP12_FEM): Invalid operator type");
348 template<
class Scalar,
class ArrayScalar>
350 const ArrayScalar & inputPoints,
351 const ArrayScalar & cellVertices,
353 TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::logic_error,
354 ">>> ERROR (Basis_HGRAD_TET_COMP12_FEM): FEM Basis calling an FVD member function");
358 template<
class Scalar,
class ArrayScalar>
360 #ifdef HAVE_INTREPID_DEBUG 362 TEUCHOS_TEST_FOR_EXCEPTION( !(DofCoords.rank() == 2), std::invalid_argument,
363 ">>> ERROR: (Intrepid::Basis_HGRAD_TET_COMP12_FEM::getDofCoords) rank = 2 required for DofCoords array");
365 TEUCHOS_TEST_FOR_EXCEPTION( !( DofCoords.dimension(0) ==
this -> basisCardinality_ ), std::invalid_argument,
366 ">>> ERROR: (Intrepid::Basis_HGRAD_TET_COMP12_FEM::getDofCoords) mismatch in number of DoF and 0th dimension of DofCoords array");
368 TEUCHOS_TEST_FOR_EXCEPTION( !( DofCoords.dimension(1) == (int)(
this -> basisCellTopology_.getDimension()) ), std::invalid_argument,
369 ">>> ERROR: (Intrepid::Basis_HGRAD_TET_COMP12_FEM::getDofCoords) incorrect reference cell (1st) dimension in DofCoords array");
372 DofCoords(0,0) = 0.0; DofCoords(0,1) = 0.0; DofCoords(0,2) = 0.0;
373 DofCoords(1,0) = 1.0; DofCoords(1,1) = 0.0; DofCoords(1,2) = 0.0;
374 DofCoords(2,0) = 0.0; DofCoords(2,1) = 1.0; DofCoords(2,2) = 0.0;
375 DofCoords(3,0) = 0.0; DofCoords(3,1) = 0.0; DofCoords(3,2) = 1.0;
376 DofCoords(4,0) = 0.5; DofCoords(4,1) = 0.0; DofCoords(4,2) = 0.0;
377 DofCoords(5,0) = 0.5; DofCoords(5,1) = 0.5; DofCoords(5,2) = 0.0;
378 DofCoords(6,0) = 0.0; DofCoords(6,1) = 0.5; DofCoords(6,2) = 0.0;
379 DofCoords(7,0) = 0.0; DofCoords(7,1) = 0.0; DofCoords(7,2) = 0.5;
380 DofCoords(8,0) = 0.5; DofCoords(8,1) = 0.0; DofCoords(8,2) = 0.5;
381 DofCoords(9,0) = 0.0; DofCoords(9,1) = 0.5; DofCoords(9,2) = 0.5;
384 template<
class Scalar,
class ArrayScalar>
389 Teuchos::Array<int> subTets;
392 Scalar xyz = x + y + z;
400 if ( (0.0 <= xyz && xyz <= 0.5) && (0.0 <= x && x <= 0.5) && (0.0 <= y && y <= 0.5) && (0.0 <= z && z <= 0.5) )
401 subTets.push_back(0);
404 if ( (0.5 <= xyz && xyz <= 1.0) && (0.5 <= x && x <= 1.0) && (0.0 <= y && y <= 0.5) && (0.0 <= z && z <= 0.5) )
405 subTets.push_back(1);
408 if ( (0.5 <= xyz && xyz <= 1.0) && (0.0 <= x && x <= 0.5) && (0.5 <= y && y <= 1.0) && (0.0 <= z && z<= 0.5) )
409 subTets.push_back(2);
412 if ( (0.5 <= xyz && xyz <= 1.0) && (0.0 <= x && x <= 0.5) && (0.0 <= y && y <= 0.5) && (0.5 <= z && z <= 1.0) )
413 subTets.push_back(3);
416 if ( (0.0 <= yz && yz <= 0.5) && (0.5 <= xy && xy <= 1.0) && (0.5 <= xz && xz <= 1.0) && (0.0 <= x && x <= 0.5) )
417 subTets.push_back(4);
420 if ( (0.5 <= xy && xy <= 1.0) && (0.5 <= yz && yz <= 1.0) && (0.5 <= xz && xz <= 1.0) && (0.75 <= xyz && xyz <= 1.0) )
421 subTets.push_back(5);
424 if ( (0.5 <= yz && yz <= 1.0) && (0.0 <= xy && xy <= 0.5) && (0.5 <= xz && xz <= 1.0) && (0.0 <= z && z <= 0.5) )
425 subTets.push_back(6);
428 if ( (0.0 <= yz && yz <= 0.5) && (0.0 <= xy && xy <= 0.5) && (0.5 <= xz && xz <= 1.0) && (0.0 <= y && y <= 0.25) )
429 subTets.push_back(7);
432 if ( (0.0 <= xz && xz <= 0.5) && (0.0 <= yz && yz <= 0.5) && (0.5 <= xy && xy <= 1.0) && (0.0 <= z && z <= 0.5) )
433 subTets.push_back(8);
436 if ( (0.0 <= xz && xz <= 0.5) && (0.5 <= xy && xy <= 1.0) && (0.5 <= yz && yz <= 1.0) && (0.0 <= y && y <= 0.5) )
437 subTets.push_back(9);
440 if ( (0.0 <= xz && xz <= 0.5) && (0.5 <= yz && yz <= 1.0) && (0.0 <= xy && xy <= 0.5) && (0.0 <= x && x <= 0.25) )
441 subTets.push_back(10);
444 if ( (0.5 <= xyz && xyz <= 0.75) && (0.0 <= xz && xz <= 0.5) && (0.0 <= yz && yz <= 0.5) && (0.0 <= xy && xy <= 0.5) )
445 subTets.push_back(11);
451 template<
class Scalar,
class ArrayScalar>
458 Teuchos::Array< Teuchos::Array<int> > pt_tets;
460 for (
int pt = 0; pt < numPoints; ++pt)
461 pt_tets.push_back(getLocalSubTetrahedra(inPts(pt,0), inPts(pt,1), inPts(pt,2)));
463 Teuchos::Array<int> flat;
466 for (
int pt = 0; pt < numPoints; ++pt)
467 for (
int i = 0; i < pt_tets[pt].size(); ++i)
468 flat.push_back(pt_tets[pt][i]);
470 for (
int i = 0; i < flat.size(); ++i)
473 for (
int pt = 0; pt < numPoints; ++pt)
474 for (
int i = 0; i < pt_tets[pt].size(); ++i)
475 w(pt, pt_tets[pt][i]) = 1.0/count(pt_tets[pt][i]);
482 template<
class Scalar,
class ArrayScalar>
489 for (
int pt = 0; pt < numPoints; ++pt)
491 lambda(pt,0) = 1. - inPts(pt,0) - inPts(pt,1) - inPts(pt,2);
492 lambda(pt,1) = inPts(pt,0);
493 lambda(pt,2) = inPts(pt,1);
494 lambda(pt,3) = inPts(pt,2);
500 template<
class Scalar,
class ArrayScalar>
504 Scalar det = a(0,3) * a(1,2) * a(2,1) * a(3,0)
505 - a(0,2) * a(1,3) * a(2,1) * a(3,0)
506 - a(0,3) * a(1,1) * a(2,2) * a(3,0)
507 + a(0,1) * a(1,3) * a(2,2) * a(3,0)
508 + a(0,2) * a(1,1) * a(2,3) * a(3,0)
509 - a(0,1) * a(1,2) * a(2,3) * a(3,0)
510 - a(0,3) * a(1,2) * a(2,0) * a(3,1)
511 + a(0,2) * a(1,3) * a(2,0) * a(3,1)
512 + a(0,3) * a(1,0) * a(2,2) * a(3,1)
513 - a(0,0) * a(1,3) * a(2,2) * a(3,1)
514 - a(0,2) * a(1,0) * a(2,3) * a(3,1)
515 + a(0,0) * a(1,2) * a(2,3) * a(3,1)
516 + a(0,3) * a(1,1) * a(2,0) * a(3,2)
517 - a(0,1) * a(1,3) * a(2,0) * a(3,2)
518 - a(0,3) * a(1,0) * a(2,1) * a(3,2)
519 + a(0,0) * a(1,3) * a(2,1) * a(3,2)
520 + a(0,1) * a(1,0) * a(2,3) * a(3,2)
521 - a(0,0) * a(1,1) * a(2,3) * a(3,2)
522 - a(0,2) * a(1,1) * a(2,0) * a(3,3)
523 + a(0,1) * a(1,2) * a(2,0) * a(3,3)
524 + a(0,2) * a(1,0) * a(2,1) * a(3,3)
525 - a(0,0) * a(1,2) * a(2,1) * a(3,3)
526 - a(0,1) * a(1,0) * a(2,2) * a(3,3)
527 + a(0,0) * a(1,1) * a(2,2) * a(3,3);
532 template<
class Scalar,
class ArrayScalar>
537 Scalar xj = det44(a);
539 ai(0,0) = (1/xj) * (-a(1,3) * a(2,2) * a(3,1) + a(1,2) * a(2,3) * a(3,1) + a(1,3) * a(2,1) * a(3,2) - a(1,1) * a(2,3) * a(3,2) - a(1,2) * a(2,1) * a(3,3) + a(1,1) * a(2,2) * a(3,3));
540 ai(0,1) = (1/xj) * ( a(0,3) * a(2,2) * a(3,1) - a(0,2) * a(2,3) * a(3,1) - a(0,3) * a(2,1) * a(3,2) + a(0,1) * a(2,3) * a(3,2) + a(0,2) * a(2,1) * a(3,3) - a(0,1) * a(2,2) * a(3,3));
541 ai(0,2) = (1/xj) * (-a(0,3) * a(1,2) * a(3,1) + a(0,2) * a(1,3) * a(3,1) + a(0,3) * a(1,1) * a(3,2) - a(0,1) * a(1,3) * a(3,2) - a(0,2) * a(1,1) * a(3,3) + a(0,1) * a(1,2) * a(3,3));
542 ai(0,3) = (1/xj) * ( a(0,3) * a(1,2) * a(2,1) - a(0,2) * a(1,3) * a(2,1) - a(0,3) * a(1,1) * a(2,2) + a(0,1) * a(1,3) * a(2,2) + a(0,2) * a(1,1) * a(2,3) - a(0,1) * a(1,2) * a(2,3));
544 ai(1,0) = (1/xj) * ( a(1,3) * a(2,2) * a(3,0) - a(1,2) * a(2,3) * a(3,0) - a(1,3) * a(2,0) * a(3,2) + a(1,0) * a(2,3) * a(3,2) + a(1,2) * a(2,0) * a(3,3) - a(1,0) * a(2,2) * a(3,3));
545 ai(1,1) = (1/xj) * (-a(0,3) * a(2,2) * a(3,0) + a(0,2) * a(2,3) * a(3,0) + a(0,3) * a(2,0) * a(3,2) - a(0,0) * a(2,3) * a(3,2) - a(0,2) * a(2,0) * a(3,3) + a(0,0) * a(2,2) * a(3,3));
546 ai(1,2) = (1/xj) * ( a(0,3) * a(1,2) * a(3,0) - a(0,2) * a(1,3) * a(3,0) - a(0,3) * a(1,0) * a(3,2) + a(0,0) * a(1,3) * a(3,2) + a(0,2) * a(1,0) * a(3,3) - a(0,0) * a(1,2) * a(3,3));
547 ai(1,3) = (1/xj) * (-a(0,3) * a(1,2) * a(2,0) + a(0,2) * a(1,3) * a(2,0) + a(0,3) * a(1,0) * a(2,2) - a(0,0) * a(1,3) * a(2,2) - a(0,2) * a(1,0) * a(2,3) + a(0,0) * a(1,2) * a(2,3));
549 ai(2,0) = (1/xj) * (-a(1,3) * a(2,1) * a(3,0) + a(1,1) * a(2,3) * a(3,0) + a(1,3) * a(2,0) * a(3,1) - a(1,0) * a(2,3) * a(3,1) - a(1,1) * a(2,0) * a(3,3) + a(1,0) * a(2,1) * a(3,3));
550 ai(2,1) = (1/xj) * ( a(0,3) * a(2,1) * a(3,0) - a(0,1) * a(2,3) * a(3,0) - a(0,3) * a(2,0) * a(3,1) + a(0,0) * a(2,3) * a(3,1) + a(0,1) * a(2,0) * a(3,3) - a(0,0) * a(2,1) * a(3,3));
551 ai(2,2) = (1/xj) * (-a(0,3) * a(1,1) * a(3,0) + a(0,1) * a(1,3) * a(3,0) + a(0,3) * a(1,0) * a(3,1) - a(0,0) * a(1,3) * a(3,1) - a(0,1) * a(1,0) * a(3,3) + a(0,0) * a(1,1) * a(3,3));
552 ai(2,3) = (1/xj) * ( a(0,3) * a(1,1) * a(2,0) - a(0,1) * a(1,3) * a(2,0) - a(0,3) * a(1,0) * a(2,1) + a(0,0) * a(1,3) * a(2,1) + a(0,1) * a(1,0) * a(2,3) - a(0,0) * a(1,1) * a(2,3));
554 ai(3,0) = (1/xj) * ( a(1,2) * a(2,1) * a(3,0) - a(1,1) * a(2,2) * a(3,0) - a(1,2) * a(2,0) * a(3,1) + a(1,0) * a(2,2) * a(3,1) + a(1,1) * a(2,0) * a(3,2) - a(1,0) * a(2,1) * a(3,2));
555 ai(3,1) = (1/xj) * (-a(0,2) * a(2,1) * a(3,0) + a(0,1) * a(2,2) * a(3,0) + a(0,2) * a(2,0) * a(3,1) - a(0,0) * a(2,2) * a(3,1) - a(0,1) * a(2,0) * a(3,2) + a(0,0) * a(2,1) * a(3,2));
556 ai(3,2) = (1/xj) * ( a(0,2) * a(1,1) * a(3,0) - a(0,1) * a(1,2) * a(3,0) - a(0,2) * a(1,0) * a(3,1) + a(0,0) * a(1,2) * a(3,1) + a(0,1) * a(1,0) * a(3,2) - a(0,0) * a(1,1) * a(3,2));
557 ai(3,3) = (1/xj) * (-a(0,2) * a(1,1) * a(2,0) + a(0,1) * a(1,2) * a(2,0) + a(0,2) * a(1,0) * a(2,1) - a(0,0) * a(1,2) * a(2,1) - a(0,1) * a(1,0) * a(2,2) + a(0,0) * a(1,1) * a(2,2));
562 template<
class Scalar,
class ArrayScalar>
661 template<
class Scalar,
class ArrayScalar>
667 xJ(0) = 1./48.; xJ(1) = 1./48.; xJ(2) = 1./48.; xJ(3) = 1./48.;
668 xJ(4) = 1./96.; xJ(5) = 1./96.; xJ(6) = 1./96.; xJ(7) = 1./96.;
669 xJ(8) = 1./96.; xJ(9) = 1./96.; xJ(10) = 1./96.; xJ(11) = 1./96.;
int dimension(const int whichDim) const
Returns the specified dimension.
void setOrdinalTagData(std::vector< std::vector< std::vector< int > > > &tagToOrdinal, std::vector< std::vector< int > > &ordinalToTag, const int *tags, const int basisCard, const int tagSize, const int posScDim, const int posScOrd, const int posDfOrd)
Fills ordinalToTag_ and tagToOrdinal_ by basis-specific tag data.
EOperator
Enumeration of primitive operators available in Intrepid. Primitive operators act on reconstructed fu...
Intrepid::FieldContainer< Scalar > inverse44(const Intrepid::FieldContainer< Scalar >) const
Returns FieldContainer of Barycentric Coordinates for the input points.
void initializeTags()
Initializes tagToOrdinal_ and ordinalToTag_ lookup arrays.
Intrepid::FieldContainer< Scalar > getSubTetDetF() const
Returns FieldContainer of local sub-tet detF.
int getDkCardinality(const EOperator operatorType, const int spaceDim)
Returns cardinality of Dk, i.e., the number of all derivatives of order k.
void getValues(ArrayScalar &outputValues, const ArrayScalar &inputPoints, const EOperator operatorType) const
FEM basis evaluation on a reference Tetrahedron cell.
Basis_HGRAD_TET_COMP12_FEM()
Constructor.
void initialize(const Scalar value=0)
Initializes a field container by assigning value to all its elements.
int isValidOperator(const EOperator operatorType)
Verifies validity of an operator enum.
Intrepid::FieldContainer< Scalar > getSubTetGrads() const
Returns FieldContainer of local sub-tet gradients.
Teuchos::Array< int > getLocalSubTetrahedra(Scalar, Scalar, Scalar) const
Returns array of local sub-tetrahdera that the given point resides in.
Scalar det44(const Intrepid::FieldContainer< Scalar >) const
Returns FieldContainer of Barycentric Coordinates for the input points.
Intrepid::FieldContainer< Scalar > getWeights(const ArrayScalar &) const
Returns FieldContainer of local integration weights.
void getDofCoords(ArrayScalar &DofCoords) const
Returns spatial locations (coordinates) of degrees of freedom on a reference Tetrahedron.
Intrepid::FieldContainer< Scalar > getBarycentricCoords(const ArrayScalar &) const
Returns FieldContainer of Barycentric Coordinates for the input points.