OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
olb::BlockReduction3D2D< T > Class Template Referencefinal

BlockReduction3D2D reduces the data of a SuperF3D functor to the intersection between a given hyperplane and the super geometry. More...

#include <blockReduction3D2D.h>

+ Inheritance diagram for olb::BlockReduction3D2D< T >:
+ Collaboration diagram for olb::BlockReduction3D2D< T >:

Public Member Functions

 BlockReduction3D2D (FunctorPtr< SuperF3D< T > > &&f, const HyperplaneLattice3D< T > &lattice, BlockDataSyncMode syncMode=BlockDataSyncMode::ReduceAndBcast, BlockDataReductionMode reductionMode=BlockDataReductionMode::Analytical)
 Construction using functor and hyperplane lattice.
 
 BlockReduction3D2D (FunctorPtr< SuperF3D< T > > &&f, const Hyperplane3D< T > &hyperplane, BlockDataSyncMode syncMode=BlockDataSyncMode::ReduceAndBcast, BlockDataReductionMode reductionMode=BlockDataReductionMode::Analytical)
 Construction using functor and hyperplane.
 
 BlockReduction3D2D (FunctorPtr< SuperF3D< T > > &&f, const Hyperplane3D< T > &hyperplane, int resolution=600, BlockDataSyncMode syncMode=BlockDataSyncMode::ReduceAndBcast)
 Construction using functor, hyperplane and resolution.
 
 BlockReduction3D2D (FunctorPtr< SuperF3D< T > > &&f, const Vector< T, 3 > &origin, const Vector< T, 3 > &u, const Vector< T, 3 > &v, int resolution=600, BlockDataSyncMode syncMode=BlockDataSyncMode::ReduceAndBcast)
 Construction using functor, origin and span vectors as well as resolution.
 
 BlockReduction3D2D (FunctorPtr< SuperF3D< T > > &&f, const Vector< T, 3 > &origin, const Vector< T, 3 > &normal, int resolution=600, BlockDataSyncMode syncMode=BlockDataSyncMode::ReduceAndBcast)
 Construction using functor, origin, normal and resolution.
 
 BlockReduction3D2D (FunctorPtr< SuperF3D< T > > &&f, const Vector< T, 3 > &normal, int resolution=600, BlockDataSyncMode syncMode=BlockDataSyncMode::ReduceAndBcast)
 Construction using functor, normal vector and resolution.
 
void initialize ()
 Initialize rank-local list of plane points to be stored in _blockData.
 
void update ()
 Updates and writes the data to _blockData using _rankLocalSubplane.
 
BlockStructureD< 2 > & getBlockStructure () override
 Overload of virtual function from class BlockF2D.
 
const std::vector< std::tuple< int, int, int > > & getRankLocalSubplane () const
 
- Public Member Functions inherited from olb::HyperplaneLattice3D< T >
 HyperplaneLattice3D (CuboidGeometry3D< T > &geometry, Hyperplane3D< T > hyperplane)
 Constructor for automatic discretization.
 
 HyperplaneLattice3D (CuboidGeometry3D< T > &geometry, Hyperplane3D< T > hyperplane, int resolution)
 Constructor for discretization of a given resolution.
 
 HyperplaneLattice3D (CuboidGeometry3D< T > &geometry, Hyperplane3D< T > hyperplane, T h)
 Constructor for discretization of a given grid width.
 
 HyperplaneLattice3D (Hyperplane3D< T > hyperplane, T h, int nx, int ny)
 Constructor for manual discretization.
 
 HyperplaneLattice3D (const HyperplaneLattice3D &)=default
 
const Hyperplane3D< T > & getHyperplane () const
 
Vector< T, 3 > getPhysR (const int &planeX, const int &planeY) const
 Transform 2d lattice coordinates to their physical 3d location.
 
int getNx () const
 
int getNy () const
 
getPhysSpacing () const
 
Vector< T, 3 > getPhysOrigin () const
 
Vector< T, 3 > getVectorU () const
 
Vector< T, 3 > getVectorV () const
 
- Public Member Functions inherited from olb::BlockDataF2D< T, T >
 BlockDataF2D (BlockData< 2, T, T > &blockData)
 Constructor.
 
 BlockDataF2D (BlockF2D< T > &f)
 to store functor data, constuctor creates _blockData with functor data
 
 ~BlockDataF2D ()
 
