LCOV - code coverage report
Current view: top level - ugbase/lib_grid/refinement/projectors - elliptic_cylinder_projector.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 11 0
Test Date: 2025-09-21 23:31:46 Functions: 0.0 % 2 0

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2016:  G-CSC, Goethe University Frankfurt
       3              :  * Author: Markus Breit
       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              : #ifndef UG__LIB_GRID__REFINEMENT__PROJECTORS__ELLIPTIC_CYLINDER_PROJECTOR_H
      34              : #define UG__LIB_GRID__REFINEMENT__PROJECTORS__ELLIPTIC_CYLINDER_PROJECTOR_H
      35              : 
      36              : #include "common/math/math_vector_matrix/math_vector_functions.h"  // VecLength etc.
      37              : #include "refinement_projector.h"
      38              : 
      39              : 
      40              : namespace ug {
      41              : ///     Projects new vertices onto a cylinder with an elliptic base.
      42              : /** For projection during refinement the radius property is ignored. Instead
      43              :  * the distance to the center of a newly inserted vertex is calculated
      44              :  * as the average distance of the vertices of the parent element to the center.
      45              :  * The radius property thus defaults to -1.
      46              :  *
      47              :  * You may still specify a radius. This radius can be used for auto-fitting of
      48              :  * the center and for reprojecting a set of vertices onto the sphere.
      49              :  */
      50              : class EllipticCylinderProjector
      51              : : public RefinementProjector
      52              : {
      53              :         public:
      54              :                 EllipticCylinderProjector();
      55              : 
      56              :                 EllipticCylinderProjector
      57              :                 (
      58              :                         const vector3& center,
      59              :                         const vector3& cylAxis,
      60              :                         const vector3& ellipseAxis1,
      61              :                         const vector3& ellipseAxis2
      62              :                 );
      63              : 
      64              :                 EllipticCylinderProjector
      65              :                 (
      66              :                         const vector3& center,
      67              :                         const vector3& cylAxis,
      68              :                         const vector3& ellipseAxis1,
      69              :                         const vector3& ellipseAxis2,
      70              :                         number radius
      71              :                 );
      72              : 
      73              :                 EllipticCylinderProjector
      74              :                 (
      75              :                         const vector3& center,
      76              :                         const vector3& cylAxis,
      77              :                         const vector3& ellipseAxis1,
      78              :                         const vector3& ellipseAxis2,
      79              :                         number radius,
      80              :                         number influenceRadius
      81              :                 );
      82              : 
      83              :                 EllipticCylinderProjector
      84              :                 (
      85              :                         SPIGeometry3d geometry,
      86              :                         const vector3& center,
      87              :                         const vector3& cylAxis,
      88              :                         const vector3& ellipseAxis1,
      89              :                         const vector3& ellipseAxis2,
      90              :                         number radius,
      91              :                         number influenceRadius
      92              :                 );
      93              : 
      94              :                 virtual ~EllipticCylinderProjector();
      95              : 
      96              :                 void set_center(const vector3& center);
      97              :                 const vector3& center() const;
      98              : 
      99              :                 void set_cylinder_axis(const vector3& axis);
     100              :                 const vector3& cylinder_axis() const;
     101              : 
     102              :                 void set_ellipse_axis1(const vector3& axis);
     103              :                 const vector3& ellipse_axis1() const;
     104              : 
     105              :                 void set_ellipse_axis2(const vector3& axis);
     106              :                 const vector3& ellipse_axis2() const;
     107              : 
     108              :                 void set_radius(number radius);
     109              :                 number radius() const;
     110              : 
     111              :                 void set_influence_radius(number influenceRadius);
     112              :                 number influence_radius() const;
     113              :         
     114              : 
     115              :                 ///     called when a new vertex was created from an old edge
     116              :                 virtual number new_vertex(Vertex* vrt, Edge* parent);
     117              : 
     118              :                 ///     called when a new vertex was created from an old face
     119              :                 virtual number new_vertex(Vertex* vrt, Face* parent);
     120              : 
     121              :                 ///     called when a new vertex was created from an old volume
     122              :                 virtual number new_vertex(Vertex* vrt, Volume* parent);
     123              : 
     124              : 
     125              :         private:
     126              :                 number radial_ellipse_coord(const vector3& v);
     127              :                 number scale_point_to_radius(vector3& vIO, number r);
     128              : 
     129              :                 template <class TElem>
     130              :                 number perform_projection(Vertex* vrt, TElem* parent);
     131              : 
     132              :                 friend class boost::serialization::access;
     133              : 
     134              :                 template <class Archive>
     135            0 :                 void serialize(Archive& ar, const unsigned int version)
     136              :                 {
     137            0 :                         ar & make_nvp("center", m_center);
     138            0 :                         ar & make_nvp("cylAxis", m_cylinder_axis);
     139            0 :                         ar & make_nvp("ellipseAxis1", m_ellipse_axis1);
     140            0 :                         ar & make_nvp("ellipseAxis2", m_ellipse_axis2);
     141            0 :                         ar & make_nvp("radius", m_radius);
     142            0 :                         ar & make_nvp("influence radius", m_influenceRadius);
     143              :                         UG_EMPTY_BASE_CLASS_SERIALIZATION(EllipticCylinderProjector, RefinementProjector);
     144              : 
     145              :                         // this is only needed during load, but does not hurt during save either
     146            0 :                         VecCross(m_ellipseNormal, m_ellipse_axis1, m_ellipse_axis2);
     147            0 :                         m_a = VecLength(m_ellipse_axis1);
     148            0 :                         m_b = VecLength(m_ellipse_axis2);
     149            0 :                 }
     150              : 
     151              : 
     152              :         private:
     153              :                 vector3 m_center;
     154              :                 vector3 m_cylinder_axis;
     155              :                 vector3 m_ellipse_axis1;
     156              :                 vector3 m_ellipse_axis2;
     157              :                 number  m_radius;
     158              :                 number  m_influenceRadius;
     159              : 
     160              :                 vector3 m_ellipseNormal;
     161              :                 number m_a;
     162              :                 number m_b;
     163              : };
     164              : 
     165              : } // namespace ug
     166              : 
     167              : #endif  // UG__LIB_GRID__REFINEMENT__PROJECTORS__ELLIPTIC_CYLINDER_PROJECTOR_H
        

Generated by: LCOV version 2.0-1