PlasCom2  1.0
XPACC Multi-physics simluation application
pcpp::util Namespace Reference

Functions

int SubIntervalFromStream (std::istream &inStream, const pcpp::IndexIntervalType &inInterval, pcpp::IndexIntervalType &subInterval)
 
std::deque< size_t > PrimeFactors (size_t inNumber)
 
int SimplePartitionInterval (const pcpp::IndexIntervalType &inInterval, std::vector< bool > partDirection, int partID, int numPart, pcpp::IndexIntervalType &outInterval, std::vector< int > &numPartitions)
 Multi-dimensional interval partitioning (non-MPI) More...
 
int Part1D (const size_t iStart, const size_t iEnd, const size_t numPart, const size_t partIndex, size_t &partStart, size_t &partEnd)
 Extract a sub-interval of a 1-dimensional integer interval. More...
 
int PartitionCartesianExtent (const pcpp::IndexIntervalType &globalExtent, const std::vector< int > &cartDims, const std::vector< int > &cartCoords, pcpp::IndexIntervalType &partExtent, std::ostream &messageStream)
 Get local sub-interval of an n-dimensional integer interval. More...
 
int PartitionCartesianInterval (const pcpp::IndexIntervalType &globalInterval, const std::vector< int > &cartDims, const std::vector< int > &cartCoords, pcpp::IndexIntervalType &partInterval, std::ostream &messageStream)
 Get local sub-interval of an n-dimensional integer interval. More...
 
void CollapseInterval (size_t &xSize, size_t &ySize, size_t &zSize, const pcpp::IndexIntervalType &inInterval, pcpp::IndexIntervalType &outInterval)
 
std::vector< pcpp::IndexIntervalTypeUniqueUnion (const std::vector< pcpp::IndexIntervalType > &intervalSet)
 
template<typename BufferDataType >
void TransferBufferData (size_t numPoints, int numComponents, size_t sourceSize, size_t targetSize, const size_t *sourceIndices, const size_t *targetIndices, const BufferDataType *sourceBuffer, BufferDataType *targetBuffer)
 Transfer data from a sized source buffer to a (different) sized target buffer. More...
 
template<typename BufferDataType >
int CopyInterval (const std::vector< size_t > &sourceSizes, const pcpp::IndexIntervalType &sourceInterval, const BufferDataType *sourceBuffer, const std::vector< size_t > &destSizes, const pcpp::IndexIntervalType &destInterval, BufferDataType *destData)
 
int RecursiveReadConfiguration (const std::string &currentPath, std::istream &inStream, pcpp::ConfigType &plascomConfig, std::ostream &messageStream, const std::string="")
 
int ProcessConfigurationFile (const std::string &configFileName, pcpp::ConfigType &plascomConfig, pcpp::CommunicatorType &globalCommunicator, std::ostream &messageStream)
 Populate a configuration object from file in parallel. More...
 
int ProcessConfigurationRestart (const std::string &restartFileName, pcpp::ConfigType &inConfig, pcpp::CommunicatorType &configCommunicator, std::ostream &messageStream)
 Populate a configuration object from an HDF5 restart file. More...
 
std::string ConfigKey (const std::string &configName, const std::string &keyName)
 
pcpp::ConfigType GetSubConfig (const std::string &configName, const pcpp::ConfigType &plascomConfig)
 
int ConfigureDataDictionary (pcpp::ConfigType &inConfig, const std::string &dictName, pcpp::field::metadataset &dataDictionary, std::ostream &messageStream)
 
pcpp::field::metadataset ExtractDictionary (const pcpp::field::metadataset &dataDictionary, const char loc)
 
pcpp::ConfigType ExtractConfigParams (const fixtures::ConfigurationType &inConfig, const std::string &configName)
 
template<typename GridType >
int ConfigureGrid (pcpp::ConfigType &inConfig, const std::string &gridKey, pcpp::CommunicatorType &inCommunicator, GridType &inGrid, std::ostream &messageStream)
 
template<typename BufferDataType >
void ReportBufferStats (std::ostream &outStream, size_t numValues, const BufferDataType *dataBuffer)
 
int ErrorMetrics (int numDim, size_t numPoints, double *dataBuffer, double *normData, size_t &maxErrLocation)
 
