GetFEM++  5.3
getfem_torus.h
Go to the documentation of this file.
1 /* -*- c++ -*- (enables emacs c++ mode) */
2 /*===========================================================================
3 
4  Copyright (C) 2014-2017 Liang Jin Lim
5 
6  This file is a part of GetFEM++
7 
8  GetFEM++ is free software; you can redistribute it and/or modify it
9  under the terms of the GNU Lesser General Public License as published
10  by the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version along with the GCC Runtime Library
12  Exception either version 3.1 or (at your option) any later version.
13  This program is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16  License and GCC Runtime Library Exception for more details.
17  You should have received a copy of the GNU Lesser General Public License
18  along with this program; if not, write to the Free Software Foundation,
19  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20 
21  As a special exception, you may use this file as it is a part of a free
22  software library without restriction. Specifically, if other files
23  instantiate templates or use macros or inline functions from this file,
24  or you compile this file and link it with other files to produce an
25  executable, this file does not by itself cause the resulting executable
26  to be covered by the GNU Lesser General Public License. This exception
27  does not however invalidate any other reasons why the executable file
28  might be covered by the GNU Lesser General Public License.
29 
30 ===========================================================================*/
31 /**
32 @file getfem_torus.h
33 @brief Provides mesh and mesh fem of torus.
34 @date May 2014
35 @author Liang Jin Lim
36 */
37 
38 #pragma once
39 
40 #ifndef GETFEM_TORUS_H__
41 #define GETFEM_TORUS_H__
42 
43 #include "getfem/getfem_mesh_fem.h"
44 
45 namespace getfem
46 {
47  /**Torus fem, the real grad base value is modified to compute radial grad of F/R.
48  It stores a reference to the original fem object. By default, torus_fem is vectorial.
49  There is an option to change it to a scalar form through set_to_scalar(bool is_scalar).
50  torus_mesh_fem will automatically check qdim of itself and set the form accordingly.
51  */
52  class torus_fem : public virtual_fem{
53 
54  public :
55  virtual size_type index_of_global_dof(size_type cv, size_type i) const;
56  void base_value(const base_node &, base_tensor &) const;
57  void grad_base_value(const base_node &, base_tensor &) const;
58  void hess_base_value(const base_node &, base_tensor &) const;
60  base_tensor &t, bool = true) const;
62  base_tensor &t, bool = true) const;
64  base_tensor &, bool = true) const;
65 
66  pfem get_original_pfem() const;
67 
68  torus_fem(pfem pf) : virtual_fem(*pf), poriginal_fem_(pf), is_scalar_(false){
69  init();
70  }
71 
72  void set_to_scalar(bool is_scalar);
73 
74  protected :
75  void init();
76 
77  private :
78  pfem poriginal_fem_;
79  bool is_scalar_;
80  };
81 
82  /**Copy an original 2D mesh to become a torus mesh with radial dimension.*/
83  class torus_mesh : public mesh
84  {
85  private:
86  bool is_adapted_;
87 
88  public:
89  torus_mesh(std::string name = std::string());
90  virtual scalar_type convex_radius_estimate(size_type ic) const;
91 
92  void adapt();
93  void adapt(const getfem::mesh &original_mesh);
94  };
95 
96  /**Mesh fem object that adapts */
97  class torus_mesh_fem : public mesh_fem{
98  public:
99 
100  torus_mesh_fem(const torus_mesh &mesh, bgeot::dim_type dim) : mesh_fem(mesh, dim){}
101  void enumerate_dof(void) const;
102 
103  private:
104  void adapt_to_torus_();
105  void del_torus_fem_();
106  };
107 
108 }
109 
110 #endif /* GETFEM_TORUS_H__ */
Torus fem, the real grad base value is modified to compute radial grad of F/R.
Definition: getfem_torus.h:52
void real_hess_base_value(const fem_interpolation_context &, base_tensor &, bool=true) const
Give the hessian of all components of the base functions at the current point of the fem_interpolatio...
Base class for finite element description.
Definition: getfem_fem.h:250
dim_type dim() const
dimension of the reference element.
Definition: getfem_fem.h:306
Define the getfem::mesh_fem class.
Describe a mesh (collection of convexes (elements) and points).
Definition: getfem_mesh.h:95
size_t size_type
used as the common size type in the library
Definition: bgeot_poly.h:49
void hess_base_value(const base_node &, base_tensor &) const
Give the value of all hessians (on ref.
Definition: getfem_torus.cc:65
Copy an original 2D mesh to become a torus mesh with radial dimension.
Definition: getfem_torus.h:83
structure passed as the argument of fem interpolation functions.
Definition: getfem_fem.h:741
GEneric Tool for Finite Element Methods.
void real_grad_base_value(const fem_interpolation_context &c, base_tensor &t, bool=true) const
Give the gradient of all components of the base functions at the current point of the fem_interpolati...
scalar_type APIDECL convex_radius_estimate(bgeot::pgeometric_trans pgt, const base_matrix &pts)
rough estimate of the radius of the convex using the largest eigenvalue of the jacobian of the geomet...
Definition: getfem_mesh.cc:756
std::shared_ptr< const getfem::virtual_fem > pfem
type of pointer on a fem description
Definition: getfem_fem.h:239
Describe a finite element method linked to a mesh.
void real_base_value(const fem_interpolation_context &c, base_tensor &t, bool=true) const
Give the value of all components of the base functions at the current point of the fem_interpolation_...
Definition: getfem_torus.cc:69
Mesh fem object that adapts.
Definition: getfem_torus.h:97
void grad_base_value(const base_node &, base_tensor &) const
Give the value of all gradients (on ref.
Definition: getfem_torus.cc:62
void base_value(const base_node &, base_tensor &) const
Give the value of all components of the base functions at the point x of the reference element...
Definition: getfem_torus.cc:59