GetFEM  5.6
bgeot_geometric_trans.h
Go to the documentation of this file.
1 /* -*- c++ -*- (enables emacs c++ mode) */
2 /*===========================================================================
3 
4  Copyright (C) 2000-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 bgeot_geometric_trans.h
32  @author Yves Renard <Yves.Renard@insa-lyon.fr>
33  @date December 20, 2000.
34  @brief Geometric transformations on convexes.
35 */
36 
37 #ifndef BGEOT_GEOMETRIC_TRANSFORMATION_H__
38 #define BGEOT_GEOMETRIC_TRANSFORMATION_H__
39 
40 #include <set>
41 #include "bgeot_config.h"
42 #include "bgeot_convex_ref.h"
44 
45 namespace bgeot {
46 
47  /** Description of a geometric transformation between a
48  * reference element and a real element.
49  *
50  * Geometric nodes and vector of polynomials. This class is not to
51  * be manipulate by itself. Use bgeot::pgeometric_trans and the
52  * functions written to produce the basic geometric transformations.
53  *
54  * <h3>Description of the geometry</h3>
55  * Let @f$T \in\ {I\hspace{-0.3em}R}^N@f$ be a real element and
56  * @f$\overline{T} \in\ {I\hspace{-0.3em}R}^P@f$ be a reference element,
57  * with @f$N >= P@f$.
58  *
59  * The geometric nodes of @f$\overline{T}@f$ are the points
60  * @f$\overline{g}^i \in\ {I\hspace{-0.3em}R}^P@f$, for @f$i = 0 .. n_g-1@f$,
61  * and the corresponding (via the geometric transformation) nodes of
62  * @f$T@f$ are the points @f$g^i \in\ {I\hspace{-0.3em}R}^N@f$.
63  *
64  * <h3>Geometric transformation</h3>
65  * The geometric transformation is the application
66  * @f[ \begin{array}{rl}
67  * \tau : \overline{T} & \longrightarrow \ T, \\
68  * \overline{x} & \longmapsto \ \ x,
69  * \end{array} @f]
70  * which should be a diffeomorphism between @f$\overline{T}@f$ and @f$T@f$.
71  * It is assumed that there exists a (generally polynomial) vector
72  * @f$ \underline{\cal N}(\overline{x})
73  * = \left({\cal N}i_(\overline{x})\right)i_, \ \ i = 0 .. n_g-1, @f$
74  * defined on @f$\overline{T}@f$ of size @f$n_g@f$, such that the
75  * transformation
76  * @f$\tau@f$ can be written
77  * @f$ \tau(\overline{x}) = \sum_{i = 0}^{n_g-1} {\cal N}i_(\overline{x})
78  * g^i@f$.
79  *
80  * Denoting by
81  * @f$ \underline{\underline{G}} = (g^0; g^1; ...;g^{n_g-1}), @f$
82  * The matrix in which each column is a geometric node of @f$T@f$,
83  * the transformation @f$\tau@f$ can be written as
84  * @f$ \tau(\overline{x}) = \underline{\underline{G}} \
85  * \underline{\cal N}(\overline{x}). @f$
86  *
87  * <h3>Gradient of the transformation</h3>
88  * The gradient of the transformation is
89  * @f[ \nabla \tau(\overline{x}) =
90  * \left( \frac{\partial \tau_i}{\partial \overline{x}_j} \right)_{ij}
91  * = \left( \sum_{l = 0}^{n_g-1}g^l_i
92  * \frac{\partial {\cal N}l_(\overline{x})}{\partial \overline{x}_j}
93  * \right)_{ij} = \underline{\underline{G}}\ \nabla
94  * \underline{\cal N}(\overline{x}), @f]
95  *
96  * Remark : @f$\underline{\underline{G}}@f$ is a @f$N \times n_g@f$ matrix,
97  * @f$\nabla \underline{\cal N}(\overline{x})@f$ is a @f$n_g \times P@f$
98  * matrix, and thus @f$\nabla \tau(\overline{x})@f$ is a @f$N \times P@f$
99  * matrix.
100  *
101  * <h3>Inverse transformation and pseudo-inverse</h3>
102  * to do ...
103  */
104  class APIDECL geometric_trans : virtual public dal::static_stored_object {
105  protected :
106 
107  bool is_lin;
108  pconvex_ref cvr;
109  std::vector<size_type> vertices_;
110  size_type complexity_; /* either the degree or the refinement of the
111  * transformation */
112  std::string name_;
113 
114  void fill_standard_vertices();
115  public :
116 
117  /// Dimension of the reference element.
118  dim_type dim() const { return cvr->structure()->dim(); }
119  /// True if the transformation is linear (affine in fact).
120  bool is_linear() const { return is_lin; }
121  /// Number of geometric nodes.
122  size_type nb_points() const { return cvr->nb_points(); }
123  /// Pointer on the convex of reference.
124  pconvex_ref convex_ref() const { return cvr; }
125  /// Structure of the reference element.
126  pconvex_structure structure() const { return cvr->structure(); }
127  /// Basic structure of the reference element.
129  { return bgeot::basic_structure(cvr->structure()); }
130  /// Gives the value of the functions vector at a certain point.
131  virtual void poly_vector_val(const base_node &pt, base_vector &val) const = 0;
132  /// Gives the value of a subgroup of the functions vector at a certain point.
133  virtual void poly_vector_val(const base_node &pt, const convex_ind_ct &ind_ct,
134  base_vector &val) const = 0;
135  /// Gives the gradient of the functions vector at a certain point.
136  virtual void poly_vector_grad(const base_node &pt, base_matrix &val) const = 0;
137  /// Gives the gradient of a subgroup of the functions vector at a certain point.
138  virtual void poly_vector_grad(const base_node &pt, const convex_ind_ct &ind_ct,
139  base_matrix &val) const = 0;
140  /// Gives the hessian of the functions vector at a certain point.
141  virtual void poly_vector_hess(const base_node &pt, base_matrix &val) const = 0;
142  /// compute K matrix from multiplication of G with gradient
143  virtual void compute_K_matrix(const base_matrix &G, const base_matrix &pc, base_matrix &K) const;
144  /// Gives the number of vertices.
145  size_type nb_vertices() const { return vertices_.size(); }
146  /// Gives the indices of vertices between the nodes.
147  const std::vector<size_type> &vertices() const { return vertices_; }
148  /// Gives the array of geometric nodes (on reference convex)
150  { return cvr->points(); }
151  /// Gives the array of geometric nodes (on reference convex)
152  pstored_point_tab pgeometric_nodes() const
153  { return cvr->pspt(); }
154  /// Gives the array of the normals to faces (on reference convex)
155  const std::vector<base_small_vector> &normals() const
156  { return cvr->normals(); }
157  /** Apply the geometric transformation to point pt,
158  PTAB contains the points of the real convex */
159  template<class CONT> base_node transform(const base_node &pt,
160  const CONT &PTAB) const;
161  base_node transform(const base_node &pt, const base_matrix &G) const;
162  void set_name(const std::string &name){name_ = name;}
163  const std::string& debug_name() const {return name_;}
164  virtual void project_into_reference_convex(base_node &pt) const
165  { cvr->project_into(pt); }
166  size_type complexity() const { return complexity_; }
167  virtual ~geometric_trans()
168  { DAL_STORED_OBJECT_DEBUG_DESTROYED(this, "Geometric transformation"); }
169  geometric_trans()
170  { DAL_STORED_OBJECT_DEBUG_CREATED(this, "Geometric transformation"); }
171  };
172 
173  template<class CONT>
175  const CONT &ptab) const {
176  base_node P(ptab[0].size());
177  size_type k = nb_points();
178  base_vector val(k);
179  poly_vector_val(pt, val);
180  for (size_type l = 0; l < k; ++l) gmm::add(gmm::scaled(ptab[l], val[l]),P);
181  return P;
182  }
183 
184  /** pointer type for a geometric transformation */
185  typedef std::shared_ptr<const bgeot::geometric_trans> pgeometric_trans;
187 
188  template<class CONT>
189  void bounding_box(base_node& min, base_node& max,
190  const CONT &ptab, pgeometric_trans pgt = 0) {
191  typename CONT::const_iterator it = ptab.begin();
192  min = max = *it; size_type P = min.size();
193  base_node::iterator itmin = min.begin(), itmax = max.begin();
194  for ( ++it; it != ptab.end(); ++it) {
195  base_node pt = *it; /* need a temporary storage since cv.points()[j] may
196  not be a reference to a base_node, but a
197  temporary base_node !! (?) */
198  base_node::const_iterator it2 = pt.begin();
199  for (size_type i = 0; i < P; ++i) {
200  itmin[i] = std::min(itmin[i], it2[i]);
201  itmax[i] = std::max(itmax[i], it2[i]);
202  }
203  }
204  /* enlarge the box for non-linear transformations .. */
205  if (pgt && !pgt->is_linear())
206  for (size_type i = 0; i < P; ++i) {
207  scalar_type e = (itmax[i]-itmin[i]) * 0.2;
208  itmin[i] -= e; itmax[i] += e;
209  }
210  }
211 
212  /** @name functions on geometric transformations
213  */
214  //@{
215 
216  pgeometric_trans APIDECL simplex_geotrans(size_type n, short_type k);
217  pgeometric_trans APIDECL parallelepiped_geotrans(size_type n, short_type k);
218  pgeometric_trans APIDECL parallelepiped_linear_geotrans(size_type n);
219  pgeometric_trans APIDECL prism_geotrans(size_type n, short_type k);
220  pgeometric_trans APIDECL prism_linear_geotrans(size_type n);
221  pgeometric_trans APIDECL product_geotrans(pgeometric_trans pg1,
222  pgeometric_trans pg2);
223  pgeometric_trans APIDECL linear_product_geotrans(pgeometric_trans pg1,
224  pgeometric_trans pg2);
225  pgeometric_trans APIDECL Q2_incomplete_geotrans(dim_type nc);
226  pgeometric_trans APIDECL prism_incomplete_P2_geotrans();
227  pgeometric_trans APIDECL pyramid_QK_geotrans(short_type k);
228  IS_DEPRECATED inline pgeometric_trans APIDECL
229  pyramid_geotrans(short_type k) { return pyramid_QK_geotrans(k); }
230  pgeometric_trans APIDECL pyramid_Q2_incomplete_geotrans();
231 
232  pgeometric_trans APIDECL default_trans_of_cvs(pconvex_structure);
233 
234  /**
235  Get the geometric transformation from its string name.
236  @see name_of_geometric_trans
237  */
238  pgeometric_trans APIDECL geometric_trans_descriptor(std::string name);
239  /**
240  Get the string name of a geometric transformation.
241 
242  List of possible names:
243  GT_PK(N,K) : Transformation on simplexes, dim N, degree K
244 
245  GT_QK(N,K) : Transformation on parallelepipeds, dim N, degree K
246  GT_PRISM(N,K) : Transformation on prisms, dim N, degree K
247  GT_PYRAMID_QK(K) : Transformation on pyramids, dim 3, degree K=0,1,2
248  GT_Q2_INCOMPLETE(N) : Q2 incomplete transformation in dim N=2 or 3.
249  GT_PYRAMID_Q2_INCOMPLETE : incomplete quadratic pyramid transformation
250  in dim 3
251  GT_PRISM_INCOMPLETE_P2 : incomplete quadratic prism transformation in
252  dim 3
253  GT_PRODUCT(a,b) : tensorial product of two transformations
254  GT_LINEAR_PRODUCT(a,b) : Linear tensorial product of two transformations
255  GT_LINEAR_QK(N) : shortcut for GT_LINEAR_PRODUCT(GT_LINEAR_QK(N-1),
256  GT_PK(1,1))
257  */
258 
259  std::string APIDECL name_of_geometric_trans(pgeometric_trans p);
260 
261  /** norm of returned vector is the ratio between the face surface on
262  * the real element and the face surface on the reference element
263  * IT IS NOT UNITARY
264  *
265  * pt is the position of the evaluation point on the reference element
266  */
267  base_small_vector APIDECL
268  compute_normal(const geotrans_interpolation_context& c, size_type face);
269 
270  /** Unit normal vector to an element of dimension N-1 in dimension N
271  * (a curve in 2D or a surface in 3D), oriented by the parametrization
272  * of the element: (K_21, -K_11) in 2D and K_1 x K_2 in 3D, where K_i
273  * is the i-th column of the gradient K of the geometric transformation.
274  * Returns an empty vector for other element and mesh dimensions.
275  */
276  base_small_vector APIDECL
277  compute_unit_element_normal(const geotrans_interpolation_context& c);
278 
279  /** return the local basis (i.e. the normal in the first column, and the
280  * tangent vectors in the other columns
281  */
282  base_matrix APIDECL
283  compute_local_basis(const geotrans_interpolation_context& c,
284  size_type face);
285  //@}
286 
287  /* ********************************************************************* */
288  /* Precomputation on geometric transformations. */
289  /* ********************************************************************* */
290 
291 
292  class geotrans_precomp_;
293  typedef std::shared_ptr<const geotrans_precomp_> pgeotrans_precomp;
294 
295 
296  /**
297  * precomputed geometric transformation operations use this for
298  * repetitive evaluation of a geometric transformations on a set of
299  * points "pspt" in the reference convex which do not change.
300  */
301  class APIDECL geotrans_precomp_ : virtual public dal::static_stored_object {
302  protected:
303  pgeometric_trans pgt;
304  pstored_point_tab pspt; /* a set of points in the reference elt*/
305  mutable std::vector<base_vector> c; /* precomputed values for the */
306  /* transformation */
307  mutable std::vector<base_matrix> pc; /* precomputed values for gradient*/
308  /* of the transformation. */
309  mutable std::vector<base_matrix> hpc; /* precomputed values for hessian*/
310  /* of the transformation. */
311  public:
312  inline const base_vector &val(size_type i) const
313  { if (c.empty()) init_val(); return c[i]; }
314  inline const base_matrix &grad(size_type i) const
315  { if (pc.empty()) init_grad(); return pc[i]; }
316  inline const base_matrix &hessian(size_type i) const
317  { if (hpc.empty()) init_hess(); return hpc[i]; }
318 
319  /**
320  * Apply the geometric transformation from the reference convex to
321  * the convex whose vertices are stored in G, to the set of points
322  * listed in pspt.
323  * @param G any container of vertices of the transformed
324  * convex.
325  * @param pt_tab on output, the transformed points.
326  */
327  template <typename CONT>
328  void transform(const CONT& G,
329  stored_point_tab& pt_tab) const;
330  template <typename CONT, typename VEC>
331  void transform(const CONT& G, size_type ii, VEC& pt) const;
332 
333  base_node transform(size_type i, const base_matrix &G) const;
334  pgeometric_trans get_trans() const { return pgt; }
335  // inline const stored_point_tab& get_point_tab() const { return *pspt; }
336  inline pstored_point_tab get_ppoint_tab() const { return pspt; }
337  geotrans_precomp_(pgeometric_trans pg, pstored_point_tab ps);
339  { DAL_STORED_OBJECT_DEBUG_DESTROYED(this, "Geotrans precomp"); }
340 
341  private:
342  void init_val() const;
343  void init_grad() const;
344  void init_hess() const;
345 
346  /**
347  * precomputes a geometric transformation for a fixed set of
348  * points in the reference convex.
349  */
350  friend pgeotrans_precomp
351  geotrans_precomp(pgeometric_trans pg, pstored_point_tab ps,
352  dal::pstatic_stored_object dep);
353 
354  };
355 
356 
357  pgeotrans_precomp
358  geotrans_precomp(pgeometric_trans pg, pstored_point_tab ps,
359  dal::pstatic_stored_object dep);
360 
361  template <typename CONT, typename VEC>
362  void geotrans_precomp_::transform(const CONT& G, size_type j,
363  VEC& pt) const {
364  size_type k = 0;
365  gmm::clear(pt);
366  if (c.empty()) init_val();
367  for (typename CONT::const_iterator itk = G.begin();
368  itk != G.end(); ++itk, ++k)
369  gmm::add(gmm::scaled(*itk, c[j][k]), pt);
370  GMM_ASSERT1(k == pgt->nb_points(),
371  "Wrong number of points in transformation");
372  }
373 
374  template <typename CONT>
375  void geotrans_precomp_::transform(const CONT& G,
376  stored_point_tab& pt_tab) const {
377  if (c.empty()) init_val();
378  pt_tab.clear(); pt_tab.resize(c.size(), base_node(G[0].size()));
379  for (size_type j = 0; j < c.size(); ++j) {
380  transform(G, j, pt_tab[j]);
381  }
382  }
383 
384  void APIDECL delete_geotrans_precomp(pgeotrans_precomp pgp);
385 
386  /**
387  * The object geotrans_precomp_pool Allow to allocate a certain number
388  * of geotrans_precomp and automatically delete them when it is
389  * deleted itself.
390  */
391  class APIDECL geotrans_precomp_pool {
392  std::set<pgeotrans_precomp> precomps;
393 
394  public :
395 
396  pgeotrans_precomp operator()(pgeometric_trans pg,
397  pstored_point_tab pspt) {
398  pgeotrans_precomp p = geotrans_precomp(pg, pspt, 0);
399  precomps.insert(p);
400  return p;
401  }
403  for (std::set<pgeotrans_precomp>::iterator it = precomps.begin();
404  it != precomps.end(); ++it)
405  delete_geotrans_precomp(*it);
406  }
407  };
408 
409 
410 
411  /** the geotrans_interpolation_context structure is passed as the
412  argument of geometric transformation interpolation
413  functions. This structure can be partially filled (for example
414  the xreal will be computed if needed as long as pgp+ii is known).
415  See also fem_interpolation_context in getfem_fem.h.
416  The name of member data, and the computations done by this structure
417  are heavily described in the GetFEM Kernel Documentation.
418  */
420  protected:
421  mutable base_node xref_; /** reference point */
422  mutable base_node xreal_; /** transformed point */
423  const base_matrix *G_; /** pointer to the matrix of real nodes of the convex */
424  mutable base_node cv_center_; /** real center of convex (average of columns of G) */
425  mutable base_matrix K_, B_, B3_, B32_; /** see documentation (getfem kernel doc) for more details */
427  pgeotrans_precomp pgp_;
428  pstored_point_tab pspt_; /** if pgp != 0, it is the same as pgp's one */
429  size_type ii_; /** index of current point in the pgp */
430  mutable scalar_type J_=0, J__=0; /** Jacobian */
431  mutable base_matrix PC, B_factors;
432  mutable base_vector aux1, aux2;
433  mutable std::vector<long> ipvt;
434  mutable bool have_J_, have_B_, have_B3_, have_B32_, have_K_, have_cv_center_;
435  void compute_J() const;
436  public:
437  bool have_xref() const { return !xref_.empty(); }
438  bool have_xreal() const { return !xreal_.empty(); }
439  bool have_G() const { return G_ != 0; }
440  bool have_K() const { return have_K_; }
441  bool have_B() const { return have_B_; }
442  bool have_B3() const { return have_B3_; }
443  bool have_B32() const { return have_B32_; }
444  bool have_pgt() const { return pgt_ != 0; }
445  bool have_pgp() const { return pgp_ != 0; }
446  /// coordinates of the current point, in the reference convex.
447  const base_node& xref() const;
448  /// coordinates of the current point, in the real convex.
449  const base_node& xreal() const;
450  /// coordinates of the center of the real convex.
451  const base_node& cv_center() const;
452  /// See getfem kernel doc for these matrices
453  const base_matrix& K() const;
454  const base_matrix& B() const;
455  const base_matrix& B3() const;
456  const base_matrix& B32() const;
457  bgeot::pgeometric_trans pgt() const { return pgt_; }
458  /** matrix whose columns are the vertices of the convex */
459  const base_matrix& G() const { return *G_; }
460  /** get the Jacobian of the geometric trans (taken at point @c xref() ) */
461  scalar_type J() const { if (!have_J_) compute_J(); return J_; }
462  size_type N() const {
463  if (have_G()) return G().nrows();
464  else if (have_xreal()) return xreal_.size();
465  else GMM_ASSERT2(false, "cannot get N");
466  return 0;
467  }
468  size_type ii() const { return ii_; }
469  bgeot::pgeotrans_precomp pgp() const { return pgp_; }
470  /** change the current point (assuming a geotrans_precomp_ is used) */
471  void set_ii(size_type ii__) {
472  if (ii_ != ii__) {
473  if (pgt_ && !pgt()->is_linear())
474  { have_K_ = have_B_ = have_B3_ = have_B32_ = have_J_ = false; }
475  xref_.resize(0); xreal_.resize(0);
476  ii_=ii__;
477  }
478  }
479  /** change the current point (coordinates given in the reference convex) */
480  void set_xref(const base_node& P);
481  void change(bgeot::pgeotrans_precomp pgp__,
482  size_type ii__,
483  const base_matrix& G__) {
484  G_ = &G__; pgt_ = pgp__->get_trans(); pgp_ = pgp__;
485  pspt_ = pgp__->get_ppoint_tab(); ii_ = ii__;
486  have_J_ = have_B_ = have_B3_ = have_B32_ = have_K_ = false;
487  have_cv_center_ = false;
488  xref_.resize(0); xreal_.resize(0); cv_center_.resize(0);
489  }
490  void change(bgeot::pgeometric_trans pgt__,
491  bgeot::pstored_point_tab pspt__,
492  size_type ii__,
493  const base_matrix& G__) {
494  G_ = &G__; pgt_ = pgt__; pgp_ = 0; pspt_ = pspt__; ii_ = ii__;
495  have_J_ = have_B_ = have_B3_ = have_B32_ = have_K_ = false;
496  have_cv_center_ = false;
497  xref_.resize(0); xreal_.resize(0); cv_center_.resize(0);
498  }
499  void change(bgeot::pgeometric_trans pgt__,
500  const base_node& xref__,
501  const base_matrix& G__) {
502  xref_ = xref__; G_ = &G__; pgt_ = pgt__; pgp_ = 0; pspt_ = 0;
503  ii_ = size_type(-1);
504  have_J_ = have_B_ = have_B3_ = have_B32_ = have_K_ = false;
505  have_cv_center_ = false;
506  xreal_.resize(0); cv_center_.resize(0);
507  }
508 
509  geotrans_interpolation_context()
510  : G_(0), pgt_(0), pgp_(0), pspt_(0), ii_(size_type(-1)),
511  have_J_(false), have_B_(false), have_B3_(false), have_B32_(false),
512  have_K_(false), have_cv_center_(false) {}
513  geotrans_interpolation_context(bgeot::pgeotrans_precomp pgp__,
514  size_type ii__,
515  const base_matrix& G__)
516  : G_(&G__), pgt_(pgp__->get_trans()), pgp_(pgp__),
517  pspt_(pgp__->get_ppoint_tab()), ii_(ii__), have_J_(false), have_B_(false),
518  have_B3_(false), have_B32_(false), have_K_(false), have_cv_center_(false) {}
519  geotrans_interpolation_context(bgeot::pgeometric_trans pgt__,
520  bgeot::pstored_point_tab pspt__,
521  size_type ii__,
522  const base_matrix& G__)
523  : G_(&G__), pgt_(pgt__), pgp_(0),
524  pspt_(pspt__), ii_(ii__), have_J_(false), have_B_(false), have_B3_(false),
525  have_B32_(false), have_K_(false), have_cv_center_(false) {}
526  geotrans_interpolation_context(bgeot::pgeometric_trans pgt__,
527  const base_node& xref__,
528  const base_matrix& G__)
529  : xref_(xref__), G_(&G__), pgt_(pgt__), pgp_(0), pspt_(0),
530  ii_(size_type(-1)), have_J_(false), have_B_(false), have_B3_(false),
531  have_B32_(false), have_K_(false), have_cv_center_(false) {}
532  };
533 
534  /* Function allowing the add of an geometric transformation method outwards
535  of getfem_integration.cc */
536 
537  typedef dal::naming_system<geometric_trans>::param_list gt_param_list;
538 
539  void APIDECL add_geometric_trans_name
541 
542 
543  /* Optimized operation for small matrices */
544  scalar_type lu_det(const scalar_type *A, size_type N);
545  scalar_type lu_inverse(scalar_type *A, size_type N, bool doassert = true);
546  inline scalar_type lu_det(const base_matrix &A)
547  { return lu_det(&(*(A.begin())), A.nrows()); }
548  inline scalar_type lu_inverse(base_matrix &A, bool doassert = true)
549  { return lu_inverse(&(*(A.begin())), A.nrows(), doassert); }
550  // Optimized matrix mult for small matrices.
551  // Multiply the matrix A of size MxN by B of size NxP in C of size MxP
552  void mat_mult(const scalar_type *A, const scalar_type *B, scalar_type *C,
553  size_type M, size_type N, size_type P);
554  // Optimized matrix mult for small matrices.
555  // Multiply the matrix A of size MxN by the transpose of B of size PxN
556  // in C of size MxP
557  void mat_tmult(const scalar_type *A, const scalar_type *B, scalar_type *C,
558  size_type M, size_type N, size_type P);
559 
560 } /* end of namespace bgeot. */
561 
562 
563 #endif /* BGEOT_GEOMETRIC_TRANSFORMATION_H__ */
defines and typedefs for namespace bgeot
Reference convexes.
Description of a geometric transformation between a reference element and a real element.
const stored_point_tab & geometric_nodes() const
Gives the array of geometric nodes (on reference convex)
dim_type dim() const
Dimension of the reference element.
pconvex_structure structure() const
Structure of the reference element.
virtual void poly_vector_grad(const base_node &pt, base_matrix &val) const =0
Gives the gradient of the functions vector at a certain point.
virtual void poly_vector_grad(const base_node &pt, const convex_ind_ct &ind_ct, base_matrix &val) const =0
Gives the gradient of a subgroup of the functions vector at a certain point.
pconvex_ref convex_ref() const
Pointer on the convex of reference.
virtual void poly_vector_hess(const base_node &pt, base_matrix &val) const =0
Gives the hessian of the functions vector at a certain point.
size_type nb_points() const
Number of geometric nodes.
const std::vector< size_type > & vertices() const
Gives the indices of vertices between the nodes.
bool is_linear() const
True if the transformation is linear (affine in fact).
virtual void poly_vector_val(const base_node &pt, const convex_ind_ct &ind_ct, base_vector &val) const =0
Gives the value of a subgroup of the functions vector at a certain point.
base_node transform(const base_node &pt, const CONT &PTAB) const
Apply the geometric transformation to point pt, PTAB contains the points of the real convex.
pstored_point_tab pgeometric_nodes() const
Gives the array of geometric nodes (on reference convex)
virtual void poly_vector_val(const base_node &pt, base_vector &val) const =0
Gives the value of the functions vector at a certain point.
pconvex_structure basic_structure() const
Basic structure of the reference element.
size_type nb_vertices() const
Gives the number of vertices.
const std::vector< base_small_vector > & normals() const
Gives the array of the normals to faces (on reference convex)
the geotrans_interpolation_context structure is passed as the argument of geometric transformation in...
const base_matrix & G() const
matrix whose columns are the vertices of the convex
size_type ii_
if pgp != 0, it is the same as pgp's one
const base_matrix * G_
transformed point
pgeometric_trans pgt_
see documentation (getfem kernel doc) for more details
base_node cv_center_
pointer to the matrix of real nodes of the convex
void set_ii(size_type ii__)
change the current point (assuming a geotrans_precomp_ is used)
scalar_type J() const
get the Jacobian of the geometric trans (taken at point xref() )
base_matrix K_
real center of convex (average of columns of G)
precomputed geometric transformation operations use this for repetitive evaluation of a geometric tra...
void transform(const CONT &G, stored_point_tab &pt_tab) const
Apply the geometric transformation from the reference convex to the convex whose vertices are stored ...
The object geotrans_precomp_pool Allow to allocate a certain number of geotrans_precomp and automatic...
Associate a name to a method descriptor and store method descriptors.
base class for static stored objects
Naming system.
Basic Geometric Tools.
gmm::uint16_type short_type
used as the common short type integer in the library
Definition: bgeot_config.h:72
std::string name_of_geometric_trans(pgeometric_trans p)
Get the string name of a geometric transformation.
std::shared_ptr< const convex_structure > pconvex_structure
Pointer on a convex structure description.
base_small_vector compute_unit_element_normal(const geotrans_interpolation_context &c)
Unit normal vector to an element of dimension N-1 in dimension N (a curve in 2D or a surface in 3D),...
base_matrix compute_local_basis(const geotrans_interpolation_context &c, size_type face)
return the local basis (i.e.
base_small_vector compute_normal(const geotrans_interpolation_context &c, size_type face)
norm of returned vector is the ratio between the face surface on the real element and the face surfac...
pgeometric_trans geometric_trans_descriptor(std::string name)
Get the geometric transformation from its string name.
size_t size_type
used as the common size type in the library
Definition: bgeot_poly.h:48
pconvex_structure basic_structure(pconvex_structure cv)
Original structure (if concerned)
std::shared_ptr< const bgeot::geometric_trans > pgeometric_trans
pointer type for a geometric transformation
Point tab storage.