1 #ifndef __PCPP_UTIL_H__ 2 #define __PCPP_UTIL_H__ 17 std::ostream &messageStream,
const std::string=
"");
22 std::ostream &messageStream);
27 std::ostream &messageStream);
29 std::string
ConfigKey(
const std::string &configName,
const std::string &keyName);
34 const std::string &dictName,
36 std::ostream &messageStream);
42 const std::string &configName);
46 template<
typename Gr
idType>
49 std::ostream &messageStream)
54 template<
typename BufferDataType>
55 void ReportBufferStats(std::ostream &outStream,
size_t numValues,
const BufferDataType *dataBuffer)
61 size_t minLocation = 0;
62 size_t maxLocation = 0;
63 double bufferMean = 0;
66 BufferDataType minValue = std::numeric_limits<BufferDataType>::max();
67 BufferDataType maxValue = -std::numeric_limits<BufferDataType>::max();
69 for(
size_t iValue = 0;iValue < numValues;iValue++){
70 if(dataBuffer[iValue] < minValue){
71 minValue = dataBuffer[iValue];
74 if(dataBuffer[iValue] > maxValue){
75 maxValue = dataBuffer[iValue];
78 bufferMean += dataBuffer[iValue];
79 bufferDev += dataBuffer[iValue]*dataBuffer[iValue];
82 bufferMean /= numValues;
83 bufferDev /= numValues;
84 bufferDev -= (bufferMean*bufferMean);
85 bufferDev = std::sqrt(std::abs(bufferDev));
87 outStream <<
"Min: " << minValue <<
" @ " << minLocation << std::endl
88 <<
"Max: " << maxValue <<
" @ " << maxLocation << std::endl
89 <<
"Mean: " << bufferMean <<
" +/- " << bufferDev << std::endl;
95 double *normData,
size_t &maxErrLocation);
void const size_t * numPoints
int ProcessConfigurationFile(const std::string &configFileName, pcpp::ConfigType &plascomConfig, pcpp::CommunicatorType &globalCommunicator, std::ostream &messageStream)
Populate a configuration object from file in parallel.
pcpp::field::metadataset ExtractDictionary(const pcpp::field::metadataset &dataDictionary, const char loc)
int ProcessConfigurationRestart(const std::string &restartFileName, pcpp::ConfigType &inConfig, pcpp::CommunicatorType &configCommunicator, std::ostream &messageStream)
Populate a configuration object from an HDF5 restart file.
int ErrorMetrics(int numDim, size_t numPoints, double *dataBuffer, double *normData, size_t &maxErrLocation)
pcpp::ConfigType ExtractConfigParams(const fixtures::ConfigurationType &inConfig, const std::string &configName)
Main encapsulation of MPI.
std::string ConfigKey(const std::string &configName, const std::string &keyName)
int ConfigureGrid(pcpp::ConfigType &inConfig, const std::string &gridKey, pcpp::CommunicatorType &inCommunicator, GridType &inGrid, std::ostream &messageStream)
int RecursiveReadConfiguration(const std::string ¤tPath, std::istream &inStream, pcpp::ConfigType &plascomConfig, std::ostream &messageStream, const std::string="")
pcpp::ConfigType GetSubConfig(const std::string &configName, const pcpp::ConfigType &plascomConfig)
void ReportBufferStats(std::ostream &outStream, size_t numValues, const BufferDataType *dataBuffer)
int ConfigureDataDictionary(pcpp::ConfigType &inConfig, const std::string &dictName, pcpp::field::metadataset &dataDictionary, std::ostream &messageStream)