Feel++ 0.111.0-preview.14
Finite Element Embedded Library in C++
Feel::detail::ExportFieldSet< MeshType, N > Class Template Reference

Time-neutral scalar/vector/tensor export storage and conversion. More...

+ Collaboration diagram for Feel::detail::ExportFieldSet< MeshType, N >:

Classes

struct  SpaceCache
 Reusable scalar conversion spaces, independent of field lifetime. Local references avoid repeated manager lookups within a sequence or snapshot. More...
 

Mesh, conversion-space, field-schema and iterator types

using mesh_type = MeshType
 
using mesh_ptrtype = std::shared_ptr< mesh_type >
 
using size_type = typename mesh_type::size_type
 
using scalar_p0_space_type = Pdh_type< MeshType, 0 >
 
using scalar_p1_space_type = Pch_type< MeshType, N >
 
using scalar_p0_space_ptrtype = std::shared_ptr< scalar_p0_space_type >
 
using scalar_p1_space_ptrtype = std::shared_ptr< scalar_p1_space_type >
 
using element_scalar_type = typename scalar_p0_space_type::element_type
 
using nodal_scalar_type = typename scalar_p1_space_type::element_type
 
using nodal_scalar_ptrtype = std::shared_ptr< nodal_scalar_type >
 
using element_scalar_ptrtype = std::shared_ptr< element_scalar_type >
 
using nodal_field_type = std::pair< FunctionSpaceType, std::vector< std::vector< nodal_scalar_ptrtype > > >
 
using element_field_type = std::pair< FunctionSpaceType, std::vector< std::vector< element_scalar_ptrtype > > >
 
using map_scalar_type = std::map< std::string, std::pair< scalar_type, bool > >
 
using map_complex_type = std::map< std::string, std::pair< complex_type, bool > >
 
using map_nodal_type = std::map< std::string, nodal_field_type >
 
using map_element_type = std::map< std::string, element_field_type >
 
using scalar_iterator = typename map_scalar_type::iterator
 
using scalar_const_iterator = typename map_scalar_type::const_iterator
 
using complex_iterator = typename map_complex_type::iterator
 
using complex_const_iterator = typename map_complex_type::const_iterator
 
using nodal_iterator = typename map_nodal_type::iterator
 
using nodal_const_iterator = typename map_nodal_type::const_iterator
 
using element_iterator = typename map_element_type::iterator
 
using element_const_iterator = typename map_element_type::const_iterator
 
using variant_representation_arg_type = std::variant< std::string, std::set< std::string > >
 
 ExportFieldSet (std::shared_ptr< SpaceCache > cache={})
 Construct empty field storage with an optional shared conversion cache. More...
 

Methods

nodal_const_iterator beginNodal () const
 
nodal_const_iterator endNodal () const
 
std::pair< nodal_const_iterator, nodal_const_iterator > nodal () const
 
element_const_iterator beginElement () const
 
element_const_iterator endElement () const
 
void showMe (std::string const &str) const
 Emit residency-state diagnostics at verbose level.
 
std::string const & fieldName (std::string const &key, bool nodal) const
 Display name retained after component buffers are released. More...
 
void cleanup ()
 Release field values, retaining the lightweight field schema.
 
void reserveNames (std::shared_ptr< std::set< std::string > const > const &names)
 Borrow reserved dataset names for collision checks on temporal fields.
 
std::shared_ptr< SpaceCache > const & spaceCache () const
 
std::set< std::string > names () const
 
void materialize (ExportFieldSet const &snapshot, bool attach)
 Materialize or detach an immutable snapshot for a temporal-only writer. Component pointers are shared temporarily; field values are not recopied. Call only after checking that names do not collide with temporal fields.
 
static std::set< std::string > representationType (variant_representation_arg_type const &requestedRepresentation, std::string const &valueIfEmpty="")
 Normalize and validate nodal/element representation arguments.
 

Accessors

bool hasData () const
 
bool isInMemory () const
 
std::uint64_t revision () const
 
void restoreDataState (bool hasData, bool isInMemory)
 Restore residency metadata without reading or allocating field values. More...
 
bool hasMesh () const
 
mesh_ptrtype mesh () const
 
scalar_const_iterator beginScalar () const
 
scalar_const_iterator endScalar () const
 
scalar_type scalar (std::string const &name) const
 get the scalar with name n More...
 
nodal_field_type const & nodal (std::string const &name) const
 get the nodal field with name n More...
 
element_field_type const & element (std::string const &name) const
 get the element field with name n More...
 

Mutators

void setMesh (mesh_ptrtype const &mesh)
 Associate the mesh used for conversion and output ordering.
 
