GEOS
SinglePhaseStatisticsAggregator.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 
90 #ifndef SRC_CORECOMPONENTS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASESTATISTICSAGGREGATOR_HPP_
91 #define SRC_CORECOMPONENTS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASESTATISTICSAGGREGATOR_HPP_
92 
94 
95 namespace geos
96 {
97 
98 class SinglePhaseBase;
99 
100 namespace singlePhaseStatistics
101 {
102 class StatsAggregator;
103 class RegionStatistics;
104 }
105 
106 template<>
107 struct StatsAggregatorTraits< singlePhaseStatistics::StatsAggregator >
108 {
109  using SolverType = SinglePhaseBase;
111 };
112 
113 namespace singlePhaseStatistics
114 {
115 
122 {
123 public:
124 
127 
134 
139 
146 
149 
154 
155  // TODO? -> split to struct PressureStats...MassStats:
156  // - optional computation of each stats
157  // - VKS for struct name ("pressureStats"..."massStats")
158  // - current RegionStatistics struct bits
159 
166  RegionStatistics( string const & targetName,
167  dataRepository::Group * const parent,
168  string_view setName,
169  bool statsOutputEnabled );
170 
171  RegionStatistics( RegionStatistics && ) = default;
172 
173 };
174 
181 class StatsAggregator : public StatsAggregatorBase< StatsAggregator >
182 {
183 public:
184 
186 
195  StatsAggregator( dataRepository::DataContext const & ownerDataContext,
196  dataRepository::Group & meshBodies,
197  bool statsOutputEnabled );
198 
207 
208  // template implementations
210 
211  void initStats( RegionStatistics & stats, real64 time ) const;
213  RegionStatistics & subRegionStats,
214  SetType const & targetSet ) const;
215  void aggregateStats( RegionStatistics & stats, RegionStatistics const & other ) const;
216  void mpiAggregateStats( RegionStatistics & stats ) const;
217  void postAggregateStats( RegionStatistics & stats );
218 
220 
221 };
222 
223 } /* namespace singlePhaseStatistics */
224 
225 } /* namespace geos */
226 
227 #endif /* SRC_CORECOMPONENTS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASESTATISTICSAGGREGATOR_HPP_ */
Output data group to contain the result of a given stat aggregator on the dataRepository....
Reponsible of computing physical statistics over the grid, registering the result in the data reposit...
void initStats(StatsGroupType &stats, real64 time) const
Initialize all statistics values to aggregable default values, before any computation / reduction for...
void postAggregateStats(StatsGroupType &stats)
Do the final computations for the statistics. Must be called after computations & aggregations.
void mpiAggregateStats(StatsGroupType &stats) const
Aggregate all instance statistics with those of other ranks.
void computeSubRegionRankStats(CellElementSubRegion &subRegion, StatsGroupType &subRegionStats, SetType const &targetSet) const
Compute the rank-local stats for the given sub-region and store the results in the given stats group.
void aggregateStats(StatsGroupType &stats, StatsGroupType const &other) const
Aggregate all instance statistics with those of another instance on the current rank.
Output data group to contain the result of a given stat aggregator on the dataRepository....
real64 m_totalUncompactedPoreVolume
total region uncompacted pore volume (not necessarily output, useful for weighting cell pressure data...
real64 m_averageTemperature
average region temperature (numerator value before postAggregateCompute())
real64 m_averagePressure
average region pressure (numerator value before postAggregateCompute())
RegionStatistics(string const &targetName, dataRepository::Group *const parent, string_view setName, bool statsOutputEnabled)
Construct a new Region Statistics object.
Reponsible of computing physical statistics over the grid, registering the result in the data reposit...
StatsAggregator(dataRepository::DataContext const &ownerDataContext, dataRepository::Group &meshBodies, bool statsOutputEnabled)
Construct a new Stats Aggregator object.
void enableRegionStatisticsAggregation(string_array const &setNames=string_array())
Enable the computation of region statistics, initialize data structure to collect them....
stdVector< string > string_array
A 1-dimensional array of geos::string types.
Definition: DataTypes.hpp:361
GEOS_GLOBALINDEX_TYPE globalIndex
Global index type (for indexing objects across MPI partitions).
Definition: DataTypes.hpp:87
double real64
64-bit floating point type.
Definition: DataTypes.hpp:98
std::string_view string_view
String type.
Definition: DataTypes.hpp:93