std::string GetConfigName (const std::string &configKey, int nameDepth=0)
 
void GetFieldMetaFromTokens (pcpp::field::metadata &metaData, std::vector< std::string > &inTokens)
 

Function Documentation

◆ CollapseInterval()

void CollapseInterval ( size_t &  xSize,
size_t &  ySize,
size_t &  zSize,
const pcpp::IndexIntervalType inInterval,
pcpp::IndexIntervalType outInterval 
)

Definition at line 93 of file PCPPIntervalUtils.C.

◆ ConfigKey()

◆ ConfigureDataDictionary()

int ConfigureDataDictionary ( pcpp::ConfigType inConfig,
const std::string &  dictName,
pcpp::field::metadataset dataDictionary,
std::ostream &  messageStream 
)

Definition at line 129 of file PCPPUtil.C.

References metadataset::AddField(), metadata::dsize, GetFieldMetaFromTokens(), Parameters::GetValue(), Parameters::GetValueVector(), Parameters::IsSet(), metadata::loc, and metadata::ncomp.

Referenced by base< GridT, StateT >::ConfigureDomain().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ConfigureGrid()

int pcpp::util::ConfigureGrid ( pcpp::ConfigType inConfig,
const std::string &  gridKey,
pcpp::CommunicatorType inCommunicator,
GridType &  inGrid,
std::ostream &  messageStream 
)

Definition at line 47 of file PCPPUtil.H.

◆ CopyInterval()

int pcpp::util::CopyInterval ( const std::vector< size_t > &  sourceSizes,
const pcpp::IndexIntervalType sourceInterval,
const BufferDataType *  sourceBuffer,
const std::vector< size_t > &  destSizes,
const pcpp::IndexIntervalType destInterval,
BufferDataType *  destData 
)

Definition at line 75 of file PCPPIntervalUtils.H.

References sizeextent::GetFlatIndices(), sizeextent::InitSimple(), and sizeextent::NNodes().

Here is the call graph for this function:

◆ ErrorMetrics()

int ErrorMetrics ( int  numDim,
size_t  numPoints,
double *  dataBuffer,
double *  normData,
size_t &  maxErrLocation 
)

Definition at line 23 of file PCPPUtil.C.

References numPoints.

Referenced by plascom2::util::PC2Compare(), and ReportBufferStats().

Here is the caller graph for this function:

◆ ExtractConfigParams()

pcpp::ConfigType ExtractConfigParams ( const fixtures::ConfigurationType inConfig,
const std::string &  configName 
)

Definition at line 70 of file PCPPUtil.C.

References x.

Referenced by base< GridT, StateT >::ConfigureDomain(), and application::ConfigureDomains().

Here is the caller graph for this function:

◆ ExtractDictionary()

pcpp::field::metadataset ExtractDictionary ( const pcpp::field::metadataset dataDictionary,
const char  loc 
)

Definition at line 9 of file PCPPUtil.C.

References metadata::loc.

◆ GetConfigName()

std::string pcpp::util::GetConfigName ( const std::string &  configKey,
int  nameDepth = 0 
)

Definition at line 57 of file PCPPUtil.C.

References x.

Referenced by RecursiveReadConfiguration().

Here is the caller graph for this function:

◆ GetFieldMetaFromTokens()

void pcpp::util::GetFieldMetaFromTokens ( pcpp::field::metadata metaData,
std::vector< std::string > &  inTokens 
)

Definition at line 113 of file PCPPUtil.C.

References metadata::dsize, metadata::loc, metadata::ncomp, and metadata::unit.

Referenced by ConfigureDataDictionary().

Here is the caller graph for this function:

◆ GetSubConfig()

pcpp::ConfigType GetSubConfig ( const std::string &  configName,
const pcpp::ConfigType plascomConfig 
)

Definition at line 90 of file PCPPUtil.C.

References x.

Referenced by TestPlasCom2Output().

Here is the caller graph for this function:

◆ Part1D()

int Part1D ( const size_t  iStart,
const size_t  iEnd,
const size_t  numPart,
const size_t  partIndex,
size_t &  partStart,
size_t &  partEnd 
)

Extract a sub-interval of a 1-dimensional integer interval.

