GetFEM  5.5
getfem_fem_level_set.h
Go to the documentation of this file.
1 /* -*- c++ -*- (enables emacs c++ mode) */
2 /*===========================================================================
3 
4  Copyright (C) 2004-2026 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, see https://www.gnu.org/licenses/.
19 
20  As a special exception, you may use this file as it is a part of a free
21  software library without restriction. Specifically, if other files
22  instantiate templates or use macros or inline functions from this file,
23  or you compile this file and link it with other files to produce an
24  executable, this file does not by itself cause the resulting executable
25  to be covered by the GNU Lesser General Public License. This exception
26  does not however invalidate any other reasons why the executable file
27  might be covered by the GNU Lesser General Public License.
28 
29 ===========================================================================*/
30 
31 /**@file getfem_fem_level_set.h
32  @author Yves Renard <Yves.Renard@insa-lyon.fr>
33  @author Julien Pommier <Julien.Pommier@insa-toulouse.fr>
34  @date March 09, 2005.
35  @brief FEM associated with getfem::mesh_fem_level_set objects.
36 
37  To be fixed : dependencies. The mesh fem using this fem will not
38  depend on the mesh fem arguments.
39 */
40 
41 
42 #ifndef GETFEM_FEM_LEVEL_SET_H__
43 #define GETFEM_FEM_LEVEL_SET_H__
44 
45 #include "getfem_mesh_level_set.h"
46 
47 
48 namespace getfem {
49  /*
50  struct zoneset_t {
51  typedef unsigned char zid_t;
52  dal::bit_vector ls_idx;
53  std::vector<zid_t> table;
54  zid_t &operator()(const std::string &p) {
55  return table[getpos(p)];
56  }
57  size_type getpos(const std::string &s) {
58  size_type p2 = 1, pos = 0;
59  for (dal::bv_visitor i(ls_idx); !i.finished(); ++i, p2 *= 2) {
60  pos += (s[i] == '+') ? p2 : 0;
61  }
62  return pos;
63  }
64  void merge(const zoneset_t &z) {
65  dal::bit_vector idx2 = ls_idx | z.ls_idx;
66  std::vector<size_type> s1, s2 = strides_for(idx2)
67  }
68  };
69  */
70 
71  /** FEM associated with getfem::mesh_fem_level_set objects.
72  */
73  class fem_level_set : public virtual_fem {
74  pfem bfem; /* the base FEM which is to be enriched */
75  const mesh_level_set &mls;
76  size_type xfem_index;
77  std::vector< const mesh_level_set::zoneset * > dofzones;
78  dal::bit_vector ls_index; /* lists only the significant level sets */
79  std::string common_ls_zones;
80  void find_zone_id(const fem_interpolation_context &c,
81  std::vector<bool> &ids, int side = 0) const;
82  public:
83  template <typename IT_LS_ENRICH>
84  fem_level_set(IT_LS_ENRICH it, pfem pf, const mesh_level_set &mls_,
85  size_type xfi) : bfem(pf), mls(mls_), xfem_index(xfi) {
86  dofzones.assign(it, it + bfem->nb_dof(0));
87  init();
88  }
89  void init();
90  void valid();
91  void base_value(const base_node &x, base_tensor &t) const;
92  void grad_base_value(const base_node &x, base_tensor &t) const;
93  void hess_base_value(const base_node &x, base_tensor &t) const;
94 
96  base_tensor &t, bool = true) const;
98  base_tensor &t, bool = true) const;
100  base_tensor &t, bool = true) const;
101 
102  };
103 } /* end of namespace getfem. */
104 
105 #endif
106 
structure passed as the argument of fem interpolation functions.
Definition: getfem_fem.h:749
FEM associated with getfem::mesh_fem_level_set objects.
void real_hess_base_value(const fem_interpolation_context &c, base_tensor &t, bool=true) const
Give the hessian of all components of the base functions at the current point of the fem_interpolatio...
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_...
void base_value(const base_node &x, base_tensor &t) const
Give the value of all components of the base functions at the point x of the reference element.
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...
void grad_base_value(const base_node &x, base_tensor &t) const
Give the value of all gradients (on ref.
void hess_base_value(const base_node &x, base_tensor &t) const
Give the value of all hessians (on ref.
Keep informations about a mesh crossed by level-sets.
Base class for finite element description.
Definition: getfem_fem.h:255
Keep informations about a mesh crossed by level-sets.
std::shared_ptr< const getfem::virtual_fem > pfem
type of pointer on a fem description
Definition: getfem_fem.h:243
size_t size_type
used as the common size type in the library
Definition: bgeot_poly.h:48
GEneric Tool for Finite Element Methods.