TINC
Toolkit for Interactive Computation
|
The DataPool class gathers data files across directories that span a parameter space. More...
#include <DataPool.hpp>
Public Member Functions | |
DataPool (std::string id, ParameterSpace &ps, std::string sliceCacheDir=std::string()) | |
DataPool (ParameterSpace &ps, std::string sliceCacheDir=std::string()) | |
void | registerDataFile (std::string filename, std::string dimensionInFile) |
registerDataFile More... | |
std::map< std::string, std::string > | getRegisteredDataFiles () |
get registered data files More... | |
void | clearRegisteredFiles () |
Clear list of registered data files. More... | |
ParameterSpace & | getParameterSpace () |
Get parameter space that controls this data pool. More... | |
std::string | createDataSlice (std::string field, std::string sliceDimension) |
Extract a slice of data. More... | |
std::string | createDataSlice (std::string field, std::vector< std::string > sliceDimensions) |
Extract a slice of data. More... | |
std::vector< std::string > | getCurrentFiles () |
get list of full path to current files in datapool More... | |
size_t | readDataSlice (std::string field, std::string sliceDimension, void *data, size_t maxLen) |
readDataSlice More... | |
std::string | getCacheDirectory () |
Get directory for data slices. More... | |
void | setCacheDirectory (std::string cacheDirectory, al::Socket *src=nullptr) |
set directory to be used to store slices More... | |
std::vector< std::string > | listFields (bool verifyConsistency=false) |
list fields in datapool More... | |
const DataPoolType | getType () |
type of the data pool. Set on constructor, can't change. More... | |
std::string | getId () |
get this object's id More... | |
void | setId (std::string id) |
set this object's id More... | |
std::string | getDocumentation () const |
void | setDocumentation (const std::string &documentation) |
Public Attributes | |
std::function< std::vector< std::string >std::vector< std::string >)> | getAllPaths |
std::function< void(al::Socket *src)> | modified = [](al::Socket * ) {} |
Protected Member Functions | |
virtual std::vector< std::string > | listFieldInFile (std::string file)=0 |
virtual bool | getFieldFromFile (std::string field, std::string file, size_t dimensionInFileIndex, void *data)=0 |
virtual bool | getFieldFromFile (std::string field, std::string file, void *data, size_t length)=0 |
std::string | getFileType (std::string file) |
Protected Attributes | |
DataPoolType | mType {DataPoolType::DATAPOOL_USER} |
std::string | mId |
std::string | mDocumentation |
The DataPool class gathers data files across directories that span a parameter space.
The parameter space and its current values determine where the files in the data pool are found. This class is useful to manage data files that are the result of parameter sweeps, generating the same type of file in different directories, where each directory represents a sample of the parameter space.
Definition at line 55 of file DataPool.hpp.
tinc::DataPool::DataPool | ( | std::string | id, |
ParameterSpace & | ps, | ||
std::string | sliceCacheDir = std::string() |
||
) |
tinc::DataPool::DataPool | ( | ParameterSpace & | ps, |
std::string | sliceCacheDir = std::string() |
||
) |
void tinc::DataPool::clearRegisteredFiles | ( | ) |
Clear list of registered data files.
std::string tinc::DataPool::createDataSlice | ( | std::string | field, |
std::string | sliceDimension | ||
) |
Extract a slice of data.
field | name of the field to extract |
sliceDimension | dimension that can change across the slice |
The slice will be created as a NetCDF4 file with a single variable called "data" that spans a dimension "values". The result will be a one dimensional slice containing the values of the "field" across all values for "sliceDimension" that must be registered in the parameter space.
std::string tinc::DataPool::createDataSlice | ( | std::string | field, |
std::vector< std::string > | sliceDimensions | ||
) |
Extract a slice of data.
field | name of the field to extract |
sliceDimensions | dimensions that can change across the slice |
The output is a multidimensional slice of the data for the "field" values. The number of dimensions of the result is the size of sliceDimensions
|
inline |
std::vector<std::string> tinc::DataPool::getCurrentFiles | ( | ) |
get list of full path to current files in datapool
Both root path and current run path are prepended to the file names.
|
inherited |
|
protectedpure virtual |
Implemented in tinc::DataPoolNetCDF, and tinc::DataPoolJson.
|
protectedpure virtual |
Implemented in tinc::DataPoolNetCDF, and tinc::DataPoolJson.
|
protected |
|
inherited |
get this object's id
|
inline |
Get parameter space that controls this data pool.
Definition at line 91 of file DataPool.hpp.
std::map<std::string, std::string> tinc::DataPool::getRegisteredDataFiles | ( | ) |
get registered data files
The dimension name in the output names the dimension whose changes have produced the values in the fields in the file
|
inline |
type of the data pool. Set on constructor, can't change.
Definition at line 171 of file DataPool.hpp.
|
protectedpure virtual |
Implemented in tinc::DataPoolNetCDF, and tinc::DataPoolJson.
std::vector<std::string> tinc::DataPool::listFields | ( | bool | verifyConsistency = false | ) |
list fields in datapool
verifyConsistency | verify that all files in datapool are consistent |
size_t tinc::DataPool::readDataSlice | ( | std::string | field, |
std::string | sliceDimension, | ||
void * | data, | ||
size_t | maxLen | ||
) |
readDataSlice
field | |
sliceDimension | dimension that can vary in the slice |
data | |
maxLen |
void tinc::DataPool::registerDataFile | ( | std::string | filename, |
std::string | dimensionInFile | ||
) |
registerDataFile
filename | |
dimensionInFile | This filename must be relative to mParameterSpace->generateRelativeRunPath. It should be present in all data paths for the parameter space. |
void tinc::DataPool::setCacheDirectory | ( | std::string | cacheDirectory, |
al::Socket * | src = nullptr |
||
) |
set directory to be used to store slices
cacheDirectory | |
src | socket that originated this request (nullptr if local) |
|
inherited |
|
inherited |
set this object's id
std::function<std::vector<std::string>std::vector<std::string>)> tinc::DataPool::getAllPaths |
Replace this function when the parameter space runningPaths() function is not adequate.
Definition at line 163 of file DataPool.hpp.
|
protectedinherited |
Definition at line 69 of file IdObject.hpp.
|
protectedinherited |
Definition at line 68 of file IdObject.hpp.
|
inherited |
Definition at line 65 of file IdObject.hpp.
|
protected |
Definition at line 181 of file DataPool.hpp.