Parameters
iStart- start of the interval
iEnd- end of the interval
numPart- number of sub-interval
partIndex- which sub-interval to return
partStart- return start of sub-interval
partEnd- return end of sub-interval
Returns
- 0 on success, 1 otherwise
Test:
TestHaloParallel
Note
Only fails if interval is too small to partition into specified number of sub-intervals

Definition at line 283 of file PCPPIntervalUtils.C.

Referenced by PartitionCartesianExtent(), PartitionCartesianInterval(), and SimplePartitionInterval().

Here is the caller graph for this function:

◆ PartitionCartesianExtent()

int PartitionCartesianExtent ( const pcpp::IndexIntervalType globalExtent,
const std::vector< int > &  cartDims,
const std::vector< int > &  cartCoords,
pcpp::IndexIntervalType partExtent,
std::ostream &  messageStream 
)

Get local sub-interval of an n-dimensional integer interval.

This function takes an n-dimensional integer interval, partitions it into a number of equal subintervals according to the input parameters and returns the local sub-interval.

Parameters
globalExtent- ref to extent to be partitioned
cartDims- ref to vector indicating number of partitions in each dimension
cartCoords- ref to vector indicating local Cartesian coordinates (of local process)
partExtent- returned extent of local partition (i.e. local partition interval)
messageStream- ref to std::ostream for any messages generated by the routine
Returns
0 on success, non-zero otherwise
Test:
TestHaloParallel

Definition at line 317 of file PCPPIntervalUtils.C.

References sizeextent::Init(), sizeextent::ND(), and Part1D().

Referenced by TestHaloParallel(), TestHaloPeriodic(), TestHDF5HyperSlab(), and TestHDF5Read2DBlockStructuredGrid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PartitionCartesianInterval()

int PartitionCartesianInterval ( const pcpp::IndexIntervalType globalInterval,
const std::vector< int > &  cartDims,
const std::vector< int > &  cartCoords,
pcpp::IndexIntervalType partInterval,
std::ostream &  messageStream 
)

Get local sub-interval of an n-dimensional integer interval.

This function takes an n-dimensional integer interval, partitions it into a number of equal subintervals according to the input parameters and returns the local sub-interval.

Parameters
globalInterval- ref to interval to be partitioned
cartDims- ref to vector indicating number of partitions in each dimension
cartCoords- ref to vector indicating local Cartesian coordinates (of local process)
partInterval- returned interval of local partition (i.e. local partition interval)
messageStream- ref to std::ostream for any messages generated by the routine
Returns
0 on success, non-zero otherwise
Test:

TestHaloParallel

TestGrid_PUBS_IntegratedHalo

Definition at line 372 of file PCPPIntervalUtils.C.

References sizeextent::Init(), sizeextent::ND(), and Part1D().

Referenced by application::ConfigureSimulation(), testfixtures::CreateSimulationFixtures(), euler::util::CreateSimulationFixtures(), euler::util::InitializeSimulationFixtures(), parallel_blockstructured::ParallelSetup(), and TestGrid_PBS_IntegratedHalo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrimeFactors()

std::deque< size_t > PrimeFactors ( size_t  inNumber)

Definition at line 132 of file PCPPIntervalUtils.C.

Referenced by pcpp::comm::SetupCartesianTopology(), and SimplePartitionInterval().

Here is the caller graph for this function:

◆ ProcessConfigurationFile()

int ProcessConfigurationFile ( const std::string &  configFileName,
pcpp::ConfigType plascomConfig,
pcpp::CommunicatorType globalCommunicator,
std::ostream &  messageStream 
)

Populate a configuration object from file in parallel.

This function populates a configuration object from input configuration file in PlasComCM format, or CodeletX format by reading the configuration object on processor 0, and BCast it out to the rest of the processors.

Parameters
configFileNamestd::string ref indicating the path to the configuration file
plascomConfigpcpp::ConfigType ref to configuration data object to populate
globalCommunicatorpcpp::CommunicatorType ref to parallel communication object
messageStreamstd::ostream reference to output stream for any status messages
Returns
0 on success, error code otherwise

Definition at line 326 of file PCPPUtil.C.

References CommunicatorObject::BroadCast(), CommunicatorObject::Check(), CommunicatorObject::Rank(), RecursiveReadConfiguration(), ix::util::RenewStream(), CommunicatorObject::SetExit(), and x.

