24#ifndef SUPER_PLANE_INTEGRAL_F_2D_HH
25#define SUPER_PLANE_INTEGRAL_F_2D_HH
40 if ( _geometry.getCuboidGeometry().getFloorLatticeR(physR, latticeR) ) {
41 const int& iX = latticeR[1];
42 const int& iY = latticeR[2];
45 return _integrationIndicatorF->operator()( iC, iX, iY )
46 && _integrationIndicatorF->operator()(iC, iX, iY+1)
47 && _integrationIndicatorF->operator()(iC, iX+1, iY )
48 && _integrationIndicatorF->operator()(iC, iX+1, iY+1);
63 :
SuperF2D<T>(f->getSuperStructure(), 2 + f->getTargetDim()),
66 _integrationIndicatorF(std::move(integrationIndicator)),
67 _subplaneIndicatorF(std::move(subplaneIndicator)),
72 _origin(hyperplaneLattice.getHyperplane().origin),
73 _u(hyperplaneLattice.getVectorU()),
74 _normal(hyperplaneLattice.getHyperplane().normal)
76 this->
getName() =
"SuperPlaneIntegralF2D";
81 for (
const std::tuple<int,int>& pos :
_reductionF.getRankLocalSubplane() ) {
82 const int& i = std::get<0>(pos);
83 const int& iC = std::get<1>(pos);
92 const T physOnHyperplane = physRelativeToOrigin *
_u;
115 std::forward<decltype(f)>(f),
118 std::forward<decltype(integrationIndicator)>(integrationIndicator),
119 std::forward<decltype(subplaneIndicator)>(subplaneIndicator),
131 std::forward<decltype(f)>(f),
134 std::forward<decltype(integrationIndicator)>(integrationIndicator),
144 std::vector<int> materials,
147 std::forward<decltype(f)>(f),
150 geometry.getMaterialIndicator(std::forward<decltype(materials)>(materials)),
161 std::forward<decltype(f)>(f),
164 std::vector<int>(1,1),
172 this->getSuperStructure().communicate();
174 _reductionF.update();
178 std::vector<T> flow(flowDim,0.);
180 for (
int pos : _rankLocalSubplane ) {
181 T outputTmp[flowDim];
182 _reductionF(outputTmp, pos);
184 for (
int j = 0; j < flowDim; j++ ) {
185 flow[j] += outputTmp[j];
189 int vox = _rankLocalSubplane.size();
191#ifdef PARALLEL_MODE_MPI
192 for (
int j = 0; j < flowDim; j++ ) {
198 const T h = _reductionF.getPhysSpacing();
202 output[0] = flow[0] * h;
214 std::copy_n(flow.cbegin(), flowDim, &output[2]);
Smart pointer for managing the various ways of passing functors around.
int getTargetDim() const
read only access to member variable _n
std::string & getName()
read and write access to name
Parametrization of a hyperplane lattice (i.e. a line lattice).
IndicatorF1D is an application from .
represents all functors that operate on a SuperStructure<T,2> in general
Representation of a statistic for a parallel 2D geometry.
Surface integral of a subset of a interpolated hyperplane.
FunctorPtr< IndicatorF1D< T > > _subplaneIndicatorF
Indicator describing the relevant subset of the interpolated hyperplane.
BlockReduction2D1D< T > _reductionF
Functor describing line to be interpolated and integrated.
Vector< T, 2 > _normal
Orthogonal vector to _u.
SuperPlaneIntegralF2D(FunctorPtr< SuperF2D< T > > &&f, SuperGeometry< T, 2 > &geometry, const HyperplaneLattice2D< T > &hyperplaneLattice, FunctorPtr< SuperIndicatorF2D< T > > &&integrationIndicator, FunctorPtr< IndicatorF1D< T > > &&subplaneIndicator, BlockDataReductionMode mode=BlockDataReductionMode::Analytical)
Primary constructor.
std::vector< int > _rankLocalSubplane
Subset of the discrete line points given by _reductionF as indicated by _integrationIndicatorF.
bool isToBeIntegrated(const Vector< T, 2 > &physR, int iC)
This is determined using the _integrationIndicatorF indicated subset of the 2d hyperplane reduced by ...
Vector< T, 2 > _u
Direction vector u as given by hyperplane definition, normalized to h.
bool operator()(T output[], const int input[]) override
Returns the line integral in the following structure:
Vector< T, 2 > _origin
Origin vector as given by hyperplane definition, (0,0) in respect to the subplane indicator _subplane...
void reduceAndBcast(T &reductVal, MPI_Op op, int root=0, MPI_Comm comm=MPI_COMM_WORLD)
Reduction operation, followed by a broadcast.
Groups all include files for the directory genericFunctions.
Top level namespace for all of OpenLB.
BlockDataReductionMode
Mode of reducing block data from given, possibly higher dimensional data.
constexpr Vector< T, D > normalize(const ScalarVector< T, D, IMPL > &a, T scale=T{1})
BlockDataSyncMode
Mode of synchronizing functor block data between processes.
@ None
optimize for usage in e.g. SuperLatticeFlux3D, only rank-local data available
Definition of a analytical line embedded in 2D space.