Quinoa unit test code coverage report
Current view: top level - IO - GmshMeshWriter.hpp (source / functions) Hit Total Coverage
Commit: Quinoa_v0.3-957-gb4f0efae0 Lines: 1 1 100.0 %
Date: 2021-11-09 12:13:43 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 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                 :            :              All rights reserved. See the LICENSE file for details.
       8                 :            :   \brief     Gmsh mesh writer class declaration
       9                 :            :   \details   Gmsh mesh writer class declaration. Currently, this class supports
      10                 :            :     line, triangle, tetrahedron, and point Gmsh element types.
      11                 :            : */
      12                 :            : // *****************************************************************************
      13                 :            : #ifndef GmshMeshWriter_h
      14                 :            : #define GmshMeshWriter_h
      15                 :            : 
      16                 :            : #include <iosfwd>
      17                 :            : #include <cstddef>
      18                 :            : #include <vector>
      19                 :            : 
      20                 :            : #include "Types.hpp"
      21                 :            : #include "Writer.hpp"
      22                 :            : #include "GmshMeshIO.hpp"
      23                 :            : 
      24                 :            : namespace tk {
      25                 :            : 
      26                 :            : class UnsMesh;
      27                 :            : 
      28                 :            : //! Gmsh mesh writer
      29                 :            : //! \details Mesh writer class facilitating writing a mesh to a file readable by
      30                 :            : //!   the Gmsh mesh generator: http://geuz.org/gmsh.
      31                 :          2 : class GmshMeshWriter : public Writer {
      32                 :            : 
      33                 :            :   public:
      34                 :            :     //! Constructor
      35                 :            :     explicit GmshMeshWriter( const std::string& filename,
      36                 :            :                              GmshFileType type = GmshFileType::BINARY,
      37                 :            :                              tk::real version = 2.2,
      38                 :            :                              int datasize = sizeof(double) );
      39                 :            : 
      40                 :            :     //! Write Gmsh mesh to file
      41                 :            :     void writeMesh( const UnsMesh& mesh );
      42                 :            : 
      43                 :            :   private:
      44                 :            :     //! Write "$Nodes--$EndNodes" section
      45                 :            :     void writeNodes( const UnsMesh& mesh );
      46                 :            : 
      47                 :            :     //! Write "$Elements--$EndElements" section
      48                 :            :     void writeElements( const UnsMesh& mesh );
      49                 :            : 
      50                 :            :     //! Write "$PhysicalNames--$EndPhysicalNames" section
      51                 :            :     void writePhysicalNames();
      52                 :            : 
      53                 :            :     //! \brief Mesh ASCII type query
      54                 :            :     //! \return true if member variable m_type indicates an ASCII mesh format
      55                 :            :     bool isASCII() const {
      56                 :            :       return m_type == GmshFileType::ASCII ? true : false;
      57                 :            :     }
      58                 :            :     //! \brief Mesh binary type query
      59                 :            :     //! \return true if member variable m_type indicates an binary mesh format
      60                 :            :     bool isBinary() const {
      61                 :            :       return m_type == GmshFileType::BINARY ? true : false;
      62                 :            :     }
      63                 :            : 
      64                 :            :     //! Write element block: element ids and connectivity (node list)
      65                 :            :     void writeElemBlock( std::size_t nnpe,
      66                 :            :                          GmshElemType type,
      67                 :            :                          const std::vector< std::size_t >& inpoel );
      68                 :            : 
      69                 :            :     GmshFileType m_type;                //!< Mesh file type: 0:ASCII, 1:binary
      70                 :            : };
      71                 :            : 
      72                 :            : } // tk::
      73                 :            : 
      74                 :            : #endif // GmshMeshWriter_h

Generated by: LCOV version 1.14