GetFEM  5.4.2
getfem_mesh_fem_product.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 // To be corrected : dependencies. The mesh fem using this fem will not
32 // depend on the mesh fem arguments.
33 
34 /**@file getfem_mesh_fem_product.h
35  @author Yves Renard <Yves.Renard@insa-lyon.fr>,
36  @author Julien Pommier <Julien.Pommier@insa-toulouse.fr>
37  @date April 8, 2005.
38  @brief A kind of product of two mesh_fems. Specific for Xfem enrichment.
39 */
40 
41 #ifndef GETFEM_MESH_FEM_PRODUCT_H__
42 #define GETFEM_MESH_FEM_PRODUCT_H__
43 
44 #include "getfem_mesh_fem.h"
45 
46 namespace getfem {
47 
48  class fem_product : public virtual_fem {
49  pfem pfems[2];
50  size_type cv, xfem_index;
51  dal::bit_vector enriched_dof1;
52 
53  public:
54 
55  fem_product(pfem pf1_, pfem pf2_, size_type i, size_type xfi,
56  const dal::bit_vector &nn)
57  : cv(i), xfem_index(xfi), enriched_dof1(nn)
58  { pfems[0] = pf1_; pfems[1] = pf2_; init(); }
59  void init();
60  void valid();
61  void base_value(const base_node &x, base_tensor &t) const;
62  void grad_base_value(const base_node &x, base_tensor &t) const;
63  void hess_base_value(const base_node &x, base_tensor &t) const;
64 
65  void real_base_value(const fem_interpolation_context& c,
66  base_tensor &t, bool = true) const;
67  void real_grad_base_value(const fem_interpolation_context& c,
68  base_tensor &t, bool = true) const;
69  void real_hess_base_value(const fem_interpolation_context& c,
70  base_tensor &t, bool = true) const;
71 
72  };
73 
74 
75  class mesh_fem_product : public mesh_fem {
76  protected :
77  const mesh_fem &mf1, &mf2;
78 
79  mutable std::vector<pfem> build_methods;
80  mutable bool is_adapted;
81  size_type xfem_index;
82  dal::bit_vector enriched_dof;
83  void clear_build_methods();
84 
85  public :
86  void adapt(void);
87  void update_from_context(void) const { is_adapted = false; touch(); }
88  void clear(void);
89 
90  size_type memsize() const
91  { return mesh_fem::memsize(); /* + ... */ }
92 
93  mesh_fem_product(const mesh_fem &me1, const mesh_fem &me2)
94  : mesh_fem(me1.linked_mesh()), mf1(me1), mf2(me2)
95  { is_adapted = false; xfem_index = reserve_xfem_index(); }
96  void set_enrichment(const dal::bit_vector &nn)
97  { enriched_dof = nn; adapt(); }
98 
99  ~mesh_fem_product() { clear_build_methods(); }
100  };
101 
102 
103 } /* end of namespace getfem. */
104 
105 #endif
106 
bgeot::size_type
size_t size_type
used as the common size type in the library
Definition: bgeot_poly.h:49
gmm::clear
void clear(L &l)
clear (fill with zeros) a vector or matrix.
Definition: gmm_blas.h:59
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::linked_mesh
const mesh & linked_mesh() const
Return a reference to the underlying mesh.
Definition: getfem_mesh_fem.h:279
getfem::mesh_fem::mesh_fem
mesh_fem(const mesh &me, dim_type Q=1)
Build a new mesh_fem.
Definition: getfem_mesh_fem.cc:528