fe_map.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 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 
19 
20 #ifndef LIBMESH_FE_MAP_H
21 #define LIBMESH_FE_MAP_H
22 
24 #include "libmesh/point.h"
25 #include "libmesh/vector_value.h"
26 #include "libmesh/enum_elem_type.h"
27 #include "libmesh/fe_type.h"
28 #include "libmesh/auto_ptr.h"
29 
30 namespace libMesh
31 {
32 
33 // forward declarations
34 class Elem;
35 
36  class FEMap
37  {
38  public:
39 
40  FEMap();
41  virtual ~FEMap(){}
42 
43  static AutoPtr<FEMap> build(FEType fe_type);
44 
45  template<unsigned int Dim>
46  void init_reference_to_physical_map(const std::vector<Point>& qp,
47  const Elem* elem);
48 
53  void compute_single_point_map(const unsigned int dim,
54  const std::vector<Real>& qw,
55  const Elem* elem,
56  unsigned int p);
57 
64  virtual void compute_affine_map(const unsigned int dim,
65  const std::vector<Real>& qw,
66  const Elem* elem);
67 
73  virtual void compute_map(const unsigned int dim,
74  const std::vector<Real>& qw,
75  const Elem* elem);
76 
80  virtual void compute_face_map(int dim,
81  const std::vector<Real>& qw,
82  const Elem* side);
83 
87  void compute_edge_map(int dim,
88  const std::vector<Real>& qw,
89  const Elem* side);
90 
95  template< unsigned int Dim>
96  void init_face_shape_functions(const std::vector<Point>& qp,
97  const Elem* side);
98 
103  template< unsigned int Dim>
104  void init_edge_shape_functions(const std::vector<Point>& qp,
105  const Elem* edge);
106 
111  const std::vector<Point>& get_xyz() const
112  { return xyz; }
113 
117  const std::vector<Real>& get_jacobian() const
118  { return jac; }
119 
124  const std::vector<Real>& get_JxW() const
125  { return JxW; }
126 
131  const std::vector<RealGradient>& get_dxyzdxi() const
132  { return dxyzdxi_map; }
133 
138  const std::vector<RealGradient>& get_dxyzdeta() const
139  { return dxyzdeta_map; }
140 
145  const std::vector<RealGradient>& get_dxyzdzeta() const
146  { return dxyzdzeta_map; }
147 
151  const std::vector<RealGradient>& get_d2xyzdxi2() const
152  { return d2xyzdxi2_map; }
153 
157  const std::vector<RealGradient>& get_d2xyzdeta2() const
158  { return d2xyzdeta2_map; }
159 
160 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
161 
165  const std::vector<RealGradient>& get_d2xyzdzeta2() const
166  { return d2xyzdzeta2_map; }
167 
168 #endif
169 
173  const std::vector<RealGradient>& get_d2xyzdxideta() const
174  { return d2xyzdxideta_map; }
175 
176 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
177 
181  const std::vector<RealGradient>& get_d2xyzdxidzeta() const
182  { return d2xyzdxidzeta_map; }
183 
187  const std::vector<RealGradient>& get_d2xyzdetadzeta() const
188  { return d2xyzdetadzeta_map; }
189 
190 #endif
191 
196  const std::vector<Real>& get_dxidx() const
197  { return dxidx_map; }
198 
203  const std::vector<Real>& get_dxidy() const
204  { return dxidy_map; }
205 
210  const std::vector<Real>& get_dxidz() const
211  { return dxidz_map; }
212 
217  const std::vector<Real>& get_detadx() const
218  { return detadx_map; }
219 
224  const std::vector<Real>& get_detady() const
225  { return detady_map; }
226 
231  const std::vector<Real>& get_detadz() const
232  { return detadz_map; }
233 
238  const std::vector<Real>& get_dzetadx() const
239  { return dzetadx_map; }
240 
245  const std::vector<Real>& get_dzetady() const
246  { return dzetady_map; }
247 
252  const std::vector<Real>& get_dzetadz() const
253  { return dzetadz_map; }
254 
258  const std::vector<std::vector<Real> >& get_psi() const
259  { return psi_map; }
260 
264  const std::vector<std::vector<Real> >& get_phi_map() const
265  { return phi_map; }
266 
270  const std::vector<std::vector<Real> >& get_dphidxi_map() const
271  { return dphidxi_map; }
272 
276  const std::vector<std::vector<Real> >& get_dphideta_map() const
277  { return dphideta_map; }
278 
282  const std::vector<std::vector<Real> >& get_dphidzeta_map() const
283  { return dphidzeta_map; }
284 
288  const std::vector<std::vector<Point> >& get_tangents() const
289  { return tangents; }
290 
294  const std::vector<Point>& get_normals() const
295  { return normals; }
296 
300  const std::vector<Real>& get_curvatures() const
301  { return curvatures;}
302 
306  void print_JxW(std::ostream& os) const;
307 
312  void print_xyz(std::ostream& os) const;
313 
314  /* FIXME: PB: The public functions below break encapsulation! I'm not happy
315  about it, but I don't have time to redo the infinite element routines.
316  These are needed in inf_fe_boundary.C and inf_fe.C. A proper implementation
317  would subclass this class and hide all the radial function business. */
321  std::vector<std::vector<Real> >& get_psi()
322  { return psi_map; }
323 
327  std::vector<std::vector<Real> >& get_dpsidxi()
328  { return dpsidxi_map; }
329 
333  std::vector<std::vector<Real> >& get_dpsideta()
334  { return dpsideta_map; }
335 
339  std::vector<std::vector<Real> >& get_d2psidxi2()
340  { return d2psidxi2_map; }
341 
345  std::vector<std::vector<Real> >& get_d2psidxideta()
346  { return d2psidxideta_map; }
347 
351  std::vector<std::vector<Real> >& get_d2psideta2()
352  { return d2psideta2_map; }
353 
357  std::vector<std::vector<Real> >& get_phi_map()
358  { return phi_map; }
359 
363  std::vector<std::vector<Real> >& get_dphidxi_map()
364  { return dphidxi_map; }
365 
369  std::vector<std::vector<Real> >& get_dphideta_map()
370  { return dphideta_map; }
371 
375  std::vector<std::vector<Real> >& get_dphidzeta_map()
376  { return dphidzeta_map; }
377 
378 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
379 
382  std::vector<std::vector<Real> >& get_d2phidxi2_map()
383  { return d2phidxi2_map; }
384 
388  std::vector<std::vector<Real> >& get_d2phidxideta_map()
389  { return d2phidxideta_map; }
390 
394  std::vector<std::vector<Real> >& get_d2phidxidzeta_map()
395  { return d2phidxidzeta_map; }
396 
400  std::vector<std::vector<Real> >& get_d2phideta2_map()
401  { return d2phideta2_map; }
402 
406  std::vector<std::vector<Real> >& get_d2phidetadzeta_map()
407  { return d2phidetadzeta_map; }
408 
412  std::vector<std::vector<Real> >& get_d2phidzeta2_map()
413  { return d2phidzeta2_map; }
414 #endif
415 
416  /* FIXME: PB: This function breaks encapsulation! Needed in FE<>::reinit and
417  InfFE<>::reinit. Not sure yet if the algorithm can be redone to avoid this. */
422  std::vector<Real>& get_JxW()
423  { return JxW; }
424 
425  protected:
426 
430  void resize_quadrature_map_vectors(const unsigned int dim, unsigned int n_qp);
431 
437  Real dxdxi_map(const unsigned int p) const { return dxyzdxi_map[p](0); }
438 
444  Real dydxi_map(const unsigned int p) const { return dxyzdxi_map[p](1); }
445 
451  Real dzdxi_map(const unsigned int p) const { return dxyzdxi_map[p](2); }
452 
458  Real dxdeta_map(const unsigned int p) const { return dxyzdeta_map[p](0); }
459 
465  Real dydeta_map(const unsigned int p) const { return dxyzdeta_map[p](1); }
466 
472  Real dzdeta_map(const unsigned int p) const { return dxyzdeta_map[p](2); }
473 
479  Real dxdzeta_map(const unsigned int p) const { return dxyzdzeta_map[p](0); }
480 
486  Real dydzeta_map(const unsigned int p) const { return dxyzdzeta_map[p](1); }
487 
493  Real dzdzeta_map(const unsigned int p) const { return dxyzdzeta_map[p](2); }
494 
498  std::vector<Point> xyz;
499 
504  std::vector<RealGradient> dxyzdxi_map;
505 
510  std::vector<RealGradient> dxyzdeta_map;
511 
516  std::vector<RealGradient> dxyzdzeta_map;
517 
522  std::vector<RealGradient> d2xyzdxi2_map;
523 
528  std::vector<RealGradient> d2xyzdxideta_map;
529 
534  std::vector<RealGradient> d2xyzdeta2_map;
535 
536 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
537 
542  std::vector<RealGradient> d2xyzdxidzeta_map;
543 
548  std::vector<RealGradient> d2xyzdetadzeta_map;
549 
554  std::vector<RealGradient> d2xyzdzeta2_map;
555 
556 #endif
557 
562  std::vector<Real> dxidx_map;
563 
568  std::vector<Real> dxidy_map;
569 
574  std::vector<Real> dxidz_map;
575 
576 
581  std::vector<Real> detadx_map;
582 
587  std::vector<Real> detady_map;
588 
593  std::vector<Real> detadz_map;
594 
595 
600  std::vector<Real> dzetadx_map;
601 
606  std::vector<Real> dzetady_map;
607 
612  std::vector<Real> dzetadz_map;
613 
617  std::vector<std::vector<Real> > phi_map;
618 
622  std::vector<std::vector<Real> > dphidxi_map;
623 
627  std::vector<std::vector<Real> > dphideta_map;
628 
632  std::vector<std::vector<Real> > dphidzeta_map;
633 
634 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
635 
639  std::vector<std::vector<Real> > d2phidxi2_map;
640 
644  std::vector<std::vector<Real> > d2phidxideta_map;
645 
649  std::vector<std::vector<Real> > d2phidxidzeta_map;
650 
654  std::vector<std::vector<Real> > d2phideta2_map;
655 
659  std::vector<std::vector<Real> > d2phidetadzeta_map;
660 
664  std::vector<std::vector<Real> > d2phidzeta2_map;
665 
666 #endif
667 
671  std::vector<std::vector<Real> > psi_map;
672 
677  std::vector<std::vector<Real> > dpsidxi_map;
678 
683  std::vector<std::vector<Real> > dpsideta_map;
684 
690  std::vector<std::vector<Real> > d2psidxi2_map;
691 
697  std::vector<std::vector<Real> > d2psidxideta_map;
698 
704  std::vector<std::vector<Real> > d2psideta2_map;
705 
709  std::vector<std::vector<Point> > tangents;
710 
714  std::vector<Point> normals;
715 
721  std::vector<Real> curvatures;
722 
726  std::vector<Real> jac;
727 
731  std::vector<Real> JxW;
732  };
733 
734 }
735 
736 #endif // LIBMESH_FE_MAP_H

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:05 UTC

Hosted By:
SourceForge.net Logo