00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00035 namespace Intrepid {
00036
00037
00038 template<class Scalar, class ArrayScalar>
00039 Basis_HGRAD_HEX_C1_FEM<Scalar,ArrayScalar>::Basis_HGRAD_HEX_C1_FEM()
00040 {
00041 this -> basisCardinality_ = 8;
00042 this -> basisDegree_ = 1;
00043 this -> basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Hexahedron<8> >() );
00044 this -> basisType_ = BASIS_FEM_DEFAULT;
00045 this -> basisCoordinates_ = COORDINATES_CARTESIAN;
00046 this -> basisTagsAreSet_ = false;
00047 }
00048
00049
00050
00051 template<class Scalar, class ArrayScalar>
00052 void Basis_HGRAD_HEX_C1_FEM<Scalar, ArrayScalar>::initializeTags() {
00053
00054
00055 int tagSize = 4;
00056 int posScDim = 0;
00057 int posScOrd = 1;
00058 int posDfOrd = 2;
00059
00060
00061 int tags[] = { 0, 0, 0, 1,
00062 0, 1, 0, 1,
00063 0, 2, 0, 1,
00064 0, 3, 0, 1,
00065 0, 4, 0, 1,
00066 0, 5, 0, 1,
00067 0, 6, 0, 1,
00068 0, 7, 0, 1 };
00069
00070
00071 Intrepid::setOrdinalTagData(this -> tagToOrdinal_,
00072 this -> ordinalToTag_,
00073 tags,
00074 this -> basisCardinality_,
00075 tagSize,
00076 posScDim,
00077 posScOrd,
00078 posDfOrd);
00079 }
00080
00081
00082
00083 template<class Scalar, class ArrayScalar>
00084 void Basis_HGRAD_HEX_C1_FEM<Scalar, ArrayScalar>::getValues(ArrayScalar & outputValues,
00085 const ArrayScalar & inputPoints,
00086 const EOperator operatorType) const {
00087
00088
00089 #ifdef HAVE_INTREPID_DEBUG
00090 Intrepid::getValues_HGRAD_Args<Scalar, ArrayScalar>(outputValues,
00091 inputPoints,
00092 operatorType,
00093 this -> getBaseCellTopology(),
00094 this -> getCardinality() );
00095 #endif
00096
00097
00098 int dim0 = inputPoints.dimension(0);
00099
00100
00101 Scalar x = 0.0;
00102 Scalar y = 0.0;
00103 Scalar z = 0.0;
00104
00105 switch (operatorType) {
00106
00107 case OPERATOR_VALUE:
00108 for (int i0 = 0; i0 < dim0; i0++) {
00109 x = inputPoints(i0, 0);
00110 y = inputPoints(i0, 1);
00111 z = inputPoints(i0, 2);
00112
00113
00114 outputValues(0, i0) = (1.0 - x)*(1.0 - y)*(1.0 - z)/8.0;
00115 outputValues(1, i0) = (1.0 + x)*(1.0 - y)*(1.0 - z)/8.0;
00116 outputValues(2, i0) = (1.0 + x)*(1.0 + y)*(1.0 - z)/8.0;
00117 outputValues(3, i0) = (1.0 - x)*(1.0 + y)*(1.0 - z)/8.0;
00118
00119 outputValues(4, i0) = (1.0 - x)*(1.0 - y)*(1.0 + z)/8.0;
00120 outputValues(5, i0) = (1.0 + x)*(1.0 - y)*(1.0 + z)/8.0;
00121 outputValues(6, i0) = (1.0 + x)*(1.0 + y)*(1.0 + z)/8.0;
00122 outputValues(7, i0) = (1.0 - x)*(1.0 + y)*(1.0 + z)/8.0;
00123 }
00124 break;
00125
00126 case OPERATOR_GRAD:
00127 case OPERATOR_D1:
00128 for (int i0 = 0; i0 < dim0; i0++) {
00129 x = inputPoints(i0,0);
00130 y = inputPoints(i0,1);
00131 z = inputPoints(i0,2);
00132
00133
00134 outputValues(0, i0, 0) = -(1.0 - y)*(1.0 - z)/8.0;
00135 outputValues(0, i0, 1) = -(1.0 - x)*(1.0 - z)/8.0;
00136 outputValues(0, i0, 2) = -(1.0 - x)*(1.0 - y)/8.0;
00137
00138 outputValues(1, i0, 0) = (1.0 - y)*(1.0 - z)/8.0;
00139 outputValues(1, i0, 1) = -(1.0 + x)*(1.0 - z)/8.0;
00140 outputValues(1, i0, 2) = -(1.0 + x)*(1.0 - y)/8.0;
00141
00142 outputValues(2, i0, 0) = (1.0 + y)*(1.0 - z)/8.0;
00143 outputValues(2, i0, 1) = (1.0 + x)*(1.0 - z)/8.0;
00144 outputValues(2, i0, 2) = -(1.0 + x)*(1.0 + y)/8.0;
00145
00146 outputValues(3, i0, 0) = -(1.0 + y)*(1.0 - z)/8.0;
00147 outputValues(3, i0, 1) = (1.0 - x)*(1.0 - z)/8.0;
00148 outputValues(3, i0, 2) = -(1.0 - x)*(1.0 + y)/8.0;
00149
00150 outputValues(4, i0, 0) = -(1.0 - y)*(1.0 + z)/8.0;
00151 outputValues(4, i0, 1) = -(1.0 - x)*(1.0 + z)/8.0;
00152 outputValues(4, i0, 2) = (1.0 - x)*(1.0 - y)/8.0;
00153
00154 outputValues(5, i0, 0) = (1.0 - y)*(1.0 + z)/8.0;
00155 outputValues(5, i0, 1) = -(1.0 + x)*(1.0 + z)/8.0;
00156 outputValues(5, i0, 2) = (1.0 + x)*(1.0 - y)/8.0;
00157
00158 outputValues(6, i0, 0) = (1.0 + y)*(1.0 + z)/8.0;
00159 outputValues(6, i0, 1) = (1.0 + x)*(1.0 + z)/8.0;
00160 outputValues(6, i0, 2) = (1.0 + x)*(1.0 + y)/8.0;
00161
00162 outputValues(7, i0, 0) = -(1.0 + y)*(1.0 + z)/8.0;
00163 outputValues(7, i0, 1) = (1.0 - x)*(1.0 + z)/8.0;
00164 outputValues(7, i0, 2) = (1.0 - x)*(1.0 + y)/8.0;
00165 }
00166 break;
00167
00168 case OPERATOR_CURL:
00169 TEST_FOR_EXCEPTION( (operatorType == OPERATOR_CURL), std::invalid_argument,
00170 ">>> ERROR (Basis_HGRAD_HEX_C1_FEM): CURL is invalid operator for rank-0 (scalar) functions in 3D");
00171 break;
00172
00173 case OPERATOR_DIV:
00174 TEST_FOR_EXCEPTION( (operatorType == OPERATOR_DIV), std::invalid_argument,
00175 ">>> ERROR (Basis_HGRAD_HEX_C1_FEM): DIV is invalid operator for rank-0 (scalar) functions in 3D");
00176 break;
00177
00178 case OPERATOR_D2:
00179 for (int i0 = 0; i0 < dim0; i0++) {
00180 x = inputPoints(i0,0);
00181 y = inputPoints(i0,1);
00182 z = inputPoints(i0,2);
00183
00184
00185 outputValues(0, i0, 0) = 0.0;
00186 outputValues(0, i0, 1) = (1.0 - z)/8.0;
00187 outputValues(0, i0, 2) = (1.0 - y)/8.0;
00188 outputValues(0, i0, 3) = 0.0;
00189 outputValues(0, i0, 4) = (1.0 - x)/8.0;
00190 outputValues(0, i0, 5) = 0.0;
00191
00192 outputValues(1, i0, 0) = 0.0;
00193 outputValues(1, i0, 1) = -(1.0 - z)/8.0;
00194 outputValues(1, i0, 2) = -(1.0 - y)/8.0;
00195 outputValues(1, i0, 3) = 0.0;
00196 outputValues(1, i0, 4) = (1.0 + x)/8.0;
00197 outputValues(1, i0, 5) = 0.0;
00198
00199 outputValues(2, i0, 0) = 0.0;
00200 outputValues(2, i0, 1) = (1.0 - z)/8.0;
00201 outputValues(2, i0, 2) = -(1.0 + y)/8.0;
00202 outputValues(2, i0, 3) = 0.0;
00203 outputValues(2, i0, 4) = -(1.0 + x)/8.0;
00204 outputValues(2, i0, 5) = 0.0;
00205
00206 outputValues(3, i0, 0) = 0.0;
00207 outputValues(3, i0, 1) = -(1.0 - z)/8.0;
00208 outputValues(3, i0, 2) = (1.0 + y)/8.0;
00209 outputValues(3, i0, 3) = 0.0;
00210 outputValues(3, i0, 4) = -(1.0 - x)/8.0;
00211 outputValues(3, i0, 5) = 0.0;
00212
00213
00214 outputValues(4, i0, 0) = 0.0;
00215 outputValues(4, i0, 1) = (1.0 + z)/8.0;
00216 outputValues(4, i0, 2) = -(1.0 - y)/8.0;
00217 outputValues(4, i0, 3) = 0.0;
00218 outputValues(4, i0, 4) = -(1.0 - x)/8.0;
00219 outputValues(4, i0, 5) = 0.0;
00220
00221 outputValues(5, i0, 0) = 0.0;
00222 outputValues(5, i0, 1) = -(1.0 + z)/8.0;
00223 outputValues(5, i0, 2) = (1.0 - y)/8.0;
00224 outputValues(5, i0, 3) = 0.0;
00225 outputValues(5, i0, 4) = -(1.0 + x)/8.0;
00226 outputValues(5, i0, 5) = 0.0;
00227
00228 outputValues(6, i0, 0) = 0.0;
00229 outputValues(6, i0, 1) = (1.0 + z)/8.0;
00230 outputValues(6, i0, 2) = (1.0 + y)/8.0;
00231 outputValues(6, i0, 3) = 0.0;
00232 outputValues(6, i0, 4) = (1.0 + x)/8.0;
00233 outputValues(6, i0, 5) = 0.0;
00234
00235 outputValues(7, i0, 0) = 0.0;
00236 outputValues(7, i0, 1) = -(1.0 + z)/8.0;
00237 outputValues(7, i0, 2) = -(1.0 + y)/8.0;
00238 outputValues(7, i0, 3) = 0.0;
00239 outputValues(7, i0, 4) = (1.0 - x)/8.0;
00240 outputValues(7, i0, 5) = 0.0;
00241 }
00242 break;
00243
00244 case OPERATOR_D3:
00245 case OPERATOR_D4:
00246 case OPERATOR_D5:
00247 case OPERATOR_D6:
00248 case OPERATOR_D7:
00249 case OPERATOR_D8:
00250 case OPERATOR_D9:
00251 case OPERATOR_D10:
00252 {
00253
00254 int DkCardinality = Intrepid::getDkCardinality(operatorType,
00255 this -> basisCellTopology_.getDimension() );
00256 for(int dofOrd = 0; dofOrd < this -> basisCardinality_; dofOrd++) {
00257 for (int i0 = 0; i0 < dim0; i0++) {
00258 for(int dkOrd = 0; dkOrd < DkCardinality; dkOrd++){
00259 outputValues(dofOrd, i0, dkOrd) = 0.0;
00260 }
00261 }
00262 }
00263 }
00264 break;
00265
00266 default:
00267 TEST_FOR_EXCEPTION( !( Intrepid::isValidOperator(operatorType) ), std::invalid_argument,
00268 ">>> ERROR (Basis_HGRAD_HEX_C1_FEM): Invalid operator type");
00269 }
00270 }
00271
00272
00273
00274 template<class Scalar, class ArrayScalar>
00275 void Basis_HGRAD_HEX_C1_FEM<Scalar, ArrayScalar>::getValues(ArrayScalar& outputValues,
00276 const ArrayScalar & inputPoints,
00277 const ArrayScalar & cellVertices,
00278 const EOperator operatorType) const {
00279 TEST_FOR_EXCEPTION( (true), std::logic_error,
00280 ">>> ERROR (Basis_HGRAD_HEX_C1_FEM): FEM Basis calling an FVD member function");
00281 }
00282
00283 }