Dune Core Modules (unstable)

multilineargeometry.hh
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 // SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
4 // SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
5 #ifndef DUNE_GEOMETRY_MULTILINEARGEOMETRY_HH
6 #define DUNE_GEOMETRY_MULTILINEARGEOMETRY_HH
7 
8 #include <cassert>
9 #include <functional>
10 #include <iterator>
11 #include <limits>
12 #include <vector>
13 
14 #include <dune/common/fmatrix.hh>
15 #include <dune/common/fvector.hh>
17 
19 #include <dune/geometry/referenceelements.hh>
20 #include <dune/geometry/type.hh>
21 
22 namespace Dune
23 {
24 
25  // MultiLinearGeometryTraits
26  // -------------------------
27 
37  template< class ct >
39  {
58  typedef Impl::FieldMatrixHelper< ct > MatrixHelper;
59 
61  static ct tolerance () { return ct( 16 ) * std::numeric_limits< ct >::epsilon(); }
62 
127  template< int mydim, int cdim >
129  {
130  typedef std::vector< FieldVector< ct, cdim > > Type;
131  };
132 
146  template< int dim >
148  {
149  static const bool v = false;
150  static const unsigned int topologyId = ~0u;
151  };
152  };
153 
154 
155 
156  // MultiLinearGeometry
157  // -------------------
158 
179  template< class ct, int mydim, int cdim, class Traits = MultiLinearGeometryTraits< ct > >
181  {
183 
184  public:
186  typedef ct ctype;
187 
189  static const int mydimension= mydim;
191  static const int coorddimension = cdim;
192 
198  typedef ctype Volume;
199 
202 
204  class JacobianInverseTransposed;
205 
208 
211 
212  protected:
213 
215 
216  public:
217 
220 
221  private:
222  static const bool hasSingleGeometryType = Traits::template hasSingleGeometryType< mydimension >::v;
223 
224  protected:
225  typedef typename Traits::MatrixHelper MatrixHelper;
226  typedef typename std::conditional< hasSingleGeometryType, std::integral_constant< unsigned int, Traits::template hasSingleGeometryType< mydimension >::topologyId >, unsigned int >::type TopologyId;
227 
228  public:
238  template< class Corners >
240  const Corners &corners )
241  : refElement_( refElement ),
242  corners_( corners )
243  {}
244 
254  template< class Corners >
256  const Corners &corners )
257  : refElement_( ReferenceElements::general( gt ) ),
258  corners_( corners )
259  {}
260 
262  bool affine () const
263  {
265  return affine( jt );
266  }
267 
269  Dune::GeometryType type () const { return GeometryType( toUnsignedInt(topologyId()), mydimension ); }
270 
272  int corners () const { return refElement().size( mydimension ); }
273 
275  GlobalCoordinate corner ( int i ) const
276  {
277  assert( (i >= 0) && (i < corners()) );
278  return std::cref(corners_).get()[ i ];
279  }
280 
282  GlobalCoordinate center () const { return global( refElement().position( 0, 0 ) ); }
283 
290  GlobalCoordinate global ( const LocalCoordinate &local ) const
291  {
292  using std::begin;
293 
294  auto cit = begin(std::cref(corners_).get());
296  global< false >( topologyId(), std::integral_constant< int, mydimension >(), cit, ctype( 1 ), local, ctype( 1 ), y );
297  return y;
298  }
299 
312  LocalCoordinate local ( const GlobalCoordinate &globalCoord ) const
313  {
314  const ctype tolerance = Traits::tolerance();
315  LocalCoordinate x = refElement().position( 0, 0 );
316  LocalCoordinate dx;
317  const bool affineMapping = this->affine();
318  do
319  {
320  // Newton's method: DF^n dx^n = F^n, x^{n+1} -= dx^n
321  const GlobalCoordinate dglobal = (*this).global( x ) - globalCoord;
322  const bool invertible =
323  MatrixHelper::template xTRightInvA< mydimension, coorddimension >( jacobianTransposed( x ), dglobal, dx );
324  if( ! invertible )
326 
327  // update x with correction
328  x -= dx;
329 
330  // for affine mappings only one iteration is needed
331  if ( affineMapping ) break;
332  } while( dx.two_norm2() > tolerance );
333  return x;
334  }
335 
351  {
352  return MatrixHelper::template sqrtDetAAT< mydimension, coorddimension >( jacobianTransposed( local ) );
353  }
354 
363  Volume volume () const
364  {
365  return integrationElement( refElement().position( 0, 0 ) ) * refElement().volume();
366  }
367 
378  {
379  using std::begin;
380 
382  auto cit = begin(std::cref(corners_).get());
383  jacobianTransposed< false >( topologyId(), std::integral_constant< int, mydimension >(), cit, ctype( 1 ), local, ctype( 1 ), jt );
384  return jt;
385  }
386 
393  JacobianInverseTransposed jacobianInverseTransposed ( const LocalCoordinate &local ) const;
394 
395  friend ReferenceElement referenceElement ( const MultiLinearGeometry &geometry )
396  {
397  return geometry.refElement();
398  }
399 
400 
407  Jacobian jacobian (const LocalCoordinate &local) const
408  {
409  return jacobianTransposed(local).transposed();
410  }
411 
419  {
420  return jacobianInverseTransposed(local).transposed();
421  }
422 
423  protected:
424 
425  ReferenceElement refElement () const
426  {
427  return refElement_;
428  }
429 
430  TopologyId topologyId () const
431  {
432  return topologyId( std::integral_constant< bool, hasSingleGeometryType >() );
433  }
434 
435  template< bool add, int dim, class CornerIterator >
436  static void global ( TopologyId topologyId, std::integral_constant< int, dim >,
437  CornerIterator &cit, const ctype &df, const LocalCoordinate &x,
438  const ctype &rf, GlobalCoordinate &y );
439  template< bool add, class CornerIterator >
440  static void global ( TopologyId topologyId, std::integral_constant< int, 0 >,
441  CornerIterator &cit, const ctype &df, const LocalCoordinate &x,
442  const ctype &rf, GlobalCoordinate &y );
443 
444  template< bool add, int rows, int dim, class CornerIterator >
445  static void jacobianTransposed ( TopologyId topologyId, std::integral_constant< int, dim >,
446  CornerIterator &cit, const ctype &df, const LocalCoordinate &x,
447  const ctype &rf, FieldMatrix< ctype, rows, cdim > &jt );
448  template< bool add, int rows, class CornerIterator >
449  static void jacobianTransposed ( TopologyId topologyId, std::integral_constant< int, 0 >,
450  CornerIterator &cit, const ctype &df, const LocalCoordinate &x,
451  const ctype &rf, FieldMatrix< ctype, rows, cdim > &jt );
452 
453  template< int dim, class CornerIterator >
454  static bool affine ( TopologyId topologyId, std::integral_constant< int, dim >, CornerIterator &cit, JacobianTransposed &jt );
455  template< class CornerIterator >
456  static bool affine ( TopologyId topologyId, std::integral_constant< int, 0 >, CornerIterator &cit, JacobianTransposed &jt );
457 
458  bool affine ( JacobianTransposed &jacobianT ) const
459  {
460  using std::begin;
461 
462  auto cit = begin(std::cref(corners_).get());
463  return affine( topologyId(), std::integral_constant< int, mydimension >(), cit, jacobianT );
464  }
465 
466  private:
467  // The following methods are needed to convert the return type of topologyId to
468  // unsigned int with g++-4.4. It has problems casting integral_constant to the
469  // integral type.
470  static unsigned int toUnsignedInt(unsigned int i) { return i; }
471  template<unsigned int v>
472  static unsigned int toUnsignedInt(std::integral_constant<unsigned int,v> ) { return v; }
473  TopologyId topologyId ( std::integral_constant< bool, true > ) const { return TopologyId(); }
474  unsigned int topologyId ( std::integral_constant< bool, false > ) const { return refElement().type().id(); }
475 
476  ReferenceElement refElement_;
477  typename Traits::template CornerStorage< mydimension, coorddimension >::Type corners_;
478  };
479 
480 
481 
482  // MultiLinearGeometry::JacobianInverseTransposed
483  // ----------------------------------------------
484 
485  template< class ct, int mydim, int cdim, class Traits >
486  class MultiLinearGeometry< ct, mydim, cdim, Traits >::JacobianInverseTransposed
487  : public FieldMatrix< ctype, coorddimension, mydimension >
488  {
490 
491  public:
492  void setup ( const JacobianTransposed &jt )
493  {
494  detInv_ = MatrixHelper::template rightInvA< mydimension, coorddimension >( jt, static_cast< Base & >( *this ) );
495  }
496 
497  void setupDeterminant ( const JacobianTransposed &jt )
498  {
499  detInv_ = MatrixHelper::template sqrtDetAAT< mydimension, coorddimension >( jt );
500  }
501 
502  ctype det () const { return ctype( 1 ) / detInv_; }
503  ctype detInv () const { return detInv_; }
504 
505  private:
506  ctype detInv_;
507  };
508 
509 
510 
523  template< class ct, int mydim, int cdim, class Traits = MultiLinearGeometryTraits< ct > >
525  : public MultiLinearGeometry< ct, mydim, cdim, Traits >
526  {
529 
530  protected:
531  typedef typename Base::MatrixHelper MatrixHelper;
532 
533  public:
534  typedef typename Base::ReferenceElement ReferenceElement;
535 
536  typedef typename Base::ctype ctype;
537 
538  using Base::mydimension;
539  using Base::coorddimension;
540 
541  typedef typename Base::LocalCoordinate LocalCoordinate;
542  typedef typename Base::GlobalCoordinate GlobalCoordinate;
543  typedef typename Base::Volume Volume;
544 
546  typedef typename Base::JacobianInverseTransposed JacobianInverseTransposed;
547  typedef typename Base::Jacobian Jacobian;
548  typedef typename Base::JacobianInverse JacobianInverse;
549 
550  template< class CornerStorage >
551  CachedMultiLinearGeometry ( const ReferenceElement &referenceElement, const CornerStorage &cornerStorage )
552  : Base( referenceElement, cornerStorage ),
553  affine_( Base::affine( jacobianTransposed_ ) ),
554  jacobianInverseTransposedComputed_( false ),
555  integrationElementComputed_( false )
556  {}
557 
558  template< class CornerStorage >
559  CachedMultiLinearGeometry ( Dune::GeometryType gt, const CornerStorage &cornerStorage )
560  : Base( gt, cornerStorage ),
561  affine_( Base::affine( jacobianTransposed_ ) ),
562  jacobianInverseTransposedComputed_( false ),
563  integrationElementComputed_( false )
564  {}
565 
567  bool affine () const { return affine_; }
568 
569  using Base::corner;
570 
572  GlobalCoordinate center () const { return global( refElement().position( 0, 0 ) ); }
573 
580  GlobalCoordinate global ( const LocalCoordinate &local ) const
581  {
582  if( affine() )
583  {
585  jacobianTransposed_.umtv( local, global );
586  return global;
587  }
588  else
589  return Base::global( local );
590  }
591 
604  LocalCoordinate local ( const GlobalCoordinate &global ) const
605  {
606  if( affine() )
607  {
608  LocalCoordinate local;
609  if( jacobianInverseTransposedComputed_ )
610  jacobianInverseTransposed_.mtv( global - corner( 0 ), local );
611  else
612  MatrixHelper::template xTRightInvA< mydimension, coorddimension >( jacobianTransposed_, global - corner( 0 ), local );
613  return local;
614  }
615  else
616  return Base::local( global );
617  }
618 
633  ctype integrationElement ( const LocalCoordinate &local ) const
634  {
635  if( affine() )
636  {
637  if( !integrationElementComputed_ )
638  {
639  jacobianInverseTransposed_.setupDeterminant( jacobianTransposed_ );
640  integrationElementComputed_ = true;
641  }
642  return jacobianInverseTransposed_.detInv();
643  }
644  else
645  return Base::integrationElement( local );
646  }
647 
649  Volume volume () const
650  {
651  if( affine() )
652  return integrationElement( refElement().position( 0, 0 ) ) * refElement().volume();
653  else
654  return Base::volume();
655  }
656 
667  {
668  if( affine() )
669  return jacobianTransposed_;
670  else
671  return Base::jacobianTransposed( local );
672  }
673 
680  JacobianInverseTransposed jacobianInverseTransposed ( const LocalCoordinate &local ) const
681  {
682  if( affine() )
683  {
684  if( !jacobianInverseTransposedComputed_ )
685  {
686  jacobianInverseTransposed_.setup( jacobianTransposed_ );
687  jacobianInverseTransposedComputed_ = true;
688  integrationElementComputed_ = true;
689  }
690  return jacobianInverseTransposed_;
691  }
692  else
693  return Base::jacobianInverseTransposed( local );
694  }
695 
702  Jacobian jacobian (const LocalCoordinate &local) const
703  {
704  return jacobianTransposed(local).transposed();
705  }
706 
714  {
715  return jacobianInverseTransposed(local).transposed();
716  }
717 
718  protected:
719  using Base::refElement;
720 
721  private:
722  mutable JacobianTransposed jacobianTransposed_;
723  mutable JacobianInverseTransposed jacobianInverseTransposed_;
724 
725  mutable bool affine_ : 1;
726 
727  mutable bool jacobianInverseTransposedComputed_ : 1;
728  mutable bool integrationElementComputed_ : 1;
729  };
730 
731 
732 
733  // Implementation of MultiLinearGeometry
734  // -------------------------------------
735 
736  template< class ct, int mydim, int cdim, class Traits >
737  inline typename MultiLinearGeometry< ct, mydim, cdim, Traits >::JacobianInverseTransposed
739  {
740  JacobianInverseTransposed jit;
741  jit.setup( jacobianTransposed( local ) );
742  return jit;
743  }
744 
745 
746  template< class ct, int mydim, int cdim, class Traits >
747  template< bool add, int dim, class CornerIterator >
749  ::global ( TopologyId topologyId, std::integral_constant< int, dim >,
750  CornerIterator &cit, const ctype &df, const LocalCoordinate &x,
751  const ctype &rf, GlobalCoordinate &y )
752  {
753  const ctype xn = df*x[ dim-1 ];
754  const ctype cxn = ctype( 1 ) - xn;
755 
756  if( Impl::isPrism( toUnsignedInt(topologyId), mydimension, mydimension-dim ) )
757  {
758  // apply (1-xn) times mapping for bottom
759  global< add >( topologyId, std::integral_constant< int, dim-1 >(), cit, df, x, rf*cxn, y );
760  // apply xn times mapping for top
761  global< true >( topologyId, std::integral_constant< int, dim-1 >(), cit, df, x, rf*xn, y );
762  }
763  else
764  {
765  assert( Impl::isPyramid( toUnsignedInt(topologyId), mydimension, mydimension-dim ) );
766  // apply (1-xn) times mapping for bottom (with argument x/(1-xn))
767  if( cxn > Traits::tolerance() || cxn < -Traits::tolerance() )
768  global< add >( topologyId, std::integral_constant< int, dim-1 >(), cit, df/cxn, x, rf*cxn, y );
769  else
770  global< add >( topologyId, std::integral_constant< int, dim-1 >(), cit, df, x, ctype( 0 ), y );
771  // apply xn times the tip
772  y.axpy( rf*xn, *cit );
773  ++cit;
774  }
775  }
776 
777  template< class ct, int mydim, int cdim, class Traits >
778  template< bool add, class CornerIterator >
780  ::global ( TopologyId, std::integral_constant< int, 0 >,
781  CornerIterator &cit, const ctype &, const LocalCoordinate &,
782  const ctype &rf, GlobalCoordinate &y )
783  {
784  const GlobalCoordinate &origin = *cit;
785  ++cit;
786  for( int i = 0; i < coorddimension; ++i )
787  y[ i ] = (add ? y[ i ] + rf*origin[ i ] : rf*origin[ i ]);
788  }
789 
790 
791  template< class ct, int mydim, int cdim, class Traits >
792  template< bool add, int rows, int dim, class CornerIterator >
794  ::jacobianTransposed ( TopologyId topologyId, std::integral_constant< int, dim >,
795  CornerIterator &cit, const ctype &df, const LocalCoordinate &x,
796  const ctype &rf, FieldMatrix< ctype, rows, cdim > &jt )
797  {
798  assert( rows >= dim );
799 
800  const ctype xn = df*x[ dim-1 ];
801  const ctype cxn = ctype( 1 ) - xn;
802 
803  auto cit2( cit );
804  if( Impl::isPrism( toUnsignedInt(topologyId), mydimension, mydimension-dim ) )
805  {
806  // apply (1-xn) times Jacobian for bottom
807  jacobianTransposed< add >( topologyId, std::integral_constant< int, dim-1 >(), cit2, df, x, rf*cxn, jt );
808  // apply xn times Jacobian for top
809  jacobianTransposed< true >( topologyId, std::integral_constant< int, dim-1 >(), cit2, df, x, rf*xn, jt );
810  // compute last row as difference between top value and bottom value
811  global< add >( topologyId, std::integral_constant< int, dim-1 >(), cit, df, x, -rf, jt[ dim-1 ] );
812  global< true >( topologyId, std::integral_constant< int, dim-1 >(), cit, df, x, rf, jt[ dim-1 ] );
813  }
814  else
815  {
816  assert( Impl::isPyramid( toUnsignedInt(topologyId), mydimension, mydimension-dim ) );
817  /*
818  * In the pyramid case, we need a transformation Tb: B -> R^n for the
819  * base B \subset R^{n-1}. The pyramid transformation is then defined as
820  * T: P \subset R^n -> R^n
821  * (x, xn) |-> (1-xn) Tb(x*) + xn t (x \in R^{n-1}, xn \in R)
822  * with the tip of the pyramid mapped to t and x* = x/(1-xn)
823  * the projection of (x,xn) onto the base.
824  *
825  * For the Jacobi matrix DT we get
826  * DT = ( A | b )
827  * with A = DTb(x*) (n x n-1 matrix)
828  * and b = dT/dxn (n-dim column vector).
829  * Furthermore
830  * b = -Tb(x*) + t + \sum_i dTb/dx_i(x^*) x_i/(1-xn)
831  *
832  * Note that both A and b are not defined in the pyramid tip (x=0, xn=1)!
833  * Indeed for B the unit square, Tb mapping B to the quadrilateral given
834  * by the vertices (0,0,0), (2,0,0), (0,1,0), (1,1,0) and t=(0,0,1), we get
835  *
836  * T(x,y,xn) = ( x(2-y/(1-xn)), y, xn )
837  * / 2-y/(1-xn) -x 0 \
838  * DT(x,y,xn) = | 0 1 0 |
839  * \ 0 0 1 /
840  * which is not continuous for xn -> 1, choose for example
841  * x=0, y=1-xn, xn -> 1 --> DT -> diag(1,1,1)
842  * x=1-xn, y=0, xn -> 1 --> DT -> diag(2,1,1)
843  *
844  * However, for Tb affine-linear, Tb(y) = My + y0, DTb = M:
845  * A = M
846  * b = -M x* - y0 + t + \sum_i M_i x_i/(1-xn)
847  * = -M x* - y0 + t + M x*
848  * = -y0 + t
849  * which is continuous for xn -> 1. Note that this b is also given by
850  * b = -Tb(0) + t + \sum_i dTb/dx_i(0) x_i/1
851  * that is replacing x* by 1 and 1-xn by 1 in the formular above.
852  *
853  * For xn -> 1, we can thus set x*=0, "1-xn"=1 (or anything != 0) and get
854  * the right result in case Tb is affine-linear.
855  */
856 
857  /* The second case effectively results in x* = 0 */
858  ctype dfcxn = (cxn > Traits::tolerance() || cxn < -Traits::tolerance()) ? ctype(df / cxn) : ctype(0);
859 
860  // initialize last row
861  // b = -Tb(x*)
862  // (b = -Tb(0) = -y0 in case xn -> 1 and Tb affine-linear)
863  global< add >( topologyId, std::integral_constant< int, dim-1 >(), cit, dfcxn, x, -rf, jt[ dim-1 ] );
864  // b += t
865  jt[ dim-1 ].axpy( rf, *cit );
866  ++cit;
867  // apply Jacobian for bottom (with argument x/(1-xn)) and correct last row
868  if( add )
869  {
870  FieldMatrix< ctype, dim-1, coorddimension > jt2;
871  // jt2 = dTb/dx_i(x*)
872  jacobianTransposed< false >( topologyId, std::integral_constant< int, dim-1 >(), cit2, dfcxn, x, rf, jt2 );
873  // A = dTb/dx_i(x*) (jt[j], j=0..dim-1)
874  // b += \sum_i dTb/dx_i(x*) x_i/(1-xn) (jt[dim-1])
875  // (b += 0 in case xn -> 1)
876  for( int j = 0; j < dim-1; ++j )
877  {
878  jt[ j ] += jt2[ j ];
879  jt[ dim-1 ].axpy( dfcxn*x[ j ], jt2[ j ] );
880  }
881  }
882  else
883  {
884  // jt = dTb/dx_i(x*)
885  jacobianTransposed< false >( topologyId, std::integral_constant< int, dim-1 >(), cit2, dfcxn, x, rf, jt );
886  // b += \sum_i dTb/dx_i(x*) x_i/(1-xn)
887  for( int j = 0; j < dim-1; ++j )
888  jt[ dim-1 ].axpy( dfcxn*x[ j ], jt[ j ] );
889  }
890  }
891  }
892 
893  template< class ct, int mydim, int cdim, class Traits >
894  template< bool add, int rows, class CornerIterator >
896  ::jacobianTransposed ( TopologyId, std::integral_constant< int, 0 >,
897  CornerIterator &cit, const ctype &, const LocalCoordinate &,
898  const ctype &, FieldMatrix< ctype, rows, cdim > & )
899  {
900  ++cit;
901  }
902 
903 
904 
905  template< class ct, int mydim, int cdim, class Traits >
906  template< int dim, class CornerIterator >
908  ::affine ( TopologyId topologyId, std::integral_constant< int, dim >, CornerIterator &cit, JacobianTransposed &jt )
909  {
910  const GlobalCoordinate &orgBottom = *cit;
911  if( !affine( topologyId, std::integral_constant< int, dim-1 >(), cit, jt ) )
912  return false;
913  const GlobalCoordinate &orgTop = *cit;
914 
915  if( Impl::isPrism( toUnsignedInt(topologyId), mydimension, mydimension-dim ) )
916  {
917  JacobianTransposed jtTop;
918  if( !affine( topologyId, std::integral_constant< int, dim-1 >(), cit, jtTop ) )
919  return false;
920 
921  // check whether both jacobians are identical
922  ctype norm( 0 );
923  for( int i = 0; i < dim-1; ++i )
924  norm += (jtTop[ i ] - jt[ i ]).two_norm2();
925  if( norm >= Traits::tolerance() )
926  return false;
927  }
928  else
929  ++cit;
930  jt[ dim-1 ] = orgTop - orgBottom;
931  return true;
932  }
933 
934  template< class ct, int mydim, int cdim, class Traits >
935  template< class CornerIterator >
937  ::affine ( TopologyId, std::integral_constant< int, 0 >, CornerIterator &cit, JacobianTransposed & )
938  {
939  ++cit;
940  return true;
941  }
942 
943 } // namespace Dune
944 
945 #endif // #ifndef DUNE_GEOMETRY_MULTILINEARGEOMETRY_HH
An implementation of the Geometry interface for affine geometries.
Implement a MultiLinearGeometry with additional caching.
Definition: multilineargeometry.hh:526
GlobalCoordinate global(const LocalCoordinate &local) const
evaluate the mapping
Definition: multilineargeometry.hh:580
bool affine() const
is this mapping affine?
Definition: multilineargeometry.hh:567
JacobianInverse jacobianInverse(const LocalCoordinate &local) const
Obtain the Jacobian's inverse.
Definition: multilineargeometry.hh:713
JacobianTransposed jacobianTransposed(const LocalCoordinate &local) const
obtain the transposed of the Jacobian
Definition: multilineargeometry.hh:666
GlobalCoordinate corner(int i) const
obtain coordinates of the i-th corner
Definition: multilineargeometry.hh:275
Volume volume() const
obtain the volume of the mapping's image
Definition: multilineargeometry.hh:649
ctype integrationElement(const LocalCoordinate &local) const
obtain the integration element
Definition: multilineargeometry.hh:633
Jacobian jacobian(const LocalCoordinate &local) const
Obtain the Jacobian.
Definition: multilineargeometry.hh:702
GlobalCoordinate center() const
obtain the centroid of the mapping's image
Definition: multilineargeometry.hh:572
JacobianInverseTransposed jacobianInverseTransposed(const LocalCoordinate &local) const
obtain the transposed of the Jacobian's inverse
Definition: multilineargeometry.hh:680
void umtv(const X &x, Y &y) const
y += A^T x
Definition: densematrix.hh:419
FieldTraits< value_type >::real_type two_norm2() const
square of two norm (sum over squared values of entries), need for block recursion
Definition: densevector.hh:650
FieldMatrix< K, COLS, ROWS > transposed() const
Return transposed of the matrix as FieldMatrix.
Definition: fmatrix.hh:171
vector space out of a tensor product of fields.
Definition: fvector.hh:95
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:114
generic geometry implementation based on corner coordinates
Definition: multilineargeometry.hh:181
static const int mydimension
geometry dimension
Definition: multilineargeometry.hh:189
Dune::GeometryType type() const
obtain the name of the reference element
Definition: multilineargeometry.hh:269
FieldVector< ctype, coorddimension > GlobalCoordinate
type of global coordinates
Definition: multilineargeometry.hh:196
JacobianTransposed jacobianTransposed(const LocalCoordinate &local) const
obtain the transposed of the Jacobian
Definition: multilineargeometry.hh:377
GlobalCoordinate global(const LocalCoordinate &local) const
evaluate the mapping
Definition: multilineargeometry.hh:290
GlobalCoordinate center() const
obtain the centroid of the mapping's image
Definition: multilineargeometry.hh:282
GlobalCoordinate corner(int i) const
obtain coordinates of the i-th corner
Definition: multilineargeometry.hh:275
ct ctype
coordinate type
Definition: multilineargeometry.hh:186
static const int coorddimension
coordinate dimension
Definition: multilineargeometry.hh:191
int corners() const
obtain number of corners of the corresponding reference element
Definition: multilineargeometry.hh:272
Volume volume() const
obtain the volume of the mapping's image
Definition: multilineargeometry.hh:363
FieldVector< ctype, mydimension > LocalCoordinate
type of local coordinates
Definition: multilineargeometry.hh:194
MultiLinearGeometry(const ReferenceElement &refElement, const Corners &corners)
constructor
Definition: multilineargeometry.hh:239
ctype Volume
type of volume
Definition: multilineargeometry.hh:198
JacobianInverse jacobianInverse(const LocalCoordinate &local) const
Obtain the Jacobian's inverse.
Definition: multilineargeometry.hh:418
MultiLinearGeometry(Dune::GeometryType gt, const Corners &corners)
constructor
Definition: multilineargeometry.hh:255
FieldMatrix< ctype, mydimension, coorddimension > JacobianTransposed
type of jacobian transposed
Definition: multilineargeometry.hh:201
ReferenceElements::ReferenceElement ReferenceElement
type of reference element
Definition: multilineargeometry.hh:219
JacobianInverseTransposed jacobianInverseTransposed(const LocalCoordinate &local) const
obtain the transposed of the Jacobian's inverse
Definition: multilineargeometry.hh:738
FieldMatrix< ctype, coorddimension, mydimension > Jacobian
Type for the Jacobian matrix.
Definition: multilineargeometry.hh:204
bool affine() const
is this mapping affine?
Definition: multilineargeometry.hh:262
FieldMatrix< ctype, mydimension, coorddimension > JacobianInverse
Type for the inverse Jacobian matrix.
Definition: multilineargeometry.hh:210
Volume integrationElement(const LocalCoordinate &local) const
obtain the integration element
Definition: multilineargeometry.hh:350
Jacobian jacobian(const LocalCoordinate &local) const
Obtain the Jacobian.
Definition: multilineargeometry.hh:407
Implements a matrix constructed from a given type representing a field and compile-time given number ...
Implements a vector constructed from a given type representing a field and a compile-time given size.
bool gt(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
test if first greater than second
Definition: float_cmp.cc:158
unspecified value type referenceElement(T &&... t)
Returns a reference element for the objects t....
constexpr auto max
Function object that returns the greater of the given values.
Definition: hybridutilities.hh:484
Dune namespace.
Definition: alignedallocator.hh:13
constexpr auto get(std::integer_sequence< T, II... >, std::integral_constant< std::size_t, pos >={})
Return the entry at position pos of the given sequence.
Definition: integersequence.hh:22
Class providing access to the singletons of the reference elements.
Definition: referenceelements.hh:128
typename Container::ReferenceElement ReferenceElement
The reference element type.
Definition: referenceelements.hh:146
template specifying the storage for the corners
Definition: multilineargeometry.hh:129
will there be only one geometry type for a dimension?
Definition: multilineargeometry.hh:148
default traits class for MultiLinearGeometry
Definition: multilineargeometry.hh:39
Impl::FieldMatrixHelper< ct > MatrixHelper
helper structure containing some matrix routines
Definition: multilineargeometry.hh:58
static ct tolerance()
tolerance to numerical algorithms
Definition: multilineargeometry.hh:61
A unique label for each type of element that can occur in a grid.
Traits for type conversions and type information.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (Apr 27, 22:29, 2024)