24#ifndef BLOCK_INDICATOR_F_2D_HH
25#define BLOCK_INDICATOR_F_2D_HH
38 _indicatorF(indicatorF)
44 auto physR = this->_blockGeometryStructure.getPhysR(input);
45 return _indicatorF(output, physR.data());
69template <
typename T,
bool HLBM>
73 _indicatorF(indicatorF)
76template <
typename T,
bool HLBM>
80 auto physR = this->_blockGeometryStructure.getPhysR(input);
81 _indicatorF(inside, physR.data());
85template <
typename T,
bool HLBM>
91template <
typename T,
bool HLBM>
94 return this->_blockGeometryStructure.getExtent() -
Vector<int,2> {1,1};
102 _materials(materials)
109 std::vector<int>(materials.begin(), materials.end()))
125 const int current = blockGeometry.
getMaterial({input[0], input[1]});
126 output[0] = std::any_of(_materials.cbegin(),
128 [current](
int material) {
129 return current == material;
138 const auto& statistics = this->getBlockGeometry().getStatistics();
139 return std::none_of(_materials.cbegin(), _materials.cend(),
140 [&statistics](
int material) ->
bool {
141 return statistics.getNvoxel(material) > 0;
148 const auto& blockGeometry = this->getBlockGeometry();
149 const auto& statistics = blockGeometry.getStatistics();
152 blockGeometry.getNx()+blockGeometry.getPadding()-1,
153 blockGeometry.getNy()+blockGeometry.getPadding()-1
156 for (
int material : _materials ) {
157 if ( statistics.getNvoxel(material) > 0 ) {
158 const Vector<int,2> localMin = statistics.getMinLatticeR(material);
159 for (
int d = 0; d < 2; ++d ) {
160 globalMin[d] = localMin[d] < globalMin[d] ? localMin[d] : globalMin[d];
171 const auto& statistics = this->getBlockGeometry().getStatistics();
173 Vector<int,2> globalMax = -this->getBlockGeometry().getPadding();
175 for (
int material : _materials ) {
176 if ( statistics.getNvoxel(material) > 0 ) {
178 const Vector<int,2> localMax = statistics.getMaxLatticeR(material);
179 for (
int d = 0; d < 2; ++d ) {
180 globalMax[d] = localMax[d] > globalMax[d] ? localMax[d] : globalMax[d];
192 _indicatorF(indicatorF)
198 return _indicatorF(output, input);
204 return _indicatorF.getMin();
210 return _indicatorF.getMax();
217 _indicatorF(indicatorF),
225 if ( this->getBlockGeometry().getMaterial(input[0],input[1]) != 0 ) {
227 for (
int iXo = -_overlap; iXo <= _overlap; ++iXo ) {
228 for (
int iYo = -_overlap; iYo <= _overlap; ++iYo ) {
229 const int neighborPos[2] = {iXo + input[0], iYo + input[1]};
230 if ( _indicatorF ( neighborPos ) &&
231 this->getBlockGeometry().isInside( neighborPos ) ) {
244 return _indicatorF.getMin() - _overlap;
250 return _indicatorF.getMax() + _overlap;
Representation of a block geometry.
int getMaterial(LatticeR< D > latticeR) const
returns the (iX,iY) entry in the 2D scalar field
Vector< int, 2 > getMax() override
Returns max lattice position of the indicated domain's bounding box.
BlockIndicatorBoundaryNeighbor2D(BlockIndicatorF2D< T > &indicatorF, int overlap)
bool operator()(bool output[], const int input[]) override
has to be implemented for 'every' derived class
Vector< int, 2 > getMin() override
Returns min lattice position of the indicated domain's bounding box.
Base block indicator functor (discrete)
Vector< int, 2 > getMax() override
Returns max lattice position of the indicated domain's bounding box.
BlockIndicatorFfromIndicatorF2D(IndicatorF2D< T > &indicatorF, BlockGeometry< T, 2 > &blockGeometry)
Vector< int, 2 > getMin() override
Returns min lattice position of the indicated domain's bounding box.
bool operator()(bool output[], const int input[]) override
has to be implemented for 'every' derived class
bool operator()(bool output[], const int input[]) override
has to be implemented for 'every' derived class
Vector< int, 2 > getMin() override
Returns a min lattice position of the indicated domain's bounding box.
Vector< int, 2 > getMax() override
Returns a max lattice position of the indicated domain's bounding box.
BlockIndicatorFfromSmoothIndicatorF2D(SmoothIndicatorF2D< T, T, HLBM > &indicatorF, BlockGeometry< T, 2 > &blockGeometry)
bool operator()(bool output[], const int input[]) override
has to be implemented for 'every' derived class
BlockIndicatorIdentity2D(BlockIndicatorF2D< T > &indicatorF)
Vector< int, 2 > getMin() override
Returns min lattice position of the indicated domain's bounding box.
Vector< int, 2 > getMax() override
Returns max lattice position of the indicated domain's bounding box.
Block indicator functor from material numbers.
Vector< int, 2 > getMax() override
Returns max lattice position of the indicated domain's bounding box.
bool operator()(bool output[], const int input[]) override
has to be implemented for 'every' derived class
bool isEmpty() override
Returns true iff indicated domain subset is empty.
BlockIndicatorMaterial2D(BlockGeometry< T, 2 > &blockGeometry, std::vector< int > materials)
Vector< int, 2 > getMin() override
Returns min lattice position of the indicated domain's bounding box.
IndicatorF2D is an application from .
ADf< T, DIM > ceil(const ADf< T, DIM > &a)
ADf< T, DIM > floor(const ADf< T, DIM > &a)
bool nearZero(T a) any_platform
return true if a is close to zero
Top level namespace for all of OpenLB.
Set of functions commonly used in LB computations – header file.