walberla::gather::CurveGatherPackInfo< GhostLayerField_T, Interpolator > Class Template Reference

Detailed Description

template<typename GhostLayerField_T, typename Interpolator = field::TrilinearInterpolator< GhostLayerField_T, real_t >>
class walberla::gather::CurveGatherPackInfo< GhostLayerField_T, Interpolator >

Packs data of a field along a curve.

#include <CurveGatherPackInfo.h>

+ Inheritance diagram for walberla::gather::CurveGatherPackInfo< GhostLayerField_T, Interpolator >:

Classes

struct  Compare
 Helper class for sorting the receivedData array according to t-value. More...
 
struct  Samples
 

Public Types

typedef Vector3< real_tRealVec3
 
typedef std::function< RealVec3(real_t t) > CurveCallback
 

Public Member Functions

Construction & Destruction
 CurveGatherPackInfo (const shared_ptr< StructuredBlockStorage > &bs, ConstBlockDataID fieldID, CurveCallback curveCallback, real_t tStart, real_t tEnd, uint_t numSamples, const shared_ptr< DataProcessor > &dp)
 Construction using a callback function. More...
 
 CurveGatherPackInfo (const shared_ptr< StructuredBlockStorage > &bs, ConstBlockDataID field, const std::string &curveX, const std::string &curveY, const std::string &curveZ, real_t tStart, real_t tEnd, uint_t numSamples, const shared_ptr< DataProcessor > &dp)
 Construction using curve definition as string. More...
 
 CurveGatherPackInfo (const shared_ptr< StructuredBlockStorage > &bs, ConstBlockDataID field, const std::vector< RealVec3 > &samplePoints, const shared_ptr< DataProcessor > &dp)
 Construction using vector of sample points. More...
 
 ~CurveGatherPackInfo () override
 
Packing Interface


void packData (const IBlock *sender, mpi::SendBuffer &outBuffer) override
 Packs all data to be gathered into the given buffer. More...
 
void unpackData (mpi::RecvBuffer &buffer) override
 Unpacks the data, packed by the packData() function. More...
 
void gatherFinished () override
 Called after a timestep has finished, and unpackData was called for each sending block. More...
 
- Public Member Functions inherited from walberla::gather::GatherPackInfo
virtual ~GatherPackInfo ()=default
 

Protected Member Functions

Helper Functions
void addSample (real_t t, const RealVec3 &p)
 Helper function needed by all constructors Computes conversion of world coordinates to local cell coordinates. More...
 
void sortReceivedData ()
 Sorts received data according to the free curve parameter t necessary because a curve may cross a block multiple times for multiple non connected t intervals. More...
 

Protected Attributes

Members for Sending


shared_ptr< StructuredBlockStorageblocks_
 
ConstBlockDataID fieldID_
 DataInterpolator acting as source, for the data that has to be packed. More...
 
std::map< const IBlock *, SampleslocalSamplePoints_
 For every LOCAL block, where data has to be packed, a vector of sample points is stored. More...
 
Members for Receiving


std::vector< std::vector< real_t > > receivedData
 Two dimensional array of received data: the outer vector has one entry for every sample point the inner vector represents one sample point. More...
 
shared_ptr< DataProcessordataProcessor_
 Channel for output of gathered data. More...
 

Member Typedef Documentation

◆ CurveCallback

template<typename GhostLayerField_T , typename Interpolator = field::TrilinearInterpolator< GhostLayerField_T, real_t >>
typedef std::function<RealVec3 (real_t t) > walberla::gather::CurveGatherPackInfo< GhostLayerField_T, Interpolator >::CurveCallback

◆ RealVec3

template<typename GhostLayerField_T , typename Interpolator = field::TrilinearInterpolator< GhostLayerField_T, real_t >>
typedef Vector3<real_t> walberla::gather::CurveGatherPackInfo< GhostLayerField_T, Interpolator >::RealVec3

Constructor & Destructor Documentation

◆ CurveGatherPackInfo() [1/3]

template<typename GlF , typename IP >
walberla::gather::CurveGatherPackInfo< GlF, IP >::CurveGatherPackInfo ( const shared_ptr< StructuredBlockStorage > &  bs,
ConstBlockDataID  fieldID,
CurveCallback  curveCallback,
real_t  tStart,
real_t  tEnd,
uint_t  numSamples,
const shared_ptr< DataProcessor > &  dp 
)

Construction using a callback function.

Parameters
bsstructured block storage, needed to map global to local coordinates
fieldIDBlockdataID pointing to a GhostLayerField of type GhostLayerField_T
curveCallbackcurve defining function, taking one real_t parameter, returning a point in "world" coordinates. Same coordinates as AABB of blockfield
tStartStart value of free curve parameter t
tEndEnd value of free curve parameter t
numSamplesnumber of subdivisions of interval [tStart,tEnd]
dpThe data processor acts as output of gathered data. When gathered data is available the process() method is called, with an array containing data points. The first element of the data point is the free curve parameter t, followed by the elements given by the data interpolator

◆ CurveGatherPackInfo() [2/3]

