1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// *****************************************************************************
/*!
  \file      src/IO/MeshWriter.hpp
  \copyright 2012-2015 J. Bakosi,
             2016-2018 Los Alamos National Security, LLC.,
             2019-2021 Triad National Security, LLC.,
             2022-2025 J. Bakosi
             All rights reserved. See the LICENSE file for details.
  \brief     Charm++ group for outputing mesh data to file
  \details   Charm++ group declaration used to output data associated to
     unstructured meshes to file(s). Charm++ chares (work units) send mesh and
     field data associated to mesh entities to the MeshWriter class defined here
     to write the data to file(s).
*/
// *****************************************************************************
#ifndef MeshWriter_h
#define MeshWriter_h

#include <vector><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <string><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <tuple><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <map><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include "Types.hpp"
#include "Centering.hpp"<--- Include file: "Centering.hpp" not found.
#include "UnsMesh.hpp"<--- Include file: "UnsMesh.hpp" not found.

#include "NoWarning/meshwriter.decl.h"<--- Include file: "NoWarning/meshwriter.decl.h" not found.

namespace tk {

//! Charm++ group used to output particle data to file in parallel
class MeshWriter : public CBase_MeshWriter {

  public:

    #if defined(__clang__)
      #pragma clang diagnostic push
      #pragma clang diagnostic ignored "-Wundefined-func-template"
    #endif

    //! Constructor: set some defaults that stay constant at all times
    //! \param[in] benchmark True of benchmark mode. No field output happens in
    //!   benchmark mode. This (and associated if tests) are here so client code
    //!   does not have to deal with this.
    //! \param[in] nmesh Total number of meshes
    MeshWriter( bool benchmark, std::size_t nmesh ) :
      m_benchmark( benchmark ),
      m_nchare( nmesh, 0 ) {}

    //! Migrate constructor
    // cppcheck-suppress uninitMemberVar
    explicit MeshWriter( CkMigrateMessage* m ) : CBase_MeshWriter( m ) {}

    #if defined(__clang__)
      #pragma clang diagnostic pop
    #endif

    //! Set the total number of chares
    void nchare( std::size_t meshid, int n );

    //! Output unstructured mesh into file
    void write( std::size_t meshid,
                bool meshoutput,
                bool fieldoutput,
                uint64_t itr,
                uint64_t itf,
                tk::real time,
                int chareid,
                const std::string& basefilename,
                const std::vector< std::size_t >& inpoel,
                const UnsMesh::Coords& coord,
                const std::map< int, std::vector< std::size_t > >& bface,
                const std::map< int, std::vector< std::size_t > >& bnode,
                const std::vector< std::size_t >& triinpoel,
                const std::vector< std::string >& elemfieldnames,
                const std::vector< std::string >& nodefieldnames,
                const std::vector< std::string >& elemsurfnames,
                const std::vector< std::string >& nodesurfnames,
                const std::vector< std::vector< tk::real > >& elemfields,
                const std::vector< std::vector< tk::real > >& nodefields,
                const std::vector< std::vector< tk::real > >& elemsurfs,
                const std::vector< std::vector< tk::real > >& nodesurfs,
                const std::set< int >& outsets,
                CkCallback c );

    /** @name Charm++ pack/unpack serializer member functions */
    ///@{
    //! \brief Pack/Unpack serialize member function
    //! \param[in,out] p Charm++'s PUP::er serializer object reference
    //! \note This is a Charm++ group, pup() is thus only for
    //!    checkpoint/restart.
    void pup( PUP::er &p ) override {
      p | m_benchmark;
      p | m_nchare;
    }
    //! \brief Pack/Unpack serialize operator|
    //! \param[in,out] p Charm++'s PUP::er serializer object reference
    //! \param[in,out] m MeshWriter object reference
    friend void operator|( PUP::er& p, MeshWriter& m ) { m.pup(p); }
    //@}

  private:
    //! True if benchmark mode
    bool m_benchmark;
    //! Total number chares across the whole problem (one per mesh)
    std::vector< int > m_nchare;

    //! Compute filename
    std::string filename( const std::string& basefilename,
                          std::size_t meshid,
                          uint64_t itr,
                          int chareid,
                          int surfid = 0 ) const;
};

} // tk::

#endif // MeshWriter_h