|
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 // 00027 // ************************************************************************ 00028 // @HEADER 00029 00035 namespace Intrepid { 00036 00037 00038 template<class Scalar, class ArrayScalar> 00039 Basis_HGRAD_LINE_C1_FEM<Scalar,ArrayScalar>::Basis_HGRAD_LINE_C1_FEM() { 00040 this -> basisCardinality_ = 2; 00041 this -> basisDegree_ = 1; 00042 this -> basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Line<2> >() ); 00043 this -> basisType_ = BASIS_FEM_DEFAULT; 00044 this -> basisCoordinates_ = COORDINATES_CARTESIAN; 00045 this -> basisTagsAreSet_ = false; 00046 } 00047 00048 00049 00050 template<class Scalar, class ArrayScalar> 00051 void Basis_HGRAD_LINE_C1_FEM<Scalar, ArrayScalar>::getValues(ArrayScalar & outputValues, 00052 const ArrayScalar & inputPoints, 00053 const EOperator operatorType) const { 00054 00055 // Verify arguments 00056 #ifdef HAVE_INTREPID_DEBUG 00057 Intrepid::getValues_HGRAD_Args<Scalar, ArrayScalar>(outputValues, 00058 inputPoints, 00059 operatorType, 00060 this -> getBaseCellTopology(), 00061 this -> getCardinality() ); 00062 #endif 00063 // Number of evaluation points = dim 0 of inputPoints 00064 int dim0 = inputPoints.dimension(0); 00065 00066 // Temporaries: (x,y) coordinates of the evaluation point 00067 Scalar x = 0.0; 00068 00069 switch (operatorType) { 00070 00071 case OPERATOR_VALUE: 00072 for (int i0 = 0; i0 < dim0; i0++) { 00073 x = inputPoints(i0, 0); 00074 00075 // outputValues is a rank-2 array with dimensions (basisCardinality_, dim0) 00076 outputValues(0, i0) = (1.0 - x)/2.0; 00077 outputValues(1, i0) = (1.0 + x)/2.0; 00078 } 00079 break; 00080 00081 case OPERATOR_GRAD: 00082 case OPERATOR_DIV: 00083 case OPERATOR_CURL: 00084 case OPERATOR_D1: 00085 for (int i0 = 0; i0 < dim0; i0++) { 00086 x = inputPoints(i0,0); 00087 00088 // outputValues is a rank-3 array with dimensions (basisCardinality_, dim0, spaceDim) 00089 outputValues(0, i0, 0) = -0.5; 00090 outputValues(1, i0, 0) = 0.5; 00091 } 00092 break; 00093 00094 case OPERATOR_D2: 00095 for (int i0 = 0; i0 < dim0; i0++) { 00096 00097 // outputValues is a rank-3 array with dimensions (basisCardinality_, dim0, D2Cardinality=3) 00098 outputValues(0, i0, 0) = 0.0; 00099 outputValues(1, i0, 0) = 0.0; 00100 } 00101 break; 00102 00103 case OPERATOR_D3: 00104 case OPERATOR_D4: 00105 case OPERATOR_D5: 00106 case OPERATOR_D6: 00107 case OPERATOR_D7: 00108 case OPERATOR_D8: 00109 case OPERATOR_D9: 00110 case OPERATOR_D10: 00111 { 00112 // outputValues is a rank-3 array with dimensions (basisCardinality_, dim0, DkCardinality) 00113 int DkCardinality = Intrepid::getDkCardinality(operatorType, 00114 this -> basisCellTopology_.getDimension() ); 00115 for(int dofOrd = 0; dofOrd < this -> basisCardinality_; dofOrd++) { 00116 for (int i0 = 0; i0 < dim0; i0++) { 00117 for(int dkOrd = 0; dkOrd < DkCardinality; dkOrd++){ 00118 outputValues(dofOrd, i0, dkOrd) = 0.0; 00119 } 00120 } 00121 } 00122 } 00123 break; 00124 00125 default: 00126 TEST_FOR_EXCEPTION( !( Intrepid::isValidOperator(operatorType) ), std::invalid_argument, 00127 ">>> ERROR (Basis_HGRAD_LINE_C1_FEM): Invalid operator type"); 00128 } 00129 } 00130 00131 template<class Scalar, class ArrayScalar> 00132 void Basis_HGRAD_LINE_C1_FEM<Scalar, ArrayScalar>::initializeTags() { 00133 00134 // Basis-dependent intializations 00135 int tagSize = 4; // size of DoF tag, i.e., number of fields in the tag 00136 int posScDim = 0; // position in the tag, counting from 0, of the subcell dim 00137 int posScOrd = 1; // position in the tag, counting from 0, of the subcell ordinal 00138 int posDfOrd = 2; // position in the tag, counting from 0, of DoF ordinal relative to the subcell 00139 00140 // An array with local DoF tags assigned to basis functions, in the order of their local enumeration 00141 int tags[] = { 0, 0, 0, 1, 00142 0, 1, 0, 1}; 00143 00144 // Basis-independent function sets tag and enum data in tagToOrdinal_ and ordinalToTag_ arrays: 00145 Intrepid::setOrdinalTagData(this -> tagToOrdinal_, 00146 this -> ordinalToTag_, 00147 tags, 00148 this -> basisCardinality_, 00149 tagSize, 00150 posScDim, 00151 posScOrd, 00152 posDfOrd); 00153 } 00154 00155 template<class Scalar, class ArrayScalar> 00156 void Basis_HGRAD_LINE_C1_FEM<Scalar, ArrayScalar>::getValues(ArrayScalar& outputValues, 00157 const ArrayScalar & inputPoints, 00158 const ArrayScalar & cellVertices, 00159 const EOperator operatorType) const { 00160 TEST_FOR_EXCEPTION( (true), std::logic_error, 00161 ">>> ERROR (Basis_HGRAD_LINE_C1_FEM): FEM Basis calling an FVD member function"); 00162 } 00163 00164 }// namespace Intrepid
1.7.4