|
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 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Pavel Bochev (pbboche@sandia.gov) or 00025 // Denis Ridzal (dridzal@sandia.gov). 00026 // Kara Peterson (kjpeter@sandia.gov). 00027 // 00028 // ************************************************************************ 00029 // @HEADER 00030 00036 namespace Intrepid { 00037 00038 template<class Scalar, class ArrayScalar> 00039 Basis_HCURL_TET_I1_FEM<Scalar,ArrayScalar>::Basis_HCURL_TET_I1_FEM() 00040 { 00041 this -> basisCardinality_ = 6; 00042 this -> basisDegree_ = 1; 00043 this -> basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Tetrahedron<4> >() ); 00044 this -> basisType_ = BASIS_FEM_DEFAULT; 00045 this -> basisCoordinates_ = COORDINATES_CARTESIAN; 00046 this -> basisTagsAreSet_ = false; 00047 } 00048 00049 template<class Scalar, class ArrayScalar> 00050 void Basis_HCURL_TET_I1_FEM<Scalar, ArrayScalar>::initializeTags() { 00051 00052 // Basis-dependent intializations 00053 int tagSize = 4; // size of DoF tag 00054 int posScDim = 0; // position in the tag, counting from 0, of the subcell dim 00055 int posScOrd = 1; // position in the tag, counting from 0, of the subcell ordinal 00056 int posDfOrd = 2; // position in the tag, counting from 0, of DoF ordinal relative to the subcell 00057 00058 // An array with local DoF tags assigned to basis functions, in the order of their local enumeration 00059 int tags[] = { 00060 1, 0, 0, 1, 00061 1, 1, 0, 1, 00062 1, 2, 0, 1, 00063 1, 3, 0, 1, 00064 1, 4, 0, 1, 00065 1, 5, 0, 1 }; 00066 00067 // Basis-independent function sets tag and enum data in tagToOrdinal_ and ordinalToTag_ arrays: 00068 Intrepid::setOrdinalTagData(this -> tagToOrdinal_, 00069 this -> ordinalToTag_, 00070 tags, 00071 this -> basisCardinality_, 00072 tagSize, 00073 posScDim, 00074 posScOrd, 00075 posDfOrd); 00076 } 00077 00078 00079 00080 template<class Scalar, class ArrayScalar> 00081 void Basis_HCURL_TET_I1_FEM<Scalar, ArrayScalar>::getValues(ArrayScalar & outputValues, 00082 const ArrayScalar & inputPoints, 00083 const EOperator operatorType) const { 00084 00085 // Verify arguments 00086 #ifdef HAVE_INTREPID_DEBUG 00087 Intrepid::getValues_HCURL_Args<Scalar, ArrayScalar>(outputValues, 00088 inputPoints, 00089 operatorType, 00090 this -> getBaseCellTopology(), 00091 this -> getCardinality() ); 00092 #endif 00093 00094 // Number of evaluation points = dim 0 of inputPoints 00095 int dim0 = inputPoints.dimension(0); 00096 00097 // Temporaries: (x,y,z) coordinates of the evaluation point 00098 Scalar x = 0.0; 00099 Scalar y = 0.0; 00100 Scalar z = 0.0; 00101 00102 switch (operatorType) { 00103 case OPERATOR_VALUE: 00104 for (int i0 = 0; i0 < dim0; i0++) { 00105 x = inputPoints(i0, 0); 00106 y = inputPoints(i0, 1); 00107 z = inputPoints(i0, 2); 00108 00109 // outputValues is a rank-3 array with dimensions (basisCardinality_, dim0, spaceDim) 00110 outputValues(0, i0, 0) = 1.0 - y - z; 00111 outputValues(0, i0, 1) = x; 00112 outputValues(0, i0, 2) = x; 00113 00114 outputValues(1, i0, 0) =-y; 00115 outputValues(1, i0, 1) = x; 00116 outputValues(1, i0, 2) = 0.0; 00117 00118 outputValues(2, i0, 0) = -y; 00119 outputValues(2, i0, 1) = -1.0 + x + z; 00120 outputValues(2, i0, 2) = -y; 00121 00122 outputValues(3, i0, 0) = z; 00123 outputValues(3, i0, 1) = z; 00124 outputValues(3, i0, 2) = 1.0 - x - y; 00125 00126 outputValues(4, i0, 0) =-z; 00127 outputValues(4, i0, 1) = 0.0; 00128 outputValues(4, i0, 2) = x; 00129 00130 outputValues(5, i0, 0) = 0.0; 00131 outputValues(5, i0, 1) =-z; 00132 outputValues(5, i0, 2) = y; 00133 } 00134 break; 00135 00136 case OPERATOR_CURL: 00137 for (int i0 = 0; i0 < dim0; i0++) { 00138 x = inputPoints(i0, 0); 00139 y = inputPoints(i0, 1); 00140 z = inputPoints(i0, 2); 00141 00142 // outputValues is a rank-3 array with dimensions (basisCardinality_, dim0, spaceDim) 00143 outputValues(0, i0, 0) = 0.0; 00144 outputValues(0, i0, 1) =-2.0; 00145 outputValues(0, i0, 2) = 2.0; 00146 00147 outputValues(1, i0, 0) = 0.0; 00148 outputValues(1, i0, 1) = 0.0; 00149 outputValues(1, i0, 2) = 2.0; 00150 00151 outputValues(2, i0, 0) =-2.0; 00152 outputValues(2, i0, 1) = 0.0; 00153 outputValues(2, i0, 2) = 2.0; 00154 00155 outputValues(3, i0, 0) =-2.0; 00156 outputValues(3, i0, 1) = 2.0; 00157 outputValues(3, i0, 2) = 0.0; 00158 00159 outputValues(4, i0, 0) = 0.0; 00160 outputValues(4, i0, 1) =-2.0; 00161 outputValues(4, i0, 2) = 0.0; 00162 00163 outputValues(5, i0, 0) = 2.0; 00164 outputValues(5, i0, 1) = 0.0; 00165 outputValues(5, i0, 2) = 0.0; 00166 } 00167 break; 00168 00169 case OPERATOR_DIV: 00170 TEST_FOR_EXCEPTION( (operatorType == OPERATOR_DIV), std::invalid_argument, 00171 ">>> ERROR (Basis_HCURL_TET_I1_FEM): DIV is invalid operator for HCURL Basis Functions"); 00172 break; 00173 00174 case OPERATOR_GRAD: 00175 TEST_FOR_EXCEPTION( (operatorType == OPERATOR_GRAD), std::invalid_argument, 00176 ">>> ERROR (Basis_HCURL_TET_I1_FEM): GRAD is invalid operator for HCURL Basis Functions"); 00177 break; 00178 00179 case OPERATOR_D1: 00180 case OPERATOR_D2: 00181 case OPERATOR_D3: 00182 case OPERATOR_D4: 00183 case OPERATOR_D5: 00184 case OPERATOR_D6: 00185 case OPERATOR_D7: 00186 case OPERATOR_D8: 00187 case OPERATOR_D9: 00188 case OPERATOR_D10: 00189 TEST_FOR_EXCEPTION( ( (operatorType == OPERATOR_D1) || 00190 (operatorType == OPERATOR_D2) || 00191 (operatorType == OPERATOR_D3) || 00192 (operatorType == OPERATOR_D4) || 00193 (operatorType == OPERATOR_D5) || 00194 (operatorType == OPERATOR_D6) || 00195 (operatorType == OPERATOR_D7) || 00196 (operatorType == OPERATOR_D8) || 00197 (operatorType == OPERATOR_D9) || 00198 (operatorType == OPERATOR_D10) ), 00199 std::invalid_argument, 00200 ">>> ERROR (Basis_HCURL_TET_I1_FEM): Invalid operator type"); 00201 break; 00202 00203 default: 00204 TEST_FOR_EXCEPTION( ( (operatorType != OPERATOR_VALUE) && 00205 (operatorType != OPERATOR_GRAD) && 00206 (operatorType != OPERATOR_CURL) && 00207 (operatorType != OPERATOR_DIV) && 00208 (operatorType != OPERATOR_D1) && 00209 (operatorType != OPERATOR_D2) && 00210 (operatorType != OPERATOR_D3) && 00211 (operatorType != OPERATOR_D4) && 00212 (operatorType != OPERATOR_D5) && 00213 (operatorType != OPERATOR_D6) && 00214 (operatorType != OPERATOR_D7) && 00215 (operatorType != OPERATOR_D8) && 00216 (operatorType != OPERATOR_D9) && 00217 (operatorType != OPERATOR_D10) ), 00218 std::invalid_argument, 00219 ">>> ERROR (Basis_HCURL_TET_I1_FEM): Invalid operator type"); 00220 } 00221 } 00222 00223 00224 00225 template<class Scalar, class ArrayScalar> 00226 void Basis_HCURL_TET_I1_FEM<Scalar, ArrayScalar>::getValues(ArrayScalar& outputValues, 00227 const ArrayScalar & inputPoints, 00228 const ArrayScalar & cellVertices, 00229 const EOperator operatorType) const { 00230 TEST_FOR_EXCEPTION( (true), std::logic_error, 00231 ">>> ERROR (Basis_HCURL_TET_I1_FEM): FEM Basis calling an FVD member function"); 00232 } 00233 00234 }// namespace Intrepid
1.7.4