GEOS
OutputBase.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 TotalEnergies
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
19 #ifndef GEOS_FILEIO_OUTPUTS_OUTPUTBASE_HPP_
20 #define GEOS_FILEIO_OUTPUTS_OUTPUTBASE_HPP_
21 
22 #include "dataRepository/Group.hpp"
24 #include "dataRepository/LogLevelsInfo.hpp" // For logInfo namespace
25 #include "common/Timer.hpp"
26 
27 namespace geos
28 {
29 
30 namespace logInfo
31 {
37 {
42  static std::string_view getDescription() { return "Output timing information"; }
43 
48  static constexpr int getMinLogLevel() { return 1; }
49 };
50 
59 {
64  virtual std::string_view getDescription() const = 0;
65 };
66 }
67 
74 {
75 public:
77  explicit OutputBase( string const & name, Group * const parent );
78 
80  virtual ~OutputBase() override;
81 
86  static void setOutputDirectory( string const & outputDir );
87 
92  static string const & getOutputDirectory();
93 
98  static void setFileNameRoot( string const & root );
99 
104  static string const & getFileNameRoot();
105 
107  virtual void setupDirectoryStructure();
108 
109  // Catalog interface
113 
114  // Catalog view keys
115  struct viewKeysStruct
116  {
117  static constexpr auto childDirectoryString = "childDirectory";
118  static constexpr auto parallelThreadsString = "parallelThreads";
119  } outputBaseViewKeys;
121 
126  string childDirectory() const { return m_childDirectory; }
127 
132  integer parallelThreads() const { return m_parallelThreads; }
133 
134 
135 
136 protected:
142  virtual void initializePreSubGroups() override;
143 
145  std::chrono::system_clock::duration m_outputTimer;
146 
151  virtual logInfo::OutputTimerBase const & getTimerCategory() const = 0;
152 
154  virtual void cleanup( real64 const time_n,
155  integer const cycleNumber,
156  integer const eventCounter,
157  real64 const eventProgress,
158  DomainPartition & domain ) override;
159 
160 private:
161  string m_childDirectory;
162  integer m_parallelThreads;
163 
164 };
165 
166 
167 } /* namespace geos */
168 
169 #endif /* GEOS_FILEIO_OUTPUTS_OUTPUTBASE_HPP_ */
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
string childDirectory() const
Get the path of the child directory where output will be written.
Definition: OutputBase.hpp:126
std::chrono::system_clock::duration m_outputTimer
Timer used to track duration of file writing operations for this specific output type.
Definition: OutputBase.hpp:145
virtual void setupDirectoryStructure()
Method for setting up output directories.
virtual void cleanup(real64 const time_n, integer const cycleNumber, integer const eventCounter, real64 const eventProgress, DomainPartition &domain) override
Called as the code exits the main run loop.
static string const & getOutputDirectory()
Getter for the output directory.
static string const & getFileNameRoot()
Getter for the file name root.
integer parallelThreads() const
Get the number of parallel threads to use to write plotfiles.
Definition: OutputBase.hpp:132
virtual ~OutputBase() override
Destructor.
virtual void initializePreSubGroups() override
Do initialization prior to calling initialization operations on the subgroups.
OutputBase(string const &name, Group *const parent)
Constructor.
static void setOutputDirectory(string const &outputDir)
Setter for the output directory.
virtual logInfo::OutputTimerBase const & getTimerCategory() const =0
Get the timer category for this output type.
static void setFileNameRoot(string const &root)
Setter for the file name root.
This class provides the base class/interface for the catalog value objects.
std::unordered_map< std::string, std::unique_ptr< CatalogInterface< BASETYPE, ARGS... > > > CatalogType
This is the type that will be used for the catalog. The catalog is actually instantiated in the BASET...
static CatalogInterface::CatalogType & getCatalog()
Get the singleton catalog for this Group.
double real64
64-bit floating point type.
Definition: DataTypes.hpp:99
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:82
std::string_view string_view
String type.
Definition: DataTypes.hpp:94
Base interface for specific output type timers.
Definition: OutputBase.hpp:59
virtual std::string_view getDescription() const =0
Get the description of this timer.
Base timer category for output operations.
Definition: OutputBase.hpp:37
static std::string_view getDescription()
Get the description of this timer.
Definition: OutputBase.hpp:42
static constexpr int getMinLogLevel()
Get the minimum log level for this timer.
Definition: OutputBase.hpp:48
struct containing the view access keys to be bound with class data member