BlockData< 2, T, T > & getBlockData ()
 returns _blockData
 
bool operator() (T output[], const int input[]) override
 access to _blockData via its get()
 
- Public Member Functions inherited from olb::BlockF2D< T >
void setBlockStructure (BlockStructureD< 2 > *blockStructure)
 
BlockF2D< T > & operator- (BlockF2D< T > &rhs)
 
BlockF2D< T > & operator+ (BlockF2D< T > &rhs)
 
BlockF2D< T > & operator* (BlockF2D< T > &rhs)
 
BlockF2D< T > & operator/ (BlockF2D< T > &rhs)
 
- Public Member Functions inherited from olb::GenericF< T, int >
virtual ~GenericF ()=default
 
int getSourceDim () const
 read only access to member variable _m
 
int getTargetDim () const
 read only access to member variable _n
 
std::string & getName ()
 read and write access to name
 
std::string const & getName () const
 read only access to name
 
virtual bool operator() (T output[], const int input[])=0
 has to be implemented for 'every' derived class
 
bool operator() (T output[])
 wrapper that call the pure virtual operator() (T output[], const S input[]) from above
 
bool operator() (T output[], int input0)
 
bool operator() (T output[], int input0, int input1)
 
bool operator() (T output[], int input0, int input1, int input2)
 
bool operator() (T output[], int input0, int input1, int input2, int input3)
 

Additional Inherited Members

- Public Types inherited from olb::GenericF< T, int >
using targetType
 
using sourceType
 
- Public Attributes inherited from olb::GenericF< T, int >
std::shared_ptr< GenericF< T, int > > _ptrCalcC
 memory management, frees resouces (calcClass)
 
- Protected Member Functions inherited from olb::BlockDataF2D< T, T >
 BlockDataF2D (int nx, int ny, int size=1)
 
- Protected Member Functions inherited from olb::BlockF2D< T >
 BlockF2D (BlockStructureD< 2 > &blockStructure, int targetDim)
 
 BlockF2D (int targetDim)
 
- Protected Member Functions inherited from olb::GenericF< T, int >
 GenericF (int targetDim, int sourceDim)
 
- Protected Attributes inherited from olb::HyperplaneLattice3D< T >
const Hyperplane3D< T > _hyperplane
 
Vector< T, 3 > _origin
 Origin vector of the lattice.
 
Vector< T, 3 > _u
 Span vector of the lattice, normalized to grid width _h.
 
Vector< T, 3 > _v
 Span vector of the lattice, normalized to grid width _h.
 
_h
 Distance between discrete lattice points.
 
int _nx
 Number of lattice points in the direction of _u.
 
int _ny
 Number of lattice points in the direction of _v.
 
- Protected Attributes inherited from olb::BlockDataF2D< T, T >
BlockData< 2, T, T > * _blockData
 
bool _owning
 
- Protected Attributes inherited from olb::BlockF2D< T >
BlockStructureD< 2 > * _blockStructure
 

Detailed Description

template<typename T>
class olb::BlockReduction3D2D< T >

BlockReduction3D2D reduces the data of a SuperF3D functor to the intersection between a given hyperplane and the super geometry.

This intersection is interpolated at a set of discrete points according to the given resolution and exposed as a BlockDataF2D functor.

The hyperplane is parametrized by a origin and two span vector u and v. Definition of hyperplanes using e.g. origin and normal vectors is supported via the Hyperplane3D interface.

Definition at line 54 of file blockReduction3D2D.h.

Constructor & Destructor Documentation

◆ BlockReduction3D2D() [1/6]

template<typename T >
olb::BlockReduction3D2D< T >::BlockReduction3D2D ( FunctorPtr< SuperF3D< T > > && f,
const HyperplaneLattice3D< T > & lattice,
BlockDataSyncMode syncMode = BlockDataSyncMode::ReduceAndBcast,
BlockDataReductionMode reductionMode = BlockDataReductionMode::Analytical )

Construction using functor and hyperplane lattice.

