DAMARIS  1.11.0
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends
damaris::Variable Class Reference

#include <Variable.hpp>

Inheritance diagram for damaris::Variable:
[legend]
Collaboration diagram for damaris::Variable:
[legend]

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< LayoutGetLayout () const
 
virtual std::shared_ptr< BufferGetBuffer ()
 
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< BlockAllocate (int source, int iteration, int bid, bool blocking=false)
 
std::shared_ptr< BlockAllocateFixedSize (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< BlockAllocateAligned (int source, int iteration, int bid, bool blocking=false)
 
std::shared_ptr< BlockRetrieve (int source, int iteration, int bid, const Handle &h, size_t size)
 
std::shared_ptr< BlockRetrieve (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< BlockGetBlock (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< MeshGetMesh ()
 
bool IsNodal ()
 
bool IsZonal ()
 
int GetVectorSizeFromBlock (std::shared_ptr< Block > b, int dim)
 
- Public Member Functions inherited from damaris::Configurable< model::Variable >
 Configurable (const model::Variable &mdl)
 
const model::VariableGetModel () 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< Layoutlayout_
 
std::shared_ptr< Bufferbuffer_
 
std::map< int32_t, std::vector< int64_t > > positions_
 

Friends

class Deleter< Variable >
 
class Manager< Variable >
 

Detailed Description

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.

Member Typedef Documentation

◆ iterator

typedef BlockIndex::iterator damaris::Variable::iterator

Constructor & Destructor Documentation

◆ Variable()

damaris::Variable::Variable ( const model::Variable mdl)
inlineprivate

Constructor.

Parameters
[in]mdl: model from which to initialize the Variable.
Here is the caller graph for this function:

◆ ~Variable()

virtual damaris::Variable::~Variable ( )
inlineprivatevirtual

Destructor.

Member Function Documentation

◆ Allocate()

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.

Parameters
[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.
Here is the call graph for this function:

◆ AllocateAligned()

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.

See also
Allocate
Here is the call graph for this function:

◆ AllocateFixedSize()

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.

See also
Allocate
Here is the call graph for this function:

◆ AttachBlock()

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.

Parameters
[in]block: block to attach.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Begin()

iterator damaris::Variable::Begin ( )
inline

Returns an iterator over the set of Blocks.

◆ ClearAll()

void damaris::Variable::ClearAll ( )

Remove all blocks from the Variable.

◆ ClearId()

void damaris::Variable::ClearId ( int  id)

Clear all blocks with a given id.

Parameters
[in]id: domain id to clear.

◆ ClearIteration()

void damaris::Variable::ClearIteration ( int  iteration)

Clear all blocks with a given iteration.

Parameters
[in]iteration: iteration to clear.

◆ ClearSource()

void damaris::Variable::ClearSource ( int  source)

Clear all blocks with a given source.

Parameters
[in]source: source to clear.

◆ ClearUpToIteration()

void damaris::Variable::ClearUpToIteration ( int  iteration)

Clear all blocks with an iteration less or equal to the given.

Parameters
[in]iteration: maximum iteration to clean.

◆ CountLocalBlocks()

int damaris::Variable::CountLocalBlocks ( int  iteration) const

Counts the number of blocks stored locally on this process for a given iteration.

Parameters
[in]iteration: iteration for which to count the blocks.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CountTotalBlocks()

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

Parameters
[in]iteration: iteration for which to count the blocks.
Here is the call graph for this function:

◆ CountTotalBlocksExact()

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

Parameters
[in]iteration: iteration for which to count the blocks.
Here is the call graph for this function:

◆ DetachBlock()

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.

Parameters
[in]block: block to detach.

◆ End()

iterator damaris::Variable::End ( )
inline

Returns an iterator pointing to the end of the set of Blocks.

◆ GetBlock()

std::shared_ptr< Block > damaris::Variable::GetBlock ( int  source,
int  iteration,
int  id 
) const

Get a Block given a source, iteration and id.

Parameters
[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.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetBlocksById()

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.

Parameters
[in]id: domain id of the blocks to get.
[out]begin: begin iterator.
[out]end: end iterator.

◆ GetBlocksByIteration()

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.

Parameters
[in]iteration: iteration of the blocks to get.
[out]begin: begin iterator.
[out]end: end iterator.

◆ GetBlocksBySource()

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.

Parameters
[in]source: source of the blocks to get.
[out]begin: begin iterator.
[out]end: end iterator.

◆ GetBuffer()

virtual std::shared_ptr<Buffer> damaris::Variable::GetBuffer ( )
inlinevirtual

Returns the buffer associated to the variable.

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

◆ GetDescription()

std::string damaris::Variable::GetDescription ( ) const
inline

Returns the description of the variable.

Here is the call graph for this function:

◆ GetID()

virtual int damaris::Variable::GetID ( ) const
inlinevirtual

Returns the id of the variable within the VariableManager.

◆ GetIDRange()

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)

Parameters
[out]lowest: lowest id number (inclusive).
[out]biggest: biggest id number (inclusive).

◆ GetIterationRange()

bool damaris::Variable::GetIterationRange ( int &  lowest,
int &  biggest 
) const

Gets the range of iterations stored.

Parameters
[out]lowest: lowest iteration number (inclusive).
[out]biggest: biggest iteration number (inclusive).

◆ GetLayout()

virtual std::shared_ptr<Layout> damaris::Variable::GetLayout ( ) const
inlinevirtual

Returns the Layout of this variable.

Here is the caller graph for this function:

◆ GetMesh()

std::shared_ptr<Mesh> damaris::Variable::GetMesh ( )
inline

Static method to return the mesh associated to the variable.

Here is the call graph for this function:

◆ GetModelCommentVariable()

virtual const std::string& damaris::Variable::GetModelCommentVariable ( ) const
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.

Here is the call graph for this function:

◆ GetModelName()

virtual const std::string& damaris::Variable::GetModelName ( ) const
inlinevirtual

Returns the name of the variable.

Here is the call graph for this function:

◆ GetModelRefVariable()

virtual const std::string& damaris::Variable::GetModelRefVariable ( ) const
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.

Here is the call graph for this function:

◆ GetModelSelectFileVariable()

virtual const std::string& damaris::Variable::GetModelSelectFileVariable ( ) const
inlinevirtual

Returns the string value of the XML <Variable ... > attribute select-file="var_name", which specifies a variable name that should be used to order data as it is placed in the file in the HDF5Store class (in collective mode only).

Here is the call graph for this function:

◆ GetModelSelectMemVariable()

virtual const std::string& damaris::Variable::GetModelSelectMemVariable ( ) const
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).

Here is the call graph for this function:

◆ GetModelSelectSubsetVariable()

virtual const std::string& damaris::Variable::GetModelSelectSubsetVariable ( ) const
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)

Here is the call graph for this function:

◆ GetName()

virtual const std::string& damaris::Variable::GetName ( ) const
inlinevirtual

Returns the absolute name of the variable.

Here is the caller graph for this function:

◆ GetPositions()

virtual std::vector<int64_t> damaris::Variable::GetPositions ( int32_t  block)
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.

Parameters
[in]block: domain id.
Returns
The vector of lower bounds of the position of the data. relative to the global dimensions (if set in the layout). It should have the same dimension as the dimension of the layout.

◆ GetSourceRange()

bool damaris::Variable::GetSourceRange ( int &  lowest,
int &  biggest 
) const

Gets the range of sources (Damaris client processes) stored on the current server.

Parameters
[out]lowest: lowest source number (inclusive).
[out]biggest: biggest source number (inclusive).

◆ GetUnit()

std::string damaris::Variable::GetUnit ( ) const
inline

Returns the unit of the variable.

Here is the call graph for this function:

◆ GetVectorSizeFromBlock()

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.

Here is the call graph for this function:

◆ IsNodal()

bool damaris::Variable::IsNodal ( )
inline

Determines if the variable elements is stored on the points of the mesh or not.

Here is the call graph for this function:

◆ IsTimeVarying()

bool damaris::Variable::IsTimeVarying ( ) const
inline

Returns true if the variable is time-varying.

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

◆ IsZonal()

bool damaris::Variable::IsZonal ( )
inline

Determines if the variable elements is stored on the cells of the mesh or not.

Here is the call graph for this function:

◆ New() [1/2]

template<typename SUPER >
static std::shared_ptr<SUPER> damaris::Variable::New ( const model::Variable mdl)
inlinestatic

Static method to build a new Variable. Constructs a std::shared_ptr.

Parameters
[in]mdl: model from which to build the Variable.
Here is the call graph for this function:

◆ New() [2/2]

template<typename SUPER >
static std::shared_ptr<SUPER> damaris::Variable::New ( const model::Variable mdl,
const std::string &  name 
)
inlinestatic

Static method to build a new Variable. Constructs a std::shared_ptr.

Parameters
[in]mdl: model from which to build the Variable.
[in]name: name for the object.
Here is the call graph for this function:

◆ Retrieve() [1/2]

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.

Parameters
[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.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Retrieve() [2/2]

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.

Parameters
[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.
Here is the call graph for this function:

◆ SetPosition()

virtual int damaris::Variable::SetPosition ( int32_t  block,
const std::vector< int64_t > &  p 
)
inlinevirtual

Sets the position of a domain.

Parameters
[in]block: domain id.
[in]p: vector of lower bounds. Should have the same dimension as the dimension of the layout.
Here is the call graph for this function:

Friends And Related Function Documentation

◆ Deleter< Variable >

friend class Deleter< Variable >
friend

◆ Manager< Variable >

friend class Manager< Variable >
friend

Field Documentation

◆ blocks_

BlockIndex damaris::Variable::blocks_
private

Blocks container.

◆ buffer_

std::shared_ptr<Buffer> damaris::Variable::buffer_
private

Buffer in which to allocate blocks of the variable.

◆ id_

int damaris::Variable::id_
private

ID of the Variable as initialized by the VariableManager.

◆ layout_

std::shared_ptr<Layout> damaris::Variable::layout_
private

Layout of the variable. Note: Only valid on client side variables as damaris_parameter_set may alter dimensions which server size variables are not updated with. Use the Block extents properties on a server side operation.

◆ name_

std::string damaris::Variable::name_
private

name of the Variable. (full name, including the groups)

◆ positions_

std::map<int32_t, std::vector<int64_t> > damaris::Variable::positions_
private

Positions of each domain within a global description of the Variable.


The documentation for this class was generated from the following files: