openPMD-api
Public Types | Public Member Functions | Friends | List of all members
openPMD::Mesh Class Reference

Container for N-dimensional, homogeneous Records. More...

#include <Mesh.hpp>

Inheritance diagram for openPMD::Mesh:
Inheritance graph
[legend]
Collaboration diagram for openPMD::Mesh:
Collaboration graph
[legend]

Public Types

enum  Geometry {
  cartesian, thetaMode, cylindrical, spherical,
  other
}
 Enumerated datatype for the geometry of the mesh. More...
 
enum  DataOrder : char { C = 'C', F = 'F' }
 Enumerated datatype for the memory layout of N-dimensional data.
 
- Public Types inherited from openPMD::BaseRecord< MeshRecordComponent >
using key_type = typename Container< MeshRecordComponent >::key_type
 
using mapped_type = typename Container< MeshRecordComponent >::mapped_type
 
using value_type = typename Container< MeshRecordComponent >::value_type
 
using size_type = typename Container< MeshRecordComponent >::size_type
 
using difference_type = typename Container< MeshRecordComponent >::difference_type
 
using allocator_type = typename Container< MeshRecordComponent >::allocator_type
 
using reference = typename Container< MeshRecordComponent >::reference
 
using const_reference = typename Container< MeshRecordComponent >::const_reference
 
using pointer = typename Container< MeshRecordComponent >::pointer
 
using const_pointer = typename Container< MeshRecordComponent >::const_pointer
 
using iterator = typename Container< MeshRecordComponent >::iterator
 
using const_iterator = typename Container< MeshRecordComponent >::const_iterator
 
- Public Types inherited from openPMD::Container< MeshRecordComponent >
using key_type = typename InternalContainer::key_type
 
using mapped_type = typename InternalContainer::mapped_type
 
using value_type = typename InternalContainer::value_type
 
using size_type = typename InternalContainer::size_type
 
using difference_type = typename InternalContainer::difference_type
 
using allocator_type = typename InternalContainer::allocator_type
 
using reference = typename InternalContainer::reference
 
using const_reference = typename InternalContainer::const_reference
 
using pointer = typename InternalContainer::pointer
 
using const_pointer = typename InternalContainer::const_pointer
 
using iterator = typename InternalContainer::iterator
 
using const_iterator = typename InternalContainer::const_iterator
 

Public Member Functions

 Mesh (Mesh const &)=default
 
Meshoperator= (Mesh const &)=default
 
Geometry geometry () const
 
std::string geometryString () const
 
MeshsetGeometry (Geometry g)
 Set the geometry of the mesh of the mesh record. More...
 
MeshsetGeometry (std::string geometry)
 Set the geometry of the mesh of the mesh record. More...
 
std::string geometryParameters () const
 
MeshsetGeometryParameters (std::string const &geometryParameters)
 Set additional parameters for the geometry, separated by a. More...
 
DataOrder dataOrder () const
 
MeshsetDataOrder (DataOrder dor)
 Set the memory layout of N-dimensional data. More...
 
std::vector< std::string > axisLabels () const
 
MeshsetAxisLabels (std::vector< std::string > const &axisLabels)
 Set the ordering of the labels for the Mesh::geometry of the mesh. More...
 
template<typename T >
std::vector< T > gridSpacing () const
 
template<typename T , typename = std::enable_if_t<std::is_floating_point< T >::value>>
MeshsetGridSpacing (std::vector< T > const &gridSpacing)
 Set the spacing of the grid points along each dimension (in the units of the simulation). More...
 
std::vector< double > gridGlobalOffset () const
 
MeshsetGridGlobalOffset (std::vector< double > const &gridGlobalOffset)
 Set the start of the current domain of the simulation (position of the beginning of the first cell) in simulation units. More...
 
double gridUnitSI () const
 
MeshsetGridUnitSI (double gridUnitSI)
 Set the unit-conversion factor to multiply each value in Mesh::gridSpacing and Mesh::gridGlobalOffset, in order to convert from simulation units to SI units. More...
 
