1 #ifndef INTREPID_HGRAD_HEX_CN_FEMDEF_HPP 2 #define INTREPID_HGRAD_HEX_CN_FEMDEF_HPP 52 template<
class Scalar,
class ArrayScalar>
56 const ArrayScalar &pts_x ,
57 const ArrayScalar &pts_y ,
58 const ArrayScalar &pts_z ):
59 ptsx_( pts_x.dimension(0) , 1 ),
60 ptsy_( pts_y.dimension(0) , 1 ),
61 ptsz_( pts_z.dimension(0) , 1 )
63 for (
int i=0;i<pts_x.dimension(0);i++)
65 ptsx_(i,0) = pts_x(i,0);
67 for (
int i=0;i<pts_y.dimension(0);i++)
69 ptsy_(i,0) = pts_y(i,0);
71 for (
int i=0;i<pts_z.dimension(0);i++)
73 ptsz_(i,0) = pts_z(i,0);
76 Array<Array<RCP<Basis<Scalar,ArrayScalar> > > > bases(1);
83 this->setBases( bases );
86 if (orderx >= ordery && orderx >= orderz ) {
89 else if (ordery >= orderx && ordery >= orderz) {
95 this ->
basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Hexahedron<8> >() );
101 template<
class Scalar,
class ArrayScalar>
104 ptsx_( order+1 , 1 ),
105 ptsy_( order+1 , 1 ),
108 Array<Array<RCP<Basis<Scalar,ArrayScalar> > > > bases(1);
113 bases[0][1] = bases[0][0];
114 bases[0][2] = bases[0][0];
116 this->setBases( bases );
120 this ->
basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Hexahedron<8> >() );
126 EPointType pt = (pointType==POINTTYPE_EQUISPACED)?pointType:POINTTYPE_WARPBLEND;
127 PointTools::getLattice<Scalar,FieldContainer<Scalar> >( ptsx_ ,
128 shards::CellTopology(shards::getCellTopologyData<shards::Line<2> >()) ,
132 for (
int i=0;i<order+1;i++)
134 ptsy_(i,0) = ptsx_(i,0);
135 ptsz_(i,0) = ptsx_(i,0);
140 template<
class Scalar,
class ArrayScalar>
156 tags[tagSize*i+1] = 0;
157 tags[tagSize*i+2] = i;
168 const std::vector<std::vector<int> >& xdoftags = xBasis_.
getAllDofTags();
169 const std::vector<std::vector<int> >& ydoftags = yBasis_.
getAllDofTags();
170 const std::vector<std::vector<int> >& zdoftags = zBasis_.
getAllDofTags();
172 std::map<int,std::map<int,int> > total_dof_per_entity;
173 std::map<int,std::map<int,int> > current_dof_per_entity;
176 for (
int i=0;i<8;i++) {
177 total_dof_per_entity[0][i] = 0;
178 current_dof_per_entity[0][i] = 0;
181 for (
int i=0;i<12;i++) {
182 total_dof_per_entity[1][i] = 0;
183 current_dof_per_entity[1][i] = 0;
186 for (
int i=0;i<6;i++) {
187 total_dof_per_entity[2][i] = 0;
188 current_dof_per_entity[2][i] = 0;
191 total_dof_per_entity[3][0] = 0;
196 const int zdim = zdoftags[k][0];
197 const int zent = zdoftags[k][1];
199 const int ydim = ydoftags[j][0];
200 const int yent = ydoftags[j][1];
202 const int xdim = xdoftags[i][0];
203 const int xent = xdoftags[i][1];
207 std::cout << i <<
" " << j <<
" " << k <<
"\t" << dofdim <<
" " << dofent << std::endl;
208 total_dof_per_entity[dofdim][dofent] += 1;
216 const int zdim = zdoftags[k][0];
217 const int zent = zdoftags[k][1];
219 const int ydim = ydoftags[j][0];
220 const int yent = ydoftags[j][1];
222 const int xdim = xdoftags[i][0];
223 const int xent = xdoftags[i][1];
227 tags[4*tagcur] = dofdim;
228 tags[4*tagcur+1] = dofent;
229 tags[4*tagcur+2] = current_dof_per_entity[dofdim][dofent];
230 current_dof_per_entity[dofdim][dofent]++;
231 tags[4*tagcur+3] = total_dof_per_entity[dofdim][dofent];
248 template<
class Scalar,
class ArrayScalar>
250 const ArrayScalar &inputPoints ,
253 #ifdef HAVE_INTREPID_DEBUG 254 Intrepid::getValues_HGRAD_Args<Scalar, ArrayScalar>(outputValues,
270 for (
int i=0;i<inputPoints.dimension(0);i++) {
271 xInputPoints(i,0) = inputPoints(i,0);
272 yInputPoints(i,0) = inputPoints(i,1);
273 zInputPoints(i,0) = inputPoints(i,2);
276 switch (operatorType) {
283 xBasis_.getValues(xBasisValues,xInputPoints,OPERATOR_VALUE);
284 yBasis_.
getValues(yBasisValues,yInputPoints,OPERATOR_VALUE);
285 zBasis_.
getValues(zBasisValues,zInputPoints,OPERATOR_VALUE);
290 for (
int i=0;i<xBasis_.getCardinality();i++) {
291 for (
int l=0;l<inputPoints.dimension(0);l++) {
292 outputValues(bfcur,l) = xBasisValues(i,l) * yBasisValues(j,l) * zBasisValues(k,l);
310 xBasis_.getValues(xBasisValues,xInputPoints,OPERATOR_VALUE);
311 yBasis_.
getValues(yBasisValues,yInputPoints,OPERATOR_VALUE);
312 zBasis_.
getValues(zBasisValues,zInputPoints,OPERATOR_VALUE);
313 xBasis_.getValues(xBasisDerivs,xInputPoints,OPERATOR_D1);
314 yBasis_.
getValues(yBasisDerivs,yInputPoints,OPERATOR_D1);
315 zBasis_.
getValues(zBasisDerivs,zInputPoints,OPERATOR_D1);
320 for (
int i=0;i<xBasis_.getCardinality();i++) {
321 for (
int l=0;l<inputPoints.dimension(0);l++) {
322 outputValues(bfcur,l,0) = xBasisDerivs(i,l,0) * yBasisValues(j,l) * zBasisValues(k,l);
323 outputValues(bfcur,l,1) = xBasisValues(i,l) * yBasisDerivs(j,l,0) * zBasisValues(k,l);
324 outputValues(bfcur,l,2) = xBasisValues(i,l) * yBasisValues(j,l) * zBasisDerivs(k,l,0);
346 Teuchos::Array<int> partialMult;
350 if (partialMult[0] == 0) {
351 xBasisValues.resize(xBasis_.getCardinality(),xInputPoints.dimension(0));
352 xBasis_.getValues( xBasisValues , xInputPoints, OPERATOR_VALUE );
355 xBasisValues.resize(xBasis_.getCardinality(),xInputPoints.dimension(0),1);
357 xBasis_.getValues( xBasisValues , xInputPoints, xop );
358 xBasisValues.resize(xBasis_.getCardinality(),xInputPoints.dimension(0));
360 if (partialMult[1] == 0) {
361 yBasisValues.resize(yBasis_.
getCardinality(),yInputPoints.dimension(0));
362 yBasis_.
getValues( yBasisValues , yInputPoints, OPERATOR_VALUE );
365 yBasisValues.resize(yBasis_.
getCardinality(),yInputPoints.dimension(0),1);
367 yBasis_.
getValues( yBasisValues , yInputPoints, yop );
368 yBasisValues.resize(yBasis_.
getCardinality(),yInputPoints.dimension(0));
370 if (partialMult[2] == 0) {
371 zBasisValues.resize(zBasis_.
getCardinality(),zInputPoints.dimension(0));
372 zBasis_.
getValues( zBasisValues , zInputPoints, OPERATOR_VALUE );
375 zBasisValues.resize(zBasis_.
getCardinality(),zInputPoints.dimension(0),1);
377 zBasis_.
getValues( zBasisValues , zInputPoints, zop );
378 zBasisValues.resize(zBasis_.
getCardinality(),zInputPoints.dimension(0));
385 for (
int i=0;i<xBasis_.getCardinality();i++) {
386 for (
int l=0;l<inputPoints.dimension(0);l++) {
387 outputValues(bfcur,l,d) = xBasisValues(i,l) * yBasisValues(j,l) * zBasisValues(k,l);
397 TEUCHOS_TEST_FOR_EXCEPTION(
true , std::invalid_argument,
398 ">>> ERROR (Basis_HGRAD_HEX_Cn_FEM): Operator type not implemented");
403 template<
class Scalar,
class ArrayScalar>
405 const ArrayScalar & inputPoints,
406 const ArrayScalar & cellVertices,
408 TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::logic_error,
409 ">>> ERROR (Basis_HGRAD_HEX_Cn_FEM): FEM Basis calling an FVD member function");
412 template<
class Scalar,
class ArrayScalar>
422 dofCoords(cur,0) = ptsx_(i);
423 dofCoords(cur,1) = ptsy_(j);
424 dofCoords(cur,2) = ptsz_(k);
virtual void getValues(ArrayScalar &outputValues, const ArrayScalar &inputPoints, const EOperator operatorType) const =0
Evaluation of a FEM basis on a reference cell.
virtual int getCardinality() const
Returns cardinality of the basis.
Implementation of the locally H(grad)-compatible FEM basis of variable order on the [-1...
virtual void getDofCoords(ArrayScalar &DofCoords) const
implement the DofCoordsInterface interface
EBasis basisType_
Type of the basis.
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.
virtual const std::vector< std::vector< int > > & getAllDofTags()
Retrieves all DoF tags.
bool basisTagsAreSet_
"true" if tagToOrdinal_ and ordinalToTag_ have been initialized
EOperator
Enumeration of primitive operators available in Intrepid. Primitive operators act on reconstructed fu...
ECoordinates basisCoordinates_
The coordinate system for which the basis is defined.
An abstract base class that defines interface for concrete basis implementations for Finite Element (...
void initializeTags()
Initializes tagToOrdinal_ and ordinalToTag_ lookup arrays.
shards::CellTopology basisCellTopology_
Base topology of the cells for which the basis is defined. See the Shards package http://trilinos...
void getValues(ArrayScalar &outputValues, const ArrayScalar &inputPoints, const EOperator operatorType) const
Evaluation of a FEM basis on a reference Hexahedron cell.
int getDkCardinality(const EOperator operatorType, const int spaceDim)
Returns cardinality of Dk, i.e., the number of all derivatives of order k.
Basis_HGRAD_HEX_Cn_FEM(const int orderx, const int ordery, const int orderz, const ArrayScalar &pts_x, const ArrayScalar &pts_y, const ArrayScalar &pts_z)
Constructor.
EPointType
Enumeration of types of point distributions in Intrepid.
static void lineProduct3d(const int dim0, const int entity0, const int dim1, const int entity1, const int dim2, const int entity2, int &resultdim, int &resultentity)
virtual const shards::CellTopology getBaseCellTopology() const
Returns the base cell topology for which the basis is defined. See Shards documentation http://trilin...
void getDkMultiplicities(Teuchos::Array< int > &partialMult, const int derivativeEnum, const EOperator operatorType, const int spaceDim)
Returns multiplicities of dx, dy, and dz based on the enumeration of the partial derivative, its order and the space dimension. Inverse of the getDkEnumeration() method.
int basisDegree_
Degree of the largest complete polynomial space that can be represented by the basis.
std::vector< std::vector< std::vector< int > > > tagToOrdinal_
DoF tag to ordinal lookup table.
int basisCardinality_
Cardinality of the basis, i.e., the number of basis functions/degrees-of-freedom. ...
std::vector< std::vector< int > > ordinalToTag_
DoF ordinal to tag lookup table.