Xyst test code coverage report
Current view: top level - IO - GmshMeshWriter.hpp (source / functions) Hit Total Coverage
Commit: ac3d28f3f8b86b070d167d5aee7fb8740cd81df6 Lines: 3 3 100.0 %
Date: 2024-11-28 13:48:12 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 8 8 100.0 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/IO/GmshMeshWriter.hpp
       4                 :            :   \copyright 2012-2015 J. Bakosi,
       5                 :            :              2016-2018 Los Alamos National Security, LLC.,
       6                 :            :              2019-2021 Triad National Security, LLC.,
       7                 :            :              2022-2024 J. Bakosi
       8                 :            :              All rights reserved. See the LICENSE file for details.
       9                 :            :   \brief     Gmsh mesh writer class declaration
      10                 :            :   \details   Gmsh mesh writer class declaration. Currently, this class supports
      11                 :            :     line, triangle, tetrahedron, and point Gmsh element types.
      12                 :            : */
      13                 :            : // *****************************************************************************
      14                 :            : #ifndef GmshMeshWriter_h
      15                 :            : #define GmshMeshWriter_h
      16                 :            : 
      17                 :            : #include <iosfwd>
      18                 :            : #include <cstddef>
      19                 :            : #include <vector>
      20                 :            : 
      21                 :            : #include "Types.hpp"
      22                 :            : #include "Writer.hpp"
      23                 :            : #include "GmshMeshIO.hpp"
      24                 :            : 
      25                 :            : namespace tk {
      26                 :            : 
      27                 :            : class UnsMesh;
      28                 :            : 
      29                 :            : //! Gmsh mesh writer
      30                 :            : //! \details Mesh writer class facilitating writing a mesh to a file readable by
      31                 :            : //!   the Gmsh mesh generator: http://geuz.org/gmsh.
      32                 :          6 : class GmshMeshWriter : public Writer {
      33                 :            : 
      34                 :            :   public:
      35                 :            :     //! Constructor
      36                 :            :     explicit GmshMeshWriter( const std::string& filename,
      37                 :            :                              GmshFileType type = GmshFileType::BINARY,
      38                 :            :                              tk::real version = 2.2,
      39                 :            :                              int datasize = sizeof(double) );
      40                 :            : 
      41                 :            :     //! Write Gmsh mesh to file
      42                 :            :     void writeMesh( const UnsMesh& mesh );
      43                 :            : 
      44                 :            :   private:
      45                 :            :     //! Write "$Nodes--$EndNodes" section
      46                 :            :     void writeNodes( const UnsMesh& mesh );
      47                 :            : 
      48                 :            :     //! Write "$Elements--$EndElements" section
      49                 :            :     void writeElements( const UnsMesh& mesh );
      50                 :            : 
      51                 :            :     //! Write "$PhysicalNames--$EndPhysicalNames" section
      52                 :            :     void writePhysicalNames();
      53                 :            : 
      54                 :            :     //! \brief Mesh ASCII type query
      55                 :            :     //! \return true if member variable m_type indicates an ASCII mesh format
      56                 :            :     bool isASCII() const {
      57 [ +  + ][ +  + ]:         16 :       return m_type == GmshFileType::ASCII ? true : false;
      58                 :            :     }
      59                 :            :     //! \brief Mesh binary type query
      60                 :            :     //! \return true if member variable m_type indicates an binary mesh format
      61                 :            :     bool isBinary() const {
      62 [ +  + ][ +  + ]:         12 :       return m_type == GmshFileType::BINARY ? true : false;
      63                 :            :     }
      64                 :            : 
      65                 :            :     //! Write element block: element ids and connectivity (node list)
      66                 :            :     void writeElemBlock( std::size_t nnpe,
      67                 :            :                          GmshElemType type,
      68                 :            :                          const std::vector< std::size_t >& inpoel );
      69                 :            : 
      70                 :            :     GmshFileType m_type;                //!< Mesh file type: 0:ASCII, 1:binary
      71                 :            : };
      72                 :            : 
      73                 :            : } // tk::
      74                 :            : 
      75                 :            : #endif // GmshMeshWriter_h

Generated by: LCOV version 1.16