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 
71 #ifndef SRC_CORECOMPONENTS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASESTATISTICSAGGREGATOR_HPP_
72 #define SRC_CORECOMPONENTS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASESTATISTICSAGGREGATOR_HPP_
73 
75 
76 namespace geos
77 {
78 
79 class SinglePhaseBase;
80 
81 namespace singlePhaseStatistics
82 {
83 class StatsAggregator;
84 class RegionStatistics;
85 }
86 
87 template<>
88 struct StatsAggregatorTraits< singlePhaseStatistics::StatsAggregator >
89 {
92 };
93 
94 namespace singlePhaseStatistics
95 {
96 
103 {
104 public:
105 
108 
115 
120 
127 
130 
135 
136  // TODO? -> split to struct PressureStats...MassStats:
137  // - optional computation of each stats
138  // - VKS for struct name ("pressureStats"..."massStats")
139  // - current RegionStatistics struct bits
140 
147  RegionStatistics( string const & targetName,
148  dataRepository::Group * const parent,
149  bool statsOutputEnabled );
150 
151  RegionStatistics( RegionStatistics && ) = default;
152 
153 };
154 
161 class StatsAggregator : public StatsAggregatorBase< StatsAggregator >
162 {
163 public:
164 
166 
175  StatsAggregator( dataRepository::DataContext const & ownerDataContext,
176  dataRepository::Group & meshBodies,
177  bool statsOutputEnabled );
178 
185 
186  // template implementations
188 
189  void initStats( RegionStatistics & stats, real64 time ) const;
190  void computeSubRegionRankStats( CellElementSubRegion & subRegion, RegionStatistics & subRegionStats ) const;
191  void aggregateStats( RegionStatistics & stats, RegionStatistics const & other ) const;
192  void mpiAggregateStats( RegionStatistics & stats ) const;
193  void postAggregateStats( RegionStatistics & stats );
194 
196 
197 };
198 
199 } /* namespace singlePhaseStatistics */
200 
201 } /* namespace geos */
202 
203 #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 computeSubRegionRankStats(CellElementSubRegion &subRegion, StatsGroupType &subRegionStats) const
Compute the rank-local stats for the given sub-region and store the results in the given stats group.
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 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....
RegionStatistics(string const &targetName, dataRepository::Group *const parent, bool statsOutputEnabled)
Construct a new Region Statistics object.
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())
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()
Enable the computation of region statistics, initialize data structure to collect them....
double real64
64-bit floating point type.
Definition: DataTypes.hpp:98