Line data Source code
1 : // The libMesh Finite Element Library. 2 : // Copyright (C) 2002-2025 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner 3 : 4 : // This library is free software; you can redistribute it and/or 5 : // modify it under the terms of the GNU Lesser General Public 6 : // License as published by the Free Software Foundation; either 7 : // version 2.1 of the License, or (at your option) any later version. 8 : 9 : // This library is distributed in the hope that it will be useful, 10 : // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 : // Lesser General Public License for more details. 13 : 14 : // You should have received a copy of the GNU Lesser General Public 15 : // License along with this library; if not, write to the Free Software 16 : // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 : 18 : #ifndef LIBMESH_FE_TRANSFORMATION_BASE_H 19 : #define LIBMESH_FE_TRANSFORMATION_BASE_H 20 : 21 : #include "libmesh/fe_base.h" 22 : 23 : namespace libMesh 24 : { 25 : 26 : //Forward Declarations 27 : template<typename T> class FEGenericBase; 28 : template<typename T> class H1FETransformation; 29 : template<typename T> class HCurlFETransformation; 30 : template<typename T> class HDivFETransformation; 31 : class FEType; 32 : 33 : /** 34 : * This class handles the computation of the shape functions in the physical domain. 35 : * Derived classes implement the particular mapping: H1, HCurl, HDiv, or L2. This 36 : * class assumes the \p FEGenericBase object has been initialized in the reference 37 : * domain (i.e. init_shape_functions has been called). 38 : * 39 : * \author Paul T. Bauman 40 : * \date 2012 41 : */ 42 : template<typename OutputShape> 43 : class FETransformationBase 44 : { 45 : public: 46 : 47 869640 : FETransformationBase() = default; 48 869640 : virtual ~FETransformationBase() = default; 49 : 50 : /** 51 : * Builds an FETransformation object based on the finite element type 52 : */ 53 : static std::unique_ptr<FETransformationBase<OutputShape>> build(const FEType & type); 54 : 55 : /** 56 : * Pre-requests any necessary data from FEMap 57 : */ 58 : virtual void init_map_phi(const FEGenericBase<OutputShape> & fe) const = 0; 59 : 60 : /** 61 : * Pre-requests any necessary data from FEMap 62 : */ 63 : virtual void init_map_dphi(const FEGenericBase<OutputShape> & fe) const = 0; 64 : 65 : /** 66 : * Pre-requests any necessary data from FEMap 67 : */ 68 : virtual void init_map_d2phi(const FEGenericBase<OutputShape> & fe) const = 0; 69 : 70 : /** 71 : * Evaluates shape functions in physical coordinates based on proper 72 : * finite element transformation. 73 : */ 74 : virtual void map_phi(const unsigned int dim, 75 : const Elem * const elem, 76 : const std::vector<Point> & qp, 77 : const FEGenericBase<OutputShape> & fe, 78 : std::vector<std::vector<OutputShape>> & phi, 79 : bool add_p_level = true) const = 0; 80 : 81 : /** 82 : * Evaluates shape function gradients in physical coordinates based on proper 83 : * finite element transformation. 84 : */ 85 : virtual void map_dphi(const unsigned int dim, 86 : const Elem * const elem, 87 : const std::vector<Point> & qp, 88 : const FEGenericBase<OutputShape> & fe, 89 : std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputGradient>> & dphi, 90 : std::vector<std::vector<OutputShape>> & dphidx, 91 : std::vector<std::vector<OutputShape>> & dphidy, 92 : std::vector<std::vector<OutputShape>> & dphidz) const = 0; 93 : 94 : #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 95 : /** 96 : * Evaluates shape function Hessians in physical coordinates based on proper 97 : * finite element transformation. 98 : */ 99 : virtual void map_d2phi(const unsigned int dim, 100 : const std::vector<Point> & qp, 101 : const FEGenericBase<OutputShape> & fe, 102 : std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputTensor>> & d2phi, 103 : std::vector<std::vector<OutputShape>> & d2phidx2, 104 : std::vector<std::vector<OutputShape>> & d2phidxdy, 105 : std::vector<std::vector<OutputShape>> & d2phidxdz, 106 : std::vector<std::vector<OutputShape>> & d2phidy2, 107 : std::vector<std::vector<OutputShape>> & d2phidydz, 108 : std::vector<std::vector<OutputShape>> & d2phidz2) const = 0; 109 : #endif //LIBMESH_ENABLE_SECOND_DERIVATIVES 110 : 111 : 112 : /** 113 : * Evaluates the shape function curl in physical coordinates based on proper 114 : * finite element transformation. 115 : */ 116 : virtual void map_curl(const unsigned int dim, 117 : const Elem * const elem, 118 : const std::vector<Point> & qp, 119 : const FEGenericBase<OutputShape> & fe, 120 : std::vector<std::vector<OutputShape>> & curl_phi) const = 0; 121 : 122 : /** 123 : * Evaluates the shape function divergence in physical coordinates based on proper 124 : * finite element transformation. 125 : */ 126 : virtual void map_div(const unsigned int dim, 127 : const Elem * const elem, 128 : const std::vector<Point> & qp, 129 : const FEGenericBase<OutputShape> & fe, 130 : std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputDivergence>> & div_phi) const = 0; 131 : 132 : }; // class FETransformationBase 133 : 134 : } 135 : 136 : #endif // LIBMESH_FE_TRANSFORMATION_BASE_H