Parameters
fFunctor to be reduced as a (non-)owning pointer or reference to SuperF3D<T>.
latticeHyperplane lattice parametrization
syncModeDefines MPI synchronization strategy of the interpolated block data.
reductionModeDefines whether data is interpolated or read from discrete lattice locations. Note: BlockDataReductionMode::Analytical imposes restrictions on hyperplane definition and discretization.

Definition at line 93 of file blockReduction3D2D.hh.

98 : HyperplaneLattice3D<T>(lattice),
99 BlockDataF2D<T,T>(lattice.getNx(), lattice.getNy(), f->getTargetDim()),
100 _f(std::move(f)),
101 _syncMode(syncMode),
102 _reductionMode(reductionMode)
103{
104 this->getName() = "planeReduction(" + _f->getName() + ")";
105
106 if ( _reductionMode == BlockDataReductionMode::Discrete ) {
107 const CuboidGeometry3D<T>& geometry = _f->getSuperStructure().getCuboidGeometry();
108 const Hyperplane3D<T>& hyperplane = this->getHyperplane();
109 const bool spansAxisPlane = hyperplane.isXYPlane() ||
110 hyperplane.isXZPlane() ||
111 hyperplane.isYZPlane();
112 // verify axes alignment and spacing of hyperplane parametrization
113 if ( !spansAxisPlane ||
114 lattice.getPhysSpacing() != geometry.getMinDeltaR() ) {
115 // hyperplane lattice doesn't describe a trivially discretizable plane
116 OstreamManager clerr(std::cerr, "BlockReduction3D2D");
117 clerr << "Given hyperplane is not trivially discretizable. "
118 << "Use BlockDataReductionMode::Analytical instead."
119 << std::endl;
120 exit(-1);
121 }
122 }
123
124 // intialize list of relevant rank local points making up the reduced plane
125 initialize();
126 // first update of data
127 update();
128}
void initialize()
Initialize rank-local list of plane points to be stored in _blockData.
void update()
Updates and writes the data to _blockData using _rankLocalSubplane.
std::string & getName()
read and write access to name
Definition genericF.hh:51
const Hyperplane3D< T > & getHyperplane() const
void exit(int exitcode)
Definition singleton.h:165
@ Discrete
Read block data from discrete lattice locations.

References olb::Discrete, olb::HyperplaneLattice3D< T >::getHyperplane(), olb::CuboidGeometry3D< T >::getMinDeltaR(), olb::GenericF< T, int >::getName(), olb::HyperplaneLattice3D< T >::getPhysSpacing(), olb::BlockReduction3D2D< T >::initialize(), olb::Hyperplane3D< T >::isXYPlane(), olb::Hyperplane3D< T >::isXZPlane(), olb::Hyperplane3D< T >::isYZPlane(), and olb::BlockReduction3D2D< T >::update().

+ Here is the call graph for this function:

◆ BlockReduction3D2D() [2/6]

template<typename T >
olb::BlockReduction3D2D< T >::BlockReduction3D2D ( FunctorPtr< SuperF3D< T > > && f,
const Hyperplane3D< T > & hyperplane,
BlockDataSyncMode syncMode = BlockDataSyncMode::ReduceAndBcast,
BlockDataReductionMode reductionMode = BlockDataReductionMode::Analytical )

Construction using functor and hyperplane.

Parameters
fFunctor to be reduced as a (non-)owning pointer or reference to SuperF3D<T>.
hyperplaneHyperplane parametrization
syncModeDefines MPI synchronization strategy of the interpolated block data.
reductionModeDefines whether data is interpolated or read from discrete lattice locations.

Definition at line 131 of file blockReduction3D2D.hh.

137 std::forward<decltype(f)>(f),
138 HyperplaneLattice3D<T>(f->getSuperStructure().getCuboidGeometry(),
139 hyperplane),
140 syncMode,
141 reductionMode)
142{ }
BlockReduction3D2D(FunctorPtr< SuperF3D< T > > &&f, const HyperplaneLattice3D< T > &lattice, BlockDataSyncMode syncMode=BlockDataSyncMode::ReduceAndBcast, BlockDataReductionMode reductionMode=BlockDataReductionMode::Analytical)
Construction using functor and hyperplane lattice.

◆ BlockReduction3D2D() [3/6]

