GetFEM  5.4.2
getfem_torus.h
Go to the documentation of this file.
1 /* -*- c++ -*- (enables emacs c++ mode) */
2 /*===========================================================================
3 
4  Copyright (C) 2014-2020 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__ */
getfem::torus_fem::real_grad_base_value
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...
Definition: getfem_torus.cc:100
getfem::torus_fem::hess_base_value
void hess_base_value(const base_node &, base_tensor &) const
Give the value of all hessians (on ref.
Definition: getfem_torus.cc:65
bgeot::size_type
size_t size_type
used as the common size type in the library
Definition: bgeot_poly.h:49
getfem::torus_mesh_fem
Mesh fem object that adapts.
Definition: getfem_torus.h:97
getfem::virtual_fem
Base class for finite element description.
Definition: getfem_fem.h:255
getfem::mesh_fem
Describe a finite element method linked to a mesh.
Definition: getfem_mesh_fem.h:148
getfem
GEneric Tool for Finite Element Methods.
Definition: getfem_accumulated_distro.h:46
getfem::fem_interpolation_context
structure passed as the argument of fem interpolation functions.
Definition: getfem_fem.h:749
getfem::torus_mesh
Copy an original 2D mesh to become a torus mesh with radial dimension.
Definition: getfem_torus.h:83
getfem_mesh_fem.h
Define the getfem::mesh_fem class.
getfem::torus_fem
Torus fem, the real grad base value is modified to compute radial grad of F/R.
Definition: getfem_torus.h:52
getfem::pfem
std::shared_ptr< const getfem::virtual_fem > pfem
type of pointer on a fem description
Definition: getfem_fem.h:244
getfem::torus_fem::grad_base_value
void grad_base_value(const base_node &, base_tensor &) const
Give the value of all gradients (on ref.
Definition: getfem_torus.cc:62
getfem::torus_mesh::convex_radius_estimate
virtual scalar_type convex_radius_estimate(size_type ic) const
Return an estimate of the convex largest dimension.
Definition: getfem_torus.cc:228
getfem::torus_fem::base_value
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
getfem::torus_fem::real_hess_base_value
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...
Definition: getfem_torus.cc:143
getfem::torus_mesh_fem::enumerate_dof
void enumerate_dof(void) const
Renumber the degrees of freedom.
Definition: getfem_torus.cc:211
getfem::mesh
Describe a mesh (collection of convexes (elements) and points).
Definition: getfem_mesh.h:95
getfem::torus_fem::real_base_value
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