GEOSX
HistoryIO.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 Total, S.A
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 GEOSX_HISTORY_IO_HPP_
20 #define GEOSX_HISTORY_IO_HPP_
21 
22 #include "dataRepository/Group.hpp"
23 
24 namespace geosx
25 {
26 class DataSpec;
27 
33 {
34 public:
35 
38  m_bufferedCount( 0 ),
39  m_bufferHead( nullptr ),
40  m_dataBuffer( 0 )
41  {}
42 
44  virtual ~BufferedHistoryIO() {}
45 
53  {
54  resizeBuffer();
56  return m_bufferHead;
57  }
58 
65  virtual void init( bool existsOkay ) = 0;
66 
70  virtual void write( ) = 0;
71 
76  virtual void compressInFile( ) = 0;
77 
83 protected:
85  virtual void resizeBuffer( ) = 0;
86 
88  void emptyBuffer( )
89  {
90  m_bufferedCount = 0;
92  }
93 
100 };
101 
102 }
103 #endif
buffer_type m_dataBuffer
The data buffer containing the history info.
Definition: HistoryIO.hpp:99
An abstract class for performing buffered history output.
Definition: HistoryIO.hpp:32
BufferedHistoryIO()
Constructor.
Definition: HistoryIO.hpp:37
virtual ~BufferedHistoryIO()
Destructor.
Definition: HistoryIO.hpp:44
localIndex m_bufferedCount
The current number of records in the buffer.
Definition: HistoryIO.hpp:95
void emptyBuffer()
Empty the history collection buffer.
Definition: HistoryIO.hpp:88
signed char buffer_unit_type
Type stored in communication buffers.
Definition: DataTypes.hpp:146
buffer_unit_type * getBufferHead()
Get the head of the internal history storage buffer.
Definition: HistoryIO.hpp:52
std::ptrdiff_t localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:125
virtual void compressInFile()=0
Ensure the repressentation of the data in the output target is dense and terse.
virtual void init(bool existsOkay)=0
Perform and intialization needed for time-history output.
buffer_unit_type * m_bufferHead
The write head of the buffer.
Definition: HistoryIO.hpp:97
virtual void write()=0
Write the buffered history data to the output target.
std::vector< buffer_unit_type > buffer_type
Type of storage for communication buffers.
Definition: DataTypes.hpp:153
virtual void resizeBuffer()=0
Resize the buffer to accomodate additional history collection.
localIndex getBufferedCount()
Query the number of history states currently stored in the internal buffer.
Definition: HistoryIO.hpp:82