Quinoa all test code coverage report
Current view: top level - IO - MeshWriter.hpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 7 7 100.0 %
Date: 2024-04-29 14:42:33 Functions: 1 1 100.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/MeshWriter.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     Charm++ group for outputing mesh data to file
       9                 :            :   \details   Charm++ group declaration used to output data associated to
      10                 :            :      unstructured meshes to file(s). Charm++ chares (work units) send mesh and
      11                 :            :      field data associated to mesh entities to the MeshWriter class defined here
      12                 :            :      to write the data to file(s).
      13                 :            : */
      14                 :            : // *****************************************************************************
      15                 :            : #ifndef MeshWriter_h
      16                 :            : #define MeshWriter_h
      17                 :            : 
      18                 :            : #include <vector>
      19                 :            : #include <string>
      20                 :            : #include <tuple>
      21                 :            : #include <map>
      22                 :            : 
      23                 :            : #include "Types.hpp"
      24                 :            : #include "Options/FieldFile.hpp"
      25                 :            : #include "Centering.hpp"
      26                 :            : #include "UnsMesh.hpp"
      27                 :            : 
      28                 :            : #include "NoWarning/meshwriter.decl.h"
      29                 :            : 
      30                 :            : namespace tk {
      31                 :            : 
      32                 :            : //! Charm++ group used to output particle data to file in parallel
      33                 :            : class MeshWriter : public CBase_MeshWriter {
      34                 :            : 
      35                 :            :   public:
      36                 :            :     //! Constructor: set some defaults that stay constant at all times
      37                 :            :     MeshWriter( ctr::FieldFileType filetype,
      38                 :            :                 Centering bnd_centering,
      39                 :            :                 bool benchmark,
      40                 :            :                 std::size_t nmesh );
      41                 :            : 
      42                 :            :     #if defined(__clang__)
      43                 :            :       #pragma clang diagnostic push
      44                 :            :       #pragma clang diagnostic ignored "-Wundefined-func-template"
      45                 :            :     #endif
      46                 :            :     //! Migrate constructor
      47                 :          5 :     explicit MeshWriter( CkMigrateMessage* m ) : CBase_MeshWriter( m ) {}
      48                 :            :     #if defined(__clang__)
      49                 :            :       #pragma clang diagnostic pop
      50                 :            :     #endif
      51                 :            : 
      52                 :            :     //! Set the total number of chares
      53                 :            :     void nchare( std::size_t meshid, int n );
      54                 :            : 
      55                 :            :     //! Output unstructured mesh into file
      56                 :            :     void write( std::size_t meshid,
      57                 :            :                 bool meshoutput,
      58                 :            :                 bool fieldoutput,
      59                 :            :                 uint64_t itr,
      60                 :            :                 uint64_t itf,
      61                 :            :                 tk::real time,
      62                 :            :                 int chareid,
      63                 :            :                 const std::string& basefilename,
      64                 :            :                 const std::vector< std::size_t >& inpoel,
      65                 :            :                 const UnsMesh::Coords& coord,
      66                 :            :                 const std::map< int, std::vector< std::size_t > >& bface,
      67                 :            :                 const std::map< int, std::vector< std::size_t > >& bnode,
      68                 :            :                 const std::vector< std::size_t >& triinpoel,
      69                 :            :                 const std::vector< std::string >& elemfieldnames,
      70                 :            :                 const std::vector< std::string >& nodefieldnames,
      71                 :            :                 const std::vector< std::string >& elemsurfnames,
      72                 :            :                 const std::vector< std::string >& nodesurfnames,
      73                 :            :                 const std::vector< std::vector< tk::real > >& elemfields,
      74                 :            :                 const std::vector< std::vector< tk::real > >& nodefields,
      75                 :            :                 const std::vector< std::vector< tk::real > >& elemsurfs,
      76                 :            :                 const std::vector< std::vector< tk::real > >& nodesurfs,
      77                 :            :                 const std::set< int >& outsets,
      78                 :            :                 CkCallback c );
      79                 :            : 
      80                 :            :     /** @name Charm++ pack/unpack serializer member functions */
      81                 :            :     ///@{
      82                 :            :     //! \brief Pack/Unpack serialize member function
      83                 :            :     //! \param[in,out] p Charm++'s PUP::er serializer object reference
      84                 :            :     //! \note This is a Charm++ group, pup() is thus only for
      85                 :            :     //!    checkpoint/restart.
      86                 :        311 :     void pup( PUP::er &p ) override {
      87                 :            :       p | m_filetype;
      88                 :        311 :       p | m_bndCentering;
      89                 :        311 :       p | m_benchmark;
      90                 :        311 :       p | m_nmesh;
      91                 :        311 :       p | m_nchare;
      92                 :        311 :     }
      93                 :            :     //! \brief Pack/Unpack serialize operator|
      94                 :            :     //! \param[in,out] p Charm++'s PUP::er serializer object reference
      95                 :            :     //! \param[in,out] m MeshWriter object reference
      96                 :            :     friend void operator|( PUP::er& p, MeshWriter& m ) { m.pup(p); }
      97                 :            :     //@}
      98                 :            : 
      99                 :            :   private:
     100                 :            :     //! Output file format type
     101                 :            :     ctr::FieldFileType m_filetype;
     102                 :            :     //! Centering to identify what boundary data to write.
     103                 :            :     Centering m_bndCentering;
     104                 :            :     //! True if benchmark mode
     105                 :            :     bool m_benchmark;
     106                 :            :     //! Total number of meshes
     107                 :            :     std::size_t m_nmesh;
     108                 :            :     //! Total number chares across the whole problem (one per mesh)
     109                 :            :     std::vector< int > m_nchare;
     110                 :            : 
     111                 :            :     //! Compute filename
     112                 :            :     std::string filename( const std::string& basefilename,
     113                 :            :                           std::size_t meshid,
     114                 :            :                           uint64_t itr,
     115                 :            :                           int chareid,
     116                 :            :                           int surfid = 0 ) const;
     117                 :            : };
     118                 :            : 
     119                 :            : } // tk::
     120                 :            : 
     121                 :            : #endif // MeshWriter_h

Generated by: LCOV version 1.14