GEOSX
PackCollection.hpp
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 
15 #ifndef GEOS_FILEIO_TIMEHISTORY_PACKCOLLECTION_HPP_
16 #define GEOS_FILEIO_TIMEHISTORY_PACKCOLLECTION_HPP_
17 
18 #include "mesh/DomainPartition.hpp"
19 #include "HistoryCollectionBase.hpp"
20 
21 namespace geos
22 {
23 
30 {
31 public:
36  PackCollection ( string const & name, Group * parent );
37 
42  static string catalogName() { return "PackCollection"; }
43 
44  virtual void initializePostSubGroups() override;
45 
47  virtual HistoryMetadata getMetaData( DomainPartition const & domain, localIndex collectionIdx ) const override;
48 
50  virtual const string & getTargetName() const override
51  {
52  return m_fieldName;
53  }
54 
64  virtual void updateSetsIndices( DomainPartition const & domain ) override final;
65 
66  virtual localIndex numMetaDataCollectors() const override final;
67 
68 private:
69 
71  struct viewKeysStruct
72  {
73  static constexpr char const * objectPathString() { return "objectPath"; }
74  static constexpr char const * fieldNameString() { return "fieldName"; }
75  static constexpr char const * setNamesString() { return "setNames"; }
76  static constexpr char const * onlyOnSetChangeString() { return "onlyOnSetChange"; }
77  static constexpr char const * disableCoordCollectionString() { return "disableCoordCollection"; }
78 
79  dataRepository::ViewKey objectPath = { "objectPath" };
80  dataRepository::ViewKey fieldName = { "fieldName" };
81  dataRepository::ViewKey setNames = { "setNames" };
82  dataRepository::ViewKey onlyOnSetChange = { "onlyOnSetChange" };
83  dataRepository::ViewKey disableCoordCollection = { "disableCoordCollection" };
84  } viewKeys;
86 
88  void buildMetaDataCollectors();
89 
92  void disableCoordCollection()
93  {
94  m_disableCoordCollection = true;
95  }
96 
98  void collect( DomainPartition const & domain,
99  localIndex const collectionIdx,
100  buffer_unit_type * & buffer ) override;
101 
108  bool collectAll() const;
109 
110  // todo : replace this with a vector of references to the actual set sortedarrays (after packing rework to allow sorted arrays to be used
111  // for indexing)
117  std::vector< array1d< localIndex > > m_setsIndices;
119  string m_objectPath;
121  string m_fieldName;
123  string_array m_setNames;
125  bool m_setChanged;
127  localIndex m_onlyOnSetChange;
130  integer m_disableCoordCollection;
134  bool m_initialized;
135 };
136 
137 }
138 #endif
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
Intermediate class for code factorisation. It mainly deals with collector and buffer management....
A minimal class to specify information about time history information being collected and output.
PackCollection(string const &name, Group *parent)
Constructor.
virtual localIndex numMetaDataCollectors() const override final
Get the number of collectors of meta-information (set indices, etc) writing time-independent informat...
virtual void updateSetsIndices(DomainPartition const &domain) override final
Update the indices related to the sets being collected.
static string catalogName()
Catalog name interface.
virtual HistoryMetadata getMetaData(DomainPartition const &domain, localIndex collectionIdx) const override
Get the metadata for what this collector collects.
virtual const string & getTargetName() const override
Get the name of the object being targeted for collection.
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
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:122
signed char buffer_unit_type
Type stored in communication buffers.
Definition: DataTypes.hpp:149
GEOSX_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:125
struct containing the view access keys to be bound with class data member