Intrepid
Intrepid_HDIV_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_ = 5;
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  2, 0, 0, 1,
74  2, 1, 0, 1,
75  2, 2, 0, 1,
76  2, 3, 0, 1,
77  2, 4, 0, 1
78  };
79 
80  // Basis-independent function sets tag and enum data in tagToOrdinal_ and ordinalToTag_ arrays:
81  Intrepid::setOrdinalTagData(this -> tagToOrdinal_,
82  this -> ordinalToTag_,
83  tags,
84  this -> basisCardinality_,
85  tagSize,
86  posScDim,
87  posScOrd,
88  posDfOrd);
89 }
90 
91 
92 
93 template<class Scalar, class ArrayScalar>
95  const ArrayScalar & inputPoints,
96  const EOperator operatorType) const {
97 
98 // Verify arguments
99 #ifdef HAVE_INTREPID_DEBUG
100  Intrepid::getValues_HDIV_Args<Scalar, ArrayScalar>(outputValues,
101  inputPoints,
102  operatorType,
103  this -> getBaseCellTopology(),
104  this -> getCardinality() );
105 #endif
106 
107  // Number of evaluation points = dim 0 of inputPoints
108  int dim0 = inputPoints.dimension(0);
109 
110  // Temporaries: (x,y,z) coordinates of the evaluation point
111  Scalar x = 0.0;
112  Scalar y = 0.0;
113  Scalar z = 0.0;
114 
115  switch (operatorType) {
116  case OPERATOR_VALUE:
117  for (int i0 = 0; i0 < dim0; i0++) {
118  x = inputPoints(i0, 0);
119  y = inputPoints(i0, 1);
120  z = inputPoints(i0, 2);
121 
122  // outputValues is a rank-3 array with dimensions (basisCardinality_, dim0, spaceDim)
123  outputValues(0, i0, 0) = x/2.0;
124  outputValues(0, i0, 1) = (y - 1.0)/2.0;
125  outputValues(0, i0, 2) = 0.0;
126 
127  outputValues(1, i0, 0) = x/2.0;
128  outputValues(1, i0, 1) = y/2.0;
129  outputValues(1, i0, 2) = 0.0;
130 
131  outputValues(2, i0, 0) = (x - 1.0)/2.0;
132  outputValues(2, i0, 1) = y/2.0;
133  outputValues(2, i0, 2) = 0.0;
134 
135  outputValues(3, i0, 0) = 0.0;
136  outputValues(3, i0, 1) = 0.0;
137  outputValues(3, i0, 2) = z - 1.0;
138 
139  outputValues(4, i0, 0) = 0.0;
140  outputValues(4, i0, 1) = 0.0;
141  outputValues(4, i0, 2) = 1.0 + z;
142  }
143  break;
144 
145  case OPERATOR_DIV:
146  // outputValues is a rank-2 array with dimensions (basisCardinality_, dim0)
147  for (int i0 = 0; i0 < dim0; i0++) {
148  outputValues(0, i0) = 1.0;
149  outputValues(1, i0) = 1.0;
150  outputValues(2, i0) = 1.0;
151  outputValues(3, i0) = 1.0;
152  outputValues(4, i0) = 1.0;
153  }
154  break;
155 
156  case OPERATOR_CURL:
157  TEUCHOS_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_CURL), std::invalid_argument,
158  ">>> ERROR (Basis_HDIV_WEDGE_I1_FEM): CURL is invalid operator for HDIV Basis Functions");
159  break;
160 
161  case OPERATOR_GRAD:
162  TEUCHOS_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_GRAD), std::invalid_argument,
163  ">>> ERROR (Basis_HDIV_WEDGE_I1_FEM): GRAD is invalid operator for HDIV Basis Functions");
164  break;
165 
166  case OPERATOR_D1:
167  case OPERATOR_D2:
168  case OPERATOR_D3:
169  case OPERATOR_D4:
170  case OPERATOR_D5:
171  case OPERATOR_D6:
172  case OPERATOR_D7:
173  case OPERATOR_D8:
174  case OPERATOR_D9:
175  case OPERATOR_D10:
176  TEUCHOS_TEST_FOR_EXCEPTION( ( (operatorType == OPERATOR_D1) ||
177  (operatorType == OPERATOR_D2) ||
178  (operatorType == OPERATOR_D3) ||
179  (operatorType == OPERATOR_D4) ||
180  (operatorType == OPERATOR_D5) ||
181  (operatorType == OPERATOR_D6) ||
182  (operatorType == OPERATOR_D7) ||
183  (operatorType == OPERATOR_D8) ||
184  (operatorType == OPERATOR_D9) ||
185  (operatorType == OPERATOR_D10) ),
186  std::invalid_argument,
187  ">>> ERROR (Basis_HDIV_WEDGE_I1_FEM): Invalid operator type");
188  break;
189 
190  default:
191  TEUCHOS_TEST_FOR_EXCEPTION( ( (operatorType != OPERATOR_VALUE) &&
192  (operatorType != OPERATOR_GRAD) &&
193  (operatorType != OPERATOR_CURL) &&
194  (operatorType != OPERATOR_DIV) &&
195  (operatorType != OPERATOR_D1) &&
196  (operatorType != OPERATOR_D2) &&
197  (operatorType != OPERATOR_D3) &&
198  (operatorType != OPERATOR_D4) &&
199  (operatorType != OPERATOR_D5) &&
200  (operatorType != OPERATOR_D6) &&
201  (operatorType != OPERATOR_D7) &&
202  (operatorType != OPERATOR_D8) &&
203  (operatorType != OPERATOR_D9) &&
204  (operatorType != OPERATOR_D10) ),
205  std::invalid_argument,
206  ">>> ERROR (Basis_HDIV_WEDGE_I1_FEM): Invalid operator type");
207  }
208 }
209 
210 
211 
212 template<class Scalar, class ArrayScalar>
214  const ArrayScalar & inputPoints,
215  const ArrayScalar & cellVertices,
216  const EOperator operatorType) const {
217  TEUCHOS_TEST_FOR_EXCEPTION( (true), std::logic_error,
218  ">>> ERROR (Basis_HDIV_WEDGE_I1_FEM): FEM Basis calling an FVD member function");
219  }
220 
221 }// namespace Intrepid
222 
223 #if defined(Intrepid_SHOW_DEPRECATED_WARNINGS)
224 #ifdef __GNUC__
225 #warning "The Intrepid package is deprecated"
226 #endif
227 #endif
228 
void initializeTags()
Initializes tagToOrdinal_ and ordinalToTag_ lookup arrays.
void getValues(ArrayScalar &outputValues, const ArrayScalar &inputPoints, const EOperator operatorType) const
Evaluation of a FEM basis on a reference Wedge cell.