DAMARIS
1.11.0
|
#include <Variable.hpp>
Public Types | |
typedef BlockIndex::iterator | iterator |
Public Member Functions | |
virtual const std::string & | GetModelName () const |
virtual const std::string & | GetModelSelectMemVariable () const |
virtual const std::string & | GetModelSelectFileVariable () const |
virtual const std::string & | GetModelRefVariable () const |
virtual const std::string & | GetModelSelectSubsetVariable () const |
virtual const std::string & | GetModelCommentVariable () const |
virtual const std::string & | GetName () const |
virtual int | GetID () const |
std::string | GetDescription () const |
std::string | GetUnit () const |
bool | IsTimeVarying () const |
virtual std::shared_ptr< Layout > | GetLayout () const |
virtual std::shared_ptr< Buffer > | GetBuffer () |
virtual int | SetPosition (int32_t block, const std::vector< int64_t > &p) |
virtual std::vector< int64_t > | GetPositions (int32_t block) |
bool | AttachBlock (const std::shared_ptr< Block > &block) |
bool | DetachBlock (const std::shared_ptr< Block > &block) |
std::shared_ptr< Block > | Allocate (int source, int iteration, int bid, bool blocking=false) |
std::shared_ptr< Block > | AllocateFixedSize (int source, int iteration, int bid, const std::vector< int64_t > &lbounds, const std::vector< int64_t > &ubounds, const std::vector< int64_t > &gbounds, const std::vector< size_t > &ghosts, bool blocking=false) |
std::shared_ptr< Block > | AllocateAligned (int source, int iteration, int bid, bool blocking=false) |
std::shared_ptr< Block > | Retrieve (int source, int iteration, int bid, const Handle &h, size_t size) |
std::shared_ptr< Block > | Retrieve (int source, int iteration, int bid, const std::vector< int64_t > &lbounds, const std::vector< int64_t > &ubounds, const std::vector< int64_t > &gbounds, const std::vector< size_t > &ghosts, const Handle &h) |
void | ClearAll () |
void | ClearIteration (int iteration) |
void | ClearUpToIteration (int iteration) |
void | ClearSource (int source) |
void | ClearId (int id) |
int | CountLocalBlocks (int iteration) const |
int | CountTotalBlocks (int iteration) const |
int | CountTotalBlocksExact (int iteration) const |
std::shared_ptr< Block > | GetBlock (int source, int iteration, int id) const |
iterator | Begin () |
iterator | End () |
void | GetBlocksByIteration (int iteration, BlocksByIteration::iterator &begin, BlocksByIteration::iterator &end) const |
void | GetBlocksBySource (int source, BlocksBySource::iterator &begin, BlocksBySource::iterator &end) const |
void | GetBlocksById (int bid, BlocksById::iterator &begin, BlocksById::iterator &end) const |
bool | GetIterationRange (int &lowest, int &biggest) const |
bool | GetSourceRange (int &lowest, int &biggest) const |
bool | GetIDRange (int &lowest, int &biggest) const |
std::shared_ptr< Mesh > | GetMesh () |
bool | IsNodal () |
bool | IsZonal () |
int | GetVectorSizeFromBlock (std::shared_ptr< Block > b, int dim) |
![]() | |
Configurable (const model::Variable &mdl) | |
const model::Variable & | GetModel () const |
Static Public Member Functions | |
template<typename SUPER > | |
static std::shared_ptr< SUPER > | New (const model::Variable &mdl, const std::string &name) |
template<typename SUPER > | |
static std::shared_ptr< SUPER > | New (const model::Variable &mdl) |
Private Member Functions | |
Variable (const model::Variable &mdl) | |
virtual | ~Variable () |
Private Attributes | |
int | id_ |
std::string | name_ |
BlockIndex | blocks_ |
std::shared_ptr< Layout > | layout_ |
std::shared_ptr< Buffer > | buffer_ |
std::map< int32_t, std::vector< int64_t > > | positions_ |
Friends | |
class | Deleter< Variable > |
class | Manager< Variable > |
The Variable object is used for describing a variable within a metadata structure. It holds an index of Blocks and additional informations. A Variable is identified by a name and an ID. The ID is either -1 if the Variable has been created manually by the user, or positive or nul integer if it has been created by the VariableManager.
typedef BlockIndex::iterator damaris::Variable::iterator |
|
inlineprivate |
Constructor.
[in] | mdl | : model from which to initialize the Variable. |
|
inlineprivatevirtual |
Destructor.
std::shared_ptr< Block > damaris::Variable::Allocate | ( | int | source, |
int | iteration, | ||
int | bid, | ||
bool | blocking = false |
||
) |
Creates a Block, allocates memory for it in the Variable's buffer and return the allocated block. The block is also attached to the Variable.
[in] | source | : source that creates the block. |
[in] | iteration | : iteration at which the block is created. |
[in] | bid | : domain id. |
[in] | blocking | : whether or not to block if the memory is full. |
std::shared_ptr< Block > damaris::Variable::AllocateAligned | ( | int | source, |
int | iteration, | ||
int | bid, | ||
bool | blocking = false |
||
) |
Same as Allocate but tries to allocate a memory region that is aligned with the memory page size.
std::shared_ptr< Block > damaris::Variable::AllocateFixedSize | ( | int | source, |
int | iteration, | ||
int | bid, | ||
const std::vector< int64_t > & | lbounds, | ||
const std::vector< int64_t > & | ubounds, | ||
const std::vector< int64_t > & | gbounds, | ||
const std::vector< size_t > & | ghosts, | ||
bool | blocking = false |
||
) |
Same as Allocate but tries to allocate a block that has fixed size (not according to layout). Intended use for dedicated nodes.
bool damaris::Variable::AttachBlock | ( | const std::shared_ptr< Block > & | block | ) |
Attach a Block already created. Since only a Variable can create a Block, either this function will be used internally, or it can be used externally to transfer a block from a Variable to another.
[in] | block | : block to attach. |
|
inline |
Returns an iterator over the set of Blocks.
void damaris::Variable::ClearAll | ( | ) |
Remove all blocks from the Variable.
void damaris::Variable::ClearId | ( | int | id | ) |
Clear all blocks with a given id.
[in] | id | : domain id to clear. |
void damaris::Variable::ClearIteration | ( | int | iteration | ) |
Clear all blocks with a given iteration.
[in] | iteration | : iteration to clear. |
void damaris::Variable::ClearSource | ( | int | source | ) |
Clear all blocks with a given source.
[in] | source | : source to clear. |
void damaris::Variable::ClearUpToIteration | ( | int | iteration | ) |
Clear all blocks with an iteration less or equal to the given.
[in] | iteration | : maximum iteration to clean. |
int damaris::Variable::CountLocalBlocks | ( | int | iteration | ) | const |
Counts the number of blocks stored locally on this process for a given iteration.
[in] | iteration | : iteration for which to count the blocks. |
int damaris::Variable::CountTotalBlocks | ( | int | iteration | ) | const |
Gives the number of blocks existing globally for the specified iteration. Currently this is an estimation only and may not reflect the true state of the system
[in] | iteration | : iteration for which to count the blocks. |
int damaris::Variable::CountTotalBlocksExact | ( | int | iteration | ) | const |
Gives the number of blocks existing globally for the specified iteration. This value should be correct even for asymmetric numbers of
[in] | iteration | : iteration for which to count the blocks. |
bool damaris::Variable::DetachBlock | ( | const std::shared_ptr< Block > & | block | ) |
Removes a block from the Variable. Will NOT delete the data until all instances of the std::shared_ptr have disappeared and all the instances of dataspace.
[in] | block | : block to detach. |
|
inline |
Returns an iterator pointing to the end of the set of Blocks.
std::shared_ptr< Block > damaris::Variable::GetBlock | ( | int | source, |
int | iteration, | ||
int | id | ||
) | const |
Get a Block given a source, iteration and id.
[in] | source | : source (Damaris client process) of the block to find. |
[in] | iteration | : iteration of the block to find. |
[in] | id | : domain id of the block to find. |
void damaris::Variable::GetBlocksById | ( | int | bid, |
BlocksById::iterator & | begin, | ||
BlocksById::iterator & | end | ||
) | const |
For the current Damaris server, get begin and end iterators over a block with domain=id, if it is present.
[in] | id | : domain id of the blocks to get. |
[out] | begin | : begin iterator. |
[out] | end | : end iterator. |
void damaris::Variable::GetBlocksByIteration | ( | int | iteration, |
BlocksByIteration::iterator & | begin, | ||
BlocksByIteration::iterator & | end | ||
) | const |
For a given iteration, get begin and end iterators over all chunks of this iteration.
[in] | iteration | : iteration of the blocks to get. |
[out] | begin | : begin iterator. |
[out] | end | : end iterator. |
void damaris::Variable::GetBlocksBySource | ( | int | source, |
BlocksBySource::iterator & | begin, | ||
BlocksBySource::iterator & | end | ||
) | const |
For a given source (Damaris client process), get begin and end iterators over all chunks of this given source.
[in] | source | : source of the blocks to get. |
[out] | begin | : begin iterator. |
[out] | end | : end iterator. |
|
inlinevirtual |
Returns the buffer associated to the variable.
|
inline |
Returns the description of the variable.
|
inlinevirtual |
Returns the id of the variable within the VariableManager.
bool damaris::Variable::GetIDRange | ( | int & | lowest, |
int & | biggest | ||
) | const |
Gets the range of blocks on the server. Requires XML domain to be set > 1 if client wants to write multiple blocks in the same iteration. (see TestVariableIDBlocks for an example). The difference between them is not the total number of blocks on a server. It is the range of blocks, with blocks able to come from different sources (Damaris clients), and iterations (i.e. id is not unique - see BlockIndex.hpp)
[out] | lowest | : lowest id number (inclusive). |
[out] | biggest | : biggest id number (inclusive). |
bool damaris::Variable::GetIterationRange | ( | int & | lowest, |
int & | biggest | ||
) | const |
Gets the range of iterations stored.
[out] | lowest | : lowest iteration number (inclusive). |
[out] | biggest | : biggest iteration number (inclusive). |
|
inlinevirtual |
|
inline |
Static method to return the mesh associated to the variable.
|
inlinevirtual |
Returns the string value of the Variable comment attribute e.g. comment="Some interesting information about this variable", which will be saved as an HDF5 "attribute" to the variable i.e. as some meta-data abount the variable data being saved.
|
inlinevirtual |
Returns the name of the variable.
|
inlinevirtual |
Returns the string value of the XML <Variable ... > attribute ref="var_name", which specifies a variable name that should be used in-place of the current variable i.e. The current variable is used for getting information that is used to apply to another variable (denoted by ref). The current variable does not need data. Useful for subsetting data using HDF5Store, without needing a copy of the data.
|
inlinevirtual |
|
inlinevirtual |
Returns the string value of the XML <Variable ... > attribute select-mem="var_name", which specifies a variable name that should be used select the data from the memory buffer (the Varaible's memory)to order data in the HDF5Store class (in collective mode only).
|
inlinevirtual |
Returns the string value of the XML <Variable ... > attribute select-subset="var_name", which specifies a variable name that should be used to specify the shape of the subset of data to output to HDF5 (in collective mode only)
|
inlinevirtual |
Returns the absolute name of the variable.
|
inlinevirtual |
Gets the current positions of a domain as a std::vector<int64_t>. Each value indicates the offset in the particular dimension into the global size of the dataset.
[in] | block | : domain id. |
bool damaris::Variable::GetSourceRange | ( | int & | lowest, |
int & | biggest | ||
) | const |
Gets the range of sources (Damaris client processes) stored on the current server.
[out] | lowest | : lowest source number (inclusive). |
[out] | biggest | : biggest source number (inclusive). |
|
inline |
Returns the unit of the variable.
int damaris::Variable::GetVectorSizeFromBlock | ( | std::shared_ptr< Block > | b, |
int | dim | ||
) |
Obtain the size of the (final) dimension of a Variable that is specified as a "vector" type. Otherwise return the dimension as 1. N.B. This is an assumed data layout for a type="vector" type variable. The Variable should be specified with a multi-dimensional Layout dimension i.e. as something like: <layout name="zonal_vect" type="double" dimensions="x,y,z,3"> And the variable that uses the Layout, has type="vector" e.g. <variable name="my_vector" layout="zonal_vect" type="vector" .. />
This function would return 3 as the vector size.
This value is used by Paraview vtkDataSet::SetNumberOfComponents() for passing multi-dimensional data to paraview, such as for Velocity field data that has 3 components (vx,vy,vz) per zonal spatial location.
|
inline |
Determines if the variable elements is stored on the points of the mesh or not.
|
inline |
Returns true if the variable is time-varying.
|
inline |
Determines if the variable elements is stored on the cells of the mesh or not.
|
inlinestatic |
|
inlinestatic |
std::shared_ptr< Block > damaris::Variable::Retrieve | ( | int | source, |
int | iteration, | ||
int | bid, | ||
const Handle & | h, | ||
size_t | size | ||
) |
Re-build a Block from a handle and known source, iteration, domain id and data size. The block will be added to the Variable. Works only if there is not yet any block associated to these metadata. The block doesn't own the data. To give data ownership to the block, call b->GainDataOwnership() on the returned block.
[in] | source | : source that created the block. |
[in] | iteration | : iteration at which the block was created. |
[in] | bid | : domain id of the block. |
[in] | h | : handle to get the address in memory. |
[in] | size | : size of the data to retrieve. |
std::shared_ptr< Block > damaris::Variable::Retrieve | ( | int | source, |
int | iteration, | ||
int | bid, | ||
const std::vector< int64_t > & | lbounds, | ||
const std::vector< int64_t > & | ubounds, | ||
const std::vector< int64_t > & | gbounds, | ||
const std::vector< size_t > & | ghosts, | ||
const Handle & | h | ||
) |
Re-build a Block from a handle and known source, iteration, domain id and upper/lower bounds. Works only if there is not yet any block associated to these metadata. The block doesn't own the data. To give data ownership to the block, call b->GainDataOwnership() on the returned block.
[in] | source | : source that created the block. |
[in] | iteration | : iteration at which the block was created. |
[in] | bid | : domain id of the block. |
[in] | lbounds | : lower bounds of the block. |
[in] | ubounds | : upper bounds of the block. |
[in] | gbounds | : global bounds of the block. |
[in] | ghosts | : ghost zones of the block. |
[in] | h | : handle to get the address in memory. |
|
inlinevirtual |
Sets the position of a domain.
[in] | block | : domain id. |
[in] | p | : vector of lower bounds. Should have the same dimension as the dimension of the layout. |
|
private |
Blocks container.
|
private |
Buffer in which to allocate blocks of the variable.
|
private |
ID of the Variable as initialized by the VariableManager.
|
private |
|
private |
name of the Variable. (full name, including the groups)
|
private |
Positions of each domain within a global description of the Variable.