GetFEM  5.4.2
getfem_level_set.h
Go to the documentation of this file.
1 /* -*- c++ -*- (enables emacs c++ mode) */
2 /*===========================================================================
3 
4  Copyright (C) 1999-2020 Yves Renard, Julien Pommier
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_level_set.h
33  @author Yves Renard <Yves.Renard@insa-lyon.fr>, Julien Pommier <Julien.Pommier@insa-toulouse.fr>
34  @date January 31, 2005.
35  @brief Define level-sets.
36 */
37 #ifndef GETFEM_LEVEL_SET_H__
38 #define GETFEM_LEVEL_SET_H__
39 
40 #include "getfem_mesh_fem.h"
41 #include "getfem_mesher.h"
42 
43 namespace getfem {
44  /** @brief Define a level-set.
45 
46  In getfem, a levelset is one or two scalar functions, defined on
47  a lagrange polynomial mesh_fem.
48 
49  The (optional) second function is a way to limit the level-set
50  to handle cracks for example.
51  */
52 
53  class level_set : public context_dependencies, virtual public dal::static_stored_object {
54 
55  protected :
56  dim_type degree_;
57  const mesh_fem *mf;
58  std::vector<scalar_type> primary_, secondary_;
59  bool with_secondary;
60  scalar_type shift_ls; // for the computation of a gap on a level_set.
61  // shift the level set on the ref element for mesher_level_set call
62  // Deprecated.
63 
64  void copy_from(const level_set &ls); // WARNING : to be updated if
65  // some components are added
66 
67  public :
68 
69  void set_shift(scalar_type shift_ls_) // Deprecated
70  { shift_ls = shift_ls_; }
71  scalar_type get_shift(void) const { return shift_ls; } // Deprecated
72  void simplify(scalar_type eps = 0.01);
73  void update_from_context(void) const { }
74  void reinit(void);
75  std::vector<scalar_type> &values(unsigned i = 0)
76  { return (i == 0) ? primary_ : secondary_; }
77  const std::vector<scalar_type> &values(unsigned i = 0) const
78  { return (i == 0) ? primary_ : secondary_; }
79 
80  pmesher_signed_distance mls_of_convex(size_type cv, unsigned lsnum = 0,
81  bool inverted = false) const;
82  bool has_secondary(void) const { return with_secondary; }
83  const mesh_fem &get_mesh_fem(void) const { return *mf; }
84  const mesh &linked_mesh() const { return mf->linked_mesh(); }
85  dim_type degree() const { return degree_; }
86  level_set(const mesh &msh, dim_type deg = dim_type(1),
87  bool with_secondary_ = false);
88  level_set(const level_set &ls);
89  level_set &operator =(const level_set &ls);
90 
91  ~level_set();
92  size_type memsize() const;
93  };
94 
95  /* Dummy level_set for default parameter of functions. */
96  const level_set &dummy_level_set();
97 
98 } /* end of namespace getfem. */
99 
100 
101 #endif /* GETFEM_LEVEL_SET_H__ */
bgeot::size_type
size_t size_type
used as the common size type in the library
Definition: bgeot_poly.h:49
getfem_mesher.h
An experimental mesher.
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::context_dependencies
Deal with interdependencies of objects.
Definition: getfem_context.h:81
getfem::mesh_fem::linked_mesh
const mesh & linked_mesh() const
Return a reference to the underlying mesh.
Definition: getfem_mesh_fem.h:279
getfem::level_set
Define a level-set.
Definition: getfem_level_set.h:53
dal::static_stored_object
base class for static stored objects
Definition: dal_static_stored_objects.h:206
getfem::level_set::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_level_set.h:73