GetFEM  5.4.2
getfem_fem_global_function.h
Go to the documentation of this file.
1 /* -*- c++ -*- (enables emacs c++ mode) */
2 /*===========================================================================
3 
4  Copyright (C) 2004-2020 Yves Renard
5  Copyright (C) 2016-2020 Konstantinos Poulios
6 
7  This file is a part of GetFEM
8 
9  GetFEM is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Lesser General Public License as published
11  by the Free Software Foundation; either version 3 of the License, or
12  (at your option) any later version along with the GCC Runtime Library
13  Exception either version 3.1 or (at your option) any later version.
14  This program is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17  License and GCC Runtime Library Exception for more details.
18  You should have received a copy of the GNU Lesser General Public License
19  along with this program; if not, write to the Free Software Foundation,
20  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
21 
22  As a special exception, you may use this file as it is a part of a free
23  software library without restriction. Specifically, if other files
24  instantiate templates or use macros or inline functions from this file,
25  or you compile this file and link it with other files to produce an
26  executable, this file does not by itself cause the resulting executable
27  to be covered by the GNU Lesser General Public License. This exception
28  does not however invalidate any other reasons why the executable file
29  might be covered by the GNU Lesser General Public License.
30 
31 ===========================================================================*/
32 
33 /**@file getfem_fem_global_function.h
34  @author Yves Renard <Yves.Renard@insa-lyon.fr>, J. Pommier
35  @date March, 2005.
36  @brief Define mesh_fem whose base functions are global function given by the user.
37 */
38 #ifndef GETFEM_FEM_GLOBAL_FUNCTION_H__
39 #define GETFEM_FEM_GLOBAL_FUNCTION_H__
40 
41 #include "getfem_fem.h"
42 #include "getfem_mesh_fem.h"
43 #include "getfem_global_function.h"
44 
45 namespace getfem {
46 
47  /// fem object with global basis functions.
49  protected :
50  std::vector<pglobal_function> functions;
51  const mesh &m;
52  const mesh_im &mim;
53  const bool has_mesh_im;
54 
55  mutable std::vector<std::vector<size_type> > index_of_global_dof_;
56  mutable bgeot::pstored_point_tab pspt_override;
57 
58  struct precomp_data { std::vector<base_tensor> val, grad, hess; };
59 
60  class precomp_pool
61  : virtual public dal::static_stored_object,
62  public std::vector< std::map<bgeot::pstored_point_tab,
63  precomp_data > >
64  {};
65 
66  // store values, gradients and hessians of base functions
67  mutable std::shared_ptr<precomp_pool> precomps;
68 
69  DAL_SIMPLE_KEY(precomp_pool_key, std::shared_ptr<precomp_pool>);
70 
71  void init();
72  virtual void update_from_context() const;
73  public :
74  virtual size_type nb_dof(size_type cv) const;
75  virtual size_type index_of_global_dof(size_type cv, size_type i) const;
76  virtual bgeot::pconvex_ref ref_convex(size_type cv) const;
77  virtual const bgeot::convex<base_node> &node_convex(size_type cv) const;
78  virtual bgeot::pstored_point_tab node_tab(size_type) const
79  { return pspt_override; }
80 
81  void base_value(const base_node &, base_tensor &) const;
82  void grad_base_value(const base_node &, base_tensor &) const;
83  void hess_base_value(const base_node &, base_tensor &) const;
84 
86  base_tensor &t, bool = true) const;
88  base_tensor &t, bool = true) const;
90  base_tensor &, bool = true) const;
91 
92  fem_global_function(const std::vector<pglobal_function> &funcs,
93  const mesh &m_);
94  fem_global_function(const std::vector<pglobal_function> &funcs,
95  const mesh_im &mim_);
96  virtual ~fem_global_function()
97  { DAL_STORED_OBJECT_DEBUG_DESTROYED(this, "Global function fem"); }
98  };
99 
100  /** create a new global function FEM.
101  @param funcs is a vector containing all global basis functions.
102  @param m is the mesh to be used for numerical integration in the assembly.
103  */
104  pfem new_fem_global_function(const std::vector<pglobal_function> &funcs,
105  const mesh &m);
106 
107  /** create a new global function FEM.
108  @param funcs is a vector containing all global basis functions.
109  @param mim is the integration method to be used in the assembly.
110  */
111  pfem new_fem_global_function(const std::vector<pglobal_function> &funcs,
112  const mesh_im &mim);
113 
114  /** release a global function FEM */
115  inline void del_fem_global_function(const pfem &pf)
116  { dal::del_stored_object(pf); }
117 
118 
119 } /* end of namespace getfem. */
120 
121 #endif
bgeot::size_type
size_t size_type
used as the common size type in the library
Definition: bgeot_poly.h:49
getfem::mesh_im
Describe an integration method linked to a mesh.
Definition: getfem_mesh_im.h:47
getfem_global_function.h
Definition of global functions to be used as base or enrichment functions in fem.
bgeot::convex< base_node >
dal::del_stored_object
void del_stored_object(const pstatic_stored_object &o, bool ignore_unstored)
Delete an object and the object which depend on it.
Definition: dal_static_stored_objects.cc:369
getfem::fem_global_function
fem object with global basis functions.
Definition: getfem_fem_global_function.h:48
getfem::virtual_fem
Base class for finite element description.
Definition: getfem_fem.h:255
getfem::fem_global_function::nb_dof
virtual size_type nb_dof(size_type cv) const
Number of degrees of freedom.
Definition: getfem_fem_global_function.cc:144
getfem::fem_global_function::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_fem_global_function.cc:175
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_mesh_fem.h
Define the getfem::mesh_fem class.
getfem::fem_global_function::grad_base_value
void grad_base_value(const base_node &, base_tensor &) const
Give the value of all gradients (on ref.
Definition: getfem_fem_global_function.cc:177
getfem::new_fem_global_function
pfem new_fem_global_function(const std::vector< pglobal_function > &funcs, const mesh &m)
create a new global function FEM.
Definition: getfem_fem_global_function.cc:304
getfem::context_dependencies
Deal with interdependencies of objects.
Definition: getfem_context.h:81
getfem::pfem
std::shared_ptr< const getfem::virtual_fem > pfem
type of pointer on a fem description
Definition: getfem_fem.h:244
getfem::fem_global_function::hess_base_value
void hess_base_value(const base_node &, base_tensor &) const
Give the value of all hessians (on ref.
Definition: getfem_fem_global_function.cc:180
getfem::fem_global_function::update_from_context
virtual void update_from_context() const
this function has to be defined and should update the object when the context is modified.
Definition: getfem_fem_global_function.cc:69
dal::static_stored_object
base class for static stored objects
Definition: dal_static_stored_objects.h:206
getfem::mesh
Describe a mesh (collection of convexes (elements) and points).
Definition: getfem_mesh.h:95
getfem::fem_global_function::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_fem_global_function.cc:264
getfem_fem.h
Definition of the finite element methods.
getfem::fem_global_function::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_fem_global_function.cc:226
getfem::fem_global_function::ref_convex
virtual bgeot::pconvex_ref ref_convex(size_type cv) const
Return the convex of the reference element.
Definition: getfem_fem_global_function.cc:160
getfem::fem_global_function::node_convex
virtual const bgeot::convex< base_node > & node_convex(size_type cv) const
Gives the convex representing the nodes on the reference element.
Definition: getfem_fem_global_function.cc:168
getfem::fem_global_function::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_fem_global_function.cc:184
getfem::del_fem_global_function
void del_fem_global_function(const pfem &pf)
release a global function FEM
Definition: getfem_fem_global_function.h:115

Rabisu Mirror Service We provide mirrors to support Open source communities. Our mirror server is located in Istanbul/Turkey region.

Please do not hesitate to contact mirror@rabisu.com for new open source mirror submissions.