|
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_HEX_C1_FEM.hpp" 00064 00065 #include "Intrepid_HGRAD_LINE_C1_FEM.hpp" 00066 00067 #include "Intrepid_HGRAD_TRI_C2_FEM.hpp" 00068 #include "Intrepid_HGRAD_QUAD_C2_FEM.hpp" 00069 #include "Intrepid_HGRAD_TET_C2_FEM.hpp" 00070 #include "Intrepid_HGRAD_TET_COMP12_FEM.hpp" 00071 #include "Intrepid_HGRAD_WEDGE_C2_FEM.hpp" 00072 #include "Intrepid_HGRAD_HEX_C2_FEM.hpp" 00073 00074 #include "Shards_CellTopology.hpp" 00075 #include "Shards_BasicTopologies.hpp" 00076 00077 #include "Teuchos_Assert.hpp" 00078 #include "Teuchos_RCP.hpp" 00079 00080 namespace Intrepid { 00081 00082 00083 //============================================================================================// 00084 // // 00085 // CellTools // 00086 // // 00087 //============================================================================================// 00088 00097 template<class Scalar> 00098 class CellTools { 00099 private: 00100 00101 //============================================================================================// 00102 // // 00103 // Parametrization coefficients of edges and faces of reference cells // 00104 // // 00105 //============================================================================================// 00106 00107 00120 static const FieldContainer<double>& getSubcellParametrization(const int subcellDim, 00121 const shards::CellTopology& parentCell); 00122 00123 00124 00164 static void setSubcellParametrization(FieldContainer<double>& subcellParametrization, 00165 const int subcellDim, 00166 const shards::CellTopology& parentCell); 00167 00168 //============================================================================================// 00169 // // 00170 // Validation of input/output arguments for CellTools methods // 00171 // // 00172 //============================================================================================// 00173 00181 template<class ArrayJac, class ArrayPoint, class ArrayCell> 00182 static void validateArguments_setJacobian(const ArrayJac & jacobian, 00183 const ArrayPoint & points, 00184 const ArrayCell & cellWorkset, 00185 const int & whichCell, 00186 const shards::CellTopology & cellTopo); 00187 00188 00189 00194 template<class ArrayJacInv, class ArrayJac> 00195 static void validateArguments_setJacobianInv(const ArrayJacInv & jacobianInv, 00196 const ArrayJac & jacobian); 00197 00198 00199 00204 template<class ArrayJacDet, class ArrayJac> 00205 static void validateArguments_setJacobianDetArgs(const ArrayJacDet & jacobianDet, 00206 const ArrayJac & jacobian); 00207 00208 00209 00217 template<class ArrayPhysPoint, class ArrayRefPoint, class ArrayCell> 00218 static void validateArguments_mapToPhysicalFrame(const ArrayPhysPoint & physPoints, 00219 const ArrayRefPoint & refPoints, 00220 const ArrayCell & cellWorkset, 00221 const shards::CellTopology & cellTopo, 00222 const int& whichCell); 00223 00224 00225 00233 template<class ArrayRefPoint, class ArrayPhysPoint, class ArrayCell> 00234 static void validateArguments_mapToReferenceFrame(const ArrayRefPoint & refPoints, 00235 const ArrayPhysPoint & physPoints, 00236 const ArrayCell & cellWorkset, 00237 const shards::CellTopology & cellTopo, 00238 const int& whichCell); 00239 00240 00241 00250 template<class ArrayRefPoint, class ArrayInitGuess, class ArrayPhysPoint, class ArrayCell> 00251 static void validateArguments_mapToReferenceFrame(const ArrayRefPoint & refPoints, 00252 const ArrayInitGuess & initGuess, 00253 const ArrayPhysPoint & physPoints, 00254 const ArrayCell & cellWorkset, 00255 const shards::CellTopology & cellTopo, 00256 const int& whichCell); 00257 00258 00259 00267 template<class ArrayIncl, class ArrayPoint, class ArrayCell> 00268 static void validateArguments_checkPointwiseInclusion(ArrayIncl & inCell, 00269 const ArrayPoint & physPoints, 00270 const ArrayCell & cellWorkset, 00271 const int & whichCell, 00272 const shards::CellTopology & cell); 00273 public: 00274 00277 CellTools(){ }; 00278 00279 00282 ~CellTools(){ }; 00283 00284 //============================================================================================// 00285 // // 00286 // Jacobian, inverse Jacobian and Jacobian determinant // 00287 // // 00288 //============================================================================================// 00289 00337 template<class ArrayJac, class ArrayPoint, class ArrayCell> 00338 static void setJacobian(ArrayJac & jacobian, 00339 const ArrayPoint & points, 00340 const ArrayCell & cellWorkset, 00341 const shards::CellTopology & cellTopo, 00342 const int & whichCell = -1); 00343 00344 00345 00358 template<class ArrayJacInv, class ArrayJac> 00359 static void setJacobianInv(ArrayJacInv & jacobianInv, 00360 const ArrayJac & jacobian); 00361 00362 00363 00376 template<class ArrayJacDet, class ArrayJac> 00377 static void setJacobianDet(ArrayJacDet & jacobianDet, 00378 const ArrayJac & jacobian); 00379 00380 //============================================================================================// 00381 // // 00382 // Reference-to-physical frame mapping and its inverse // 00383 // // 00384 //============================================================================================// 00385 00441 template<class ArrayPhysPoint, class ArrayRefPoint, class ArrayCell> 00442 static void mapToPhysicalFrame(ArrayPhysPoint & physPoints, 00443 const ArrayRefPoint & refPoints, 00444 const ArrayCell & cellWorkset, 00445 const shards::CellTopology & cellTopo, 00446 const int & whichCell = -1); 00447 00448 00449 00508 template<class ArrayRefPoint, class ArrayPhysPoint, class ArrayCell> 00509 static void mapToReferenceFrame(ArrayRefPoint & refPoints, 00510 const ArrayPhysPoint & physPoints, 00511 const ArrayCell & cellWorkset, 00512 const shards::CellTopology & cellTopo, 00513 const int & whichCell = -1); 00514 00515 00516 00562 template<class ArrayRefPoint, class ArrayInitGuess, class ArrayPhysPoint, class ArrayCell> 00563 static void mapToReferenceFrameInitGuess(ArrayRefPoint & refPoints, 00564 const ArrayInitGuess & initGuess, 00565 const ArrayPhysPoint & physPoints, 00566 const ArrayCell & cellWorkset, 00567 const shards::CellTopology & cellTopo, 00568 const int & whichCell = -1); 00569 00570 00571 00622 template<class ArraySubcellPoint, class ArrayParamPoint> 00623 static void mapToReferenceSubcell(ArraySubcellPoint & refSubcellPoints, 00624 const ArrayParamPoint & paramPoints, 00625 const int subcellDim, 00626 const int subcellOrd, 00627 const shards::CellTopology & parentCell); 00628 00629 00630 00656 template<class ArrayEdgeTangent> 00657 static void getReferenceEdgeTangent(ArrayEdgeTangent & refEdgeTangent, 00658 const int & edgeOrd, 00659 const shards::CellTopology & parentCell); 00660 00661 00662 00699 template<class ArrayFaceTangentU, class ArrayFaceTangentV> 00700 static void getReferenceFaceTangents(ArrayFaceTangentU & refFaceTanU, 00701 ArrayFaceTangentV & refFaceTanV, 00702 const int & faceOrd, 00703 const shards::CellTopology & parentCell); 00704 00705 00706 00769 template<class ArraySideNormal> 00770 static void getReferenceSideNormal(ArraySideNormal & refSideNormal, 00771 const int & sideOrd, 00772 const shards::CellTopology & parentCell); 00773 00774 00775 00814 template<class ArrayFaceNormal> 00815 static void getReferenceFaceNormal(ArrayFaceNormal & refFaceNormal, 00816 const int & faceOrd, 00817 const shards::CellTopology & parentCell); 00818 00819 00820 00850 template<class ArrayEdgeTangent, class ArrayJac> 00851 static void getPhysicalEdgeTangents(ArrayEdgeTangent & edgeTangents, 00852 const ArrayJac & worksetJacobians, 00853 const int & worksetEdgeOrd, 00854 const shards::CellTopology & parentCell); 00855 00856 00857 00897 template<class ArrayFaceTangentU, class ArrayFaceTangentV, class ArrayJac> 00898 static void getPhysicalFaceTangents(ArrayFaceTangentU & faceTanU, 00899 ArrayFaceTangentV & faceTanV, 00900 const ArrayJac & worksetJacobians, 00901 const int & worksetFaceOrd, 00902 const shards::CellTopology & parentCell); 00903 00904 00905 00966 template<class ArraySideNormal, class ArrayJac> 00967 static void getPhysicalSideNormals(ArraySideNormal & sideNormals, 00968 const ArrayJac & worksetJacobians, 00969 const int & worksetSideOrd, 00970 const shards::CellTopology & parentCell); 00971 00972 00973 01012 template<class ArrayFaceNormal, class ArrayJac> 01013 static void getPhysicalFaceNormals(ArrayFaceNormal & faceNormals, 01014 const ArrayJac & worksetJacobians, 01015 const int & worksetFaceOrd, 01016 const shards::CellTopology & parentCell); 01017 01018 01019 //============================================================================================// 01020 // // 01021 // Inclusion tests // 01022 // // 01023 //============================================================================================// 01024 01035 static int checkPointInclusion(const Scalar* point, 01036 const int pointDim, 01037 const shards::CellTopology & cellTopo, 01038 const double & threshold = INTREPID_THRESHOLD); 01039 01040 01041 01054 template<class ArrayPoint> 01055 static int checkPointsetInclusion(const ArrayPoint & points, 01056 const shards::CellTopology & cellTopo, 01057 const double & threshold = INTREPID_THRESHOLD); 01058 01059 01060 01087 template<class ArrayIncl, class ArrayPoint> 01088 static void checkPointwiseInclusion(ArrayIncl & inRefCell, 01089 const ArrayPoint & points, 01090 const shards::CellTopology & cellTopo, 01091 const double & threshold = INTREPID_THRESHOLD); 01092 01093 01094 01130 template<class ArrayIncl, class ArrayPoint, class ArrayCell> 01131 static void checkPointwiseInclusion(ArrayIncl & inCell, 01132 const ArrayPoint & points, 01133 const ArrayCell & cellWorkset, 01134 const shards::CellTopology & cell, 01135 const int & whichCell = -1, 01136 const double & threshold = INTREPID_THRESHOLD); 01137 01138 01139 01150 static const double* getReferenceVertex(const shards::CellTopology& cell, 01151 const int vertexOrd); 01152 01153 01154 01169 template<class ArraySubcellVert> 01170 static void getReferenceSubcellVertices(ArraySubcellVert & subcellVertices, 01171 const int subcellDim, 01172 const int subcellOrd, 01173 const shards::CellTopology& parentCell); 01174 01175 01176 01192 static const double* getReferenceNode(const shards::CellTopology& cell, 01193 const int nodeOrd); 01194 01195 01196 01210 template<class ArraySubcellNode> 01211 static void getReferenceSubcellNodes(ArraySubcellNode& subcellNodes, 01212 const int subcellDim, 01213 const int subcellOrd, 01214 const shards::CellTopology& parentCell); 01215 01216 01217 01223 static int hasReferenceCell(const shards::CellTopology & cellTopo); 01224 01225 01226 01227 //============================================================================================// 01228 // // 01229 // Debug // 01230 // // 01231 //============================================================================================// 01232 01233 01239 static void printSubcellVertices(const int subcellDim, 01240 const int subcellOrd, 01241 const shards::CellTopology & parentCell); 01242 01243 01244 01248 template<class ArrayCell> 01249 static void printWorksetSubcell(const ArrayCell & cellWorkset, 01250 const shards::CellTopology & parentCell, 01251 const int& pCellOrd, 01252 const int& subcellDim, 01253 const int& subcellOrd, 01254 const int& fieldWidth = 3); 01255 01256 }; // class CellTools 01257 01258 } // namespace Intrepid 01259 01260 // include templated function definitions 01261 01262 #include "Intrepid_CellToolsDef.hpp" 01263 01264 #endif 01265 01266 /*************************************************************************************************** 01267 ** ** 01268 ** D O C U M E N T A T I O N P A G E S ** 01269 ** ** 01270 **************************************************************************************************/ 01271
1.7.6.1