|
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 #ifndef INTREPID_CELLTOOLS_HPP 00050 #define INTREPID_CELLTOOLS_HPP 00051 00052 00053 #include "Intrepid_FieldContainer.hpp" 00054 #include "Intrepid_RealSpaceTools.hpp" 00055 #include "Intrepid_ConfigDefs.hpp" 00056 #include "Intrepid_Types.hpp" 00057 #include "Intrepid_Utils.hpp" 00058 #include "Intrepid_Basis.hpp" 00059 #include "Intrepid_HGRAD_TRI_C1_FEM.hpp" 00060 #include "Intrepid_HGRAD_QUAD_C1_FEM.hpp" 00061 #include "Intrepid_HGRAD_TET_C1_FEM.hpp" 00062 #include "Intrepid_HGRAD_WEDGE_C1_FEM.hpp" 00063 #include "Intrepid_HGRAD_PYR_C1_FEM.hpp" 00064 #include "Intrepid_HGRAD_HEX_C1_FEM.hpp" 00065 00066 #include "Intrepid_HGRAD_LINE_C1_FEM.hpp" 00067 00068 #include "Intrepid_HGRAD_TRI_C2_FEM.hpp" 00069 #include "Intrepid_HGRAD_QUAD_C2_FEM.hpp" 00070 #include "Intrepid_HGRAD_TET_C2_FEM.hpp" 00071 #include "Intrepid_HGRAD_TET_COMP12_FEM.hpp" 00072 #include "Intrepid_HGRAD_WEDGE_C2_FEM.hpp" 00073 #include "Intrepid_HGRAD_WEDGE_I2_FEM.hpp" 00074 #include "Intrepid_HGRAD_HEX_C2_FEM.hpp" 00075 #include "Intrepid_HGRAD_HEX_I2_FEM.hpp" 00076 #include "Intrepid_HGRAD_PYR_I2_FEM.hpp" 00077 00078 #include "Shards_CellTopology.hpp" 00079 #include "Shards_BasicTopologies.hpp" 00080 00081 #include "Teuchos_Assert.hpp" 00082 #include "Teuchos_RCP.hpp" 00083 00084 namespace Intrepid { 00085 00086 00087 //============================================================================================// 00088 // // 00089 // CellTools // 00090 // // 00091 //============================================================================================// 00092 00101 template<class Scalar> 00102 class CellTools { 00103 private: 00104 00105 //============================================================================================// 00106 // // 00107 // Parametrization coefficients of edges and faces of reference cells // 00108 // // 00109 //============================================================================================// 00110 00111 00124 static const FieldContainer<double>& getSubcellParametrization(const int subcellDim, 00125 const shards::CellTopology& parentCell); 00126 00127 00128 00168 static void setSubcellParametrization(FieldContainer<double>& subcellParametrization, 00169 const int subcellDim, 00170 const shards::CellTopology& parentCell); 00171 00172 //============================================================================================// 00173 // // 00174 // Validation of input/output arguments for CellTools methods // 00175 // // 00176 //============================================================================================// 00177 00185 template<class ArrayJac, class ArrayPoint, class ArrayCell> 00186 static void validateArguments_setJacobian(const ArrayJac & jacobian, 00187 const ArrayPoint & points, 00188 const ArrayCell & cellWorkset, 00189 const int & whichCell, 00190 const shards::CellTopology & cellTopo); 00191 00192 00193 00198 template<class ArrayJacInv, class ArrayJac> 00199 static void validateArguments_setJacobianInv(const ArrayJacInv & jacobianInv, 00200 const ArrayJac & jacobian); 00201 00202 00203 00208 template<class ArrayJacDet, class ArrayJac> 00209 static void validateArguments_setJacobianDetArgs(const ArrayJacDet & jacobianDet, 00210 const ArrayJac & jacobian); 00211 00212 00213 00221 template<class ArrayPhysPoint, class ArrayRefPoint, class ArrayCell> 00222 static void validateArguments_mapToPhysicalFrame(const ArrayPhysPoint & physPoints, 00223 const ArrayRefPoint & refPoints, 00224 const ArrayCell & cellWorkset, 00225 const shards::CellTopology & cellTopo, 00226 const int& whichCell); 00227 00228 00229 00237 template<class ArrayRefPoint, class ArrayPhysPoint, class ArrayCell> 00238 static void validateArguments_mapToReferenceFrame(const ArrayRefPoint & refPoints, 00239 const ArrayPhysPoint & physPoints, 00240 const ArrayCell & cellWorkset, 00241 const shards::CellTopology & cellTopo, 00242 const int& whichCell); 00243 00244 00245 00254 template<class ArrayRefPoint, class ArrayInitGuess, class ArrayPhysPoint, class ArrayCell> 00255 static void validateArguments_mapToReferenceFrame(const ArrayRefPoint & refPoints, 00256 const ArrayInitGuess & initGuess, 00257 const ArrayPhysPoint & physPoints, 00258 const ArrayCell & cellWorkset, 00259 const shards::CellTopology & cellTopo, 00260 const int& whichCell); 00261 00262 00263 00271 template<class ArrayIncl, class ArrayPoint, class ArrayCell> 00272 static void validateArguments_checkPointwiseInclusion(ArrayIncl & inCell, 00273 const ArrayPoint & physPoints, 00274 const ArrayCell & cellWorkset, 00275 const int & whichCell, 00276 const shards::CellTopology & cell); 00277 public: 00278 00281 CellTools(){ }; 00282 00283 00286 ~CellTools(){ }; 00287 00288 //============================================================================================// 00289 // // 00290 // Jacobian, inverse Jacobian and Jacobian determinant // 00291 // // 00292 //============================================================================================// 00293 00341 template<class ArrayJac, class ArrayPoint, class ArrayCell> 00342 static void setJacobian(ArrayJac & jacobian, 00343 const ArrayPoint & points, 00344 const ArrayCell & cellWorkset, 00345 const shards::CellTopology & cellTopo, 00346 const int & whichCell = -1); 00347 00348 00349 00362 template<class ArrayJacInv, class ArrayJac> 00363 static void setJacobianInv(ArrayJacInv & jacobianInv, 00364 const ArrayJac & jacobian); 00365 00366 00367 00380 template<class ArrayJacDet, class ArrayJac> 00381 static void setJacobianDet(ArrayJacDet & jacobianDet, 00382 const ArrayJac & jacobian); 00383 00384 //============================================================================================// 00385 // // 00386 // Reference-to-physical frame mapping and its inverse // 00387 // // 00388 //============================================================================================// 00389 00445 template<class ArrayPhysPoint, class ArrayRefPoint, class ArrayCell> 00446 static void mapToPhysicalFrame(ArrayPhysPoint & physPoints, 00447 const ArrayRefPoint & refPoints, 00448 const ArrayCell & cellWorkset, 00449 const shards::CellTopology & cellTopo, 00450 const int & whichCell = -1); 00451 00452 00453 00512 template<class ArrayRefPoint, class ArrayPhysPoint, class ArrayCell> 00513 static void mapToReferenceFrame(ArrayRefPoint & refPoints, 00514 const ArrayPhysPoint & physPoints, 00515 const ArrayCell & cellWorkset, 00516 const shards::CellTopology & cellTopo, 00517 const int & whichCell = -1); 00518 00519 00520 00566 template<class ArrayRefPoint, class ArrayInitGuess, class ArrayPhysPoint, class ArrayCell> 00567 static void mapToReferenceFrameInitGuess(ArrayRefPoint & refPoints, 00568 const ArrayInitGuess & initGuess, 00569 const ArrayPhysPoint & physPoints, 00570 const ArrayCell & cellWorkset, 00571 const shards::CellTopology & cellTopo, 00572 const int & whichCell = -1); 00573 00574 00575 00626 template<class ArraySubcellPoint, class ArrayParamPoint> 00627 static void mapToReferenceSubcell(ArraySubcellPoint & refSubcellPoints, 00628 const ArrayParamPoint & paramPoints, 00629 const int subcellDim, 00630 const int subcellOrd, 00631 const shards::CellTopology & parentCell); 00632 00633 00634 00660 template<class ArrayEdgeTangent> 00661 static void getReferenceEdgeTangent(ArrayEdgeTangent & refEdgeTangent, 00662 const int & edgeOrd, 00663 const shards::CellTopology & parentCell); 00664 00665 00666 00703 template<class ArrayFaceTangentU, class ArrayFaceTangentV> 00704 static void getReferenceFaceTangents(ArrayFaceTangentU & refFaceTanU, 00705 ArrayFaceTangentV & refFaceTanV, 00706 const int & faceOrd, 00707 const shards::CellTopology & parentCell); 00708 00709 00710 00773 template<class ArraySideNormal> 00774 static void getReferenceSideNormal(ArraySideNormal & refSideNormal, 00775 const int & sideOrd, 00776 const shards::CellTopology & parentCell); 00777 00778 00779 00818 template<class ArrayFaceNormal> 00819 static void getReferenceFaceNormal(ArrayFaceNormal & refFaceNormal, 00820 const int & faceOrd, 00821 const shards::CellTopology & parentCell); 00822 00823 00824 00854 template<class ArrayEdgeTangent, class ArrayJac> 00855 static void getPhysicalEdgeTangents(ArrayEdgeTangent & edgeTangents, 00856 const ArrayJac & worksetJacobians, 00857 const int & worksetEdgeOrd, 00858 const shards::CellTopology & parentCell); 00859 00860 00861 00901 template<class ArrayFaceTangentU, class ArrayFaceTangentV, class ArrayJac> 00902 static void getPhysicalFaceTangents(ArrayFaceTangentU & faceTanU, 00903 ArrayFaceTangentV & faceTanV, 00904 const ArrayJac & worksetJacobians, 00905 const int & worksetFaceOrd, 00906 const shards::CellTopology & parentCell); 00907 00908 00909 00970 template<class ArraySideNormal, class ArrayJac> 00971 static void getPhysicalSideNormals(ArraySideNormal & sideNormals, 00972 const ArrayJac & worksetJacobians, 00973 const int & worksetSideOrd, 00974 const shards::CellTopology & parentCell); 00975 00976 00977 01016 template<class ArrayFaceNormal, class ArrayJac> 01017 static void getPhysicalFaceNormals(ArrayFaceNormal & faceNormals, 01018 const ArrayJac & worksetJacobians, 01019 const int & worksetFaceOrd, 01020 const shards::CellTopology & parentCell); 01021 01022 01023 //============================================================================================// 01024 // // 01025 // Inclusion tests // 01026 // // 01027 //============================================================================================// 01028 01039 static int checkPointInclusion(const Scalar* point, 01040 const int pointDim, 01041 const shards::CellTopology & cellTopo, 01042 const double & threshold = INTREPID_THRESHOLD); 01043 01044 01045 01058 template<class ArrayPoint> 01059 static int checkPointsetInclusion(const ArrayPoint & points, 01060 const shards::CellTopology & cellTopo, 01061 const double & threshold = INTREPID_THRESHOLD); 01062 01063 01064 01091 template<class ArrayIncl, class ArrayPoint> 01092 static void checkPointwiseInclusion(ArrayIncl & inRefCell, 01093 const ArrayPoint & points, 01094 const shards::CellTopology & cellTopo, 01095 const double & threshold = INTREPID_THRESHOLD); 01096 01097 01098 01134 template<class ArrayIncl, class ArrayPoint, class ArrayCell> 01135 static void checkPointwiseInclusion(ArrayIncl & inCell, 01136 const ArrayPoint & points, 01137 const ArrayCell & cellWorkset, 01138 const shards::CellTopology & cell, 01139 const int & whichCell = -1, 01140 const double & threshold = INTREPID_THRESHOLD); 01141 01142 01143 01154 static const double* getReferenceVertex(const shards::CellTopology& cell, 01155 const int vertexOrd); 01156 01157 01158 01173 template<class ArraySubcellVert> 01174 static void getReferenceSubcellVertices(ArraySubcellVert & subcellVertices, 01175 const int subcellDim, 01176 const int subcellOrd, 01177 const shards::CellTopology& parentCell); 01178 01179 01180 01196 static const double* getReferenceNode(const shards::CellTopology& cell, 01197 const int nodeOrd); 01198 01199 01200 01214 template<class ArraySubcellNode> 01215 static void getReferenceSubcellNodes(ArraySubcellNode& subcellNodes, 01216 const int subcellDim, 01217 const int subcellOrd, 01218 const shards::CellTopology& parentCell); 01219 01220 01221 01227 static int hasReferenceCell(const shards::CellTopology & cellTopo); 01228 01229 01230 01231 //============================================================================================// 01232 // // 01233 // Debug // 01234 // // 01235 //============================================================================================// 01236 01237 01243 static void printSubcellVertices(const int subcellDim, 01244 const int subcellOrd, 01245 const shards::CellTopology & parentCell); 01246 01247 01248 01252 template<class ArrayCell> 01253 static void printWorksetSubcell(const ArrayCell & cellWorkset, 01254 const shards::CellTopology & parentCell, 01255 const int& pCellOrd, 01256 const int& subcellDim, 01257 const int& subcellOrd, 01258 const int& fieldWidth = 3); 01259 01260 }; // class CellTools 01261 01262 } // namespace Intrepid 01263 01264 // include templated function definitions 01265 01266 #include "Intrepid_CellToolsDef.hpp" 01267 01268 #endif 01269 01270 /*************************************************************************************************** 01271 ** ** 01272 ** D O C U M E N T A T I O N P A G E S ** 01273 ** ** 01274 **************************************************************************************************/ 01275
1.7.6.1