LCOV - code coverage report
Current view: top level - ugbase/lib_disc/reference_element - reference_mapping_provider.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 86 0
Test Date: 2025-09-21 23:31:46 Functions: 0.0 % 301 0

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2011-2015:  G-CSC, Goethe University Frankfurt
       3              :  * Author: Andreas Vogel
       4              :  * 
       5              :  * This file is part of UG4.
       6              :  * 
       7              :  * UG4 is free software: you can redistribute it and/or modify it under the
       8              :  * terms of the GNU Lesser General Public License version 3 (as published by the
       9              :  * Free Software Foundation) with the following additional attribution
      10              :  * requirements (according to LGPL/GPL v3 §7):
      11              :  * 
      12              :  * (1) The following notice must be displayed in the Appropriate Legal Notices
      13              :  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
      14              :  * 
      15              :  * (2) The following notice must be displayed at a prominent place in the
      16              :  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
      17              :  * 
      18              :  * (3) The following bibliography is recommended for citation and must be
      19              :  * preserved in all covered files:
      20              :  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
      21              :  *   parallel geometric multigrid solver on hierarchically distributed grids.
      22              :  *   Computing and visualization in science 16, 4 (2013), 151-164"
      23              :  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
      24              :  *   flexible software system for simulating pde based models on high performance
      25              :  *   computers. Computing and visualization in science 16, 4 (2013), 165-179"
      26              :  * 
      27              :  * This program is distributed in the hope that it will be useful,
      28              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      29              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      30              :  * GNU Lesser General Public License for more details.
      31              :  */
      32              : 
      33              : #include "common/util/provider.h"
      34              : #include "reference_mapping_provider.h"
      35              : #include "reference_mapping.h"
      36              : 
      37              : namespace ug{
      38              : 
      39              : 
      40              : /// wrapper of a ReferenceElementMapping into the virtual base class
      41              : template <typename TRefMapping>
      42            0 : class DimReferenceMappingWrapper
      43              :         : public DimReferenceMapping<TRefMapping::dim, TRefMapping::worldDim>,
      44              :           public TRefMapping
      45              : {
      46              :         public:
      47              :         ///     world dimension (range space dimension)
      48              :                 static const int worldDim = TRefMapping::worldDim;
      49              : 
      50              :         ///     reference dimension (domain space dimension)
      51              :                 static const int dim = TRefMapping::dim;
      52              : 
      53              :         public:
      54              :         ///     returns if mapping is affine
      55            0 :                 virtual bool is_linear() const {return TRefMapping::isLinear;}
      56              : 
      57              :         ///     refresh mapping for new set of corners
      58            0 :                 virtual void update(const MathVector<worldDim>* vCorner)
      59              :                 {
      60            0 :                         TRefMapping::update(vCorner);
      61            0 :                 }
      62              : 
      63              :         ///     refresh mapping for new set of corners
      64            0 :                 virtual void update(const std::vector<MathVector<worldDim> >& vCorner)
      65              :                 {
      66            0 :                         TRefMapping::update(vCorner);
      67            0 :                 }
      68              : 
      69              :         ///     map local coordinate to global coordinate
      70            0 :                 virtual void local_to_global(MathVector<worldDim>& globPos,
      71              :                                              const MathVector<dim>& locPos) const
      72              :                 {
      73            0 :                         TRefMapping::local_to_global(globPos, locPos);
      74            0 :                 }
      75              : 
      76              :         ///     map n local coordinate to global coordinate
      77            0 :                 virtual void local_to_global(MathVector<worldDim>* vGlobPos,
      78              :                                                                          const MathVector<dim>* vLocPos, size_t n) const
      79              :                 {
      80            0 :                         TRefMapping::local_to_global(vGlobPos, vLocPos, n);
      81            0 :                 }
      82              : 
      83              :         ///     map local coordinate to global coordinate for a vector of local positions
      84            0 :                 virtual void local_to_global(std::vector<MathVector<worldDim> >& vGlobPos,
      85              :                                              const std::vector<MathVector<dim> >& vLocPos) const
      86              :                 {
      87            0 :                         TRefMapping::local_to_global(vGlobPos, vLocPos);
      88            0 :                 }
      89              : 
      90              :         ///     map global coordinate to local coordinate
      91            0 :                 void global_to_local(MathVector<dim>& locPos,
      92              :                                                          const MathVector<worldDim>& globPos,
      93              :                                                          const size_t maxIter = 1000,
      94              :                                                          const number tol = 1e-10) const
      95              :                 {
      96            0 :                         TRefMapping::global_to_local(locPos, globPos, maxIter, tol);
      97            0 :                 }
      98              : 
      99              :         ///     map global coordinate to local coordinate for n local positions
     100            0 :                 void global_to_local(MathVector<dim>* vLocPos,
     101              :                                                          const MathVector<worldDim>* vGlobPos, size_t n,
     102              :                                                          const size_t maxIter = 1000,
     103              :                                                          const number tol = 1e-10) const
     104              :                 {
     105            0 :                         TRefMapping::global_to_local(vLocPos, vGlobPos, n, maxIter, tol);
     106            0 :                 }
     107              : 
     108              :         ///     map global coordinate to local coordinate for a vector of local positions
     109            0 :                 void global_to_local(std::vector<MathVector<dim> >& vLocPos,
     110              :                                                          const std::vector<MathVector<worldDim> >& vGlobPos,
     111              :                                                          const size_t maxIter = 1000,
     112              :                                                          const number tol = 1e-10) const
     113              :                 {
     114            0 :                         TRefMapping::global_to_local(vLocPos, vGlobPos, maxIter, tol);
     115            0 :                 }
     116              : 
     117              :         ///     returns jacobian
     118            0 :                 virtual void jacobian(MathMatrix<worldDim, dim>& J,
     119              :                                       const MathVector<dim>& locPos) const
     120              :                 {
     121            0 :                         TRefMapping::jacobian(J, locPos);
     122            0 :                 }
     123              : 
     124              :         ///     returns jacobian for n local positions
     125            0 :                 virtual void jacobian(MathMatrix<worldDim, dim>* vJ,
     126              :                                       const MathVector<dim>* vLocPos, size_t n) const
     127              :                 {
     128            0 :                         TRefMapping::jacobian(vJ, vLocPos, n);
     129            0 :                 }
     130              : 
     131              :         ///     returns jacobian for a vector of local positions
     132            0 :                 virtual void jacobian(std::vector<MathMatrix<worldDim, dim> >& vJ,
     133              :                                       const std::vector<MathVector<dim> >& vLocPos) const
     134              :                 {
     135            0 :                         TRefMapping::jacobian(vJ, vLocPos);
     136            0 :                 }
     137              : 
     138              :         ///     returns transposed of jacobian
     139            0 :                 virtual void jacobian_transposed(MathMatrix<dim, worldDim>& JT,
     140              :                                                  const MathVector<dim>& locPos) const
     141              :                 {
     142            0 :                         TRefMapping::jacobian_transposed(JT, locPos);
     143            0 :                 }
     144              : 
     145              :         ///     returns transposed of jacobian for n local positions
     146            0 :                 virtual void jacobian_transposed(MathMatrix<dim, worldDim>* vJT,
     147              :                                                                                  const MathVector<dim>* vLocPos, size_t n) const
     148              :                 {
     149            0 :                         TRefMapping::jacobian_transposed(vJT, vLocPos, n);
     150            0 :                 }
     151              : 
     152              :         ///     returns transposed of jacobian for a vector of positions
     153            0 :                 virtual void jacobian_transposed(std::vector<MathMatrix<dim, worldDim> >& vJT,
     154              :                                                  const std::vector<MathVector<dim> >& vLocPos) const
     155              :                 {
     156            0 :                         TRefMapping::jacobian_transposed(vJT, vLocPos);
     157            0 :                 }
     158              : 
     159              :         ///     returns transposed of the inverse of the jacobian
     160            0 :                 virtual number jacobian_transposed_inverse(MathMatrix<worldDim, dim>& JTInv,
     161              :                                                          const MathVector<dim>& locPos) const
     162              :                 {
     163            0 :                         return TRefMapping::jacobian_transposed_inverse(JTInv, locPos);
     164              :                 }
     165              : 
     166              :         ///     returns transposed of the inverse of the jacobian for n local positions
     167            0 :                 virtual void jacobian_transposed_inverse(MathMatrix<worldDim, dim>* vJTInv,
     168              :                                                                                                  const MathVector<dim>* vLocPos, size_t n) const
     169              :                 {
     170            0 :                         TRefMapping::jacobian_transposed_inverse(vJTInv, vLocPos, n);
     171            0 :                 }
     172              : 
     173              :         ///     returns transposed of the inverse of the jacobian for n local positions
     174            0 :                 virtual void jacobian_transposed_inverse(MathMatrix<worldDim, dim>* vJTInv,
     175              :                                                          number* vDet,
     176              :                                                                                                  const MathVector<dim>* vLocPos, size_t n) const
     177              :                 {
     178            0 :                         TRefMapping::jacobian_transposed_inverse(vJTInv, vDet, vLocPos, n);
     179            0 :                 }
     180              : 
     181              :         ///     returns transposed of the inverse of the jacobian for a vector of positions
     182            0 :                 virtual void jacobian_transposed_inverse(std::vector<MathMatrix<worldDim, dim> >& vJTInv,
     183              :                                                          const std::vector<MathVector<dim> >& vLocPos) const
     184              :                 {
     185            0 :                         TRefMapping::jacobian_transposed_inverse(vJTInv, vLocPos);
     186            0 :                 }
     187              : 
     188              :         ///     returns transposed of the inverse of the jacobian for a vector of positions
     189            0 :                 virtual void jacobian_transposed_inverse(std::vector<MathMatrix<worldDim, dim> >& vJTInv,
     190              :                                                          std::vector<number>& vDet,
     191              :                                                                                                  const std::vector<MathVector<dim> >& vLocPos) const
     192              :                 {
     193            0 :                         TRefMapping::jacobian_transposed_inverse(vJTInv, vDet, vLocPos);
     194            0 :                 }
     195              : 
     196              :         ///     returns the determinate of the jacobian
     197            0 :                 virtual number sqrt_gram_det(const MathVector<dim>& locPos) const
     198              :                 {
     199            0 :                         return TRefMapping::sqrt_gram_det(locPos);
     200              :                 }
     201              : 
     202              :         ///     returns the determinate of the jacobian for n local positions
     203            0 :                 virtual void sqrt_gram_det(number* vDet,
     204              :                                           const MathVector<dim>* vLocPos, size_t n) const
     205              :                 {
     206            0 :                         TRefMapping::sqrt_gram_det(vDet, vLocPos, n);
     207            0 :                 }
     208              : 
     209              :         ///     returns the determinate of the jacobian for a vector of local positions
     210            0 :                 virtual void sqrt_gram_det(std::vector<number>& vDet,
     211              :                                           const std::vector<MathVector<dim> >& vLocPos) const
     212              :                 {
     213            0 :                         TRefMapping::sqrt_gram_det(vDet, vLocPos);
     214            0 :                 }
     215              : 
     216              :         ///     virtual destructor
     217            0 :                 virtual ~DimReferenceMappingWrapper() {}
     218              : };
     219              : 
     220              : 
     221            0 : ReferenceMappingProvider::
     222            0 : ReferenceMappingProvider()
     223              : {
     224              : //      clear mappings
     225            0 :         for(int d = 0; d < 4; ++d)
     226            0 :                 for(int rd = 0; rd < 4; ++rd)
     227            0 :                         for(int roid = 0; roid < NUM_REFERENCE_OBJECTS; ++roid)
     228            0 :                                 m_vvvMapping[d][rd][roid] = NULL;
     229              : 
     230              : //      set mappings
     231              : 
     232              : //      edge
     233            0 :         set_mapping<1,1>(ROID_EDGE, Provider<DimReferenceMappingWrapper<ReferenceMapping<ReferenceEdge, 1> > >::get());
     234            0 :         set_mapping<1,2>(ROID_EDGE, Provider<DimReferenceMappingWrapper<ReferenceMapping<ReferenceEdge, 2> > >::get());
     235            0 :         set_mapping<1,3>(ROID_EDGE, Provider<DimReferenceMappingWrapper<ReferenceMapping<ReferenceEdge, 3> > >::get());
     236              : 
     237              : //      triangle
     238            0 :         set_mapping<2,2>(ROID_TRIANGLE, Provider<DimReferenceMappingWrapper<ReferenceMapping<ReferenceTriangle, 2> > >::get());
     239            0 :         set_mapping<2,3>(ROID_TRIANGLE, Provider<DimReferenceMappingWrapper<ReferenceMapping<ReferenceTriangle, 3> > >::get());
     240              : 
     241              : //      quadrilateral
     242            0 :         set_mapping<2,2>(ROID_QUADRILATERAL, Provider<DimReferenceMappingWrapper<ReferenceMapping<ReferenceQuadrilateral, 2> > >::get());
     243            0 :         set_mapping<2,3>(ROID_QUADRILATERAL, Provider<DimReferenceMappingWrapper<ReferenceMapping<ReferenceQuadrilateral, 3> > >::get());
     244              : 
     245              : //      3d elements
     246            0 :         set_mapping<3,3>(ROID_TETRAHEDRON, Provider<DimReferenceMappingWrapper<ReferenceMapping<ReferenceTetrahedron, 3> > >::get());
     247            0 :         set_mapping<3,3>(ROID_PRISM, Provider<DimReferenceMappingWrapper<ReferenceMapping<ReferencePrism, 3> > >::get());
     248            0 :         set_mapping<3,3>(ROID_PYRAMID, Provider<DimReferenceMappingWrapper<ReferenceMapping<ReferencePyramid, 3> > >::get());
     249            0 :         set_mapping<3,3>(ROID_HEXAHEDRON, Provider<DimReferenceMappingWrapper<ReferenceMapping<ReferenceHexahedron, 3> > >::get());
     250            0 :         set_mapping<3,3>(ROID_OCTAHEDRON, Provider<DimReferenceMappingWrapper<ReferenceMapping<ReferenceOctahedron, 3> > >::get());
     251            0 : }
     252              : 
     253              : 
     254              : } // end namespace ug
        

Generated by: LCOV version 2.0-1