template<typename T >
olb::BlockReduction3D2D< T >::BlockReduction3D2D ( FunctorPtr< SuperF3D< T > > && f,
const Hyperplane3D< T > & hyperplane,
int resolution = 600,
BlockDataSyncMode syncMode = BlockDataSyncMode::ReduceAndBcast )

Construction using functor, hyperplane and resolution.

Parameters
fFunctor to be reduced as a (non-)owning pointer or reference to SuperF3D<T>.
hyperplaneHyperplane parametrization
resolutionDefines the number of voxel of the longest side. If it equals zero, _h is set to the cuboid geometry's minDeltaR.
syncModeDefines MPI synchronization strategy of the interpolated block data.

Definition at line 145 of file blockReduction3D2D.hh.

151 std::forward<decltype(f)>(f),
152 HyperplaneLattice3D<T>(f->getSuperStructure().getCuboidGeometry(),
153 hyperplane, resolution),
154 syncMode)
155{ }

◆ BlockReduction3D2D() [4/6]

template<typename T >
olb::BlockReduction3D2D< T >::BlockReduction3D2D ( FunctorPtr< SuperF3D< T > > && f,
const Vector< T, 3 > & origin,
const Vector< T, 3 > & u,
const Vector< T, 3 > & v,
int resolution = 600,
BlockDataSyncMode syncMode = BlockDataSyncMode::ReduceAndBcast )

Construction using functor, origin and span vectors as well as resolution.

Parameters
fFunctor to be reduced as a (non-)owning pointer or reference to SuperF3D<T>.
originOrigin vector
uSpan vector
vSpan vector
resolutionDefines the number of voxel of the longest side. If it equals zero, _h is set to the cuboid geometry's minDeltaR.
syncModeDefines MPI synchronization strategy of the interpolated block data.

Definition at line 158 of file blockReduction3D2D.hh.

163 std::forward<decltype(f)>(f),
164 Hyperplane3D<T>().originAt(origin).spannedBy(u, v),
165 resolution, syncMode)
166{ }

◆ BlockReduction3D2D() [5/6]

template<typename T >
olb::BlockReduction3D2D< T >::BlockReduction3D2D ( FunctorPtr< SuperF3D< T > > && f,
const Vector< T, 3 > & origin,
const Vector< T, 3 > & normal,
int resolution = 600,
BlockDataSyncMode syncMode = BlockDataSyncMode::ReduceAndBcast )

Construction using functor, origin, normal and resolution.

Parameters
fFunctor to be reduced as a (non-)owning pointer or reference to SuperF3D<T>.
originOrigin vector
normalNormal vector
resolutionDefines the number of voxel of the longest side. If it equals zero, _h is set to the cuboid geometry's minDeltaR.
syncModeDefines MPI synchronization strategy of the interpolated block data.

Definition at line 169 of file blockReduction3D2D.hh.

174 std::forward<decltype(f)>(f),
175 Hyperplane3D<T>().originAt(origin).normalTo(normal),
176 resolution, syncMode)
177{ }

◆ BlockReduction3D2D() [6/6]

template<typename T >
olb::BlockReduction3D2D< T >::BlockReduction3D2D ( FunctorPtr< SuperF3D< T > > && f,
const Vector< T, 3 > & normal,
int resolution = 600,
BlockDataSyncMode syncMode = BlockDataSyncMode::ReduceAndBcast )

Construction using functor, normal vector and resolution.

Parameters
fFunctor to be reduced as a (non-)owning pointer or reference to SuperF3D<T>.
normalNormal vector
resolutionDefines the number of voxel of the longest side. If it equals zero, _h is set to the cuboid geometry's minDeltaR.
syncModeDefines MPI synchronization strategy of the interpolated block data.

Definition at line 180 of file blockReduction3D2D.hh.

185 std::forward<decltype(f)>(f),
186 Hyperplane3D<T>()
187 .centeredIn(f->getSuperStructure().getCuboidGeometry().getMotherCuboid())
188 .normalTo(normal),
189 resolution, syncMode)
190{ }

Member Function Documentation

◆ getBlockStructure()

template<typename T >
BlockStructureD< 2 > & olb::BlockReduction3D2D< T >::getBlockStructure ( )
overridevirtual

Overload of virtual function from class BlockF2D.

Reimplemented from olb::BlockF2D< T >.

