$extrastylesheet
fe_interface.h
Go to the documentation of this file.
00001 // The libMesh Finite Element Library.
00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
00003 
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Lesser General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2.1 of the License, or (at your option) any later version.
00008 
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Lesser General Public License for more details.
00013 
00014 // You should have received a copy of the GNU Lesser General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 
00018 
00019 
00020 #ifndef LIBMESH_FE_INTERFACE_H
00021 #define LIBMESH_FE_INTERFACE_H
00022 
00023 // Local includes
00024 #include "libmesh/libmesh_common.h"
00025 #include "libmesh/enum_elem_type.h"
00026 #include "libmesh/vector_value.h"
00027 #include "libmesh/enum_fe_family.h"
00028 
00029 // C++ includes
00030 #include <map>
00031 #include <vector>
00032 
00033 namespace libMesh
00034 {
00035 
00036 
00037 // forward declarations
00038 class BoundaryInfo;
00039 class DofConstraints;
00040 class DofMap;
00041 class Elem;
00042 class FEType;
00043 class FEComputeData;
00044 class Point;
00045 class MeshBase;
00046 
00047 #ifdef LIBMESH_ENABLE_PERIODIC
00048 class PeriodicBoundaries;
00049 class PointLocatorBase;
00050 #endif
00051 
00061 // ------------------------------------------------------------
00062 // FEInterface class definition
00063 
00064 class FEInterface
00065 {
00066 private:
00067 
00071   FEInterface();
00072 
00073 public:
00074 
00078   virtual ~FEInterface() {}
00079 
00087   static unsigned int n_shape_functions(const unsigned int dim,
00088                                         const FEType& fe_t,
00089                                         const ElemType t);
00090 
00098   static unsigned int n_dofs(const unsigned int dim,
00099                              const FEType& fe_t,
00100                              const ElemType t);
00101 
00109   static unsigned int n_dofs_at_node(const unsigned int dim,
00110                                      const FEType& fe_t,
00111                                      const ElemType t,
00112                                      const unsigned int n);
00113 
00121   static unsigned int n_dofs_per_elem(const unsigned int dim,
00122                                       const FEType& fe_t,
00123                                       const ElemType t);
00124 
00132   static void dofs_on_side(const Elem* const elem,
00133                            const unsigned int dim,
00134                            const FEType& fe_t,
00135                            unsigned int s,
00136                            std::vector<unsigned int>& di);
00137 
00145   static void dofs_on_edge(const Elem* const elem,
00146                            const unsigned int dim,
00147                            const FEType& fe_t,
00148                            unsigned int e,
00149                            std::vector<unsigned int>& di);
00150 
00162   static void nodal_soln(const unsigned int dim,
00163                          const FEType& fe_t,
00164                          const Elem* elem,
00165                          const std::vector<Number>& elem_soln,
00166                          std::vector<Number>& nodal_soln);
00167 
00172   static Point map(unsigned int dim,
00173                    const FEType& fe_t,
00174                    const Elem* elem,
00175                    const Point& p);
00176 
00186   static Point inverse_map (const unsigned int dim,
00187                             const FEType& fe_t,
00188                             const Elem* elem,
00189                             const Point& p,
00190                             const Real tolerance = TOLERANCE,
00191                             const bool secure = true);
00192 
00204   static void  inverse_map (const unsigned int dim,
00205                             const FEType& fe_t,
00206                             const Elem* elem,
00207                             const std::vector<Point>& physical_points,
00208                             std::vector<Point>&       reference_points,
00209                             const Real tolerance = TOLERANCE,
00210                             const bool secure = true);
00211 
00220   static bool on_reference_element(const Point& p,
00221                                    const ElemType t,
00222                                    const Real eps=TOLERANCE);
00231   static Real shape(const unsigned int dim,
00232                     const FEType& fe_t,
00233                     const ElemType t,
00234                     const unsigned int i,
00235                     const Point& p);
00236 
00245   static Real shape(const unsigned int dim,
00246                     const FEType& fe_t,
00247                     const Elem* elem,
00248                     const unsigned int i,
00249                     const Point& p);
00250 
00259   template< typename OutputType>
00260   static void shape(const unsigned int dim,
00261                     const FEType& fe_t,
00262                     const ElemType t,
00263                     const unsigned int i,
00264                     const Point& p,
00265                     OutputType& phi);
00266 
00275   template< typename OutputType>
00276   static void shape(const unsigned int dim,
00277                     const FEType& fe_t,
00278                     const Elem* elem,
00279                     const unsigned int i,
00280                     const Point& p,
00281                     OutputType& phi);
00282 
00292   static void compute_data(const unsigned int dim,
00293                            const FEType& fe_t,
00294                            const Elem* elem,
00295                            FEComputeData& data);
00296 
00297 #ifdef LIBMESH_ENABLE_AMR
00298 
00303   static void compute_constraints (DofConstraints &constraints,
00304                                    DofMap &dof_map,
00305                                    const unsigned int variable_number,
00306                                    const Elem* elem);
00307 #endif // #ifdef LIBMESH_ENABLE_AMR
00308 
00309 #ifdef LIBMESH_ENABLE_PERIODIC
00310 
00315   static void compute_periodic_constraints (DofConstraints &constraints,
00316                                             DofMap &dof_map,
00317                                             const PeriodicBoundaries &boundaries,
00318                                             const MeshBase &mesh,
00319                                             const PointLocatorBase* point_locator,
00320                                             const unsigned int variable_number,
00321                                             const Elem* elem);
00322 #endif // #ifdef LIBMESH_ENABLE_PERIODIC
00323 
00328   static unsigned int max_order (const FEType& fe_t,
00329                                  const ElemType& el_t);
00330 
00335   static bool extra_hanging_dofs (const FEType& fe_t);
00336 
00341   static FEFieldType field_type( const FEType& fe_type );
00342 
00347   static FEFieldType field_type( const FEFamily& fe_family );
00348 
00353   static unsigned int n_vec_dim( const MeshBase& mesh, const FEType& fe_type );
00354 
00355 private:
00356 
00357 
00364   static bool is_InfFE_elem(const ElemType et);
00365 
00366 
00367 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
00368 
00369   // ------------------------------------------------------------
00370   /*
00371    * All these private members do the same as their public
00372    * counterparts, but for infinite elements. This dis-entangles
00373    * the calls to \p FE and \p InfFE.
00374    */
00375 
00376   static unsigned int ifem_n_shape_functions(const unsigned int dim,
00377                                              const FEType& fe_t,
00378                                              const ElemType t);
00379 
00380   static unsigned int ifem_n_dofs(const unsigned int dim,
00381                                   const FEType& fe_t,
00382                                   const ElemType t);
00383 
00384   static unsigned int ifem_n_dofs_at_node(const unsigned int dim,
00385                                           const FEType& fe_t,
00386                                           const ElemType t,
00387                                           const unsigned int n);
00388 
00389   static unsigned int ifem_n_dofs_per_elem(const unsigned int dim,
00390                                            const FEType& fe_t,
00391                                            const ElemType t);
00392 
00393   static void ifem_nodal_soln(const unsigned int dim,
00394                               const FEType& fe_t,
00395                               const Elem* elem,
00396                               const std::vector<Number>& elem_soln,
00397                               std::vector<Number>& nodal_soln);
00398 
00399   static Point ifem_inverse_map (const unsigned int dim,
00400                                  const FEType& fe_t,
00401                                  const Elem* elem,
00402                                  const Point& p,
00403                                  const Real tolerance = TOLERANCE,
00404                                  const bool secure = true);
00405 
00406   static void ifem_inverse_map (const unsigned int dim,
00407                                 const FEType& fe_t,
00408                                 const Elem* elem,
00409                                 const std::vector<Point>& physical_points,
00410                                 std::vector<Point>&       reference_points,
00411                                 const Real tolerance = TOLERANCE,
00412                                 const bool secure = true);
00413 
00414 
00415   static bool ifem_on_reference_element(const Point& p,
00416                                         const ElemType t,
00417                                         const Real eps);
00418 
00419   static Real ifem_shape(const unsigned int dim,
00420                          const FEType& fe_t,
00421                          const ElemType t,
00422                          const unsigned int i,
00423                          const Point& p);
00424 
00425   static Real ifem_shape(const unsigned int dim,
00426                          const FEType& fe_t,
00427                          const Elem* elem,
00428                          const unsigned int i,
00429                          const Point& p);
00430 
00431   static void ifem_compute_data(const unsigned int dim,
00432                                 const FEType& fe_t,
00433                                 const Elem* elem,
00434                                 FEComputeData& data);
00435 
00436 #endif
00437 
00438 
00439 };
00440 
00441 
00442 
00443 
00444 
00445 // ------------------------------------------------------------
00446 // FEInterface class inline members
00447 #ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS
00448 
00449 inline bool FEInterface::is_InfFE_elem(const ElemType)
00450 {
00451   return false;
00452 }
00453 
00454 #else
00455 
00456 inline bool FEInterface::is_InfFE_elem(const ElemType et)
00457 {
00458 
00459   switch (et)
00460     {
00461     case INFEDGE2:
00462     case INFQUAD4:
00463     case INFQUAD6:
00464     case INFHEX8:
00465     case INFHEX16:
00466     case INFHEX18:
00467     case INFPRISM6:
00468     case INFPRISM12:
00469       {
00470         return true;
00471       }
00472 
00473     default:
00474       {
00475         return false;
00476       }
00477     }
00478 }
00479 
00480 #endif //ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS
00481 
00482 
00483 
00484 } // namespace libMesh
00485 
00486 
00487 
00488 
00489 #endif // LIBMESH_FE_INTERFACE_H