GEOS
PackCollection.hpp
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 Total, S.A
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 
16 #ifndef GEOS_FILEIO_TIMEHISTORY_PACKCOLLECTION_HPP_
17 #define GEOS_FILEIO_TIMEHISTORY_PACKCOLLECTION_HPP_
18 
19 #include "mesh/DomainPartition.hpp"
20 #include "HistoryCollectionBase.hpp"
21 
22 namespace geos
23 {
24 
31 {
32 public:
37  PackCollection ( string const & name, Group * parent );
38 
43  static string catalogName() { return "PackCollection"; }
44 
45  virtual void initializePostSubGroups() override;
46 
48  virtual HistoryMetadata getMetaData( DomainPartition const & domain, localIndex collectionIdx ) const override;
49 
51  virtual const string & getTargetName() const override
52  {
53  return m_fieldName;
54  }
55 
65  virtual void updateSetsIndices( DomainPartition const & domain ) override final;
66 
67  virtual localIndex numMetaDataCollectors() const override final;
68 
69 private:
70 
72  struct viewKeysStruct
73  {
74  static constexpr char const * objectPathString() { return "objectPath"; }
75  static constexpr char const * fieldNameString() { return "fieldName"; }
76  static constexpr char const * setNamesString() { return "setNames"; }
77  static constexpr char const * onlyOnSetChangeString() { return "onlyOnSetChange"; }
78  static constexpr char const * disableCoordCollectionString() { return "disableCoordCollection"; }
79 
80  dataRepository::ViewKey objectPath = { "objectPath" };
81  dataRepository::ViewKey fieldName = { "fieldName" };
82  dataRepository::ViewKey setNames = { "setNames" };
83  dataRepository::ViewKey onlyOnSetChange = { "onlyOnSetChange" };
84  dataRepository::ViewKey disableCoordCollection = { "disableCoordCollection" };
85  } viewKeys;
87 
89  void buildMetaDataCollectors();
90 
93  void disableCoordCollection()
94  {
95  m_disableCoordCollection = true;
96  }
97 
99  void collect( DomainPartition const & domain,
100  localIndex const collectionIdx,
101  buffer_unit_type * & buffer ) override;
102 
109  bool collectAll() const;
110 
111  // todo : replace this with a vector of references to the actual set sortedarrays (after packing rework to allow sorted arrays to be used
112  // for indexing)
118  std::vector< array1d< localIndex > > m_setsIndices;
120  string m_objectPath;
122  string m_fieldName;
124  string_array m_setNames;
126  bool m_setChanged;
128  localIndex m_onlyOnSetChange;
131  integer m_disableCoordCollection;
135  bool m_initialized;
136 };
137 
138 }
139 #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 void initializePostSubGroups() override
Forwarding public initializing function...
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:1662
array1d< string > string_array
A 1-dimensional array of geos::string types.
Definition: DataTypes.hpp:392
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:85
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:82
signed char buffer_unit_type
Type stored in communication buffers.
Definition: DataTypes.hpp:109
struct containing the view access keys to be bound with class data member