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