Xyst test code coverage report
Current view: top level - IO - MeshWriter.hpp (source / functions) Coverage Total Hit
Commit: 1fb74642dd9d7732b67f32dec2f2762e238d3fa7 Lines: 100.0 % 8 8
Test Date: 2025-08-13 22:18:46 Functions: 100.0 % 2 2
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
Branches: 50.0 % 2 1

             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                 :             :              2022-2025 J. Bakosi
       8                 :             :              All rights reserved. See the LICENSE file for details.
       9                 :             :   \brief     Charm++ group for outputing mesh data to file
      10                 :             :   \details   Charm++ group declaration used to output data associated to
      11                 :             :      unstructured meshes to file(s). Charm++ chares (work units) send mesh and
      12                 :             :      field data associated to mesh entities to the MeshWriter class defined here
      13                 :             :      to write the data to file(s).
      14                 :             : */
      15                 :             : // *****************************************************************************
      16                 :             : #ifndef MeshWriter_h
      17                 :             : #define MeshWriter_h
      18                 :             : 
      19                 :             : #include <vector>
      20                 :             : #include <string>
      21                 :             : #include <tuple>
      22                 :             : #include <map>
      23                 :             : 
      24                 :             : #include "Types.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                 :             : 
      37                 :             :     #if defined(__clang__)
      38                 :             :       #pragma clang diagnostic push
      39                 :             :       #pragma clang diagnostic ignored "-Wundefined-func-template"
      40                 :             :     #endif
      41                 :             : 
      42                 :             :     //! Constructor: set some defaults that stay constant at all times
      43                 :             :     //! \param[in] benchmark True of benchmark mode. No field output happens in
      44                 :             :     //!   benchmark mode. This (and associated if tests) are here so client code
      45                 :             :     //!   does not have to deal with this.
      46                 :             :     //! \param[in] nmesh Total number of meshes
      47                 :         770 :     MeshWriter( bool benchmark, std::size_t nmesh ) :
      48                 :         770 :       m_benchmark( benchmark ),
      49         [ +  - ]:         770 :       m_nchare( nmesh, 0 ) {}
      50                 :             : 
      51                 :             :     //! Migrate constructor
      52                 :             :     // cppcheck-suppress uninitMemberVar
      53                 :          30 :     explicit MeshWriter( CkMigrateMessage* m ) : CBase_MeshWriter( m ) {}
      54                 :             : 
      55                 :             :     #if defined(__clang__)
      56                 :             :       #pragma clang diagnostic pop
      57                 :             :     #endif
      58                 :             : 
      59                 :             :     //! Set the total number of chares
      60                 :             :     void nchare( std::size_t meshid, int n );
      61                 :             : 
      62                 :             :     //! Output unstructured mesh into file
      63                 :             :     void write( std::size_t meshid,
      64                 :             :                 bool meshoutput,
      65                 :             :                 bool fieldoutput,
      66                 :             :                 uint64_t itr,
      67                 :             :                 uint64_t itf,
      68                 :             :                 tk::real time,
      69                 :             :                 int chareid,
      70                 :             :                 const std::string& basefilename,
      71                 :             :                 const std::vector< std::size_t >& inpoel,
      72                 :             :                 const UnsMesh::Coords& coord,
      73                 :             :                 const std::map< int, std::vector< std::size_t > >& bface,
      74                 :             :                 const std::map< int, std::vector< std::size_t > >& bnode,
      75                 :             :                 const std::vector< std::size_t >& triinpoel,
      76                 :             :                 const std::vector< std::string >& elemfieldnames,
      77                 :             :                 const std::vector< std::string >& nodefieldnames,
      78                 :             :                 const std::vector< std::string >& elemsurfnames,
      79                 :             :                 const std::vector< std::string >& nodesurfnames,
      80                 :             :                 const std::vector< std::vector< tk::real > >& elemfields,
      81                 :             :                 const std::vector< std::vector< tk::real > >& nodefields,
      82                 :             :                 const std::vector< std::vector< tk::real > >& elemsurfs,
      83                 :             :                 const std::vector< std::vector< tk::real > >& nodesurfs,
      84                 :             :                 const std::set< int >& outsets,
      85                 :             :                 CkCallback c );
      86                 :             : 
      87                 :             :     /** @name Charm++ pack/unpack serializer member functions */
      88                 :             :     ///@{
      89                 :             :     //! \brief Pack/Unpack serialize member function
      90                 :             :     //! \param[in,out] p Charm++'s PUP::er serializer object reference
      91                 :             :     //! \note This is a Charm++ group, pup() is thus only for
      92                 :             :     //!    checkpoint/restart.
      93                 :         398 :     void pup( PUP::er &p ) override {
      94                 :         398 :       p | m_benchmark;
      95                 :         398 :       p | m_nchare;
      96                 :         398 :     }
      97                 :             :     //! \brief Pack/Unpack serialize operator|
      98                 :             :     //! \param[in,out] p Charm++'s PUP::er serializer object reference
      99                 :             :     //! \param[in,out] m MeshWriter object reference
     100                 :             :     friend void operator|( PUP::er& p, MeshWriter& m ) { m.pup(p); }
     101                 :             :     //@}
     102                 :             : 
     103                 :             :   private:
     104                 :             :     //! True if benchmark mode
     105                 :             :     bool m_benchmark;
     106                 :             :     //! Total number chares across the whole problem (one per mesh)
     107                 :             :     std::vector< int > m_nchare;
     108                 :             : 
     109                 :             :     //! Compute filename
     110                 :             :     std::string filename( const std::string& basefilename,
     111                 :             :                           std::size_t meshid,
     112                 :             :                           uint64_t itr,
     113                 :             :                           int chareid,
     114                 :             :                           int surfid = 0 ) const;
     115                 :             : };
     116                 :             : 
     117                 :             : } // tk::
     118                 :             : 
     119                 :             : #endif // MeshWriter_h
        

Generated by: LCOV version 2.0-1