LCOV - code coverage report
Current view: top level - src/mesquite/Misc - PlanarDomain.hpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 14 14 100.0 %
Date: 2020-07-18 00:09:26 Functions: 4 4 100.0 %
Branches: 9 18 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* *****************************************************************
       2                 :            :     MESQUITE -- The Mesh Quality Improvement Toolkit
       3                 :            : 
       4                 :            :     Copyright 2004 Sandia Corporation and Argonne National
       5                 :            :     Laboratory.  Under the terms of Contract DE-AC04-94AL85000
       6                 :            :     with Sandia Corporation, the U.S. Government retains certain
       7                 :            :     rights in this software.
       8                 :            : 
       9                 :            :     This library is free software; you can redistribute it and/or
      10                 :            :     modify it under the terms of the GNU Lesser General Public
      11                 :            :     License as published by the Free Software Foundation; either
      12                 :            :     version 2.1 of the License, or (at your option) any later version.
      13                 :            : 
      14                 :            :     This library is distributed in the hope that it will be useful,
      15                 :            :     but WITHOUT ANY WARRANTY; without even the implied warranty of
      16                 :            :     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      17                 :            :     Lesser General Public License for more details.
      18                 :            : 
      19                 :            :     You should have received a copy of the GNU Lesser General Public License
      20                 :            :     (lgpl.txt) along with this library; if not, write to the Free Software
      21                 :            :     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
      22                 :            : 
      23                 :            :     [email protected], [email protected], [email protected],
      24                 :            :     [email protected], [email protected], [email protected],
      25                 :            :     [email protected]
      26                 :            : 
      27                 :            :   ***************************************************************** */
      28                 :            : /*!
      29                 :            :   \file   PlanarDomain.hpp
      30                 :            :   \brief
      31                 :            : 
      32                 :            : 
      33                 :            :   \author Thomas Leurent
      34                 :            :   \date   2002-01-17
      35                 :            : */
      36                 :            : 
      37                 :            : #ifndef MSQ_PLANAR_DOMAIN_HPP
      38                 :            : #define MSQ_PLANAR_DOMAIN_HPP
      39                 :            : 
      40                 :            : #include "MeshInterface.hpp"
      41                 :            : #include "Vector3D.hpp"
      42                 :            : 
      43                 :            : namespace MBMesquite
      44                 :            : {
      45                 :            : /*! \class PlanarDomain
      46                 :            :      This is a template for a planar domain.
      47                 :            :      It will provide the normal information necessary for surface mesh optimization.
      48                 :            :   */
      49                 :            : class MESQUITE_EXPORT PlanarDomain : public MBMesquite::MeshDomain
      50                 :            : {
      51                 :            :   public:
      52                 :            :     enum Plane
      53                 :            :     {
      54                 :            :         XY = 2,
      55                 :            :         XZ = 1,
      56                 :            :         YZ = 0
      57                 :            :     };
      58                 :            : 
      59                 :         18 :     inline PlanarDomain( Plane orient, double offset = 0.0 )
      60         [ +  - ]:         18 :     {
      61 [ +  - ][ +  - ]:         18 :         Vector3D normal( 0, 0, 0 ), point( 0, 0, 0 );
      62         [ +  - ]:         18 :         normal[orient] = 1.0;
      63         [ +  - ]:         18 :         point[orient]  = offset;
      64         [ +  - ]:         18 :         set_plane( normal, point );
      65                 :         18 :     }
      66                 :            : 
      67         [ +  - ]:          4 :     PlanarDomain() {}
      68                 :            : 
      69                 :         29 :     inline PlanarDomain( const Vector3D& normal, const Vector3D& point )
      70         [ +  - ]:         29 :     {
      71         [ +  - ]:         29 :         set_plane( normal, point );
      72                 :         29 :     }
      73                 :            : 
      74                 :            :     virtual ~PlanarDomain();
      75                 :            : 
      76                 :            :     void fit_vertices( Mesh* mesh, MsqError& err, double epsilon = 0.0 );
      77                 :            : 
      78                 :            :     void fit_vertices( Mesh* mesh, const Mesh::VertexHandle* vertex_array, size_t vertex_array_length, MsqError& err,
      79                 :            :                        double epsilon = 0.0 );
      80                 :            : 
      81                 :            :     void set_plane( const Vector3D& normal, const Vector3D& point );
      82                 :            : 
      83                 :            :     void flip();
      84                 :            : 
      85                 :         57 :     const Vector3D& get_normal() const
      86                 :            :     {
      87                 :         57 :         return mNormal;
      88                 :            :     }
      89                 :            : 
      90                 :            :     double get_coeff()
      91                 :            :     {
      92                 :            :         return mCoeff;
      93                 :            :     }
      94                 :            : 
      95                 :            :     Vector3D get_origin() const
      96                 :            :     {
      97                 :            :         return -mCoeff * mNormal;
      98                 :            :     }
      99                 :            : 
     100                 :            :     virtual void snap_to( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const;
     101                 :            : 
     102                 :            :     virtual void vertex_normal_at( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const;
     103                 :            : 
     104                 :            :     virtual void element_normal_at( Mesh::ElementHandle entity_handle, Vector3D& coordinate ) const;
     105                 :            : 
     106                 :            :     virtual void vertex_normal_at( const Mesh::VertexHandle* handle, Vector3D coords[], unsigned count,
     107                 :            :                                    MsqError& err ) const;
     108                 :            : 
     109                 :            :     virtual void closest_point( Mesh::VertexHandle handle, const Vector3D& position, Vector3D& closest,
     110                 :            :                                 Vector3D& normal, MsqError& err ) const;
     111                 :            : 
     112                 :            :     virtual void domain_DoF( const Mesh::VertexHandle* handle_array, unsigned short* dof_array, size_t num_vertices,
     113                 :            :                              MsqError& err ) const;
     114                 :            : 
     115                 :            :   private:
     116                 :            :     Vector3D mNormal;
     117                 :            :     double mCoeff;
     118                 :            : };
     119                 :            : }  // namespace MBMesquite
     120                 :            : 
     121                 :            : #endif

Generated by: LCOV version 1.11