$extrastylesheet
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_MAP_H 00021 #define LIBMESH_FE_MAP_H 00022 00023 #include "libmesh/reference_counted_object.h" 00024 #include "libmesh/point.h" 00025 #include "libmesh/vector_value.h" 00026 #include "libmesh/enum_elem_type.h" 00027 #include "libmesh/fe_type.h" 00028 #include "libmesh/auto_ptr.h" 00029 #include "libmesh/node.h" 00030 00031 namespace libMesh 00032 { 00033 00034 // forward declarations 00035 class Elem; 00036 00037 class FEMap 00038 { 00039 public: 00040 00041 FEMap(); 00042 virtual ~FEMap(){} 00043 00044 static UniquePtr<FEMap> build(FEType fe_type); 00045 00046 template<unsigned int Dim> 00047 void init_reference_to_physical_map(const std::vector<Point>& qp, 00048 const Elem* elem); 00049 00057 void compute_single_point_map(const unsigned int dim, 00058 const std::vector<Real>& qw, 00059 const Elem* elem, 00060 unsigned int p, 00061 const std::vector<Node*>& elem_nodes); 00062 00069 virtual void compute_affine_map(const unsigned int dim, 00070 const std::vector<Real>& qw, 00071 const Elem* elem); 00072 00078 virtual void compute_null_map(const unsigned int dim, 00079 const std::vector<Real>& qw); 00080 00081 00087 virtual void compute_map(const unsigned int dim, 00088 const std::vector<Real>& qw, 00089 const Elem* elem); 00090 00094 virtual void compute_face_map(int dim, 00095 const std::vector<Real>& qw, 00096 const Elem* side); 00097 00101 void compute_edge_map(int dim, 00102 const std::vector<Real>& qw, 00103 const Elem* side); 00104 00109 template< unsigned int Dim> 00110 void init_face_shape_functions(const std::vector<Point>& qp, 00111 const Elem* side); 00112 00117 template< unsigned int Dim> 00118 void init_edge_shape_functions(const std::vector<Point>& qp, 00119 const Elem* edge); 00120 00125 const std::vector<Point>& get_xyz() const 00126 { return xyz; } 00127 00131 const std::vector<Real>& get_jacobian() const 00132 { return jac; } 00133 00138 const std::vector<Real>& get_JxW() const 00139 { return JxW; } 00140 00145 const std::vector<RealGradient>& get_dxyzdxi() const 00146 { return dxyzdxi_map; } 00147 00152 const std::vector<RealGradient>& get_dxyzdeta() const 00153 { return dxyzdeta_map; } 00154 00159 const std::vector<RealGradient>& get_dxyzdzeta() const 00160 { return dxyzdzeta_map; } 00161 00165 const std::vector<RealGradient>& get_d2xyzdxi2() const 00166 { return d2xyzdxi2_map; } 00167 00171 const std::vector<RealGradient>& get_d2xyzdeta2() const 00172 { return d2xyzdeta2_map; } 00173 00174 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 00175 00179 const std::vector<RealGradient>& get_d2xyzdzeta2() const 00180 { return d2xyzdzeta2_map; } 00181 00182 #endif 00183 00187 const std::vector<RealGradient>& get_d2xyzdxideta() const 00188 { return d2xyzdxideta_map; } 00189 00190 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 00191 00195 const std::vector<RealGradient>& get_d2xyzdxidzeta() const 00196 { return d2xyzdxidzeta_map; } 00197 00201 const std::vector<RealGradient>& get_d2xyzdetadzeta() const 00202 { return d2xyzdetadzeta_map; } 00203 00204 #endif 00205 00210 const std::vector<Real>& get_dxidx() const 00211 { return dxidx_map; } 00212 00217 const std::vector<Real>& get_dxidy() const 00218 { return dxidy_map; } 00219 00224 const std::vector<Real>& get_dxidz() const 00225 { return dxidz_map; } 00226 00231 const std::vector<Real>& get_detadx() const 00232 { return detadx_map; } 00233 00238 const std::vector<Real>& get_detady() const 00239 { return detady_map; } 00240 00245 const std::vector<Real>& get_detadz() const 00246 { return detadz_map; } 00247 00252 const std::vector<Real>& get_dzetadx() const 00253 { return dzetadx_map; } 00254 00259 const std::vector<Real>& get_dzetady() const 00260 { return dzetady_map; } 00261 00266 const std::vector<Real>& get_dzetadz() const 00267 { return dzetadz_map; } 00268 00272 const std::vector<std::vector<Real> >& get_psi() const 00273 { return psi_map; } 00274 00278 const std::vector<std::vector<Real> >& get_phi_map() const 00279 { return phi_map; } 00280 00284 const std::vector<std::vector<Real> >& get_dphidxi_map() const 00285 { return dphidxi_map; } 00286 00290 const std::vector<std::vector<Real> >& get_dphideta_map() const 00291 { return dphideta_map; } 00292 00296 const std::vector<std::vector<Real> >& get_dphidzeta_map() const 00297 { return dphidzeta_map; } 00298 00302 const std::vector<std::vector<Point> >& get_tangents() const 00303 { return tangents; } 00304 00308 const std::vector<Point>& get_normals() const 00309 { return normals; } 00310 00314 const std::vector<Real>& get_curvatures() const 00315 { return curvatures;} 00316 00320 void print_JxW(std::ostream& os) const; 00321 00326 void print_xyz(std::ostream& os) const; 00327 00328 /* FIXME: PB: The public functions below break encapsulation! I'm not happy 00329 about it, but I don't have time to redo the infinite element routines. 00330 These are needed in inf_fe_boundary.C and inf_fe.C. A proper implementation 00331 would subclass this class and hide all the radial function business. */ 00335 std::vector<std::vector<Real> >& get_psi() 00336 { return psi_map; } 00337 00341 std::vector<std::vector<Real> >& get_dpsidxi() 00342 { return dpsidxi_map; } 00343 00347 std::vector<std::vector<Real> >& get_dpsideta() 00348 { return dpsideta_map; } 00349 00353 std::vector<std::vector<Real> >& get_d2psidxi2() 00354 { return d2psidxi2_map; } 00355 00359 std::vector<std::vector<Real> >& get_d2psidxideta() 00360 { return d2psidxideta_map; } 00361 00365 std::vector<std::vector<Real> >& get_d2psideta2() 00366 { return d2psideta2_map; } 00367 00371 std::vector<std::vector<Real> >& get_phi_map() 00372 { return phi_map; } 00373 00377 std::vector<std::vector<Real> >& get_dphidxi_map() 00378 { return dphidxi_map; } 00379 00383 std::vector<std::vector<Real> >& get_dphideta_map() 00384 { return dphideta_map; } 00385 00389 std::vector<std::vector<Real> >& get_dphidzeta_map() 00390 { return dphidzeta_map; } 00391 00392 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 00393 00396 std::vector<std::vector<Real> >& get_d2phidxi2_map() 00397 { return d2phidxi2_map; } 00398 00402 std::vector<std::vector<Real> >& get_d2phidxideta_map() 00403 { return d2phidxideta_map; } 00404 00408 std::vector<std::vector<Real> >& get_d2phidxidzeta_map() 00409 { return d2phidxidzeta_map; } 00410 00414 std::vector<std::vector<Real> >& get_d2phideta2_map() 00415 { return d2phideta2_map; } 00416 00420 std::vector<std::vector<Real> >& get_d2phidetadzeta_map() 00421 { return d2phidetadzeta_map; } 00422 00426 std::vector<std::vector<Real> >& get_d2phidzeta2_map() 00427 { return d2phidzeta2_map; } 00428 #endif 00429 00430 /* FIXME: PB: This function breaks encapsulation! Needed in FE<>::reinit and 00431 InfFE<>::reinit. Not sure yet if the algorithm can be redone to avoid this. */ 00436 std::vector<Real>& get_JxW() 00437 { return JxW; } 00438 00439 protected: 00440 00444 void resize_quadrature_map_vectors(const unsigned int dim, unsigned int n_qp); 00445 00451 Real dxdxi_map(const unsigned int p) const { return dxyzdxi_map[p](0); } 00452 00458 Real dydxi_map(const unsigned int p) const { return dxyzdxi_map[p](1); } 00459 00465 Real dzdxi_map(const unsigned int p) const { return dxyzdxi_map[p](2); } 00466 00472 Real dxdeta_map(const unsigned int p) const { return dxyzdeta_map[p](0); } 00473 00479 Real dydeta_map(const unsigned int p) const { return dxyzdeta_map[p](1); } 00480 00486 Real dzdeta_map(const unsigned int p) const { return dxyzdeta_map[p](2); } 00487 00493 Real dxdzeta_map(const unsigned int p) const { return dxyzdzeta_map[p](0); } 00494 00500 Real dydzeta_map(const unsigned int p) const { return dxyzdzeta_map[p](1); } 00501 00507 Real dzdzeta_map(const unsigned int p) const { return dxyzdzeta_map[p](2); } 00508 00512 std::vector<Point> xyz; 00513 00518 std::vector<RealGradient> dxyzdxi_map; 00519 00524 std::vector<RealGradient> dxyzdeta_map; 00525 00530 std::vector<RealGradient> dxyzdzeta_map; 00531 00536 std::vector<RealGradient> d2xyzdxi2_map; 00537 00542 std::vector<RealGradient> d2xyzdxideta_map; 00543 00548 std::vector<RealGradient> d2xyzdeta2_map; 00549 00550 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 00551 00556 std::vector<RealGradient> d2xyzdxidzeta_map; 00557 00562 std::vector<RealGradient> d2xyzdetadzeta_map; 00563 00568 std::vector<RealGradient> d2xyzdzeta2_map; 00569 00570 #endif 00571 00576 std::vector<Real> dxidx_map; 00577 00582 std::vector<Real> dxidy_map; 00583 00588 std::vector<Real> dxidz_map; 00589 00590 00595 std::vector<Real> detadx_map; 00596 00601 std::vector<Real> detady_map; 00602 00607 std::vector<Real> detadz_map; 00608 00609 00614 std::vector<Real> dzetadx_map; 00615 00620 std::vector<Real> dzetady_map; 00621 00626 std::vector<Real> dzetadz_map; 00627 00631 std::vector<std::vector<Real> > phi_map; 00632 00636 std::vector<std::vector<Real> > dphidxi_map; 00637 00641 std::vector<std::vector<Real> > dphideta_map; 00642 00646 std::vector<std::vector<Real> > dphidzeta_map; 00647 00648 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 00649 00653 std::vector<std::vector<Real> > d2phidxi2_map; 00654 00658 std::vector<std::vector<Real> > d2phidxideta_map; 00659 00663 std::vector<std::vector<Real> > d2phidxidzeta_map; 00664 00668 std::vector<std::vector<Real> > d2phideta2_map; 00669 00673 std::vector<std::vector<Real> > d2phidetadzeta_map; 00674 00678 std::vector<std::vector<Real> > d2phidzeta2_map; 00679 00680 #endif 00681 00685 std::vector<std::vector<Real> > psi_map; 00686 00691 std::vector<std::vector<Real> > dpsidxi_map; 00692 00697 std::vector<std::vector<Real> > dpsideta_map; 00698 00704 std::vector<std::vector<Real> > d2psidxi2_map; 00705 00711 std::vector<std::vector<Real> > d2psidxideta_map; 00712 00718 std::vector<std::vector<Real> > d2psideta2_map; 00719 00723 std::vector<std::vector<Point> > tangents; 00724 00728 std::vector<Point> normals; 00729 00735 std::vector<Real> curvatures; 00736 00740 std::vector<Real> jac; 00741 00745 std::vector<Real> JxW; 00746 }; 00747 00748 } 00749 00750 #endif // LIBMESH_FE_MAP_H