GetFEM  5.4.2
bgeot_convex_ref.h
Go to the documentation of this file.
1 /* -*- c++ -*- (enables emacs c++ mode) */
2 /*===========================================================================
3 
4  Copyright (C) 2001-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 
33 /**@file bgeot_convex_ref.h
34  @author Yves Renard <Yves.Renard@insa-lyon.fr>
35  @date Septembre 28, 2001.
36  @brief Reference convexes
37 */
38 #ifndef BGEOT_CONVEX_REF_H__
39 #define BGEOT_CONVEX_REF_H__
40 
41 #include "bgeot_convex.h"
42 
43 namespace bgeot {
44 
45  /** @defgroup refconvexes Reference Convexes*/
46  /*@{*/
47 
48  /** Point tab storage. */
50  public std::vector<base_node> {
51  const base_node &operator[](size_type i) const
52  { return std::vector<base_node>::operator [](i); }
53  template <class IT> stored_point_tab(IT it, IT ite)
54  : std::vector<base_node>(it, ite)
55  { DAL_STORED_OBJECT_DEBUG_CREATED(this, "Stored point tab"); }
56  virtual ~stored_point_tab()
57  { DAL_STORED_OBJECT_DEBUG_DESTROYED(this, "Stored point tab"); }
58  };
59 
60  typedef std::shared_ptr<const stored_point_tab> pstored_point_tab;
61 
62  pstored_point_tab store_point_tab(const stored_point_tab& spt);
63 
64  /* store a new (read-only) array of points in stored_point_tab_tab */
65  template<class CONT> pstored_point_tab store_point_tab(const CONT &TAB)
66  { return store_point_tab(stored_point_tab(TAB.begin(), TAB.end())); }
67 
68  class mesh_structure;
69 
70  class convex_of_reference;
71  typedef std::shared_ptr<const convex_of_reference> pconvex_ref;
72 
73  /** Base class for reference convexes.
74 
75  Examples of reference convexes are (the order
76  1 triangle (0,0)-(1,0)-(0,1), the order 2 segment
77  (0)-(.5)-(1.), etc...). This class stores :
78 
79  - a list of points (vertices of the reference convex, plus
80  other points for reference convexes of degree > 1).
81 
82  - a normal for each face of the convex.
83 
84  - a mesh structure defining the smallest simplex partition of
85  the convex.
86 
87  - a pointer to the "basic convex_ref": for a convex_ref of
88  degree k, this is a pointer to the correspounding convex_ref of
89  degree 1.
90  */
92  public convex<base_node> {
93  protected :
94  std::vector<base_small_vector> normals_;
95  pstored_point_tab ppoints;
96  std::shared_ptr<mesh_structure> psimplexified_convex;
97  pconvex_ref basic_convex_ref_;
98  const bool auto_basic;
99  convex_of_reference(pconvex_structure cvs, bool auto_basic);
100 
101  public :
102  /// return a negative or null number if the base_node is in the convex.
103  virtual scalar_type is_in(const base_node &) const = 0;
104  /** return a null (or almost zero) if pt is in the face of the convex.
105  * Does not control if the point is in the convex, but if a point
106  * supposed to be in a convex is in this face. return a negative number
107  * if the point is in the side of the face where the element is and
108  * positive in the other side.
109  */
110  virtual scalar_type is_in_face(short_type, const base_node &) const =0;
111  /** will project any given point lying outside the convex onto the convex
112  outer surface */
113  virtual void project_into(base_node &pt) const {
114  GMM_ASSERT1(!auto_basic, "This method has to be overloaded in every "
115  "basic convex");
116  basic_convex_ref_->project_into(pt);
117  }
118  bool is_basic() const { return auto_basic; }
119  /// return the normal vector for each face.
120  const std::vector<base_small_vector> &normals() const
121  { return normals_; }
122  /// return the vertices of the reference convex.
123  const stored_point_tab &points() const { return *ppoints; }
124  const stored_point_tab &points() { return *ppoints; }
125  pstored_point_tab pspt() const { return ppoints; }
126  virtual ~convex_of_reference()
127  { DAL_STORED_OBJECT_DEBUG_DESTROYED(this, "Convex of reference"); }
128 
129  /** return a mesh structure composed of simplexes whose union
130  is the reference convex. All simplexes have the same (direct)
131  orientation.
132  */
133  const mesh_structure* simplexified_convex() const;
134  friend pconvex_ref basic_convex_ref(pconvex_ref cvr);
135  };
136 
137  /// return the associated order 1 reference convex.
138  inline pconvex_ref basic_convex_ref(pconvex_ref cvr)
139  { return cvr->auto_basic ? cvr : cvr->basic_convex_ref_; }
140 
141  // interface with qhull
142  void qhull_delaunay(const std::vector<base_node> &pts,
143  gmm::dense_matrix<size_type>& simplexes);
144 
145 
146  //@name public functions for obtaining a convex of reference
147  //@{
148 
149  /** returns a simplex of reference of dimension nc and degree k */
150  pconvex_ref simplex_of_reference(dim_type nc, short_type k = 1);
151  /** parallelepiped of reference of dimension nc (and degree 1) */
152  pconvex_ref parallelepiped_of_reference(dim_type nc, dim_type k = 1);
153  /** incomplete Q2 quadrilateral/hexahedral of reference of dimension
154  d = 2 or 3 */
155  pconvex_ref Q2_incomplete_of_reference(dim_type d);
156  /** prism of reference of dimension nc (and degree 1) */
157  pconvex_ref prism_of_reference(dim_type nc);
158  /** incomplete quadratic prism element of reference (15-node) */
159  pconvex_ref prism_incomplete_P2_of_reference();
160  /** pyramidal element of reference of degree k (k = 1 or 2 only) */
161  pconvex_ref pyramid_QK_of_reference(dim_type k);
162  IS_DEPRECATED pconvex_ref inline
163  pyramid_of_reference(dim_type k) { return pyramid_QK_of_reference(k); }
164  /** incomplete quadratic pyramidal element of reference (13-node) */
166  /** tensorial product of two convex ref.
167  in order to ensure unicity, it is required the a->dim() >= b->dim() */
168  pconvex_ref convex_ref_product(pconvex_ref a, pconvex_ref b);
169  /** equilateral simplex (degree 1). used only for mesh quality estimations */
170  pconvex_ref equilateral_simplex_of_reference(dim_type nc);
171 
172  /** generic convex with n global nodes */
173  pconvex_ref generic_dummy_convex_ref(dim_type nc, size_type n, short_type nf);
174  //@}
175 
176  /*@}*/
177 } /* end of namespace bgeot. */
178 
179 
180 #endif /* BGEOT_CONVEX_REF_H__ */
bgeot::convex_of_reference::simplexified_convex
const mesh_structure * simplexified_convex() const
return a mesh structure composed of simplexes whose union is the reference convex.
Definition: bgeot_convex_ref.cc:217
bgeot::pyramid_Q2_incomplete_of_reference
pconvex_ref pyramid_Q2_incomplete_of_reference()
incomplete quadratic pyramidal element of reference (13-node)
Definition: bgeot_convex_ref.cc:576
bgeot::convex_of_reference::is_in
virtual scalar_type is_in(const base_node &) const =0
return a negative or null number if the base_node is in the convex.
bgeot::basic_convex_ref
pconvex_ref basic_convex_ref(pconvex_ref cvr)
return the associated order 1 reference convex.
Definition: bgeot_convex_ref.h:138
bgeot::size_type
size_t size_type
used as the common size type in the library
Definition: bgeot_poly.h:49
bgeot::convex_of_reference::normals
const std::vector< base_small_vector > & normals() const
return the normal vector for each face.
Definition: bgeot_convex_ref.h:120
bgeot::pyramid_QK_of_reference
pconvex_ref pyramid_QK_of_reference(dim_type k)
pyramidal element of reference of degree k (k = 1 or 2 only)
Definition: bgeot_convex_ref.cc:522
bgeot::convex
generic definition of a convex ( bgeot::convex_structure + vertices coordinates )
Definition: bgeot_convex.h:50
bgeot::convex_of_reference::basic_convex_ref
friend pconvex_ref basic_convex_ref(pconvex_ref cvr)
return the associated order 1 reference convex.
Definition: bgeot_convex_ref.h:138
bgeot::short_type
gmm::uint16_type short_type
used as the common short type integer in the library
Definition: bgeot_config.h:72
bgeot::convex_ref_product
pconvex_ref convex_ref_product(pconvex_ref a, pconvex_ref b)
tensorial product of two convex ref.
Definition: bgeot_convex_ref.cc:729
bgeot::prism_incomplete_P2_of_reference
pconvex_ref prism_incomplete_P2_of_reference()
incomplete quadratic prism element of reference (15-node)
Definition: bgeot_convex_ref.cc:635
bgeot::convex_of_reference::is_in_face
virtual scalar_type is_in_face(short_type, const base_node &) const =0
return a null (or almost zero) if pt is in the face of the convex.
bgeot::small_vector< scalar_type >
bgeot::convex_of_reference
Base class for reference convexes.
Definition: bgeot_convex_ref.h:91
bgeot::prism_of_reference
pconvex_ref prism_of_reference(dim_type nc)
prism of reference of dimension nc (and degree 1)
Definition: bgeot_convex_ref.cc:753
bgeot::parallelepiped_of_reference
pconvex_ref parallelepiped_of_reference(dim_type nc, dim_type k)
parallelepiped of reference of dimension nc (and degree 1)
Definition: bgeot_convex_ref.cc:747
bgeot
Basic Geometric Tools.
Definition: bgeot_convex_ref.cc:27
bgeot::pconvex_structure
std::shared_ptr< const convex_structure > pconvex_structure
Pointer on a convex structure description.
Definition: bgeot_convex_structure.h:54
dal::static_stored_object
base class for static stored objects
Definition: dal_static_stored_objects.h:206
bgeot::stored_point_tab
Point tab storage.
Definition: bgeot_convex_ref.h:49
bgeot_convex.h
Convex objects (structure + vertices)
bgeot::simplex_of_reference
pconvex_ref simplex_of_reference(dim_type nc, short_type K)
returns a simplex of reference of dimension nc and degree k
Definition: bgeot_convex_ref.cc:340
bgeot::equilateral_simplex_of_reference
pconvex_ref equilateral_simplex_of_reference(dim_type nc)
equilateral simplex (degree 1).
Definition: bgeot_convex_ref.cc:831
bgeot::convex_of_reference::points
const stored_point_tab & points() const
return the vertices of the reference convex.
Definition: bgeot_convex_ref.h:123
bgeot::generic_dummy_convex_ref
pconvex_ref generic_dummy_convex_ref(dim_type nc, size_type n, short_type nf)
generic convex with n global nodes
Definition: bgeot_convex_ref.cc:867
bgeot::Q2_incomplete_of_reference
pconvex_ref Q2_incomplete_of_reference(dim_type nc)
incomplete Q2 quadrilateral/hexahedral of reference of dimension d = 2 or 3
Definition: bgeot_convex_ref.cc:426
bgeot::convex_of_reference::project_into
virtual void project_into(base_node &pt) const
will project any given point lying outside the convex onto the convex outer surface
Definition: bgeot_convex_ref.h:113

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.