GetFEM  5.4.2
getfem_mesh_fem_sum.h
Go to the documentation of this file.
1 /* -*- c++ -*- (enables emacs c++ mode) */
2 /*===========================================================================
3 
4  Copyright (C) 2004-2020 Yves Renard
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 /**@file getfem_mesh_fem_sum.h
32  @author Yves Renard <Yves.Renard@insa-lyon.fr>
33  @author Julien Pommier <Julien.Pommier@insa-toulouse.fr>
34  @date March 18, 2005.
35  @brief Implement a special mesh_fem with merges the FEMs of two
36  (or more) mesh_fems.
37 */
38 
39 #ifndef GETFEM_MESH_SUM_H__
40 #define GETFEM_MESH_SUM_H__
41 
42 #include "getfem_mesh_fem.h"
43 
44 namespace getfem {
45  typedef std::vector<const std::string *> dof_enrichments;
46 
47  /** @internal FEM used in mesh_fem_sum objects. */
48  class fem_sum : public virtual_fem {
49  std::vector<pfem> pfems; /* the fems to be summed */
50  bool smart_global_dof_linking_;
51  size_type cv;
52 
53  public:
54 
55  size_type index_of_global_dof(size_type cv_, size_type j) const;
56  fem_sum(const std::vector<pfem> &pfs, size_type i,
57  bool smart_global_dof_linking)
58  : pfems(pfs), smart_global_dof_linking_(smart_global_dof_linking),
59  cv(i) { init(); }
60  void init();
61  void valid();
62  void base_value(const base_node &x, base_tensor &t) const;
63  void grad_base_value(const base_node &x, base_tensor &t) const;
64  void hess_base_value(const base_node &x, base_tensor &t) const;
65 
66  void real_base_value(const fem_interpolation_context& c,
67  base_tensor &t, bool = true) const;
68  void real_grad_base_value(const fem_interpolation_context& c,
69  base_tensor &t, bool = true) const;
70  void real_hess_base_value(const fem_interpolation_context& c,
71  base_tensor &t, bool = true) const;
72  void mat_trans(base_matrix &M, const base_matrix &G,
73  bgeot::pgeometric_trans pgt) const;
74  };
75 
76 
77  /** @brief Implement a special mesh_fem with merges the FEMs of
78  two (or more) mesh_fems.
79  */
80  class mesh_fem_sum : public mesh_fem {
81  protected :
82  std::vector<const mesh_fem *> mfs;
83 
84  mutable std::map< std::vector<pfem>, pfem> situations;
85  mutable std::vector<pfem> build_methods;
86  mutable bool is_adapted;
87  bool smart_global_dof_linking_;
88  void clear_build_methods();
89 
90  public :
91  void adapt(void);
92  void update_from_context(void) const { is_adapted = false; }
93  void clear(void);
94 
95  size_type memsize() const {
96  return mesh_fem::memsize(); // + ... ;
97  }
98 
99  mesh_fem_sum(const mesh &me, bool smart_global_dof_linking = false)
100  : mesh_fem(me), smart_global_dof_linking_(smart_global_dof_linking)
101  { is_adapted = false; }
102  void set_mesh_fems(const std::vector<const mesh_fem *> &mefs)
103  { mfs = mefs; adapt(); }
104  /** enabled "smart" dof linking between the mesh_fems.
105  It was introduced for the point-wise matching part of
106  tests/crack.cc but it does not work with discontinuous global
107  functions...
108  */
110  { smart_global_dof_linking_ = b; }
111  void set_mesh_fems(const mesh_fem &mf1)
112  { mfs.clear(); mfs.push_back(&mf1); adapt(); }
113  void set_mesh_fems(const mesh_fem &mf1, const mesh_fem &mf2)
114  { mfs.clear(); mfs.push_back(&mf1); mfs.push_back(&mf2); adapt(); }
115  void set_mesh_fems(const mesh_fem &mf1, const mesh_fem &mf2,
116  const mesh_fem &mf3) {
117  mfs.clear();
118  mfs.push_back(&mf1); mfs.push_back(&mf2); mfs.push_back(&mf3);
119  adapt();
120  }
121 
122  ~mesh_fem_sum() { clear_build_methods(); }
123  };
124 
125 
126 } /* end of namespace getfem. */
127 
128 #endif
129 
getfem::mesh_fem_sum::update_from_context
void update_from_context(void) const
this function has to be defined and should update the object when the context is modified.
Definition: getfem_mesh_fem_sum.h:92
bgeot::size_type
size_t size_type
used as the common size type in the library
Definition: bgeot_poly.h:49
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_mesh_fem.h
Define the getfem::mesh_fem class.
getfem::pfem
std::shared_ptr< const getfem::virtual_fem > pfem
type of pointer on a fem description
Definition: getfem_fem.h:244
getfem::mesh_fem_sum
Implement a special mesh_fem with merges the FEMs of two (or more) mesh_fems.
Definition: getfem_mesh_fem_sum.h:80
bgeot::pgeometric_trans
std::shared_ptr< const bgeot::geometric_trans > pgeometric_trans
pointer type for a geometric transformation
Definition: bgeot_geometric_trans.h:186
getfem::mesh_fem_sum::set_smart_global_dof_linking
void set_smart_global_dof_linking(bool b)
enabled "smart" dof linking between the mesh_fems.
Definition: getfem_mesh_fem_sum.h:109

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.