GEOSX
TimeHistoryOutput.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2019 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2019 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2019 TotalEnergies
8  * Copyright (c) 2019- GEOSX Contributors
9  * All right reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
19 #ifndef GEOS_FILEIO_OUTPUTS_HISTORYOUTPUT_HPP_
20 #define GEOS_FILEIO_OUTPUTS_HISTORYOUTPUT_HPP_
21 
22 #include "OutputBase.hpp"
23 #include "fileIO/timeHistory/HistoryCollection.hpp"
24 #include "fileIO/timeHistory/BufferedHistoryIO.hpp"
25 #include "fileIO/timeHistory/HDFHistoryIO.hpp"
26 
27 #include "LvArray/src/Array.hpp" // just for collector
28 
29 namespace geos
30 {
31 
38 {
39 public:
41  TimeHistoryOutput( string const & name,
42  Group * const parent );
43 
45  virtual ~TimeHistoryOutput() override
46  { }
47 
52  static string catalogName() { return "TimeHistory"; }
53 
61 
65  virtual void reinit() override;
66 
71  void setFileName( string const & root );
72 
77  virtual bool execute( real64 const time_n,
78  real64 const dt,
79  integer const cycleNumber,
80  integer const eventCounter,
81  real64 const eventProgress,
82  DomainPartition & domain ) override;
87  virtual void cleanup( real64 const time_n,
88  integer const cycleNumber,
89  integer const eventCounter,
90  real64 const eventProgress,
91  DomainPartition & domain ) override;
92 
94  struct viewKeys
95  {
96  static constexpr char const * timeHistoryOutputTargetString() { return "sources"; }
97  static constexpr char const * timeHistoryOutputFilenameString() { return "filename"; }
98  static constexpr char const * timeHistoryOutputFormatString() { return "format"; }
99  static constexpr char const * timeHistoryRestartString() { return "restart"; }
100 
101  dataRepository::ViewKey timeHistoryOutputTarget = { "sources" };
102  dataRepository::ViewKey timeHistoryOutputFilename = { "filename" };
103  dataRepository::ViewKey timeHistoryOutputFormat = { "format" };
104  dataRepository::ViewKey timeHistoryRestart = { "restart" };
105  } timeHistoryOutputViewKeys;
107 
112 #if defined(GEOSX_USE_PYGEOSX)
113  virtual PyTypeObject * getPythonType() const override;
114 #endif
115 
116 private:
117 
123  void initCollectorParallel( DomainPartition const & domain, HistoryCollection & collector );
124 
126  string_array m_collectorPaths;
128  string m_format;
130  string m_filename;
132  integer m_recordCount;
134  std::vector< std::unique_ptr< BufferedHistoryIO > > m_io;
135 };
136 }
137 
138 #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.
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:1625
array1d< string > string_array
A 1-dimensional array of geos::string types.
Definition: DataTypes.hpp:432
double real64
64-bit floating point type.
Definition: DataTypes.hpp:139
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:122