MeshsetUnitDimension (std::map< UnitDimension, double > const &unitDimension)
 Set the powers of the 7 base measures characterizing the record's unit in SI. More...
 
template<typename T >
timeOffset () const
 
template<typename T , typename = std::enable_if_t<std::is_floating_point< T >::value>>
MeshsetTimeOffset (T timeOffset)
 Set the offset between the time at which this record is defined and the Iteration::time attribute of the Series::basePath level. More...
 
- Public Member Functions inherited from openPMD::BaseRecord< MeshRecordComponent >
 BaseRecord (BaseRecord const &b)
 
BaseRecordoperator= (BaseRecord const &b)
 
mapped_type & operator[] (key_type const &key) override
 
mapped_type & operator[] (key_type &&key) override
 
BaseRecord< RecordComponent >::mapped_type & operator[] (std::string &&key)
 
size_type erase (key_type const &key) override
 
iterator erase (iterator res) override
 
std::array< double, 7 > unitDimension () const
 Return the physical dimension (quantity) of a record. More...
 
bool scalar () const
 Returns true if this record only contains a single component. More...
 
- Public Member Functions inherited from openPMD::Container< MeshRecordComponent >
 Container (Container const &)=default
 
iterator begin () noexcept
 
const_iterator begin () const noexcept
 
const_iterator cbegin () const noexcept
 
iterator end () noexcept
 
const_iterator end () const noexcept
 
const_iterator cend () const noexcept
 
bool empty () const noexcept
 
size_type size () const noexcept
 
void clear ()
 Remove all objects from the container and (if written) from disk. More...
 
std::pair< iterator, bool > insert (value_type const &value)
 
std::pair< iterator, bool > insert (P &&value)
 
iterator insert (const_iterator hint, value_type const &value)
 
iterator insert (const_iterator hint, P &&value)
 
void insert (InputIt first, InputIt last)
 
void insert (std::initializer_list< value_type > ilist)
 
void swap (Container &other)
 
mapped_type & at (key_type const &key)
 
mapped_type const & at (key_type const &key) const
 
virtual mapped_type & operator[] (key_type const &key)
 Access the value that is mapped to a key equivalent to key, creating it if such key does not exist already. More...
 
virtual mapped_type & operator[] (key_type &&key)
 Access the value that is mapped to a key equivalent to key, creating it if such key does not exist already. More...
 
iterator find (key_type const &key)
 
const_iterator find (key_type const &key) const
 
size_type count (key_type const &key) const
 This returns either 1 if the key is found in the container of 0 if not. More...
 
bool contains (key_type const &key) const
 Checks if there is an element with a key equivalent to an exiting key in the container. More...
 
virtual size_type erase (key_type const &key)
 Remove a single element from the container and (if written) from disk. More...
 
virtual iterator erase (iterator res)
 
auto emplace (Args &&... args) -> decltype(InternalContainer().emplace(std::forward< Args >(args)...))
 
- Public Member Functions inherited from openPMD::AttributableInterface
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...
 
AttributableInterfacesetComment (std::string const &comment)
 Populate Attribute corresponding to a comment with the user-supplied comment. More...
 
void seriesFlush ()
 Flush the corresponding Series object. More...
 
MyPath myPath () const
 The path to this object within its containing Series. More...
 
template<typename T >
bool setAttribute (std::string const &key, T value)
 Populate Attribute of provided name with provided value. More...
 
bool setAttribute (std::string const &key, char const value[])
 

Friends

class Container< Mesh >
 
class Iteration
 

Additional Inherited Members

- Protected Types inherited from openPMD::Container< MeshRecordComponent >
using InternalContainer = std::map< std::string, MeshRecordComponent >
 
- Protected Types inherited from openPMD::AttributableInterface
enum  ReadMode { IgnoreExisting, OverrideExisting, FullyReread }
 
- Protected Member Functions inherited from openPMD::BaseRecord< MeshRecordComponent >
void readBase ()
 
- Protected Member Functions inherited from openPMD::Container< MeshRecordComponent >
void clear_unchecked ()
 