template<typename GlF , typename IP >
walberla::gather::CurveGatherPackInfo< GlF, IP >::CurveGatherPackInfo ( const shared_ptr< StructuredBlockStorage > &  bs,
ConstBlockDataID  field,
const std::string &  curveX,
const std::string &  curveY,
const std::string &  curveZ,
real_t  tStart,
real_t  tEnd,
uint_t  numSamples,
const shared_ptr< DataProcessor > &  dp 
)

Construction using curve definition as string.

see constructor above

Parameters
curveXstring containing the function that defines the x value of the curve the name of the free parameter is 't' example: cos(t)+2*t+exp(t)

◆ CurveGatherPackInfo() [3/3]

template<typename GhostLayerField_T , typename Interpolator = field::TrilinearInterpolator< GhostLayerField_T, real_t >>
walberla::gather::CurveGatherPackInfo< GhostLayerField_T, Interpolator >::CurveGatherPackInfo ( const shared_ptr< StructuredBlockStorage > &  bs,
ConstBlockDataID  field,
const std::vector< RealVec3 > &  samplePoints,
const shared_ptr< DataProcessor > &  dp 
)

Construction using vector of sample points.

Parameters
samplePointsCurve definition using a vector of points in R^3. The points are expected to be in "world" coordinates

◆ ~CurveGatherPackInfo()

template<typename GhostLayerField_T , typename Interpolator = field::TrilinearInterpolator< GhostLayerField_T, real_t >>
walberla::gather::CurveGatherPackInfo< GhostLayerField_T, Interpolator >::~CurveGatherPackInfo ( )
inlineoverride

Member Function Documentation

◆ addSample()

template<typename GlF , typename IP >
void walberla::gather::CurveGatherPackInfo< GlF, IP >::addSample ( real_t  t,
const RealVec3 p 
)
protected

Helper function needed by all constructors Computes conversion of world coordinates to local cell coordinates.

If sampled point lies in a locally allocated block, it is added to localSamplePoints_ . Initializes also the totalNumberOfSamples_ member.

◆ gatherFinished()

template<typename GlF , typename IP >
void walberla::gather::CurveGatherPackInfo< GlF, IP >::gatherFinished
overridevirtual

Called after a timestep has finished, and unpackData was called for each sending block.

Reimplemented from walberla::gather::GatherPackInfo.

◆ packData()

template<typename GlF , typename Interpolator >
void walberla::gather::CurveGatherPackInfo< GlF, Interpolator >::packData ( const IBlock sender,
mpi::SendBuffer outBuffer 
)
overridevirtual

Packs all data to be gathered into the given buffer.

Restrictions:

  • The packed amount of data for a given block has to stay constant
  • The packed amount of data for a given block has to be constant for all timesteps (i.e. for all calls of this function)

Implements walberla::gather::GatherPackInfo.

◆ sortReceivedData()

template<typename GlF , typename IP >
void walberla::gather::CurveGatherPackInfo< GlF, IP >::sortReceivedData
protected

Sorts received data according to the free curve parameter t necessary because a curve may cross a block multiple times for multiple non connected t intervals.

◆ unpackData()

template<typename GlF , typename IP >
void walberla::gather::CurveGatherPackInfo< GlF, IP >::unpackData ( mpi::RecvBuffer buffer)
overridevirtual

Unpacks the data, packed by the packData() function.

  • function is called on gathering process multiple times per timestep, once for each block that packed a non-zero message. It has to read the same amount as packData() has written. Therefore is usually necessary that packData inserts a header describing how much data the block packed

Implements walberla::gather::GatherPackInfo.

Member Data Documentation

◆ blocks_

template<typename GhostLayerField_T , typename Interpolator = field::TrilinearInterpolator< GhostLayerField_T, real_t >>
shared_ptr<StructuredBlockStorage> walberla::gather::CurveGatherPackInfo< GhostLayerField_T, Interpolator >::blocks_
protected

◆ dataProcessor_

template<typename GhostLayerField_T , typename Interpolator = field::TrilinearInterpolator< GhostLayerField_T, real_t >>
shared_ptr<DataProcessor> walberla::gather::CurveGatherPackInfo< GhostLayerField_T, Interpolator >::dataProcessor_
protected

Channel for output of gathered data.

◆ fieldID_

template<typename GhostLayerField_T , typename Interpolator = field::TrilinearInterpolator< GhostLayerField_T, real_t >>
ConstBlockDataID walberla::gather::CurveGatherPackInfo< GhostLayerField_T, Interpolator >::fieldID_
protected

DataInterpolator acting as source, for the data that has to be packed.

◆ localSamplePoints_

template<typename GhostLayerField_T , typename Interpolator = field::TrilinearInterpolator< GhostLayerField_T, real_t >>
std::map<const IBlock*, Samples > walberla::gather::CurveGatherPackInfo< GhostLayerField_T, Interpolator >::localSamplePoints_
protected

For every LOCAL block, where data has to be packed, a vector of sample points is stored.

Points are stored in local cell coordinates

◆ receivedData

template<typename GhostLayerField_T , typename Interpolator = field::TrilinearInterpolator< GhostLayerField_T, real_t >>
std::vector<std::vector<real_t> > walberla::gather::CurveGatherPackInfo< GhostLayerField_T, Interpolator >::receivedData
protected

Two dimensional array of received data: the outer vector has one entry for every sample point the inner vector represents one sample point.

  • the first entry (receivedData[i][0] ) is the t-value
  • subsequent entries are for the f values

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