|
Intrepid
|
00001 // @HEADER 00002 // ************************************************************************ 00003 // 00004 // Intrepid Package 00005 // Copyright (2007) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // Redistribution and use in source and binary forms, with or without 00011 // modification, are permitted provided that the following conditions are 00012 // met: 00013 // 00014 // 1. Redistributions of source code must retain the above copyright 00015 // notice, this list of conditions and the following disclaimer. 00016 // 00017 // 2. Redistributions in binary form must reproduce the above copyright 00018 // notice, this list of conditions and the following disclaimer in the 00019 // documentation and/or other materials provided with the distribution. 00020 // 00021 // 3. Neither the name of the Corporation nor the names of the 00022 // contributors may be used to endorse or promote products derived from 00023 // this software without specific prior written permission. 00024 // 00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 // 00037 // Questions? Contact Pavel Bochev (pbboche@sandia.gov) 00038 // Denis Ridzal (dridzal@sandia.gov), or 00039 // Kara Peterson (kjpeter@sandia.gov) 00040 // 00041 // ************************************************************************ 00042 // @HEADER 00043 00049 namespace Intrepid { 00050 00051 template<class Scalar, class ArrayScalar> 00052 Basis_HCURL_WEDGE_I1_FEM<Scalar,ArrayScalar>::Basis_HCURL_WEDGE_I1_FEM() 00053 { 00054 this -> basisCardinality_ = 9; 00055 this -> basisDegree_ = 1; 00056 this -> basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Wedge<6> >() ); 00057 this -> basisType_ = BASIS_FEM_DEFAULT; 00058 this -> basisCoordinates_ = COORDINATES_CARTESIAN; 00059 this -> basisTagsAreSet_ = false; 00060 } 00061 00062 template<class Scalar, class ArrayScalar> 00063 void Basis_HCURL_WEDGE_I1_FEM<Scalar, ArrayScalar>::initializeTags() { 00064 00065 // Basis-dependent intializations 00066 int tagSize = 4; // size of DoF tag 00067 int posScDim = 0; // position in the tag, counting from 0, of the subcell dim 00068 int posScOrd = 1; // position in the tag, counting from 0, of the subcell ordinal 00069 int posDfOrd = 2; // position in the tag, counting from 0, of DoF ordinal relative to the subcell 00070 00071 // An array with local DoF tags assigned to basis functions, in the order of their local enumeration 00072 int tags[] = { 00073 1, 0, 0, 1, 00074 1, 1, 0, 1, 00075 1, 2, 0, 1, 00076 1, 3, 0, 1, 00077 1, 4, 0, 1, 00078 1, 5, 0, 1, 00079 1, 6, 0, 1, 00080 1, 7, 0, 1, 00081 1, 8, 0, 1 }; 00082 00083 // Basis-independent function sets tag and enum data in tagToOrdinal_ and ordinalToTag_ arrays: 00084 Intrepid::setOrdinalTagData(this -> tagToOrdinal_, 00085 this -> ordinalToTag_, 00086 tags, 00087 this -> basisCardinality_, 00088 tagSize, 00089 posScDim, 00090 posScOrd, 00091 posDfOrd); 00092 } 00093 00094 00095 00096 template<class Scalar, class ArrayScalar> 00097 void Basis_HCURL_WEDGE_I1_FEM<Scalar, ArrayScalar>::getValues(ArrayScalar & outputValues, 00098 const ArrayScalar & inputPoints, 00099 const EOperator operatorType) const { 00100 00101 // Verify arguments 00102 #ifdef HAVE_INTREPID_DEBUG 00103 Intrepid::getValues_HCURL_Args<Scalar, ArrayScalar>(outputValues, 00104 inputPoints, 00105 operatorType, 00106 this -> getBaseCellTopology(), 00107 this -> getCardinality() ); 00108 #endif 00109 00110 // Number of evaluation points = dim 0 of inputPoints 00111 int dim0 = inputPoints.dimension(0); 00112 00113 // Temporaries: (x,y,z) coordinates of the evaluation point 00114 Scalar x = 0.0; 00115 Scalar y = 0.0; 00116 Scalar z = 0.0; 00117 00118 switch (operatorType) { 00119 case OPERATOR_VALUE: 00120 for (int i0 = 0; i0 < dim0; i0++) { 00121 x = inputPoints(i0, 0); 00122 y = inputPoints(i0, 1); 00123 z = inputPoints(i0, 2); 00124 00125 // outputValues is a rank-3 array with dimensions (basisCardinality_, dim0, spaceDim) 00126 outputValues(0, i0, 0) = (1.0 - z)*(1.0 - y)/2.0; 00127 outputValues(0, i0, 1) = x*(1.0 - z)/2.0; 00128 outputValues(0, i0, 2) = 0.0; 00129 00130 outputValues(1, i0, 0) = y*(z - 1.0)/2.0; 00131 outputValues(1, i0, 1) = x*(1.0 - z)/2.0; 00132 outputValues(1, i0, 2) = 0.0; 00133 00134 outputValues(2, i0, 0) = y*(z - 1.0)/2.0; 00135 outputValues(2, i0, 1) = (1.0 - x)*(z - 1.0)/2.0; 00136 outputValues(2, i0, 2) = 0.0; 00137 00138 outputValues(3, i0, 0) = (1.0 - y)*(1.0 + z)/2.0; 00139 outputValues(3, i0, 1) = x*(1.0 + z)/2.0; 00140 outputValues(3, i0, 2) = 0.0; 00141 00142 outputValues(4, i0, 0) =-y*(1.0 + z)/2.0; 00143 outputValues(4, i0, 1) = x*(1.0 + z)/2.0; 00144 outputValues(4, i0, 2) = 0.0; 00145 00146 outputValues(5, i0, 0) = -y*(1.0 + z)/2.0; 00147 outputValues(5, i0, 1) = (x - 1.0)*(1.0 + z)/2.0; 00148 outputValues(5, i0, 2) = 0.0; 00149 00150 outputValues(6, i0, 0) = 0.0; 00151 outputValues(6, i0, 1) = 0.0; 00152 outputValues(6, i0, 2) = (1.0 - x - y)/2.0; 00153 00154 outputValues(7, i0, 0) = 0.0; 00155 outputValues(7, i0, 1) = 0.0; 00156 outputValues(7, i0, 2) = x/2.0; 00157 00158 outputValues(8, i0, 0) = 0.0; 00159 outputValues(8, i0, 1) = 0.0; 00160 outputValues(8, i0, 2) = y/2.0; 00161 00162 } 00163 break; 00164 00165 case OPERATOR_CURL: 00166 for (int i0 = 0; i0 < dim0; i0++) { 00167 x = inputPoints(i0, 0); 00168 y = inputPoints(i0, 1); 00169 z = inputPoints(i0, 2); 00170 00171 // outputValues is a rank-3 array with dimensions (basisCardinality_, dim0, spaceDim) 00172 outputValues(0, i0, 0) = x/2.0; 00173 outputValues(0, i0, 1) = (y - 1.0)/2.0; 00174 outputValues(0, i0, 2) = 1.0 - z; 00175 00176 outputValues(1, i0, 0) = x/2.0; 00177 outputValues(1, i0, 1) = y/2.0; 00178 outputValues(1, i0, 2) = 1.0 - z; 00179 00180 outputValues(2, i0, 0) = (x - 1.0)/2.0; 00181 outputValues(2, i0, 1) = y/2.0; 00182 outputValues(2, i0, 2) = 1.0 - z; 00183 00184 outputValues(3, i0, 0) = -x/2.0; 00185 outputValues(3, i0, 1) = (1.0 - y)/2.0; 00186 outputValues(3, i0, 2) = 1.0 + z; 00187 00188 outputValues(4, i0, 0) = -x/2.0; 00189 outputValues(4, i0, 1) = -y/2.0; 00190 outputValues(4, i0, 2) = 1.0 + z; 00191 00192 outputValues(5, i0, 0) = (1.0 - x)/2.0; 00193 outputValues(5, i0, 1) = -y/2.0; 00194 outputValues(5, i0, 2) = 1.0 + z; 00195 00196 outputValues(6, i0, 0) =-0.5; 00197 outputValues(6, i0, 1) = 0.5; 00198 outputValues(6, i0, 2) = 0.0; 00199 00200 outputValues(7, i0, 0) = 0.0; 00201 outputValues(7, i0, 1) =-0.5; 00202 outputValues(7, i0, 2) = 0.0; 00203 00204 outputValues(8, i0, 0) = 0.5; 00205 outputValues(8, i0, 1) = 0.0; 00206 outputValues(8, i0, 2) = 0.0; 00207 } 00208 break; 00209 00210 case OPERATOR_DIV: 00211 TEUCHOS_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_DIV), std::invalid_argument, 00212 ">>> ERROR (Basis_HCURL_WEDGE_I1_FEM): DIV is invalid operator for HCURL Basis Functions"); 00213 break; 00214 00215 case OPERATOR_GRAD: 00216 TEUCHOS_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_GRAD), std::invalid_argument, 00217 ">>> ERROR (Basis_HCURL_WEDGE_I1_FEM): GRAD is invalid operator for HCURL Basis Functions"); 00218 break; 00219 00220 case OPERATOR_D1: 00221 case OPERATOR_D2: 00222 case OPERATOR_D3: 00223 case OPERATOR_D4: 00224 case OPERATOR_D5: 00225 case OPERATOR_D6: 00226 case OPERATOR_D7: 00227 case OPERATOR_D8: 00228 case OPERATOR_D9: 00229 case OPERATOR_D10: 00230 TEUCHOS_TEST_FOR_EXCEPTION( ( (operatorType == OPERATOR_D1) || 00231 (operatorType == OPERATOR_D2) || 00232 (operatorType == OPERATOR_D3) || 00233 (operatorType == OPERATOR_D4) || 00234 (operatorType == OPERATOR_D5) || 00235 (operatorType == OPERATOR_D6) || 00236 (operatorType == OPERATOR_D7) || 00237 (operatorType == OPERATOR_D8) || 00238 (operatorType == OPERATOR_D9) || 00239 (operatorType == OPERATOR_D10) ), 00240 std::invalid_argument, 00241 ">>> ERROR (Basis_HCURL_WEDGE_I1_FEM): Invalid operator type"); 00242 break; 00243 00244 default: 00245 TEUCHOS_TEST_FOR_EXCEPTION( ( (operatorType != OPERATOR_VALUE) && 00246 (operatorType != OPERATOR_GRAD) && 00247 (operatorType != OPERATOR_CURL) && 00248 (operatorType != OPERATOR_DIV) && 00249 (operatorType != OPERATOR_D1) && 00250 (operatorType != OPERATOR_D2) && 00251 (operatorType != OPERATOR_D3) && 00252 (operatorType != OPERATOR_D4) && 00253 (operatorType != OPERATOR_D5) && 00254 (operatorType != OPERATOR_D6) && 00255 (operatorType != OPERATOR_D7) && 00256 (operatorType != OPERATOR_D8) && 00257 (operatorType != OPERATOR_D9) && 00258 (operatorType != OPERATOR_D10) ), 00259 std::invalid_argument, 00260 ">>> ERROR (Basis_HCURL_WEDGE_I1_FEM): Invalid operator type"); 00261 } 00262 } 00263 00264 00265 00266 template<class Scalar, class ArrayScalar> 00267 void Basis_HCURL_WEDGE_I1_FEM<Scalar, ArrayScalar>::getValues(ArrayScalar& outputValues, 00268 const ArrayScalar & inputPoints, 00269 const ArrayScalar & cellVertices, 00270 const EOperator operatorType) const { 00271 TEUCHOS_TEST_FOR_EXCEPTION( (true), std::logic_error, 00272 ">>> ERROR (Basis_HCURL_WEDGE_I1_FEM): FEM Basis calling an FVD member function"); 00273 } 00274 00275 }// namespace Intrepid
1.7.6.1