AddToStorage.h File Reference

Detailed Description

Functions to add fields to blocks.

Author
Florian Schornbaum flori.nosp@m.an.s.nosp@m.chorn.nosp@m.baum.nosp@m.@fau..nosp@m.de
Martin Bauer marti.nosp@m.n.ba.nosp@m.uer@f.nosp@m.au.d.nosp@m.e In waLBerla, a central data structure is the BlockStorage. A BlockStorage itself contains blocks, which hold the actual data. To add data to a block one has to specify a so called 'BlockDataHandling' that, among other things, is responsible for the allocation and initialization of the block data on each separate block. To store, for example, a vector<int> at each block we have to write a 'BlockDataHandling' that allocates a new vector<int> and returns a pointer to it. This 'BlockDataHandling' is registered at the BlockStorage and called for each block. For details see documentation of BlockStorage::addBlockData() and StructuredBlockStorage::addBlockData(). Often one wants to store fields as block data, so this file provides helper functions for this common task. When we create fields as block data, we effectively introduce a new subdivision of the domain. The first subdivision is the block structure, whereas the block is then again structured in cells. The subdivision into cells is managed by a StructuredBlockStorage. The StructuredBlockStorage is a BlockStorage that knows about the subdivision into cells like number of cells per block, mapping for local to global cells, etc. The following functions can be used to add a FlagField or any GhostLayerField as a block data to a StructuredBlockStorage. Additionally a BlockDataCreator for each field is provided, if one wants to make the creation dependent on selectors
#include "FlagField.h"
#include "GhostLayerField.h"
#include "field/blockforest/BlockDataHandling.h"
#include <type_traits>

Classes

struct  walberla::field::internal::AddToStorage< GhostLayerField_T, BlockStorage_T, Enable >
 
struct  walberla::field::internal::AddToStorage< GhostLayerField_T, BlockStorage_T, typename std::enable_if<(std::is_integral< typename GhostLayerField_T::value_type >::value||std::is_floating_point< typename GhostLayerField_T::value_type >::value) &&! std::is_same< GhostLayerField_T, FlagField< typename GhostLayerField_T::value_type > >::value >::type >
 
struct  walberla::field::Creator< GhostLayerField_T, Enable >
 BlockDataCreator for fields. More...
 
struct  walberla::field::Creator< GhostLayerField_T, typename std::enable_if< std::is_integral< typename GhostLayerField_T::value_type >::value||std::is_floating_point< typename GhostLayerField_T::value_type >::value >::type >
 
struct  walberla::field::Creator< FlagField< T > >
 

Namespaces

 walberla
 \file TimestepTracker.h \ingroup lbm \author Frederik Hennig frede.nosp@m.rik..nosp@m.henni.nosp@m.g@fa.nosp@m.u.de
 
 walberla::field
 
 walberla::field::internal
 

Functions

template<typename FlagField_T , typename BlockStorage_T >
BlockDataID walberla::field::addFlagFieldToStorage (const shared_ptr< BlockStorage_T > &blocks, const std::string &identifier, const uint_t nrOfGhostLayers=uint_t(1), const bool alwaysInitialize=false, const std::function< void(FlagField_T *field, IBlock *const block) > &initFunction=std::function< void(FlagField_T *field, IBlock *const block) >(), const Set< SUID > &requiredSelectors=Set< SUID >::emptySet(), const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
 
template<typename FlagField_T , typename BlockStorage_T >
BlockDataID walberla::field::addFlagFieldToStorage (const shared_ptr< BlockStorage_T > &blocks, const std::string &identifier, const uint_t nrOfGhostLayers, const bool alwaysInitialize, const Set< SUID > &requiredSelectors, const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
 
template<typename GhostLayerField_T , typename BlockStorage_T >
BlockDataID walberla::field::addToStorage (const shared_ptr< BlockStorage_T > &blocks, const std::string &identifier, const typename GhostLayerField_T::value_type &initValue=typename GhostLayerField_T::value_type(), const Layout layout=fzyx, const uint_t nrOfGhostLayers=uint_t(1), const bool alwaysInitialize=false, const std::function< void(GhostLayerField_T *field, IBlock *const block) > &initFunction=std::function< void(GhostLayerField_T *field, IBlock *const block) >(), const Set< SUID > &requiredSelectors=Set< SUID >::emptySet(), const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
 
template<typename GhostLayerField_T , typename BlockStorage_T >
BlockDataID walberla::field::addToStorage (const shared_ptr< BlockStorage_T > &blocks, const std::string &identifier, const typename GhostLayerField_T::value_type &initValue, const Layout layout, const uint_t nrOfGhostLayers, const shared_ptr< field::FieldAllocator< typename GhostLayerField_T::value_type > > alloc)
 
template<typename GhostLayerField_T , typename BlockStorage_T >
BlockDataID walberla::field::addToStorage (const shared_ptr< BlockStorage_T > &blocks, const std::string &identifier, const typename GhostLayerField_T::value_type &initValue, const Layout layout, const uint_t nrOfGhostLayers, const bool alwaysInitialize, const Set< SUID > &requiredSelectors, const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
 
template<typename GhostLayerField_T , typename BlockStorage_T >
BlockDataID walberla::field::addToStorage (const shared_ptr< BlockStorage_T > &blocks, const std::string &identifier, const std::function< Vector3< uint_t >(const shared_ptr< StructuredBlockStorage > &, IBlock *const) > &calculateSize, const typename GhostLayerField_T::value_type &initValue=typename GhostLayerField_T::value_type(), const Layout layout=fzyx, const uint_t nrOfGhostLayers=uint_t(1), const bool alwaysInitialize=false, const std::function< void(GhostLayerField_T *field, IBlock *const block) > &initFunction=std::function< void(GhostLayerField_T *field, IBlock *const block) >(), const Set< SUID > &requiredSelectors=Set< SUID >::emptySet(), const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet(), const shared_ptr< field::FieldAllocator< typename GhostLayerField_T::value_type > > alloc=nullptr)
 
template<typename GhostLayerField_T , typename BlockStorage_T >
BlockDataID walberla::field::addToStorage (const shared_ptr< BlockStorage_T > &blocks, const std::string &identifier, const std::function< Vector3< uint_t >(const shared_ptr< StructuredBlockStorage > &, IBlock *const) > calculateSize, const typename GhostLayerField_T::value_type &initValue, const Layout layout, const uint_t nrOfGhostLayers, const bool alwaysInitialize, const Set< SUID > &requiredSelectors, const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
 
template<typename Field_T , typename BlockStorage_T >
BlockDataID walberla::field::addCloneToStorage (const shared_ptr< BlockStorage_T > &blocks, ConstBlockDataID fieldToClone, const std::string &identifier, const Set< SUID > &requiredSelectors=Set< SUID >::emptySet(), const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
 Adds a copy of an existing field to BlockStorage. More...
 
template<typename Field_T , typename BlockStorage_T >
BlockDataID walberla::field::addFlattenedShallowCopyToStorage (const shared_ptr< BlockStorage_T > &blocks, ConstBlockDataID fieldToClone, const std::string &identifier, const Set< SUID > &requiredSelectors=Set< SUID >::emptySet(), const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
 Adds a flattened shallow copy of an existing field to BlockStorage. More...