Referenced by application::ConfigureApplication(), TestPCPPHDF5Write(), TestPlasCom2Input(), and TestPlasCom2Output().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessConfigurationRestart()

int ProcessConfigurationRestart ( const std::string &  restartFileName,
pcpp::ConfigType inConfig,
pcpp::CommunicatorType configCommunicator,
std::ostream &  messageStream 
)

Populate a configuration object from an HDF5 restart file.

This function populates a configuration object from input HDF5 file in PlasCom2 format by reading the configuration object on processor 0, and BCast it out to the rest of the processors.

Parameters
restartFileNamestd::string ref indicating the path to the configuration file
plascomConfigpcpp::ConfigType ref to configuration data object to populate
globalCommunicatorpcpp::CommunicatorType ref to parallel communication object
messageStreamstd::ostream reference to output stream for any status messages
Returns
0 on success, error code otherwise

Definition at line 396 of file PCPPUtil.C.

References base::AttributeExists(), CommunicatorObject::BroadCast(), CommunicatorObject::Check(), base::Close(), ix::sys::FILEEXISTS(), base::Open(), CommunicatorObject::Rank(), base::ReadAttribute(), Parameters::ReadFromStream(), and CommunicatorObject::SetErr().

Referenced by application::ConfigureApplication(), and TestPlasCom2Input().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RecursiveReadConfiguration()

int RecursiveReadConfiguration ( const std::string &  currentPath,
std::istream &  inStream,
pcpp::ConfigType plascomConfig,
std::ostream &  messageStream,
const std::string  inName = "" 
)

Definition at line 203 of file PCPPUtil.C.

References ix::sys::FILEEXISTS(), GetConfigName(), KeyValuePairObj< K, V >::Key(), KeyValuePairObj< K, V >::Value(), and x.

Referenced by ProcessConfigurationFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReportBufferStats()

void pcpp::util::ReportBufferStats ( std::ostream &  outStream,
size_t  numValues,
const BufferDataType *  dataBuffer 
)

Definition at line 55 of file PCPPUtil.H.

References ErrorMetrics(), and numPoints.

Referenced by base::Report().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SimplePartitionInterval()

int SimplePartitionInterval ( const pcpp::IndexIntervalType inInterval,
std::vector< bool >  partDirection,
int  partID,
int  numPart,
pcpp::IndexIntervalType outInterval,
std::vector< int > &  numPartitions 
)

Multi-dimensional interval partitioning (non-MPI)

Definition at line 151 of file PCPPIntervalUtils.C.

References Part1D(), and PrimeFactors().

Referenced by parallel_blockstructured::SetupThreads(), TestHaloThreaded(), and TestVarious().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SubIntervalFromStream()

int SubIntervalFromStream ( std::istream &  inStream,
const pcpp::IndexIntervalType inInterval,
pcpp::IndexIntervalType subInterval 
)

Definition at line 7 of file PCPPIntervalUtils.C.

References sizeextent::Copy(), and sizeextent::Overlap().

Here is the call graph for this function:

◆ TransferBufferData()

void pcpp::util::TransferBufferData ( size_t  numPoints,
int  numComponents,
size_t  sourceSize,
size_t  targetSize,
const size_t *  sourceIndices,
const size_t *  targetIndices,
const BufferDataType *  sourceBuffer,
BufferDataType *  targetBuffer 
)

Transfer data from a sized source buffer to a (different) sized target buffer.

Template function to transfer numPoints data items of specified type from sourceBuffer with total size indicated by sourceSize into targetBuffer with size indicated by targetSize. The shapes of the data to be transferred from/to is encapsulated by the sourceIndices/targetIndices flat arrays of source and target indices, resp. If numComponents > 1, then the sourceSize, and targetSize arguments are interpreted as blockSizes and a number of blocks = numComponents will be transferred.

Definition at line 53 of file PCPPIntervalUtils.H.

References numComponents, and numPoints.

◆ UniqueUnion()

std::vector< pcpp::IndexIntervalType > UniqueUnion ( const std::vector< pcpp::IndexIntervalType > &  intervalSet)

Definition at line 75 of file PCPPIntervalUtils.C.

References sizeextent::Overlap().

Here is the call graph for this function: