GetFEM  5.4.3
bgeot_geometric_trans.h
Go to the documentation of this file.
1 /* -*- c++ -*- (enables emacs c++ mode) */
2 /*===========================================================================
3 
4  Copyright (C) 2000-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 /** @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  std::string name_;
114 
115  void fill_standard_vertices();
116  public :
117 
118  /// Dimension of the reference element.
119  dim_type dim() const { return cvr->structure()->dim(); }
120  /// True if the transformation is linear (affine in fact).
121  bool is_linear() const { return is_lin; }
122  /// Number of geometric nodes.
123  size_type nb_points() const { return cvr->nb_points(); }
124  /// Pointer on the convex of reference.
125  pconvex_ref convex_ref() const { return cvr; }
126  /// Structure of the reference element.
127  pconvex_structure structure() const { return cvr->structure(); }
128  /// Basic structure of the reference element.
130  { return bgeot::basic_structure(cvr->structure()); }
131  /// Gives the value of the functions vector at a certain point.
132  virtual void poly_vector_val(const base_node &pt, base_vector &val) const = 0;
133  /// Gives the value of a subgroup of the functions vector at a certain point.
134  virtual void poly_vector_val(const base_node &pt, const convex_ind_ct &ind_ct,
135  base_vector &val) const = 0;
136  /// Gives the gradient of the functions vector at a certain point.
137  virtual void poly_vector_grad(const base_node &pt, base_matrix &val) const = 0;
138  /// Gives the gradient of a subgroup of the functions vector at a certain point.
139  virtual void poly_vector_grad(const base_node &pt, const convex_ind_ct &ind_ct,
140  base_matrix &val) const = 0;
141  /// Gives the hessian of the functions vector at a certain point.
142  virtual void poly_vector_hess(const base_node &pt, base_matrix &val) const = 0;
143  /// compute K matrix from multiplication of G with gradient
144  virtual void compute_K_matrix(const base_matrix &G, const base_matrix &pc, base_matrix &K) const;
145  /// Gives the number of vertices.
146  size_type nb_vertices() const { return vertices_.size(); }
147  /// Gives the indices of vertices between the nodes.
148  const std::vector<size_type> &vertices() const { return vertices_; }
149  /// Gives the array of geometric nodes (on reference convex)
151  { return cvr->points(); }
152  /// Gives the array of geometric nodes (on reference convex)
153  pstored_point_tab pgeometric_nodes() const
154  { return cvr->pspt(); }
155  /// Gives the array of the normals to faces (on reference convex)
156  const std::vector<base_small_vector> &normals() const
157  { return cvr->normals(); }
158  /** Apply the geometric transformation to point pt,
159  PTAB contains the points of the real convex */
160  template<class CONT> base_node transform(const base_node &pt,
161  const CONT &PTAB) const;
162  base_node transform(const base_node &pt, const base_matrix &G) const;
163  void set_name(const std::string &name){name_ = name;}
164  const std::string& debug_name() const {return name_;}
165  virtual void project_into_reference_convex(base_node &pt) const
166  { cvr->project_into(pt); }
167  size_type complexity() const { return complexity_; }
168  virtual ~geometric_trans()
169  { DAL_STORED_OBJECT_DEBUG_DESTROYED(this, "Geometric transformation"); }
170  geometric_trans()
171  { DAL_STORED_OBJECT_DEBUG_CREATED(this, "Geometric transformation"); }
172  };
173 
174  template<class CONT>
176  const CONT &ptab) const {
177  base_node P(ptab[0].size());
178  size_type k = nb_points();
179  base_vector val(k);
180  poly_vector_val(pt, val);
181  for (size_type l = 0; l < k; ++l) gmm::add(gmm::scaled(ptab[l], val[l]),P);
182  return P;
183  }
184 
185  /** pointer type for a geometric transformation */
186  typedef std::shared_ptr<const bgeot::geometric_trans> pgeometric_trans;
188 
189  template<class CONT>
190  void bounding_box(base_node& min, base_node& max,
191  const CONT &ptab, pgeometric_trans pgt = 0) {
192  typename CONT::const_iterator it = ptab.begin();
193  min = max = *it; size_type P = min.size();
194  base_node::iterator itmin = min.begin(), itmax = max.begin();
195  for ( ++it; it != ptab.end(); ++it) {
196  base_node pt = *it; /* need a temporary storage since cv.points()[j] may
197  not be a reference to a base_node, but a
198  temporary base_node !! (?) */
199  base_node::const_iterator it2 = pt.begin();
200  for (size_type i = 0; i < P; ++i) {
201  itmin[i] = std::min(itmin[i], it2[i]);
202  itmax[i] = std::max(itmax[i], it2[i]);
203  }
204  }
205  /* enlarge the box for non-linear transformations .. */
206  if (pgt && !pgt->is_linear())
207  for (size_type i = 0; i < P; ++i) {
208  scalar_type e = (itmax[i]-itmin[i]) * 0.2;
209  itmin[i] -= e; itmax[i] += e;
210  }
211  }
212 
213  /** @name functions on geometric transformations
214  */
215  //@{
216 
217  pgeometric_trans APIDECL simplex_geotrans(size_type n, short_type k);
218  pgeometric_trans APIDECL parallelepiped_geotrans(size_type n, short_type k);
219  pgeometric_trans APIDECL parallelepiped_linear_geotrans(size_type n);
220  pgeometric_trans APIDECL prism_geotrans(size_type n, short_type k);
221  pgeometric_trans APIDECL prism_linear_geotrans(size_type n);
222  pgeometric_trans APIDECL product_geotrans(pgeometric_trans pg1,
223  pgeometric_trans pg2);
224  pgeometric_trans APIDECL linear_product_geotrans(pgeometric_trans pg1,
225  pgeometric_trans pg2);
226  pgeometric_trans APIDECL Q2_incomplete_geotrans(dim_type nc);
227  pgeometric_trans APIDECL prism_incomplete_P2_geotrans();
228  pgeometric_trans APIDECL pyramid_QK_geotrans(short_type k);
229  IS_DEPRECATED inline pgeometric_trans APIDECL
230  pyramid_geotrans(short_type k) { return pyramid_QK_geotrans(k); }
231  pgeometric_trans APIDECL pyramid_Q2_incomplete_geotrans();
232 
233  pgeometric_trans APIDECL default_trans_of_cvs(pconvex_structure);
234 
235  /**
236  Get the geometric transformation from its string name.
237  @see name_of_geometric_trans
238  */
239  pgeometric_trans APIDECL geometric_trans_descriptor(std::string name);
240  /**
241  Get the string name of a geometric transformation.
242 
243  List of possible names:
244  GT_PK(N,K) : Transformation on simplexes, dim N, degree K
245 
246  GT_QK(N,K) : Transformation on parallelepipeds, dim N, degree K
247  GT_PRISM(N,K) : Transformation on prisms, dim N, degree K
248  GT_PYRAMID_QK(K) : Transformation on pyramids, dim 3, degree K=0,1,2
249  GT_Q2_INCOMPLETE(N) : Q2 incomplete transformation in dim N=2 or 3.
250  GT_PYRAMID_Q2_INCOMPLETE : incomplete quadratic pyramid transformation
251  in dim 3
252  GT_PRISM_INCOMPLETE_P2 : incomplete quadratic prism transformation in
253  dim 3
254  GT_PRODUCT(a,b) : tensorial product of two transformations
255  GT_LINEAR_PRODUCT(a,b) : Linear tensorial product of two transformations
256  GT_LINEAR_QK(N) : shortcut for GT_LINEAR_PRODUCT(GT_LINEAR_QK(N-1),
257  GT_PK(1,1))
258  */
259 
260  std::string APIDECL name_of_geometric_trans(pgeometric_trans p);
261 
262  /** norm of returned vector is the ratio between the face surface on
263  * the real element and the face surface on the reference element
264  * IT IS NOT UNITARY
265  *
266  * pt is the position of the evaluation point on the reference element
267  */
268  base_small_vector APIDECL
269  compute_normal(const geotrans_interpolation_context& c, size_type face);
270 
271  /** return the local basis (i.e. the normal in the first column, and the
272  * tangent vectors in the other columns
273  */
274  base_matrix APIDECL
275  compute_local_basis(const geotrans_interpolation_context& c,
276  size_type face);
277  //@}
278 
279  /* ********************************************************************* */
280  /* Precomputation on geometric transformations. */
281  /* ********************************************************************* */
282 
283 
284  class geotrans_precomp_;
285  typedef std::shared_ptr<const geotrans_precomp_> pgeotrans_precomp;
286 
287 
288  /**
289  * precomputed geometric transformation operations use this for
290  * repetitive evaluation of a geometric transformations on a set of
291  * points "pspt" in the reference convex which do not change.
292  */
293  class APIDECL geotrans_precomp_ : virtual public dal::static_stored_object {
294  protected:
295  pgeometric_trans pgt;
296  pstored_point_tab pspt; /* a set of points in the reference elt*/
297  mutable std::vector<base_vector> c; /* precomputed values for the */
298  /* transformation */
299  mutable std::vector<base_matrix> pc; /* precomputed values for gradient*/
300  /* of the transformation. */
301  mutable std::vector<base_matrix> hpc; /* precomputed values for hessian*/
302  /* of the transformation. */
303  public:
304  inline const base_vector &val(size_type i) const
305  { if (c.empty()) init_val(); return c[i]; }
306  inline const base_matrix &grad(size_type i) const
307  { if (pc.empty()) init_grad(); return pc[i]; }
308  inline const base_matrix &hessian(size_type i) const
309  { if (hpc.empty()) init_hess(); return hpc[i]; }
310 
311  /**
312  * Apply the geometric transformation from the reference convex to
313  * the convex whose vertices are stored in G, to the set of points
314  * listed in pspt.
315  * @param G any container of vertices of the transformed
316  * convex.
317  * @param pt_tab on output, the transformed points.
318  */
319  template <typename CONT>
320  void transform(const CONT& G,
321  stored_point_tab& pt_tab) const;
322  template <typename CONT, typename VEC>
323  void transform(const CONT& G, size_type ii, VEC& pt) const;
324 
325  base_node transform(size_type i, const base_matrix &G) const;
326  pgeometric_trans get_trans() const { return pgt; }
327  // inline const stored_point_tab& get_point_tab() const { return *pspt; }
328  inline pstored_point_tab get_ppoint_tab() const { return pspt; }
329  geotrans_precomp_(pgeometric_trans pg, pstored_point_tab ps);
331  { DAL_STORED_OBJECT_DEBUG_DESTROYED(this, "Geotrans precomp"); }
332 
333  private:
334  void init_val() const;
335  void init_grad() const;
336  void init_hess() const;
337 
338  /**
339  * precomputes a geometric transformation for a fixed set of
340  * points in the reference convex.
341  */
342  friend pgeotrans_precomp
343  geotrans_precomp(pgeometric_trans pg, pstored_point_tab ps,
344  dal::pstatic_stored_object dep);
345 
346  };
347 
348 
349  pgeotrans_precomp
350  geotrans_precomp(pgeometric_trans pg, pstored_point_tab ps,
351  dal::pstatic_stored_object dep);
352 
353  template <typename CONT, typename VEC>
354  void geotrans_precomp_::transform(const CONT& G, size_type j,
355  VEC& pt) const {
356  size_type k = 0;
357  gmm::clear(pt);
358  if (c.empty()) init_val();
359  for (typename CONT::const_iterator itk = G.begin();
360  itk != G.end(); ++itk, ++k)
361  gmm::add(gmm::scaled(*itk, c[j][k]), pt);
362  GMM_ASSERT1(k == pgt->nb_points(),
363  "Wrong number of points in transformation");
364  }
365 
366  template <typename CONT>
367  void geotrans_precomp_::transform(const CONT& G,
368  stored_point_tab& pt_tab) const {
369  if (c.empty()) init_val();
370  pt_tab.clear(); pt_tab.resize(c.size(), base_node(G[0].size()));
371  for (size_type j = 0; j < c.size(); ++j) {
372  transform(G, j, pt_tab[j]);
373  }
374  }
375 
376  void APIDECL delete_geotrans_precomp(pgeotrans_precomp pgp);
377 
378  /**
379  * The object geotrans_precomp_pool Allow to allocate a certain number
380  * of geotrans_precomp and automatically delete them when it is
381  * deleted itself.
382  */
383  class APIDECL geotrans_precomp_pool {
384  std::set<pgeotrans_precomp> precomps;
385 
386  public :
387 
388  pgeotrans_precomp operator()(pgeometric_trans pg,
389  pstored_point_tab pspt) {
390  pgeotrans_precomp p = geotrans_precomp(pg, pspt, 0);
391  precomps.insert(p);
392  return p;
393  }
395  for (std::set<pgeotrans_precomp>::iterator it = precomps.begin();
396  it != precomps.end(); ++it)
397  delete_geotrans_precomp(*it);
398  }
399  };
400 
401 
402 
403  /** the geotrans_interpolation_context structure is passed as the
404  argument of geometric transformation interpolation
405  functions. This structure can be partially filled (for example
406  the xreal will be computed if needed as long as pgp+ii is known).
407  See also fem_interpolation_context in getfem_fem.h.
408  The name of member data, and the computations done by this structure
409  are heavily described in the GetFEM Kernel Documentation.
410  */
412  protected:
413  mutable base_node xref_; /** reference point */
414  mutable base_node xreal_; /** transformed point */
415  const base_matrix *G_; /** pointer to the matrix of real nodes of the convex */
416  mutable base_node cv_center_; /** real center of convex (average of columns of G) */
417  mutable base_matrix K_, B_, B3_, B32_; /** see documentation (getfem kernel doc) for more details */
419  pgeotrans_precomp pgp_;
420  pstored_point_tab pspt_; /** if pgp != 0, it is the same as pgp's one */
421  size_type ii_; /** index of current point in the pgp */
422  mutable scalar_type J_=0, J__=0; /** Jacobian */
423  mutable base_matrix PC, B_factors;
424  mutable base_vector aux1, aux2;
425  mutable std::vector<long> ipvt;
426  mutable bool have_J_, have_B_, have_B3_, have_B32_, have_K_, have_cv_center_;
427  void compute_J() const;
428  public:
429  bool have_xref() const { return !xref_.empty(); }
430  bool have_xreal() const { return !xreal_.empty(); }
431  bool have_G() const { return G_ != 0; }
432  bool have_K() const { return have_K_; }
433  bool have_B() const { return have_B_; }
434  bool have_B3() const { return have_B3_; }
435  bool have_B32() const { return have_B32_; }
436  bool have_pgt() const { return pgt_ != 0; }
437  bool have_pgp() const { return pgp_ != 0; }
438  /// coordinates of the current point, in the reference convex.
439  const base_node& xref() const;
440  /// coordinates of the current point, in the real convex.
441  const base_node& xreal() const;
442  /// coordinates of the center of the real convex.
443  const base_node& cv_center() const;
444  /// See getfem kernel doc for these matrices
445  const base_matrix& K() const;
446  const base_matrix& B() const;
447  const base_matrix& B3() const;
448  const base_matrix& B32() const;
449  bgeot::pgeometric_trans pgt() const { return pgt_; }
450  /** matrix whose columns are the vertices of the convex */
451  const base_matrix& G() const { return *G_; }
452  /** get the Jacobian of the geometric trans (taken at point @c xref() ) */
453  scalar_type J() const { if (!have_J_) compute_J(); return J_; }
454  size_type N() const {
455  if (have_G()) return G().nrows();
456  else if (have_xreal()) return xreal_.size();
457  else GMM_ASSERT2(false, "cannot get N");
458  return 0;
459  }
460  size_type ii() const { return ii_; }
461  bgeot::pgeotrans_precomp pgp() const { return pgp_; }
462  /** change the current point (assuming a geotrans_precomp_ is used) */
463  void set_ii(size_type ii__) {
464  if (ii_ != ii__) {
465  if (pgt_ && !pgt()->is_linear())
466  { have_K_ = have_B_ = have_B3_ = have_B32_ = have_J_ = false; }
467  xref_.resize(0); xreal_.resize(0);
468  ii_=ii__;
469  }
470  }
471  /** change the current point (coordinates given in the reference convex) */
472  void set_xref(const base_node& P);
473  void change(bgeot::pgeotrans_precomp pgp__,
474  size_type ii__,
475  const base_matrix& G__) {
476  G_ = &G__; pgt_ = pgp__->get_trans(); pgp_ = pgp__;
477  pspt_ = pgp__->get_ppoint_tab(); ii_ = ii__;
478  have_J_ = have_B_ = have_B3_ = have_B32_ = have_K_ = false;
479  have_cv_center_ = false;
480  xref_.resize(0); xreal_.resize(0); cv_center_.resize(0);
481  }
482  void change(bgeot::pgeometric_trans pgt__,
483  bgeot::pstored_point_tab pspt__,
484  size_type ii__,
485  const base_matrix& G__) {
486  G_ = &G__; pgt_ = pgt__; pgp_ = 0; pspt_ = pspt__; ii_ = ii__;
487  have_J_ = have_B_ = have_B3_ = have_B32_ = have_K_ = false;
488  have_cv_center_ = false;
489  xref_.resize(0); xreal_.resize(0); cv_center_.resize(0);
490  }
491  void change(bgeot::pgeometric_trans pgt__,
492  const base_node& xref__,
493  const base_matrix& G__) {
494  xref_ = xref__; G_ = &G__; pgt_ = pgt__; pgp_ = 0; pspt_ = 0;
495  ii_ = size_type(-1);
496  have_J_ = have_B_ = have_B3_ = have_B32_ = have_K_ = false;
497  have_cv_center_ = false;
498  xreal_.resize(0); cv_center_.resize(0);
499  }
500 
501  geotrans_interpolation_context()
502  : G_(0), pgt_(0), pgp_(0), pspt_(0), ii_(size_type(-1)),
503  have_J_(false), have_B_(false), have_B3_(false), have_B32_(false),
504  have_K_(false), have_cv_center_(false) {}
505  geotrans_interpolation_context(bgeot::pgeotrans_precomp pgp__,
506  size_type ii__,
507  const base_matrix& G__)
508  : G_(&G__), pgt_(pgp__->get_trans()), pgp_(pgp__),
509  pspt_(pgp__->get_ppoint_tab()), ii_(ii__), have_J_(false), have_B_(false),
510  have_B3_(false), have_B32_(false), have_K_(false), have_cv_center_(false) {}
511  geotrans_interpolation_context(bgeot::pgeometric_trans pgt__,
512  bgeot::pstored_point_tab pspt__,
513  size_type ii__,
514  const base_matrix& G__)
515  : G_(&G__), pgt_(pgt__), pgp_(0),
516  pspt_(pspt__), ii_(ii__), have_J_(false), have_B_(false), have_B3_(false),
517  have_B32_(false), have_K_(false), have_cv_center_(false) {}
518  geotrans_interpolation_context(bgeot::pgeometric_trans pgt__,
519  const base_node& xref__,
520  const base_matrix& G__)
521  : xref_(xref__), G_(&G__), pgt_(pgt__), pgp_(0), pspt_(0),
522  ii_(size_type(-1)), have_J_(false), have_B_(false), have_B3_(false),
523  have_B32_(false), have_K_(false), have_cv_center_(false) {}
524  };
525 
526  /* Function allowing the add of an geometric transformation method outwards
527  of getfem_integration.cc */
528 
529  typedef dal::naming_system<geometric_trans>::param_list gt_param_list;
530 
531  void APIDECL add_geometric_trans_name
533 
534 
535  /* Optimized operation for small matrices */
536  scalar_type lu_det(const scalar_type *A, size_type N);
537  scalar_type lu_inverse(scalar_type *A, size_type N, bool doassert = true);
538  inline scalar_type lu_det(const base_matrix &A)
539  { return lu_det(&(*(A.begin())), A.nrows()); }
540  inline scalar_type lu_inverse(base_matrix &A, bool doassert = true)
541  { return lu_inverse(&(*(A.begin())), A.nrows(), doassert); }
542  // Optimized matrix mult for small matrices.
543  // Multiply the matrix A of size MxN by B of size NxP in C of size MxP
544  void mat_mult(const scalar_type *A, const scalar_type *B, scalar_type *C,
545  size_type M, size_type N, size_type P);
546  // Optimized matrix mult for small matrices.
547  // Multiply the matrix A of size MxN by the transpose of B of size PxN
548  // in C of size MxP
549  void mat_tmult(const scalar_type *A, const scalar_type *B, scalar_type *C,
550  size_type M, size_type N, size_type P);
551 
552 } /* end of namespace bgeot. */
553 
554 
555 #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:73
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:49
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.