Quinoa all test code coverage report
Current view: top level - IO - STLTxtMeshReader.hpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 0 4 0.0 %
Date: 2024-04-29 14:42:33 Functions: 0 1 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 30 0.0 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/IO/STLTxtMeshReader.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     ASCII STL (STereoLithography) reader class declaration
       9                 :            :   \details   ASCII STL (STereoLithographu) reader class declaration.
      10                 :            : */
      11                 :            : // *****************************************************************************
      12                 :            : #ifndef STLTxtMeshReader_h
      13                 :            : #define STLTxtMeshReader_h
      14                 :            : 
      15                 :            : #include <iostream>
      16                 :            : #include <stddef.h>
      17                 :            : #include <string>
      18                 :            : 
      19                 :            : #include "Types.hpp"
      20                 :            : #include "Reader.hpp"
      21                 :            : #include "Exception.hpp"
      22                 :            : 
      23                 :            : namespace tk {
      24                 :            : 
      25                 :            : class STLMesh;
      26                 :            : 
      27                 :            : //! \brief STLTxtMeshReader : tk::Reader
      28                 :            : //! \details Mesh reader class facilitating reading a mesh from a file in
      29                 :            : //!   ASCII STL format.
      30                 :            : class STLTxtMeshReader : public Reader {
      31                 :            : 
      32                 :            :   public:
      33                 :            :     //! Constructor
      34                 :            :     explicit STLTxtMeshReader( const std::string& filename, STLMesh& mesh );
      35                 :            : 
      36                 :            :     //! Read ASCII STL mesh
      37                 :            :     void readMesh();
      38                 :            : 
      39                 :            :   private:
      40                 :            :     //! \brief ASCII STL keyword with operator>> redefined to do error checking
      41                 :            :     //!    without contaminating client-code
      42                 :            :     struct STLKeyword {
      43                 :            :       std::string read;                 //!< Keyword read in from input
      44                 :            :       const std::string correct;        //!< Keyword that should be read in
      45                 :            : 
      46                 :            :       //! Initializer constructor
      47                 :            :       explicit STLKeyword( const std::string& corr ) noexcept :
      48                 :            :         read(), correct(corr) {}
      49                 :            : 
      50                 :            :       //! Operator >> for reading a keyword and hande error
      51                 :          0 :       friend std::ifstream& operator>> (std::ifstream& is, STLKeyword& kw) {
      52                 :          0 :         is >> kw.read;
      53 [ -  - ][ -  - ]:          0 :         ErrChk( kw.read == kw.correct,
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
                 [ -  - ]
      54                 :            :                 "Corruption in ASCII STL file while parsing keyword '" +
      55                 :            :                 kw.read + "', should be '" + kw.correct + "'" );
      56                 :          0 :         return is;
      57                 :            :       }
      58                 :            :     };
      59                 :            : 
      60                 :            :     //! Read (or count vertices in) ASCII STL mesh
      61                 :            :     std::size_t readFacets( const bool store,
      62                 :            :                             tk::real* const x = nullptr,
      63                 :            :                             tk::real* const y = nullptr,
      64                 :            :                             tk::real* const z = nullptr );
      65                 :            : 
      66                 :            :     const bool STORE = true;                 //!< Indicator to store facets
      67                 :            :     const bool COUNT = false;                //!< Indicator to only count facets
      68                 :            :     STLMesh& m_mesh;                         //!< Mesh
      69                 :            : };
      70                 :            : 
      71                 :            : } // tk::
      72                 :            : 
      73                 :            : #endif // STLTxtMeshReader_h

Generated by: LCOV version 1.14