1 #ifndef INTREPID_HGRAD_HEX_C1_FEMDEF_HPP
2 #define INTREPID_HGRAD_HEX_C1_FEMDEF_HPP
54 template<
class Scalar,
class ArrayScalar>
57 this -> basisCardinality_ = 8;
58 this -> basisDegree_ = 1;
59 this -> basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Hexahedron<8> >() );
60 this -> basisType_ = BASIS_FEM_DEFAULT;
61 this -> basisCoordinates_ = COORDINATES_CARTESIAN;
62 this -> basisTagsAreSet_ =
false;
67 template<
class Scalar,
class ArrayScalar>
77 int tags[] = { 0, 0, 0, 1,
87 Intrepid::setOrdinalTagData(
this -> tagToOrdinal_,
88 this -> ordinalToTag_,
90 this -> basisCardinality_,
99 template<
class Scalar,
class ArrayScalar>
101 const ArrayScalar & inputPoints,
102 const EOperator operatorType)
const {
105 #ifdef HAVE_INTREPID_DEBUG
106 Intrepid::getValues_HGRAD_Args<Scalar, ArrayScalar>(outputValues,
109 this -> getBaseCellTopology(),
110 this -> getCardinality() );
114 int dim0 = inputPoints.dimension(0);
121 switch (operatorType) {
124 for (
int i0 = 0; i0 < dim0; i0++) {
125 x = inputPoints(i0, 0);
126 y = inputPoints(i0, 1);
127 z = inputPoints(i0, 2);
130 outputValues(0, i0) = (1.0 - x)*(1.0 - y)*(1.0 - z)/8.0;
131 outputValues(1, i0) = (1.0 + x)*(1.0 - y)*(1.0 - z)/8.0;
132 outputValues(2, i0) = (1.0 + x)*(1.0 + y)*(1.0 - z)/8.0;
133 outputValues(3, i0) = (1.0 - x)*(1.0 + y)*(1.0 - z)/8.0;
135 outputValues(4, i0) = (1.0 - x)*(1.0 - y)*(1.0 + z)/8.0;
136 outputValues(5, i0) = (1.0 + x)*(1.0 - y)*(1.0 + z)/8.0;
137 outputValues(6, i0) = (1.0 + x)*(1.0 + y)*(1.0 + z)/8.0;
138 outputValues(7, i0) = (1.0 - x)*(1.0 + y)*(1.0 + z)/8.0;
144 for (
int i0 = 0; i0 < dim0; i0++) {
145 x = inputPoints(i0,0);
146 y = inputPoints(i0,1);
147 z = inputPoints(i0,2);
150 outputValues(0, i0, 0) = -(1.0 - y)*(1.0 - z)/8.0;
151 outputValues(0, i0, 1) = -(1.0 - x)*(1.0 - z)/8.0;
152 outputValues(0, i0, 2) = -(1.0 - x)*(1.0 - y)/8.0;
154 outputValues(1, i0, 0) = (1.0 - y)*(1.0 - z)/8.0;
155 outputValues(1, i0, 1) = -(1.0 + x)*(1.0 - z)/8.0;
156 outputValues(1, i0, 2) = -(1.0 + x)*(1.0 - y)/8.0;
158 outputValues(2, i0, 0) = (1.0 + y)*(1.0 - z)/8.0;
159 outputValues(2, i0, 1) = (1.0 + x)*(1.0 - z)/8.0;
160 outputValues(2, i0, 2) = -(1.0 + x)*(1.0 + y)/8.0;
162 outputValues(3, i0, 0) = -(1.0 + y)*(1.0 - z)/8.0;
163 outputValues(3, i0, 1) = (1.0 - x)*(1.0 - z)/8.0;
164 outputValues(3, i0, 2) = -(1.0 - x)*(1.0 + y)/8.0;
166 outputValues(4, i0, 0) = -(1.0 - y)*(1.0 + z)/8.0;
167 outputValues(4, i0, 1) = -(1.0 - x)*(1.0 + z)/8.0;
168 outputValues(4, i0, 2) = (1.0 - x)*(1.0 - y)/8.0;
170 outputValues(5, i0, 0) = (1.0 - y)*(1.0 + z)/8.0;
171 outputValues(5, i0, 1) = -(1.0 + x)*(1.0 + z)/8.0;
172 outputValues(5, i0, 2) = (1.0 + x)*(1.0 - y)/8.0;
174 outputValues(6, i0, 0) = (1.0 + y)*(1.0 + z)/8.0;
175 outputValues(6, i0, 1) = (1.0 + x)*(1.0 + z)/8.0;
176 outputValues(6, i0, 2) = (1.0 + x)*(1.0 + y)/8.0;
178 outputValues(7, i0, 0) = -(1.0 + y)*(1.0 + z)/8.0;
179 outputValues(7, i0, 1) = (1.0 - x)*(1.0 + z)/8.0;
180 outputValues(7, i0, 2) = (1.0 - x)*(1.0 + y)/8.0;
185 TEUCHOS_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_CURL), std::invalid_argument,
186 ">>> ERROR (Basis_HGRAD_HEX_C1_FEM): CURL is invalid operator for rank-0 (scalar) functions in 3D");
190 TEUCHOS_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_DIV), std::invalid_argument,
191 ">>> ERROR (Basis_HGRAD_HEX_C1_FEM): DIV is invalid operator for rank-0 (scalar) functions in 3D");
195 for (
int i0 = 0; i0 < dim0; i0++) {
196 x = inputPoints(i0,0);
197 y = inputPoints(i0,1);
198 z = inputPoints(i0,2);
201 outputValues(0, i0, 0) = 0.0;
202 outputValues(0, i0, 1) = (1.0 - z)/8.0;
203 outputValues(0, i0, 2) = (1.0 - y)/8.0;
204 outputValues(0, i0, 3) = 0.0;
205 outputValues(0, i0, 4) = (1.0 - x)/8.0;
206 outputValues(0, i0, 5) = 0.0;
208 outputValues(1, i0, 0) = 0.0;
209 outputValues(1, i0, 1) = -(1.0 - z)/8.0;
210 outputValues(1, i0, 2) = -(1.0 - y)/8.0;
211 outputValues(1, i0, 3) = 0.0;
212 outputValues(1, i0, 4) = (1.0 + x)/8.0;
213 outputValues(1, i0, 5) = 0.0;
215 outputValues(2, i0, 0) = 0.0;
216 outputValues(2, i0, 1) = (1.0 - z)/8.0;
217 outputValues(2, i0, 2) = -(1.0 + y)/8.0;
218 outputValues(2, i0, 3) = 0.0;
219 outputValues(2, i0, 4) = -(1.0 + x)/8.0;
220 outputValues(2, i0, 5) = 0.0;
222 outputValues(3, i0, 0) = 0.0;
223 outputValues(3, i0, 1) = -(1.0 - z)/8.0;
224 outputValues(3, i0, 2) = (1.0 + y)/8.0;
225 outputValues(3, i0, 3) = 0.0;
226 outputValues(3, i0, 4) = -(1.0 - x)/8.0;
227 outputValues(3, i0, 5) = 0.0;
230 outputValues(4, i0, 0) = 0.0;
231 outputValues(4, i0, 1) = (1.0 + z)/8.0;
232 outputValues(4, i0, 2) = -(1.0 - y)/8.0;
233 outputValues(4, i0, 3) = 0.0;
234 outputValues(4, i0, 4) = -(1.0 - x)/8.0;
235 outputValues(4, i0, 5) = 0.0;
237 outputValues(5, i0, 0) = 0.0;
238 outputValues(5, i0, 1) = -(1.0 + z)/8.0;
239 outputValues(5, i0, 2) = (1.0 - y)/8.0;
240 outputValues(5, i0, 3) = 0.0;
241 outputValues(5, i0, 4) = -(1.0 + x)/8.0;
242 outputValues(5, i0, 5) = 0.0;
244 outputValues(6, i0, 0) = 0.0;
245 outputValues(6, i0, 1) = (1.0 + z)/8.0;
246 outputValues(6, i0, 2) = (1.0 + y)/8.0;
247 outputValues(6, i0, 3) = 0.0;
248 outputValues(6, i0, 4) = (1.0 + x)/8.0;
249 outputValues(6, i0, 5) = 0.0;
251 outputValues(7, i0, 0) = 0.0;
252 outputValues(7, i0, 1) = -(1.0 + z)/8.0;
253 outputValues(7, i0, 2) = -(1.0 + y)/8.0;
254 outputValues(7, i0, 3) = 0.0;
255 outputValues(7, i0, 4) = (1.0 - x)/8.0;
256 outputValues(7, i0, 5) = 0.0;
270 int DkCardinality = Intrepid::getDkCardinality(operatorType,
271 this -> basisCellTopology_.getDimension() );
272 for(
int dofOrd = 0; dofOrd <
this -> basisCardinality_; dofOrd++) {
273 for (
int i0 = 0; i0 < dim0; i0++) {
274 for(
int dkOrd = 0; dkOrd < DkCardinality; dkOrd++){
275 outputValues(dofOrd, i0, dkOrd) = 0.0;
283 TEUCHOS_TEST_FOR_EXCEPTION( !( Intrepid::isValidOperator(operatorType) ), std::invalid_argument,
284 ">>> ERROR (Basis_HGRAD_HEX_C1_FEM): Invalid operator type");
290 template<
class Scalar,
class ArrayScalar>
292 const ArrayScalar & inputPoints,
293 const ArrayScalar & cellVertices,
294 const EOperator operatorType)
const {
295 TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::logic_error,
296 ">>> ERROR (Basis_HGRAD_HEX_C1_FEM): FEM Basis calling an FVD member function");
299 template<
class Scalar,
class ArrayScalar>
301 #ifdef HAVE_INTREPID_DEBUG
303 TEUCHOS_TEST_FOR_EXCEPTION( !(DofCoords.rank() == 2), std::invalid_argument,
304 ">>> ERROR: (Intrepid::Basis_HGRAD_HEX_C1_FEM::getDofCoords) rank = 2 required for DofCoords array");
306 TEUCHOS_TEST_FOR_EXCEPTION( !( DofCoords.dimension(0) ==
this -> basisCardinality_ ), std::invalid_argument,
307 ">>> ERROR: (Intrepid::Basis_HGRAD_HEX_C1_FEM::getDofCoords) mismatch in number of DoF and 0th dimension of DofCoords array");
309 TEUCHOS_TEST_FOR_EXCEPTION( !( DofCoords.dimension(1) == (int)(
this -> basisCellTopology_.getDimension()) ), std::invalid_argument,
310 ">>> ERROR: (Intrepid::Basis_HGRAD_HEX_C1_FEM::getDofCoords) incorrect reference cell (1st) dimension in DofCoords array");
313 DofCoords(0,0) = -1.0; DofCoords(0,1) = -1.0; DofCoords(0,2) = -1.0;
314 DofCoords(1,0) = 1.0; DofCoords(1,1) = -1.0; DofCoords(1,2) = -1.0;
315 DofCoords(2,0) = 1.0; DofCoords(2,1) = 1.0; DofCoords(2,2) = -1.0;
316 DofCoords(3,0) = -1.0; DofCoords(3,1) = 1.0; DofCoords(3,2) = -1.0;
317 DofCoords(4,0) = -1.0; DofCoords(4,1) = -1.0; DofCoords(4,2) = 1.0;
318 DofCoords(5,0) = 1.0; DofCoords(5,1) = -1.0; DofCoords(5,2) = 1.0;
319 DofCoords(6,0) = 1.0; DofCoords(6,1) = 1.0; DofCoords(6,2) = 1.0;
320 DofCoords(7,0) = -1.0; DofCoords(7,1) = 1.0; DofCoords(7,2) = 1.0;
Basis_HGRAD_HEX_C1_FEM()
Constructor.
void initializeTags()
Initializes tagToOrdinal_ and ordinalToTag_ lookup arrays.
void getDofCoords(ArrayScalar &DofCoords) const
Returns spatial locations (coordinates) of degrees of freedom on a reference Quadrilateral.
void getValues(ArrayScalar &outputValues, const ArrayScalar &inputPoints, const EOperator operatorType) const
Evaluation of a FEM basis on a reference Hexahedron cell.