GetFEM  5.4.2
getfem_fem_level_set.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 
32 /**@file getfem_fem_level_set.h
33  @author Yves Renard <Yves.Renard@insa-lyon.fr>
34  @author Julien Pommier <Julien.Pommier@insa-toulouse.fr>
35  @date March 09, 2005.
36  @brief FEM associated with getfem::mesh_fem_level_set objects.
37 
38  To be fixed : dependencies. The mesh fem using this fem will not
39  depend on the mesh fem arguments.
40 */
41 
42 
43 #ifndef GETFEM_FEM_LEVEL_SET_H__
44 #define GETFEM_FEM_LEVEL_SET_H__
45 
46 #include "getfem_mesh_level_set.h"
47 
48 
49 namespace getfem {
50  /*
51  struct zoneset_t {
52  typedef unsigned char zid_t;
53  dal::bit_vector ls_idx;
54  std::vector<zid_t> table;
55  zid_t &operator()(const std::string &p) {
56  return table[getpos(p)];
57  }
58  size_type getpos(const std::string &s) {
59  size_type p2 = 1, pos = 0;
60  for (dal::bv_visitor i(ls_idx); !i.finished(); ++i, p2 *= 2) {
61  pos += (s[i] == '+') ? p2 : 0;
62  }
63  return pos;
64  }
65  void merge(const zoneset_t &z) {
66  dal::bit_vector idx2 = ls_idx | z.ls_idx;
67  std::vector<size_type> s1, s2 = strides_for(idx2)
68  }
69  };
70  */
71 
72  /** FEM associated with getfem::mesh_fem_level_set objects.
73  */
74  class fem_level_set : public virtual_fem {
75  pfem bfem; /* the base FEM which is to be enriched */
76  const mesh_level_set &mls;
77  size_type xfem_index;
78  std::vector< const mesh_level_set::zoneset * > dofzones;
79  dal::bit_vector ls_index; /* lists only the significant level sets */
80  std::string common_ls_zones;
81  void find_zone_id(const fem_interpolation_context &c,
82  std::vector<bool> &ids, int side = 0) const;
83  public:
84  template <typename IT_LS_ENRICH>
85  fem_level_set(IT_LS_ENRICH it, pfem pf, const mesh_level_set &mls_,
86  size_type xfi) : bfem(pf), mls(mls_), xfem_index(xfi) {
87  dofzones.assign(it, it + bfem->nb_dof(0));
88  init();
89  }
90  void init();
91  void valid();
92  void base_value(const base_node &x, base_tensor &t) const;
93  void grad_base_value(const base_node &x, base_tensor &t) const;
94  void hess_base_value(const base_node &x, base_tensor &t) const;
95 
97  base_tensor &t, bool = true) const;
99  base_tensor &t, bool = true) const;
101  base_tensor &t, bool = true) const;
102 
103  };
104 } /* end of namespace getfem. */
105 
106 #endif
107 
getfem::fem_level_set::hess_base_value
void hess_base_value(const base_node &x, base_tensor &t) const
Give the value of all hessians (on ref.
Definition: getfem_fem_level_set.cc:84
bgeot::size_type
size_t size_type
used as the common size type in the library
Definition: bgeot_poly.h:49
getfem::fem_level_set::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_level_set.cc:168
getfem_mesh_level_set.h
Keep informations about a mesh crossed by level-sets.
getfem::virtual_fem
Base class for finite element description.
Definition: getfem_fem.h:255
getfem::fem_level_set::base_value
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.
Definition: getfem_fem_level_set.cc:79
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::fem_level_set::grad_base_value
void grad_base_value(const base_node &x, base_tensor &t) const
Give the value of all gradients (on ref.
Definition: getfem_fem_level_set.cc:81
getfem::mesh_level_set
Keep informations about a mesh crossed by level-sets.
Definition: getfem_mesh_level_set.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::fem_level_set::real_hess_base_value
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...
Definition: getfem_fem_level_set.cc:200
getfem::fem_level_set
FEM associated with getfem::mesh_fem_level_set objects.
Definition: getfem_fem_level_set.h:74
getfem::fem_level_set::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_level_set.cc:141