Intrepid
Intrepid_HCURL_WEDGE_I1_FEMDef.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ************************************************************************
3 //
4 // Intrepid Package
5 // Copyright (2007) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Pavel Bochev (pbboche@sandia.gov)
38 // Denis Ridzal (dridzal@sandia.gov), or
39 // Kara Peterson (kjpeter@sandia.gov)
40 //
41 // ************************************************************************
42 // @HEADER
43 
49 namespace Intrepid {
50 
51 template<class Scalar, class ArrayScalar>
53  {
54  this -> basisCardinality_ = 9;
55  this -> basisDegree_ = 1;
56  this -> basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Wedge<6> >() );
57  this -> basisType_ = BASIS_FEM_DEFAULT;
58  this -> basisCoordinates_ = COORDINATES_CARTESIAN;
59  this -> basisTagsAreSet_ = false;
60  }
61 
62 template<class Scalar, class ArrayScalar>
64 
65  // Basis-dependent intializations
66  int tagSize = 4; // size of DoF tag
67  int posScDim = 0; // position in the tag, counting from 0, of the subcell dim
68  int posScOrd = 1; // position in the tag, counting from 0, of the subcell ordinal
69  int posDfOrd = 2; // position in the tag, counting from 0, of DoF ordinal relative to the subcell
70 
71  // An array with local DoF tags assigned to basis functions, in the order of their local enumeration
72  int tags[] = {
73  1, 0, 0, 1,
74  1, 1, 0, 1,
75  1, 2, 0, 1,
76  1, 3, 0, 1,
77  1, 4, 0, 1,
78  1, 5, 0, 1,
79  1, 6, 0, 1,
80  1, 7, 0, 1,
81  1, 8, 0, 1 };
82 
83  // Basis-independent function sets tag and enum data in tagToOrdinal_ and ordinalToTag_ arrays:
84  Intrepid::setOrdinalTagData(this -> tagToOrdinal_,
85  this -> ordinalToTag_,
86  tags,
87  this -> basisCardinality_,
88  tagSize,
89  posScDim,
90  posScOrd,
91  posDfOrd);
92 }
93 
94 
95 
96 template<class Scalar, class ArrayScalar>
98  const ArrayScalar & inputPoints,
99  const EOperator operatorType) const {
100 
101 // Verify arguments
102 #ifdef HAVE_INTREPID_DEBUG
103  Intrepid::getValues_HCURL_Args<Scalar, ArrayScalar>(outputValues,
104  inputPoints,
105  operatorType,
106  this -> getBaseCellTopology(),
107  this -> getCardinality() );
108 #endif
109 
110  // Number of evaluation points = dim 0 of inputPoints
111  int dim0 = inputPoints.dimension(0);
112 
113  // Temporaries: (x,y,z) coordinates of the evaluation point
114  Scalar x = 0.0;
115  Scalar y = 0.0;
116  Scalar z = 0.0;
117 
118  switch (operatorType) {
119  case OPERATOR_VALUE:
120  for (int i0 = 0; i0 < dim0; i0++) {
121  x = inputPoints(i0, 0);
122  y = inputPoints(i0, 1);
123  z = inputPoints(i0, 2);
124 
125  // outputValues is a rank-3 array with dimensions (basisCardinality_, dim0, spaceDim)
126  outputValues(0, i0, 0) = (1.0 - z)*(1.0 - y)/2.0;
127  outputValues(0, i0, 1) = x*(1.0 - z)/2.0;
128  outputValues(0, i0, 2) = 0.0;
129 
130  outputValues(1, i0, 0) = y*(z - 1.0)/2.0;
131  outputValues(1, i0, 1) = x*(1.0 - z)/2.0;
132  outputValues(1, i0, 2) = 0.0;
133 
134  outputValues(2, i0, 0) = y*(z - 1.0)/2.0;
135  outputValues(2, i0, 1) = (1.0 - x)*(z - 1.0)/2.0;
136  outputValues(2, i0, 2) = 0.0;
137 
138  outputValues(3, i0, 0) = (1.0 - y)*(1.0 + z)/2.0;
139  outputValues(3, i0, 1) = x*(1.0 + z)/2.0;
140  outputValues(3, i0, 2) = 0.0;
141 
142  outputValues(4, i0, 0) =-y*(1.0 + z)/2.0;
143  outputValues(4, i0, 1) = x*(1.0 + z)/2.0;
144  outputValues(4, i0, 2) = 0.0;
145 
146  outputValues(5, i0, 0) = -y*(1.0 + z)/2.0;
147  outputValues(5, i0, 1) = (x - 1.0)*(1.0 + z)/2.0;
148  outputValues(5, i0, 2) = 0.0;
149 
150  outputValues(6, i0, 0) = 0.0;
151  outputValues(6, i0, 1) = 0.0;
152  outputValues(6, i0, 2) = (1.0 - x - y)/2.0;
153 
154  outputValues(7, i0, 0) = 0.0;
155  outputValues(7, i0, 1) = 0.0;
156  outputValues(7, i0, 2) = x/2.0;
157 
158  outputValues(8, i0, 0) = 0.0;
159  outputValues(8, i0, 1) = 0.0;
160  outputValues(8, i0, 2) = y/2.0;
161 
162  }
163  break;
164 
165  case OPERATOR_CURL:
166  for (int i0 = 0; i0 < dim0; i0++) {
167  x = inputPoints(i0, 0);
168  y = inputPoints(i0, 1);
169  z = inputPoints(i0, 2);
170 
171  // outputValues is a rank-3 array with dimensions (basisCardinality_, dim0, spaceDim)
172  outputValues(0, i0, 0) = x/2.0;
173  outputValues(0, i0, 1) = (y - 1.0)/2.0;
174  outputValues(0, i0, 2) = 1.0 - z;
175 
176  outputValues(1, i0, 0) = x/2.0;
177  outputValues(1, i0, 1) = y/2.0;
178  outputValues(1, i0, 2) = 1.0 - z;
179 
180  outputValues(2, i0, 0) = (x - 1.0)/2.0;
181  outputValues(2, i0, 1) = y/2.0;
182  outputValues(2, i0, 2) = 1.0 - z;
183 
184  outputValues(3, i0, 0) = -x/2.0;
185  outputValues(3, i0, 1) = (1.0 - y)/2.0;
186  outputValues(3, i0, 2) = 1.0 + z;
187 
188  outputValues(4, i0, 0) = -x/2.0;
189  outputValues(4, i0, 1) = -y/2.0;
190  outputValues(4, i0, 2) = 1.0 + z;
191 
192  outputValues(5, i0, 0) = (1.0 - x)/2.0;
193  outputValues(5, i0, 1) = -y/2.0;
194  outputValues(5, i0, 2) = 1.0 + z;
195 
196  outputValues(6, i0, 0) =-0.5;
197  outputValues(6, i0, 1) = 0.5;
198  outputValues(6, i0, 2) = 0.0;
199 
200  outputValues(7, i0, 0) = 0.0;
201  outputValues(7, i0, 1) =-0.5;
202  outputValues(7, i0, 2) = 0.0;
203 
204  outputValues(8, i0, 0) = 0.5;
205  outputValues(8, i0, 1) = 0.0;
206  outputValues(8, i0, 2) = 0.0;
207  }
208  break;
209 
210  case OPERATOR_DIV:
211  TEUCHOS_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_DIV), std::invalid_argument,
212  ">>> ERROR (Basis_HCURL_WEDGE_I1_FEM): DIV is invalid operator for HCURL Basis Functions");
213  break;
214 
215  case OPERATOR_GRAD:
216  TEUCHOS_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_GRAD), std::invalid_argument,
217  ">>> ERROR (Basis_HCURL_WEDGE_I1_FEM): GRAD is invalid operator for HCURL Basis Functions");
218  break;
219 
220  case OPERATOR_D1:
221  case OPERATOR_D2:
222  case OPERATOR_D3:
223  case OPERATOR_D4:
224  case OPERATOR_D5:
225  case OPERATOR_D6:
226  case OPERATOR_D7:
227  case OPERATOR_D8:
228  case OPERATOR_D9:
229  case OPERATOR_D10:
230  TEUCHOS_TEST_FOR_EXCEPTION( ( (operatorType == OPERATOR_D1) ||
231  (operatorType == OPERATOR_D2) ||
232  (operatorType == OPERATOR_D3) ||
233  (operatorType == OPERATOR_D4) ||
234  (operatorType == OPERATOR_D5) ||
235  (operatorType == OPERATOR_D6) ||
236  (operatorType == OPERATOR_D7) ||
237  (operatorType == OPERATOR_D8) ||
238  (operatorType == OPERATOR_D9) ||
239  (operatorType == OPERATOR_D10) ),
240  std::invalid_argument,
241  ">>> ERROR (Basis_HCURL_WEDGE_I1_FEM): Invalid operator type");
242  break;
243 
244  default:
245  TEUCHOS_TEST_FOR_EXCEPTION( ( (operatorType != OPERATOR_VALUE) &&
246  (operatorType != OPERATOR_GRAD) &&
247  (operatorType != OPERATOR_CURL) &&
248  (operatorType != OPERATOR_DIV) &&
249  (operatorType != OPERATOR_D1) &&
250  (operatorType != OPERATOR_D2) &&
251  (operatorType != OPERATOR_D3) &&
252  (operatorType != OPERATOR_D4) &&
253  (operatorType != OPERATOR_D5) &&
254  (operatorType != OPERATOR_D6) &&
255  (operatorType != OPERATOR_D7) &&
256  (operatorType != OPERATOR_D8) &&
257  (operatorType != OPERATOR_D9) &&
258  (operatorType != OPERATOR_D10) ),
259  std::invalid_argument,
260  ">>> ERROR (Basis_HCURL_WEDGE_I1_FEM): Invalid operator type");
261  }
262 }
263 
264 
265 
266 template<class Scalar, class ArrayScalar>
268  const ArrayScalar & inputPoints,
269  const ArrayScalar & cellVertices,
270  const EOperator operatorType) const {
271  TEUCHOS_TEST_FOR_EXCEPTION( (true), std::logic_error,
272  ">>> ERROR (Basis_HCURL_WEDGE_I1_FEM): FEM Basis calling an FVD member function");
273  }
274 
275 }// namespace Intrepid
276 
277 #if defined(Intrepid_SHOW_DEPRECATED_WARNINGS)
278 #ifdef __GNUC__
279 #warning "The Intrepid package is deprecated"
280 #endif
281 #endif
282 
void getValues(ArrayScalar &outputValues, const ArrayScalar &inputPoints, const EOperator operatorType) const
Evaluation of a FEM basis on a reference Wedge cell.
void initializeTags()
Initializes tagToOrdinal_ and ordinalToTag_ lookup arrays.