EraseStaleEntries eraseStaleEntries ()
 
- Protected Member Functions inherited from openPMD::AttributableInterface
 AttributableInterface (internal::AttributableData *)
 
template<typename T >
 AttributableInterface (T *attri)
 
const internal::SeriesInternalretrieveSeries () const
 
internal::SeriesInternalretrieveSeries ()
 
void seriesFlush (FlushLevel)
 
void flushAttributes ()
 
void readAttributes (ReadMode)
 
template<typename 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< T > readVectorFloatingpoint (std::string const &key) const
 Retrieve a vector of values of a floating point Attributes of user-defined precision with ensured type-safety. More...
 
AbstractIOHandlerIOHandler ()
 
const AbstractIOHandlerIOHandler () const
 
Writable *& parent ()
 
const Writableparent () const
 
Writablewritable ()
 
const Writablewritable () const
 
internal::AttributableDataget ()
 
const internal::AttributableDataget () const
 
bool dirty () const
 
bool & dirty ()
 
bool written () const
 
bool & written ()
 
const IterationcontainingIteration () const
 Returns the corresponding Iteration. More...
 
IterationcontainingIteration ()
 
- Protected Attributes inherited from openPMD::BaseRecord< MeshRecordComponent >
std::shared_ptr< bool > m_containsScalar
 
- Protected Attributes inherited from openPMD::Container< MeshRecordComponent >
std::shared_ptr< InternalContainer > m_container
 
- Protected Attributes inherited from openPMD::LegacyAttributable
std::shared_ptr< internal::AttributableDatam_attributableData
 
- Protected Attributes inherited from openPMD::AttributableInterface
internal::AttributableDatam_attri = nullptr
 

Detailed Description

Container for N-dimensional, homogeneous Records.

See also
https://github.com/openPMD/openPMD-standard/blob/latest/STANDARD.md#mesh-based-records

Member Enumeration Documentation

◆ Geometry

Enumerated datatype for the geometry of the mesh.

Note
If the default values do not suit your application, you can set arbitrary Geometry with MeshRecordComponent::setAttribute("geometry", VALUE). Note that this might break openPMD compliance and tool support.

Member Function Documentation

◆ axisLabels()

std::vector< std::string > openPMD::Mesh::axisLabels ( ) const
Returns
Ordering of the labels for the Mesh::geometry of the mesh.

◆ dataOrder()

Mesh::DataOrder openPMD::Mesh::dataOrder ( ) const
Returns
Memory layout of N-dimensional data.

◆ geometry()

Mesh::Geometry openPMD::Mesh::geometry ( ) const
Returns
Enum representing the geometry of the mesh of the mesh record.

◆ geometryParameters()

std::string openPMD::Mesh::geometryParameters ( ) const
Exceptions
no_such_attribute_errorIf Mesh::geometry is not Mesh::Geometry::thetaMode.
Returns
String representing additional parameters for the geometry, separated by a
;
.

◆ geometryString()

std::string openPMD::Mesh::geometryString ( ) const
Returns
String representing the geometry of the mesh of the mesh record.

◆ gridGlobalOffset()

std::vector< double > openPMD::Mesh::gridGlobalOffset ( ) const
Returns
Vector of (double) representing the start of the current domain of the simulation (position of the beginning of the first cell) in simulation units.

◆ gridSpacing()

template<typename T >
std::vector< T > openPMD::Mesh::gridSpacing
inline
Template Parameters
TFloating point type of user-selected precision (e.g. float, double).
Returns
vector of T representing the spacing of the grid points along each dimension (in the units of the simulation).

◆ gridUnitSI()

double openPMD::Mesh::gridUnitSI ( ) const
Returns
Unit-conversion factor to multiply each value in Mesh::gridSpacing and Mesh::gridGlobalOffset, in order to convert from simulation units to SI units.

◆ setAxisLabels()

Mesh & openPMD::Mesh::setAxisLabels ( std::vector< std::string > const &  axisLabels)

Set the ordering of the labels for the Mesh::geometry of the mesh.

