GetFEM  5.5
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 <[email protected]>
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  /** return the local basis (i.e. the normal in the first column, and the
271  * tangent vectors in the other columns
272  */
273  base_matrix APIDECL
274  compute_local_basis(const geotrans_interpolation_context& c,
275  size_type face);
276  //@}
277 
278  /* ********************************************************************* */
279  /* Precomputation on geometric transformations. */
280  /* ********************************************************************* */
281 
282 
283  class geotrans_precomp_;
284  typedef std::shared_ptr<const geotrans_precomp_> pgeotrans_precomp;
285 
286 
287  /**
288  * precomputed geometric transformation operations use this for
289  * repetitive evaluation of a geometric transformations on a set of
290  * points "pspt" in the reference convex which do not change.
291  */
292  class APIDECL geotrans_precomp_ : virtual public dal::static_stored_object {
293  protected:
294  pgeometric_trans pgt;
295  pstored_point_tab pspt; /* a set of points in the reference elt*/
296  mutable std::vector<base_vector> c; /* precomputed values for the */
297  /* transformation */
298  mutable std::vector<base_matrix> pc; /* precomputed values for gradient*/
299  /* of the transformation. */
300  mutable std::vector<base_matrix> hpc; /* precomputed values for hessian*/
301  /* of the transformation. */
302  public:
303  inline const base_vector &val(size_type i) const
304  { if (c.empty()) init_val(); return c[i]; }
305  inline const base_matrix &grad(size_type i) const
306  { if (pc.empty()) init_grad(); return pc[i]; }
307  inline const base_matrix &hessian(size_type i) const
308  { if (hpc.empty()) init_hess(); return hpc[i]; }
309 
310  /**
311  * Apply the geometric transformation from the reference convex to
312  * the convex whose vertices are stored in G, to the set of points
313  * listed in pspt.
314  * @param G any container of vertices of the transformed
315  * convex.
316  * @param pt_tab on output, the transformed points.
317  */
318  template <typename CONT>
319  void transform(const CONT& G,
320  stored_point_tab& pt_tab) const;
321  template <typename CONT, typename VEC>
322  void transform(const CONT& G, size_type ii, VEC& pt) const;
323 
324  base_node transform(size_type i, const base_matrix &G) const;
325  pgeometric_trans get_trans() const { return pgt; }
326  // inline const stored_point_tab& get_point_tab() const { return *pspt; }
327  inline pstored_point_tab get_ppoint_tab() const { return pspt; }
328  geotrans_precomp_(pgeometric_trans pg, pstored_point_tab ps);
330  { DAL_STORED_OBJECT_DEBUG_DESTROYED(this, "Geotrans precomp"); }
331 
332  private:
333  void init_val() const;
334  void init_grad() const;
335  void init_hess() const;
336 
337  /**
338  * precomputes a geometric transformation for a fixed set of
339  * points in the reference convex.
340  */
341  friend pgeotrans_precomp
342  geotrans_precomp(pgeometric_trans pg, pstored_point_tab ps,
343  dal::pstatic_stored_object dep);
344 
345  };
346 
347 
348  pgeotrans_precomp
349  geotrans_precomp(pgeometric_trans pg, pstored_point_tab ps,
350  dal::pstatic_stored_object dep);
351 
352  template <typename CONT, typename VEC>
353  void geotrans_precomp_::transform(const CONT& G, size_type j,
354  VEC& pt) const {
355  size_type k = 0;
356  gmm::clear(pt);
357  if (c.empty()) init_val();
358  for (typename CONT::const_iterator itk = G.begin();
359  itk != G.end(); ++itk, ++k)
360  gmm::add(gmm::scaled(*itk, c[j][k]), pt);
361  GMM_ASSERT1(k == pgt->nb_points(),
362  "Wrong number of points in transformation");
363  }
364 
365  template <typename CONT>
366  void geotrans_precomp_::transform(const CONT& G,
367  stored_point_tab& pt_tab) const {
368  if (c.empty()) init_val();
369  pt_tab.clear(); pt_tab.resize(c.size(), base_node(G[0].size()));
370  for (size_type j = 0; j < c.size(); ++j) {
371  transform(G, j, pt_tab[j]);
372  }
373  }
374 
375  void APIDECL delete_geotrans_precomp(pgeotrans_precomp pgp);
376 
377  /**
378  * The object geotrans_precomp_pool Allow to allocate a certain number
379  * of geotrans_precomp and automatically delete them when it is
380  * deleted itself.
381  */
382  class APIDECL geotrans_precomp_pool {
383  std::set<pgeotrans_precomp> precomps;
384 
385  public :
386 
387  pgeotrans_precomp operator()(pgeometric_trans pg,
388  pstored_point_tab pspt) {
389  pgeotrans_precomp p = geotrans_precomp(pg, pspt, 0);
390  precomps.insert(p);
391  return p;
392  }
394  for (std::set<pgeotrans_precomp>::iterator it = precomps.begin();
395  it != precomps.end(); ++it)
396  delete_geotrans_precomp(*it);
397  }
398  };
399 
400 
401 
402  /** the geotrans_interpolation_context structure is passed as the
403  argument of geometric transformation interpolation
404  functions. This structure can be partially filled (for example
405  the xreal will be computed if needed as long as pgp+ii is known).
406  See also fem_interpolation_context in getfem_fem.h.
407  The name of member data, and the computations done by this structure
408  are heavily described in the GetFEM Kernel Documentation.
409  */
411  protected:
412  mutable base_node xref_; /** reference point */
413  mutable base_node xreal_; /** transformed point */
414  const base_matrix *G_; /** pointer to the matrix of real nodes of the convex */
415  mutable base_node cv_center_; /** real center of convex (average of columns of G) */
416  mutable base_matrix K_, B_, B3_, B32_; /** see documentation (getfem kernel doc) for more details */
418  pgeotrans_precomp pgp_;
419  pstored_point_tab pspt_; /** if pgp != 0, it is the same as pgp's one */
420  size_type ii_; /** index of current point in the pgp */
421  mutable scalar_type J_=0, J__=0; /** Jacobian */
422  mutable base_matrix PC, B_factors;
423  mutable base_vector aux1, aux2;
424  mutable std::vector<long> ipvt;
425  mutable bool have_J_, have_B_, have_B3_, have_B32_, have_K_, have_cv_center_;
426  void compute_J() const;
427  public:
428  bool have_xref() const { return !xref_.empty(); }
429  bool have_xreal() const { return !xreal_.empty(); }
430  bool have_G() const { return G_ != 0; }
431  bool have_K() const { return have_K_; }
432  bool have_B() const { return have_B_; }
433  bool have_B3() const { return have_B3_; }
434  bool have_B32() const { return have_B32_; }
435  bool have_pgt() const { return pgt_ != 0; }
436  bool have_pgp() const { return pgp_ != 0; }
437  /// coordinates of the current point, in the reference convex.
438  const base_node& xref() const;
439  /// coordinates of the current point, in the real convex.
440  const base_node& xreal() const;
441  /// coordinates of the center of the real convex.
442  const base_node& cv_center() const;
443  /// See getfem kernel doc for these matrices
444  const base_matrix& K() const;
445  const base_matrix& B() const;
446  const base_matrix& B3() const;
447  const base_matrix& B32() const;
448  bgeot::pgeometric_trans pgt() const { return pgt_; }
449  /** matrix whose columns are the vertices of the convex */
450  const base_matrix& G() const { return *G_; }
451  /** get the Jacobian of the geometric trans (taken at point @c xref() ) */
452  scalar_type J() const { if (!have_J_) compute_J(); return J_; }
453  size_type N() const {
454  if (have_G()) return G().nrows();
455  else if (have_xreal()) return xreal_.size();
456  else GMM_ASSERT2(false, "cannot get N");
457  return 0;
458  }
459  size_type ii() const { return ii_; }
460  bgeot::pgeotrans_precomp pgp() const { return pgp_; }
461  /** change the current point (assuming a geotrans_precomp_ is used) */
462  void set_ii(size_type ii__) {
463  if (ii_ != ii__) {
464  if (pgt_ && !pgt()->is_linear())
465  { have_K_ = have_B_ = have_B3_ = have_B32_ = have_J_ = false; }
466  xref_.resize(0); xreal_.resize(0);
467  ii_=ii__;
468  }
469  }
470  /** change the current point (coordinates given in the reference convex) */
471  void set_xref(const base_node& P);
472  void change(bgeot::pgeotrans_precomp pgp__,
473  size_type ii__,
474  const base_matrix& G__) {
475  G_ = &G__; pgt_ = pgp__->get_trans(); pgp_ = pgp__;
476  pspt_ = pgp__->get_ppoint_tab(); ii_ = ii__;
477  have_J_ = have_B_ = have_B3_ = have_B32_ = have_K_ = false;
478  have_cv_center_ = false;
479  xref_.resize(0); xreal_.resize(0); cv_center_.resize(0);
480  }
481  void change(bgeot::pgeometric_trans pgt__,
482  bgeot::pstored_point_tab pspt__,
483  size_type ii__,
484  const base_matrix& G__) {
485  G_ = &G__; pgt_ = pgt__; pgp_ = 0; pspt_ = pspt__; 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  const base_node& xref__,
492  const base_matrix& G__) {
493  xref_ = xref__; G_ = &G__; pgt_ = pgt__; pgp_ = 0; pspt_ = 0;
494  ii_ = size_type(-1);
495  have_J_ = have_B_ = have_B3_ = have_B32_ = have_K_ = false;
496  have_cv_center_ = false;
497  xreal_.resize(0); cv_center_.resize(0);
498  }
499 
500  geotrans_interpolation_context()
501  : G_(0), pgt_(0), pgp_(0), pspt_(0), ii_(size_type(-1)),
502  have_J_(false), have_B_(false), have_B3_(false), have_B32_(false),
503  have_K_(false), have_cv_center_(false) {}
504  geotrans_interpolation_context(bgeot::pgeotrans_precomp pgp__,
505  size_type ii__,
506  const base_matrix& G__)
507  : G_(&G__), pgt_(pgp__->get_trans()), pgp_(pgp__),
508  pspt_(pgp__->get_ppoint_tab()), ii_(ii__), have_J_(false), have_B_(false),
509  have_B3_(false), have_B32_(false), have_K_(false), have_cv_center_(false) {}
510  geotrans_interpolation_context(bgeot::pgeometric_trans pgt__,
511  bgeot::pstored_point_tab pspt__,
512  size_type ii__,
513  const base_matrix& G__)
514  : G_(&G__), pgt_(pgt__), pgp_(0),
515  pspt_(pspt__), ii_(ii__), have_J_(false), have_B_(false), have_B3_(false),
516  have_B32_(false), have_K_(false), have_cv_center_(false) {}
517  geotrans_interpolation_context(bgeot::pgeometric_trans pgt__,
518  const base_node& xref__,
519  const base_matrix& G__)
520  : xref_(xref__), G_(&G__), pgt_(pgt__), pgp_(0), pspt_(0),
521  ii_(size_type(-1)), have_J_(false), have_B_(false), have_B3_(false),
522  have_B32_(false), have_K_(false), have_cv_center_(false) {}
523  };
524 
525  /* Function allowing the add of an geometric transformation method outwards
526  of getfem_integration.cc */
527 
528  typedef dal::naming_system<geometric_trans>::param_list gt_param_list;
529 
530  void APIDECL add_geometric_trans_name
532 
533 
534  /* Optimized operation for small matrices */
535  scalar_type lu_det(const scalar_type *A, size_type N);
536  scalar_type lu_inverse(scalar_type *A, size_type N, bool doassert = true);
537  inline scalar_type lu_det(const base_matrix &A)
538  { return lu_det(&(*(A.begin())), A.nrows()); }
539  inline scalar_type lu_inverse(base_matrix &A, bool doassert = true)
540  { return lu_inverse(&(*(A.begin())), A.nrows(), doassert); }
541  // Optimized matrix mult for small matrices.
542  // Multiply the matrix A of size MxN by B of size NxP in C of size MxP
543  void mat_mult(const scalar_type *A, const scalar_type *B, scalar_type *C,
544  size_type M, size_type N, size_type P);
545  // Optimized matrix mult for small matrices.
546  // Multiply the matrix A of size MxN by the transpose of B of size PxN
547  // in C of size MxP
548  void mat_tmult(const scalar_type *A, const scalar_type *B, scalar_type *C,
549  size_type M, size_type N, size_type P);
550 
551 } /* end of namespace bgeot. */
552 
553 
554 #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_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.