LCOV - code coverage report
Current view: top level - include/outputs - Nemesis.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 1 1 100.0 %
Date: 2025-07-17 01:28:37 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : #pragma once
      11             : 
      12             : // MOOSE includes
      13             : #include "AdvancedOutput.h"
      14             : 
      15             : // libMesh forward declarations
      16             : namespace libMesh
      17             : {
      18             : class Nemesis_IO;
      19             : }
      20             : 
      21             : /**
      22             :  * Class for output data to the Nemesis format
      23             :  */
      24             : class Nemesis : public AdvancedOutput
      25             : {
      26             : public:
      27             :   static InputParameters validParams();
      28             : 
      29             :   /**
      30             :    * Class constructor
      31             :    */
      32             :   Nemesis(const InputParameters & parameters);
      33             : 
      34             :   /**
      35             :    * Sets up the libMesh::NemesisII_IO object used for outputting to the Nemesis format
      36             :    */
      37             :   virtual void initialSetup() override;
      38             : 
      39             :   /**
      40             :    * Creates a new NemesisII_IO output object for outputting a new mesh
      41             :    */
      42             :   virtual void meshChanged() override;
      43             : 
      44             :   /**
      45             :    * Performs the necessary deletion and re-creating of NemesisII_IO object
      46             :    *
      47             :    * This function is stand-alone and called directly from the output() method because
      48             :    * the NemesisII_IO object is extremely fragile with respect to closing a file that has
      49             :    * not had data written. Thus, it is important to only create a new NemesisII_IO object
      50             :    * if it is certain that it will be used.
      51             :    */
      52             :   virtual void outputSetup();
      53             : 
      54          24 :   bool supportsMaterialPropertyOutput() const override { return true; }
      55             : 
      56             : protected:
      57             :   /**
      58             :    * Overload the Output::output method, this is required for Nemesis
      59             :    * output due to the method utilized for outputting single/global parameters
      60             :    */
      61             :   virtual void output() override;
      62             : 
      63             :   /**
      64             :    * Writes postprocessor values to global output parameters
      65             :    */
      66             :   virtual void outputPostprocessors() override;
      67             : 
      68             :   /**
      69             :    * Writes scalar AuxVariables to global output parameters
      70             :    */
      71             :   virtual void outputScalarVariables() override;
      72             : 
      73             :   /**
      74             :    * Returns the current filename, this method handles the -s000 suffix
      75             :    * common to NemesisII files.
      76             :    * @return A string containing the current filename to be written
      77             :    */
      78             :   virtual std::string filename() override;
      79             : 
      80             :   /// Pointer to the libMesh::NemesisII_IO object that performs the actual data output
      81             :   std::unique_ptr<libMesh::Nemesis_IO> _nemesis_io_ptr;
      82             : 
      83             :   /// Storage for scalar values (postprocessors and scalar AuxVariables)
      84             :   std::vector<Real> _global_values;
      85             : 
      86             :   /// Storage for names of the above scalar values
      87             :   std::vector<std::string> _global_names;
      88             : 
      89             :   /// Current output filename; utilized by filename() to create the proper suffix
      90             :   unsigned int & _file_num;
      91             : 
      92             : private:
      93             :   /// Count of outputs per exodus file
      94             :   unsigned int & _nemesis_num;
      95             : 
      96             :   /// Flag if the output has been initialized
      97             :   bool _nemesis_initialized;
      98             : 
      99             :   /// Flag indicating MOOSE is recovering via --recover command-line option
     100             :   bool _recovering;
     101             : 
     102             :   /// A flag indicating to the Nemesis object that the mesh has changed
     103             :   bool & _nemesis_mesh_changed;
     104             : 
     105             :   /// Flag to output HDF5 format (when available) in Nemesis. libMesh wants to do
     106             :   ///  so by default (for backwards compatibility with libMesh HDF5 users), but we
     107             :   /// want to avoid this by default (for backwards compatibility with most Moose users
     108             :   /// and to avoid generating regression test gold files that non-HDF5 Moose builds can't read)
     109             :   bool _write_hdf5;
     110             : };

Generated by: LCOV version 1.14