OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::SuperLatticePointExtraction< T, DESCRIPTOR, FUNCTOR > Class Template Referencefinal

Convenience class for extracting data associated to set of arbitrary physical points. More...

#include <superLatticePointExtraction.h>

+ Collaboration diagram for olb::SuperLatticePointExtraction< T, DESCRIPTOR, FUNCTOR >:

Public Member Functions

 SuperLatticePointExtraction (SuperLattice< T, DESCRIPTOR > &sLattice, const std::vector< Vector< T, DESCRIPTOR::d > > &points)
 
std::size_t getSize () const
 
Vector< T, DESCRIPTOR::d > getPhysR (std::size_t iExtracted) const
 
auto getValue (std::size_t iExtracted) const
 
template<typename FIELD >
void setParameter (FieldD< T, DESCRIPTOR, FIELD > &&value)
 
void update ()
 

Detailed Description

template<typename T, typename DESCRIPTOR, typename FUNCTOR>
class olb::SuperLatticePointExtraction< T, DESCRIPTOR, FUNCTOR >

Convenience class for extracting data associated to set of arbitrary physical points.

Definition at line 53 of file superLatticePointExtraction.h.

Constructor & Destructor Documentation

◆ SuperLatticePointExtraction()

template<typename T , typename DESCRIPTOR , typename FUNCTOR >
olb::SuperLatticePointExtraction< T, DESCRIPTOR, FUNCTOR >::SuperLatticePointExtraction ( SuperLattice< T, DESCRIPTOR > & sLattice,
const std::vector< Vector< T, DESCRIPTOR::d > > & points )

Definition at line 47 of file superLatticePointExtraction.hh.

50 : _sLattice(sLattice),
51 _sampleD(sLattice.getLoadBalancer()),
52 _couplingO(PointExtractionO<FUNCTOR>{},
53 names::Lattice{}, sLattice,
54 names::Points{}, _sampleD),
55 _extractionPointD(points.size()),
56 _extractionResultD(points.size())
57{
58 const auto& geometry = _sLattice.getCuboidDecomposition();
59 LoadBalancer<T>& load = _sLattice.getLoadBalancer();
60
61 for (int iC=0; iC < geometry.size(); ++iC) {
62 _rankLocalPointsSize[iC] = 0;
63 }
64
65 for (std::size_t iG=0; iG < points.size(); ++iG) {
66 const auto& physR = points[iG];
67 _extractionPointD.setField(iG, physR);
68 if (auto iC = geometry.getC(physR)) {
69 if (load.isLocal(*iC)) {
70 _rankLocalPoints.emplace_back(*iC, iG, physR);
71 _rankLocalPointsSize[*iC]++;
72 }
73 }
74 }
75
76 std::map<int,int> rankLocalPointsIndex;
77 for (auto [iC, size] : _rankLocalPointsSize) {
78 if (load.isLocal(iC)) {
79 auto& block = _sampleD.getBlock(load.loc(iC));
80 block.resize({size,1,1});
81 rankLocalPointsIndex[iC] = 0;
82 }
83 }
84
85 for (auto& [iC, iG, physR] : _rankLocalPoints) {
86 auto& block = _sampleD.getBlock(load.loc(iC));
87 auto iPoint = rankLocalPointsIndex[iC]++;
88 auto point = block.get(iPoint);
89 point.template setField<fields::PHYS_R>(physR);
90 }
91
92 _sampleD.setProcessingContext(ProcessingContext::Simulation);
93}
@ Simulation
Data available on host for e.g. functor evaluation.

Member Function Documentation

◆ getPhysR()

template<typename T , typename DESCRIPTOR , typename FUNCTOR >
Vector< T, DESCRIPTOR::d > olb::SuperLatticePointExtraction< T, DESCRIPTOR, FUNCTOR >::getPhysR ( std::size_t iExtracted) const
inline

Definition at line 81 of file superLatticePointExtraction.h.

81 {
82 return _extractionPointD.getField(iExtracted);
83 }

References olb::FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD >::getField().

+ Here is the call graph for this function:

◆ getSize()

template<typename T , typename DESCRIPTOR , typename FUNCTOR >
std::size_t olb::SuperLatticePointExtraction< T, DESCRIPTOR, FUNCTOR >::getSize ( ) const
inline

Definition at line 77 of file superLatticePointExtraction.h.

77 {
78 return _extractionPointD.getSize();
79 }

References olb::ColumnVector< COLUMN, D >::getSize().

+ Here is the call graph for this function:

◆ getValue()

template<typename T , typename DESCRIPTOR , typename FUNCTOR >
auto olb::SuperLatticePointExtraction< T, DESCRIPTOR, FUNCTOR >::getValue ( std::size_t iExtracted) const
inline

Definition at line 85 of file superLatticePointExtraction.h.

85 {
86 return _extractionResultD.getField(iExtracted);
87 }
auto getField(std::size_t iCell) const
Return copy of FIELD data for cell iCell.

References olb::FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD >::getField().

+ Here is the call graph for this function:

◆ setParameter()

template<typename T , typename DESCRIPTOR , typename FUNCTOR >
template<typename FIELD >
void olb::SuperLatticePointExtraction< T, DESCRIPTOR, FUNCTOR >::setParameter ( FieldD< T, DESCRIPTOR, FIELD > && value)
inline

Definition at line 90 of file superLatticePointExtraction.h.

90 {
91 _couplingO.template setParameter<FIELD>(std::move(value));
92 }
void setParameter(FieldD< T, DESCRIPTOR, FIELD > &&value)

References olb::SuperLatticePointExtraction< T, DESCRIPTOR, FUNCTOR >::setParameter().

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

◆ update()

template<typename T , typename DESCRIPTOR , typename FUNCTOR >
void olb::SuperLatticePointExtraction< T, DESCRIPTOR, FUNCTOR >::update ( )

Definition at line 96 of file superLatticePointExtraction.hh.

97{
98 _couplingO.execute();
99 _sampleD.setProcessingContext(ProcessingContext::Evaluation);
100
101#ifdef PARALLEL_MODE_MPI
102 FieldArrayD<T,DESCRIPTOR,Platform::CPU_SISD,typename FUNCTOR::result_field> localResultD(
103 _extractionResultD.getSize());
104
105 updateExtractionResultD(localResultD);
106
107 for (unsigned iD=0; iD < DESCRIPTOR::template size<typename FUNCTOR::result_field>(); ++iD) {
108 singleton::mpi().reduce(localResultD[iD].data(),
109 _extractionResultD[iD].data(),
110 _extractionResultD[iD].size(),
111 MPI_SUM);
112 }
113#else
114 updateExtractionResultD(_extractionResultD);
115#endif
116}
std::size_t getSize() const
void reduce(T &sendVal, T &recvVal, MPI_Op op, int root=0, MPI_Comm=MPI_COMM_WORLD)
Reduction operation toward one processor.
MpiManager & mpi()

References olb::Evaluation, olb::singleton::mpi(), and olb::singleton::MpiManager::reduce().

+ Here is the call graph for this function:

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