Note
Dimensionality constraint is not verified by API.
Parameters
axisLabelsvector containing N (string) elements, where N is the number of dimensions in the simulation.
Returns
Reference to modified mesh.

◆ setDataOrder()

Mesh & openPMD::Mesh::setDataOrder ( Mesh::DataOrder  dor)

Set the memory layout of N-dimensional data.

Parameters
dormemory layout of N-dimensional data.
Returns
Reference to modified mesh.

◆ setGeometry() [1/2]

Mesh & openPMD::Mesh::setGeometry ( Mesh::Geometry  g)

Set the geometry of the mesh of the mesh record.

Parameters
ggeometry of the mesh of the mesh record.
Returns
Reference to modified mesh.

◆ setGeometry() [2/2]

Mesh & openPMD::Mesh::setGeometry ( std::string  geometry)

Set the geometry of the mesh of the mesh record.

If the geometry is unknown to the openPMD-api, the string is prefixed with "other:" automatically unless the prefix is already present.

Parameters
geometrygeometry of the mesh of the mesh record, as string
Returns
Reference to modified mesh.

◆ setGeometryParameters()

Mesh & openPMD::Mesh::setGeometryParameters ( std::string const &  geometryParameters)

Set additional parameters for the geometry, separated by a.

;

.

Note
Separation constraint is not verified by API.
Parameters
geometryParametersadditional parameters for the geometry, separated by a
;
.
Returns
Reference to modified mesh.

◆ setGridGlobalOffset()

Mesh & openPMD::Mesh::setGridGlobalOffset ( std::vector< double > const &  gridGlobalOffset)

Set the start of the current domain of the simulation (position of the beginning of the first cell) in simulation units.

Note
Dimensionality constraint is not verified by API.
Parameters
gridGlobalOffsetvector containing N (double) elements, where N is the number of dimensions in the simulation.
Returns
Reference to modified mesh.

◆ setGridSpacing()

template<typename T , typename >
template Mesh & openPMD::Mesh::setGridSpacing ( std::vector< T > const &  gridSpacing)

Set the spacing of the grid points along each dimension (in the units of the simulation).

Note
Dimensionality constraint is not verified by API.
Template Parameters
TFloating point type of user-selected precision (e.g. float, double).
Parameters
gridSpacingvector containing N (T) elements, where N is the number of dimensions in the simulation.
Returns
Reference to modified mesh.

◆ setGridUnitSI()

Mesh & openPMD::Mesh::setGridUnitSI ( double  gridUnitSI)

Set the unit-conversion factor to multiply each value in Mesh::gridSpacing and Mesh::gridGlobalOffset, in order to convert from simulation units to SI units.

Parameters
gridUnitSIunit-conversion factor to multiply each value in Mesh::gridSpacing and Mesh::gridGlobalOffset, in order to convert from simulation units to SI units.
Returns
Reference to modified mesh.

◆ setTimeOffset()

template<typename T , typename >
template Mesh & openPMD::Mesh::setTimeOffset ( timeOffset)

Set the offset between the time at which this record is defined and the Iteration::time attribute of the Series::basePath level.

Note
This should be written in the same unit system as Iteration::time.
Template Parameters
TFloating point type of user-selected precision (e.g. float, double).
Parameters
timeOffsetOffset between the time at which this record is defined and the Iteration::time attribute of the Series::basePath level.
Returns
Reference to modified mesh.

◆ setUnitDimension()

Mesh & openPMD::Mesh::setUnitDimension ( std::map< UnitDimension, double > const &  unitDimension)

Set the powers of the 7 base measures characterizing the record's unit in SI.

Parameters
unitDimensionmap containing pairs of (UnitDimension, double) that represent the power of the particular base.
Returns
Reference to modified mesh.

◆ timeOffset()

template<typename T >
T openPMD::Mesh::timeOffset
inline
Template Parameters
TFloating point type of user-selected precision (e.g. float, double).
Returns
Offset between the time at which this record is defined and the Iteration::time attribute of the Series::basePath level.

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