FEELPP_DEPRECATED void addScalar (std::string const &name, scalar_type const &value, bool cst=false)
 Legacy scalar registration; prefer the floating-point add overload.
 
template<typename T >
void add (std::string const &name, T const &value, bool cst=false, typename std::enable_if< std::is_floating_point< T >::value >::type *=nullptr)
 Store a scalar; cst selects the backend's per-case constant encoding.
 
void addComplex (std::string const &name, complex_type const &value, bool cst=false)
 Store a complex quantity using the existing backend convention.
 
void addRegions (std::string const &prefix="")
 Add generated mesh-region fields to this container. More...
 
void addRegions (std::string const &prefix, std::string const &prefixfname)
 Add partition IDs with separate display-name and filename prefixes.
 
template<typename FunctionType >
void add (std::initializer_list< std::string > name, FunctionType const &func, typename std::enable_if< is_functionspace_element_v< decay_type< FunctionType > > >::type *=nullptr)
 Convert an FE field using explicit names for mixed-space components.
 
template<typename FunctionType >
void add (std::variant< std::string, std::vector< std::string > > const &name, FunctionType const &func, variant_representation_arg_type const &reps="", typename std::enable_if< is_functionspace_element_v< decay_type< FunctionType > > >::type *=nullptr)
 Convert single or mixed FE fields; one mixed name expands to name_0, name_1, etc.
 
template<typename FunctionType >
void add (std::string const &name, std::string const &filename, FunctionType const &func, variant_representation_arg_type const &requestedRepresentations="", typename std::enable_if< is_functionspace_element_v< decay_type< FunctionType > > >::type *=nullptr)
 Convert an FE field into the requested nodal/element representations.
 
template<bool isNodal, bool isElementToNodal, typename FunctionType >
FEELPP_NO_EXPORT void add (std::string const &name, std::string const &filename, FunctionType const &func)
 Copy/interpolate FE components into scalar export buffers.
 
template<typename ExprT >
requires std::is_base_of_v<ExprBase, ExprT>
void add (std::string const &name, ExprT const &expr, variant_representation_arg_type const &rep="")
 Evaluate an expression on the whole associated mesh.
 
template<typename ExprT , typename EltWrapperT = Range<mesh_type, MESH_ELEMENTS>>
requires ( std::is_base_of_v<ExprBase, ExprT> && is_filter_v<EltWrapperT> )
void add (std::string const &name, ExprT const &expr, EltWrapperT const &rangElt, variant_representation_arg_type const &rep="")
 Evaluate an expression on an explicit mesh range.
 
template<typename ExprT >
requires std::is_base_of_v<ExprBase, ExprT>
void add (std::string const &name, std::string const &filename, ExprT const &expr, variant_representation_arg_type const &rep="")
 Evaluate an expression using distinct display and filename keys.
 
template<typename ExprT , typename EltWrapperT = Range<mesh_type, MESH_ELEMENTS>>
requires ( std::is_base_of_v<ExprBase, ExprT> && is_filter_v<EltWrapperT> )
void add (std::string const &name, std::string const &filename, ExprT const &expr, EltWrapperT const &rangElt, variant_representation_arg_type const &requestedRepresentation="")
 Dispatch ranged expression conversion by representation.
 
template<bool isNodal, typename ExprT , typename EltWrapperT = Range<mesh_type, MESH_ELEMENTS>>
FEELPP_NO_EXPORT void addExpr (std::string const &name, std::string const &filename, ExprT const &expr, EltWrapperT const &rangeElt)
 Evaluate each scalar/vector/tensor expression component into its own buffer.
 

Detailed Description

template<typename MeshType, int N = 1>
class Feel::detail::ExportFieldSet< MeshType, N >

Time-neutral scalar/vector/tensor export storage and conversion.

Template Parameters
MeshTypeMesh defining the field layout.
NGeometric/export nodal order.

Constructor & Destructor Documentation

◆ ExportFieldSet()

template<typename MeshType , int N = 1>
Feel::detail::ExportFieldSet< MeshType, N >::ExportFieldSet ( std::shared_ptr< SpaceCache >  cache = {})
explicit

Construct empty field storage with an optional shared conversion cache.

Parameters
cacheCompatible conversion spaces, shared without temporal ownership.

Member Function Documentation

◆ addRegions()

template<typename MeshType , int N = 1>
void Feel::detail::ExportFieldSet< MeshType, N >::addRegions ( std::string const &  prefix = "")

Add generated mesh-region fields to this container.

some regions can be automatically generated such as the process id map

Parameters
prefixprefix string for the region

