GEOS
TimeHistoryOutput.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 
20 #ifndef GEOS_FILEIO_OUTPUTS_HISTORYOUTPUT_HPP_
21 #define GEOS_FILEIO_OUTPUTS_HISTORYOUTPUT_HPP_
22 
23 #include "OutputBase.hpp"
24 #include "fileIO/timeHistory/HistoryCollection.hpp"
25 #include "fileIO/timeHistory/BufferedHistoryIO.hpp"
26 #include "fileIO/timeHistory/HDFHistoryIO.hpp"
27 
28 #include "LvArray/src/Array.hpp" // just for collector
29 
30 namespace geos
31 {
32 
39 {
40 public:
42  TimeHistoryOutput( string const & name,
43  Group * const parent );
44 
46  virtual ~TimeHistoryOutput() override
47  { }
48 
53  static string catalogName() { return "TimeHistory"; }
54 
62 
66  virtual void reinit() override;
67 
72  void setFileName( string const & root );
73 
78  virtual bool execute( real64 const time_n,
79  real64 const dt,
80  integer const cycleNumber,
81  integer const eventCounter,
82  real64 const eventProgress,
83  DomainPartition & domain ) override;
88  virtual void cleanup( real64 const time_n,
89  integer const cycleNumber,
90  integer const eventCounter,
91  real64 const eventProgress,
92  DomainPartition & domain ) override;
93 
95  struct viewKeys
96  {
97  static constexpr char const * timeHistoryOutputTargetString() { return "sources"; }
98  static constexpr char const * timeHistoryOutputFilenameString() { return "filename"; }
99  static constexpr char const * timeHistoryOutputFormatString() { return "format"; }
100  static constexpr char const * timeHistoryRestartString() { return "restart"; }
101 
102  dataRepository::ViewKey timeHistoryOutputTarget = { "sources" };
103  dataRepository::ViewKey timeHistoryOutputFilename = { "filename" };
104  dataRepository::ViewKey timeHistoryOutputFormat = { "format" };
105  dataRepository::ViewKey timeHistoryRestart = { "restart" };
106  } timeHistoryOutputViewKeys;
108 
113 #if defined(GEOS_USE_PYGEOSX)
114  virtual PyTypeObject * getPythonType() const override;
115 #endif
116 
117 protected:
121  logInfo::OutputTimerBase const & getTimerCategory() const override;
122 
123 private:
124 
130  void initCollectorParallel( DomainPartition const & domain, HistoryCollection & collector );
131 
133  string_array m_collectorPaths;
135  string m_format;
137  string m_filename;
139  integer m_recordCount;
141  std::vector< std::unique_ptr< BufferedHistoryIO > > m_io;
142 };
143 }
144 
145 #endif
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
virtual void initializePostInitialConditionsPostSubGroups() override
Perform initalization after all subgroups have been initialized. Check for existing files and data sp...
TimeHistoryOutput(string const &name, Group *const parent)
Constructor.
virtual void cleanup(real64 const time_n, integer const cycleNumber, integer const eventCounter, real64 const eventProgress, DomainPartition &domain) override
Writes out a time history file at the end of the simulation.
void setFileName(string const &root)
Set the output filename (This is usefull for pygeosx user)
virtual bool execute(real64 const time_n, real64 const dt, integer const cycleNumber, integer const eventCounter, real64 const eventProgress, DomainPartition &domain) override
Writes out a time history file.
logInfo::OutputTimerBase const & getTimerCategory() const override
Return PyHistoryOutput type.
static string catalogName()
Catalog name interface.
virtual void reinit() override
Performs re-initialization of certain variable depending on the solver being used.
virtual ~TimeHistoryOutput() override
Destructor.
Group::wrapperMap::KeyIndex ViewKey
Type alias for KeyIndexT type used for wrapper lookups.
Definition: Group.hpp:1662
array1d< string > string_array
A 1-dimensional array of geos::string types.
Definition: DataTypes.hpp:392
double real64
64-bit floating point type.
Definition: DataTypes.hpp:99
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:82
Base interface for specific output type timers.
Definition: OutputBase.hpp:59