openPMD-api
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
openPMD::RecordComponent Class Reference
Inheritance diagram for openPMD::RecordComponent:
Inheritance graph
[legend]
Collaboration diagram for openPMD::RecordComponent:
Collaboration graph
[legend]

Public Types

enum  Allocation { USER, API, AUTO }
 

Public Member Functions

RecordComponentsetUnitSI (double)
 
RecordComponentresetDataset (Dataset)
 
uint8_t getDimensionality () const
 
Extent getExtent () const
 
template<typename T >
RecordComponentmakeConstant (T)
 Create a dataset with regular extent and constant value. More...
 
template<typename T >
RecordComponentmakeEmpty (uint8_t dimensions)
 Create a dataset with zero extent in each dimension. More...
 
RecordComponentmakeEmpty (Datatype dt, uint8_t dimensions)
 Non-template overload of RecordComponent::makeEmpty(). More...
 
bool empty () const
 Returns true if this is an empty record component. More...
 
template<typename T >
std::shared_ptr< TloadChunk (Offset={0u}, Extent={-1u}, double targetUnitSI=std::numeric_limits< double >::quiet_NaN())
 Load and allocate a chunk of data. More...
 
template<typename T >
void loadChunk (std::shared_ptr< T >, Offset, Extent, double targetUnitSI=std::numeric_limits< double >::quiet_NaN())
 Load a chunk of data into pre-allocated memory. More...
 
template<typename T >
void storeChunk (std::shared_ptr< T >, Offset, Extent)
 
template<typename T_ContiguousContainer >
std::enable_if< traits::IsContiguousContainer< T_ContiguousContainer >::value >::type storeChunk (T_ContiguousContainer &, Offset={0u}, Extent={-1u})
 
- Public Member Functions inherited from openPMD::BaseRecordComponent
double unitSI () const
 
BaseRecordComponentresetDatatype (Datatype)
 
Datatype getDatatype () const
 
bool constant () const
 Returns true if this is a constant record component. More...
 
ChunkTable availableChunks ()
 Get data chunks that are available to be loaded from the backend. More...
 
- Public Member Functions inherited from openPMD::Attributable
 Attributable (Attributable const &)
 
 Attributable (Attributable &&)=delete
 
Attributableoperator= (Attributable const &)
 
Attributableoperator= (Attributable &&)=delete
 
Attribute getAttribute (std::string const &key) const
 Retrieve value of Attribute stored with provided key. More...
 
bool deleteAttribute (std::string const &key)
 Remove Attribute of provided value both logically and physically. More...
 
std::vector< std::string > attributes () const
 List all currently stored Attributes' keys. More...
 
size_t numAttributes () const
 Count all currently stored Attributes. More...
 
bool containsAttribute (std::string const &key) const
 Check whether am Attribute with a given key exists. More...
 
std::string comment () const
 Retrieve a user-supplied comment associated with the object. More...
 
AttributablesetComment (std::string const &comment)
 Populate Attribute corresponding to a comment with the user-supplied comment. More...
 
template<typename T >
bool setAttribute (std::string const &key, T const &value)
 Populate Attribute of provided name with provided value. More...
 
bool setAttribute (std::string const &key, char const value[])
 

Static Public Attributes

static constexpr char const *const SCALAR = "\vScalar"
 

Protected Member Functions

void readBase ()
 
- Protected Member Functions inherited from openPMD::Attributable
void flushAttributes ()
 
void readAttributes ()
 
template<typename T >
T readFloatingpoint (std::string const &key) const
 Retrieve the value of a floating point Attribute of user-defined precision with ensured type-safety. More...
 
template<typename T >
std::vector< TreadVectorFloatingpoint (std::string const &key) const
 Retrieve a vector of values of a floating point Attributes of user-defined precision with ensured type-safety. More...
 
bool & dirty () const
 
bool & written () const
 

Protected Attributes

std::shared_ptr< std::queue< IOTask > > m_chunks
 
std::shared_ptr< Attributem_constantValue
 
std::shared_ptr< bool > m_isEmpty = std::make_shared< bool >( false )
 
std::shared_ptr< bool > hasBeenRead = std::make_shared< bool >( false )
 Make sure to parse a RecordComponent only once.
 
- Protected Attributes inherited from openPMD::BaseRecordComponent
std::shared_ptr< Datasetm_dataset
 
std::shared_ptr< bool > m_isConstant
 
- Protected Attributes inherited from openPMD::Attributable
std::shared_ptr< Writablem_writable
 
AbstractFilePositionabstractFilePosition
 
AbstractIOHandlerIOHandler
 
Writableparent
 

Friends

template<typename T , typename T_key , typename T_container >
class Container
 
class Iteration
 
class ParticleSpecies
 
template<typename T_elem >
class BaseRecord
 
class Record
 
class Mesh
 

Member Function Documentation

◆ empty()

bool openPMD::RecordComponent::empty ( ) const

Returns true if this is an empty record component.

An empty record component has a defined dimensionality but zero extent and no value(s) stored in it.

Returns
true if an empty record component

◆ loadChunk() [1/2]

template<typename T >
std::shared_ptr< T > openPMD::RecordComponent::loadChunk ( Offset  o = {0u},
Extent  e = {-1u},
double  targetUnitSI = std::numeric_limits< double >::quiet_NaN() 
)
inline

Load and allocate a chunk of data.

Set offset to {0u} and extent to {-1u} for full selection.

If offset is non-zero and extent is {-1u} the leftover extent in the record component will be selected.

◆ loadChunk() [2/2]

template<typename T >
void openPMD::RecordComponent::loadChunk ( std::shared_ptr< T data,
Offset  o,
Extent  e,
double  targetUnitSI = std::numeric_limits< double >::quiet_NaN() 
)
inline

Load a chunk of data into pre-allocated memory.

shared_ptr for data must be pre-allocated, contiguous and large enough for extent

Set offset to {0u} and extent to {-1u} for full selection.

If offset is non-zero and extent is {-1u} the leftover extent in the record component will be selected.

◆ makeConstant()

template<typename T >
RecordComponent & openPMD::RecordComponent::makeConstant ( T  value)
inline

Create a dataset with regular extent and constant value.

In a constant record component, the value for each date in its extent is the same. Implemented by storing only a constant value as meta-data.

Template Parameters
Ttype of the stored value
Returns
A reference to this RecordComponent.

◆ makeEmpty() [1/2]

template<typename T >
RecordComponent & openPMD::RecordComponent::makeEmpty ( uint8_t  dimensions)
inline

Create a dataset with zero extent in each dimension.

Implemented by creating a constant record component with a dummy value (default constructor of the respective datatype).

Parameters
dimensionsThe number of dimensions. Must be greater than zero.
Returns
A reference to this RecordComponent.

◆ makeEmpty() [2/2]

RecordComponent & openPMD::RecordComponent::makeEmpty ( Datatype  dt,
uint8_t  dimensions 
)

Non-template overload of RecordComponent::makeEmpty().

Uses the passed openPMD datatype to determine the template parameter.

Parameters
dtThe datatype of which to create an empty dataset.
dimensionsThe dimensionality of the dataset.
Returns
RecordComponent&

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