Definition at line 264 of file blockReduction3D2D.hh.

265{
266 return *this->_blockData;
267}
BlockData< 2, T, T > * _blockData

◆ getRankLocalSubplane()

template<typename T >
const std::vector< std::tuple< int, int, int > > & olb::BlockReduction3D2D< T >::getRankLocalSubplane ( ) const
Returns
reference to the rank local list of discrete plane points, cuboid ids

Definition at line 270 of file blockReduction3D2D.hh.

271{
272 return this->_rankLocalSubplane;
273}

◆ initialize()

template<typename T >
void olb::BlockReduction3D2D< T >::initialize ( )

Initialize rank-local list of plane points to be stored in _blockData.

Definition at line 193 of file blockReduction3D2D.hh.

194{
195 const CuboidGeometry3D<T>& geometry = _f->getSuperStructure().getCuboidGeometry();
196 LoadBalancer<T>& load = _f->getSuperStructure().getLoadBalancer();
197
198 _rankLocalSubplane.clear();
199
200 for ( int iX = 0; iX < this->getNx(); ++iX ) {
201 for ( int iY = 0; iY < this->getNy(); ++iY ) {
202 const Vector<T,3> physR = this->getPhysR(iX, iY);
203
204 // Schedule plane point for storage if its physical position intersects the
205 // mother cuboid and the cuboid of the nearest lattice position is local to
206 // the current rank:
207 int iC;
208 if ( geometry.getC(physR, iC) ) {
209 if ( load.isLocal(iC) ) {
210 _rankLocalSubplane.emplace_back(iX, iY, iC);
211 }
212 }
213 }
214 }
215}
Vector< T, 3 > getPhysR(const int &planeX, const int &planeY) const
Transform 2d lattice coordinates to their physical 3d location.

References olb::CuboidGeometry3D< T >::getC(), and olb::LoadBalancer< T >::isLocal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

template<typename T >
void olb::BlockReduction3D2D< T >::update ( )

Updates and writes the data to _blockData using _rankLocalSubplane.

Definition at line 218 of file blockReduction3D2D.hh.

219{
220 _f->getSuperStructure().communicate();
221
222#ifdef PARALLEL_MODE_MPI
223 std::unique_ptr<BlockData<2,T,T>> localBlockData(
224 new BlockData<2,T,T>({{this->getNx(), this->getNy()}, 0}, _f->getTargetDim()));
225
226 switch ( _reductionMode ) {
228 updateBlockAnalytical(*localBlockData);
229 break;
231 updateBlockDiscrete(*localBlockData);
232 break;
233 }
234
235 switch ( _syncMode ) {
237 singleton::mpi().reduce(*localBlockData, this->getBlockData(), MPI_SUM);
239 break;
241 singleton::mpi().reduce(*localBlockData, this->getBlockData(), MPI_SUM);
242 break;
244 if (this->_owning) {
245 delete this->_blockData;
246 }
247 this->_blockData = localBlockData.release();
248 this->_owning = true;
249 break;
250 }
251#else
252 switch ( _reductionMode ) {
254 updateBlockAnalytical(this->getBlockData());
255 break;
257 updateBlockDiscrete(this->getBlockData());
258 break;
259 }
260#endif
261}
BlockData< 2, T, T > & getBlockData()
returns _blockData
void bCast(T *sendBuf, int sendCount, int root=0, MPI_Comm comm=MPI_COMM_WORLD)
Broadcast data from one processor to multiple processors.
void reduce(T &sendVal, T &recvVal, MPI_Op op, int root=0, MPI_Comm=MPI_COMM_WORLD)
Reduction operation toward one processor.
MpiManager & mpi()
@ Analytical
Interpolate block data at exact physical locations.
@ ReduceOnly
optimize for usage in e.g. BlockGifWriter, full data only available on main rank
@ None
optimize for usage in e.g. SuperLatticeFlux3D, only rank-local data available
@ ReduceAndBcast
default behavior, full block data available on all ranks after update

References olb::Analytical, olb::singleton::MpiManager::bCast(), olb::Discrete, olb::singleton::mpi(), olb::None, olb::singleton::MpiManager::reduce(), olb::ReduceAndBcast, and olb::ReduceOnly.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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