1 #ifndef INTREPID_HGRAD_QUAD_C1_FEMDEF_HPP 2 #define INTREPID_HGRAD_QUAD_C1_FEMDEF_HPP 53 template<
class Scalar,
class ArrayScalar>
56 this -> basisCardinality_ = 4;
57 this -> basisDegree_ = 1;
58 this -> basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Quadrilateral<4> >() );
59 this -> basisType_ = BASIS_FEM_DEFAULT;
60 this -> basisCoordinates_ = COORDINATES_CARTESIAN;
61 this -> basisTagsAreSet_ =
false;
65 template<
class Scalar,
class ArrayScalar>
75 int tags[] = { 0, 0, 0, 1,
82 this -> ordinalToTag_,
84 this -> basisCardinality_,
93 template<
class Scalar,
class ArrayScalar>
95 const ArrayScalar & inputPoints,
99 #ifdef HAVE_INTREPID_DEBUG 100 Intrepid::getValues_HGRAD_Args<Scalar, ArrayScalar>(outputValues,
103 this -> getBaseCellTopology(),
104 this -> getCardinality() );
108 int dim0 = inputPoints.dimension(0);
114 switch (operatorType) {
117 for (
int i0 = 0; i0 < dim0; i0++) {
118 x = inputPoints(i0, 0);
119 y = inputPoints(i0, 1);
122 outputValues(0, i0) = (1.0 - x)*(1.0 - y)/4.0;
123 outputValues(1, i0) = (1.0 + x)*(1.0 - y)/4.0;
124 outputValues(2, i0) = (1.0 + x)*(1.0 + y)/4.0;
125 outputValues(3, i0) = (1.0 - x)*(1.0 + y)/4.0;
131 for (
int i0 = 0; i0 < dim0; i0++) {
132 x = inputPoints(i0,0);
133 y = inputPoints(i0,1);
136 outputValues(0, i0, 0) = -(1.0 - y)/4.0;
137 outputValues(0, i0, 1) = -(1.0 - x)/4.0;
139 outputValues(1, i0, 0) = (1.0 - y)/4.0;
140 outputValues(1, i0, 1) = -(1.0 + x)/4.0;
142 outputValues(2, i0, 0) = (1.0 + y)/4.0;
143 outputValues(2, i0, 1) = (1.0 + x)/4.0;
145 outputValues(3, i0, 0) = -(1.0 + y)/4.0;
146 outputValues(3, i0, 1) = (1.0 - x)/4.0;
151 for (
int i0 = 0; i0 < dim0; i0++) {
152 x = inputPoints(i0,0);
153 y = inputPoints(i0,1);
156 outputValues(0, i0, 0) = -(1.0 - x)/4.0;
157 outputValues(0, i0, 1) = (1.0 - y)/4.0;
159 outputValues(1, i0, 0) = -(1.0 + x)/4.0;
160 outputValues(1, i0, 1) = -(1.0 - y)/4.0;
162 outputValues(2, i0, 0) = (1.0 + x)/4.0;
163 outputValues(2, i0, 1) = -(1.0 + y)/4.0;
165 outputValues(3, i0, 0) = (1.0 - x)/4.0;
166 outputValues(3, i0, 1) = (1.0 + y)/4.0;
171 TEUCHOS_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_DIV), std::invalid_argument,
172 ">>> ERROR (Basis_HGRAD_QUAD_C1_FEM): DIV is invalid operator for rank-0 (scalar) functions in 2D");
176 for (
int i0 = 0; i0 < dim0; i0++) {
179 outputValues(0, i0, 0) = 0.0;
180 outputValues(0, i0, 1) = 0.25;
181 outputValues(0, i0, 2) = 0.0;
183 outputValues(1, i0, 0) = 0.0;
184 outputValues(1, i0, 1) = -0.25;
185 outputValues(1, i0, 2) = 0.0;
187 outputValues(2, i0, 0) = 0.0;
188 outputValues(2, i0, 1) = 0.25;
189 outputValues(2, i0, 2) = 0.0;
191 outputValues(3, i0, 0) = 0.0;
192 outputValues(3, i0, 1) = -0.25;
193 outputValues(3, i0, 2) = 0.0;
208 this -> basisCellTopology_.getDimension() );
209 for(
int dofOrd = 0; dofOrd <
this -> basisCardinality_; dofOrd++) {
210 for (
int i0 = 0; i0 < dim0; i0++) {
211 for(
int dkOrd = 0; dkOrd < DkCardinality; dkOrd++){
212 outputValues(dofOrd, i0, dkOrd) = 0.0;
221 ">>> ERROR (Basis_HGRAD_QUAD_C1_FEM): Invalid operator type");
227 template<
class Scalar,
class ArrayScalar>
229 const ArrayScalar & inputPoints,
230 const ArrayScalar & cellVertices,
232 TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::logic_error,
233 ">>> ERROR (Basis_HGRAD_QUAD_C1_FEM): FEM Basis calling an FVD member function");
238 template<
class Scalar,
class ArrayScalar>
240 #ifdef HAVE_INTREPID_DEBUG 242 TEUCHOS_TEST_FOR_EXCEPTION( !(DofCoords.rank() == 2), std::invalid_argument,
243 ">>> ERROR: (Intrepid::Basis_HGRAD_QUAD_C1_FEM::getDofCoords) rank = 2 required for DofCoords array");
245 TEUCHOS_TEST_FOR_EXCEPTION( !( DofCoords.dimension(0) ==
this -> basisCardinality_ ), std::invalid_argument,
246 ">>> ERROR: (Intrepid::Basis_HGRAD_QUAD_C1_FEM::getDofCoords) mismatch in number of DoF and 0th dimension of DofCoords array");
248 TEUCHOS_TEST_FOR_EXCEPTION( !( DofCoords.dimension(1) == (int)(
this -> basisCellTopology_.getDimension()) ), std::invalid_argument,
249 ">>> ERROR: (Intrepid::Basis_HGRAD_QUAD_C1_FEM::getDofCoords) incorrect reference cell (1st) dimension in DofCoords array");
252 DofCoords(0,0) = -1.0; DofCoords(0,1) = -1.0;
253 DofCoords(1,0) = 1.0; DofCoords(1,1) = -1.0;
254 DofCoords(2,0) = 1.0; DofCoords(2,1) = 1.0;
255 DofCoords(3,0) = -1.0; DofCoords(3,1) = 1.0;
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...
int getDkCardinality(const EOperator operatorType, const int spaceDim)
Returns cardinality of Dk, i.e., the number of all derivatives of order k.
void getDofCoords(ArrayScalar &DofCoords) const
Returns spatial locations (coordinates) of degrees of freedom on a reference Quadrilateral.
int isValidOperator(const EOperator operatorType)
Verifies validity of an operator enum.
void getValues(ArrayScalar &outputValues, const ArrayScalar &inputPoints, const EOperator operatorType) const
FEM basis evaluation on a reference Quadrilateral cell.
void initializeTags()
Initializes tagToOrdinal_ and ordinalToTag_ lookup arrays.
Basis_HGRAD_QUAD_C1_FEM()
Constructor.