|
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_HDIV_TRI_I1_FEM<Scalar,ArrayScalar>::Basis_HDIV_TRI_I1_FEM() 00040 { 00041 this -> basisCardinality_ = 3; 00042 this -> basisDegree_ = 1; 00043 this -> basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Triangle<3> >() ); 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_HDIV_TRI_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 // 2, 0, 0, 1, 00064 // 2, 1, 0, 1, 00065 // 2, 2, 0, 1 00066 }; 00067 00068 // Basis-independent function sets tag and enum data in tagToOrdinal_ and ordinalToTag_ arrays: 00069 Intrepid::setOrdinalTagData(this -> tagToOrdinal_, 00070 this -> ordinalToTag_, 00071 tags, 00072 this -> basisCardinality_, 00073 tagSize, 00074 posScDim, 00075 posScOrd, 00076 posDfOrd); 00077 } 00078 00079 00080 00081 template<class Scalar, class ArrayScalar> 00082 void Basis_HDIV_TRI_I1_FEM<Scalar, ArrayScalar>::getValues(ArrayScalar & outputValues, 00083 const ArrayScalar & inputPoints, 00084 const EOperator operatorType) const { 00085 00086 00087 // Verify arguments 00088 #ifdef HAVE_INTREPID_DEBUG 00089 Intrepid::getValues_HDIV_Args<Scalar, ArrayScalar>(outputValues, 00090 inputPoints, 00091 operatorType, 00092 this -> getBaseCellTopology(), 00093 this -> getCardinality() ); 00094 #endif 00095 00096 00097 // Number of evaluation points = dim 0 of inputPoints 00098 int dim0 = inputPoints.dimension(0); 00099 00100 // Temporaries: (x,y) coordinates of the evaluation point 00101 Scalar x = 0.0; 00102 Scalar y = 0.0; 00103 00104 switch (operatorType) { 00105 case OPERATOR_VALUE: 00106 for (int i0 = 0; i0 < dim0; i0++) { 00107 x = inputPoints(i0, 0); 00108 y = inputPoints(i0, 1); 00109 00110 // outputValues is a rank-3 array with dimensions (basisCardinality_, dim0, spaceDim) 00111 outputValues(0, i0, 0) = x; 00112 outputValues(0, i0, 1) = y - 1.0; 00113 00114 outputValues(1, i0, 0) = x; 00115 outputValues(1, i0, 1) = y; 00116 00117 outputValues(2, i0, 0) = x - 1.0; 00118 outputValues(2, i0, 1) = y; 00119 } 00120 break; 00121 00122 case OPERATOR_DIV: 00123 // outputValues is a rank-2 array with dimensions (basisCardinality_, dim0) 00124 for (int i0 = 0; i0 < dim0; i0++) { 00125 outputValues(0, i0) = 2.0; 00126 outputValues(1, i0) = 2.0; 00127 outputValues(2, i0) = 2.0; 00128 } 00129 break; 00130 00131 case OPERATOR_CURL: 00132 TEST_FOR_EXCEPTION( (operatorType == OPERATOR_CURL), std::invalid_argument, 00133 ">>> ERROR (Basis_HDIV_TRI_I1_FEM): CURL is invalid operator for HDIV Basis Functions"); 00134 break; 00135 00136 case OPERATOR_GRAD: 00137 TEST_FOR_EXCEPTION( (operatorType == OPERATOR_GRAD), std::invalid_argument, 00138 ">>> ERROR (Basis_HDIV_TRI_I1_FEM): GRAD is invalid operator for HDIV Basis Functions"); 00139 break; 00140 00141 case OPERATOR_D1: 00142 case OPERATOR_D2: 00143 case OPERATOR_D3: 00144 case OPERATOR_D4: 00145 case OPERATOR_D5: 00146 case OPERATOR_D6: 00147 case OPERATOR_D7: 00148 case OPERATOR_D8: 00149 case OPERATOR_D9: 00150 case OPERATOR_D10: 00151 TEST_FOR_EXCEPTION( ( (operatorType == OPERATOR_D1) && 00152 (operatorType == OPERATOR_D2) && 00153 (operatorType == OPERATOR_D3) && 00154 (operatorType == OPERATOR_D4) && 00155 (operatorType == OPERATOR_D5) && 00156 (operatorType == OPERATOR_D6) && 00157 (operatorType == OPERATOR_D7) && 00158 (operatorType == OPERATOR_D8) && 00159 (operatorType == OPERATOR_D9) && 00160 (operatorType == OPERATOR_D10) ), 00161 std::invalid_argument, 00162 ">>> ERROR (Basis_HDIV_TRI_I1_FEM): Invalid operator type"); 00163 break; 00164 00165 default: 00166 TEST_FOR_EXCEPTION( ( (operatorType != OPERATOR_VALUE) && 00167 (operatorType != OPERATOR_GRAD) && 00168 (operatorType != OPERATOR_CURL) && 00169 (operatorType != OPERATOR_DIV) && 00170 (operatorType != OPERATOR_D1) && 00171 (operatorType != OPERATOR_D2) && 00172 (operatorType != OPERATOR_D3) && 00173 (operatorType != OPERATOR_D4) && 00174 (operatorType != OPERATOR_D5) && 00175 (operatorType != OPERATOR_D6) && 00176 (operatorType != OPERATOR_D7) && 00177 (operatorType != OPERATOR_D8) && 00178 (operatorType != OPERATOR_D9) && 00179 (operatorType != OPERATOR_D10) ), 00180 std::invalid_argument, 00181 ">>> ERROR (Basis_HDIV_TRI_I1_FEM): Invalid operator type"); 00182 } 00183 } 00184 00185 00186 00187 template<class Scalar, class ArrayScalar> 00188 void Basis_HDIV_TRI_I1_FEM<Scalar, ArrayScalar>::getValues(ArrayScalar& outputValues, 00189 const ArrayScalar & inputPoints, 00190 const ArrayScalar & cellVertices, 00191 const EOperator operatorType) const { 00192 TEST_FOR_EXCEPTION( (true), std::logic_error, 00193 ">>> ERROR (Basis_HDIV_TRI_I1_FEM): FEM Basis calling an FVD member function"); 00194 } 00195 00196 }// namespace Intrepid
1.7.4