References Feel::sanitize().

◆ beginElement()

template<typename MeshType , int N = 1>
element_const_iterator Feel::detail::ExportFieldSet< MeshType, N >::beginElement ( ) const
Returns
First element field schema and payload.

◆ beginNodal()

template<typename MeshType , int N = 1>
nodal_const_iterator Feel::detail::ExportFieldSet< MeshType, N >::beginNodal ( ) const
Returns
First nodal field schema and payload.

◆ beginScalar()

template<typename MeshType , int N = 1>
scalar_const_iterator Feel::detail::ExportFieldSet< MeshType, N >::beginScalar ( ) const
Returns
the begin iterator for scalars

◆ element()

template<typename MeshType , int N = 1>
element_field_type const & Feel::detail::ExportFieldSet< MeshType, N >::element ( std::string const &  name) const

get the element field with name n

Parameters
namename of the element field
Returns
the element field

◆ endElement()

template<typename MeshType , int N = 1>
element_const_iterator Feel::detail::ExportFieldSet< MeshType, N >::endElement ( ) const
Returns
End of element fields.

◆ endNodal()

template<typename MeshType , int N = 1>
nodal_const_iterator Feel::detail::ExportFieldSet< MeshType, N >::endNodal ( ) const
Returns
End of nodal fields.

◆ endScalar()

template<typename MeshType , int N = 1>
scalar_const_iterator Feel::detail::ExportFieldSet< MeshType, N >::endScalar ( ) const
Returns
the end iterator for scalars

◆ fieldName()

template<typename MeshType , int N = 1>
std::string const & Feel::detail::ExportFieldSet< MeshType, N >::fieldName ( std::string const &  key,
bool  nodal 
) const

Display name retained after component buffers are released.

Parameters
keyOutput filename key.
nodalTrue for a nodal field, false for an element field.

◆ hasData()

template<typename MeshType , int N = 1>
bool Feel::detail::ExportFieldSet< MeshType, N >::hasData ( ) const
Returns
Whether geometry or field data has been associated.

◆ hasMesh()

template<typename MeshType , int N = 1>
bool Feel::detail::ExportFieldSet< MeshType, N >::hasMesh ( ) const
Returns
true if the mesh is available

◆ isInMemory()

template<typename MeshType , int N = 1>
bool Feel::detail::ExportFieldSet< MeshType, N >::isInMemory ( ) const
Returns
Whether component buffers are marked resident.

◆ mesh()

template<typename MeshType , int N = 1>
mesh_ptrtype Feel::detail::ExportFieldSet< MeshType, N >::mesh ( ) const

◆ names()

template<typename MeshType , int N = 1>
std::set< std::string > Feel::detail::ExportFieldSet< MeshType, N >::names ( ) const
Returns
All output keys currently present, including cleaned schemas.

Referenced by Feel::detail::ExportFieldSet< MeshType, N >::add().

◆ nodal() [1/2]

template<typename MeshType , int N = 1>
std::pair< nodal_const_iterator, nodal_const_iterator > Feel::detail::ExportFieldSet< MeshType, N >::nodal ( ) const
Returns
Range of nodal fields.

◆ nodal() [2/2]

template<typename MeshType , int N = 1>
nodal_field_type const & Feel::detail::ExportFieldSet< MeshType, N >::nodal ( std::string const &  name) const

get the nodal field with name n

Parameters
namename of the nodal field
Returns
the nodal field

◆ restoreDataState()

template<typename MeshType , int N = 1>
void Feel::detail::ExportFieldSet< MeshType, N >::restoreDataState ( bool  hasData,
bool  isInMemory 
)

Restore residency metadata without reading or allocating field values.

Parameters
hasDataWhether geometry or field data was recorded.
isInMemoryWhether resident component buffers were recorded. Used for legacy metadata serialization; this is not payload loading.

◆ revision()

template<typename MeshType , int N = 1>
std::uint64_t Feel::detail::ExportFieldSet< MeshType, N >::revision ( ) const
Returns
Content revision, independent of output time and publication state. Registration and mesh changes advance this value; cleanup does not.

◆ scalar()

template<typename MeshType , int N = 1>
scalar_type Feel::detail::ExportFieldSet< MeshType, N >::scalar ( std::string const &  name) const

get the scalar with name n

Parameters
namename of the nodal scalar field
Returns
the scalar value

◆ spaceCache()

template<typename MeshType , int N = 1>
std::shared_ptr< SpaceCache > const & Feel::detail::ExportFieldSet< MeshType, N >::spaceCache ( ) const
Returns
Conversion workspace shared by compatible field sets.