OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::BlockIndicatorMaterial2D< T > Class Template Reference

Block indicator functor from material numbers. More...

#include <blockIndicatorF2D.h>

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

Public Member Functions

 BlockIndicatorMaterial2D (BlockGeometry< T, 2 > &blockGeometry, std::vector< int > materials)
 
 BlockIndicatorMaterial2D (BlockGeometry< T, 2 > &blockGeometry, std::list< int > materials)
 
 BlockIndicatorMaterial2D (BlockGeometry< T, 2 > &blockGeometry, int material)
 
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.
 
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.
 
- Public Member Functions inherited from olb::BlockIndicatorF2D< T >
 BlockIndicatorF2D (BlockGeometry< T, 2 > &geometry)
 
BlockGeometry< T, 2 > & getBlockGeometry ()
 Get underlying block geometry structure.
 
bool operator() (const int input[])
 Block indicator specific function operator overload.
 
bool operator() (int iX, int iY)
 
bool operator() (LatticeR< 2 > loc)
 
void setCache (const BlockData< 2, T, bool > &cache)
 Set bool-mask cache to be used by indicator operator overloads.
 
- Public Member Functions inherited from olb::BlockF2D< bool >
virtual BlockStructureD< 2 > & getBlockStructure ()
 virtual destructor for defined behaviour
 
void setBlockStructure (BlockStructureD< 2 > *blockStructure)
 
BlockF2D< bool > & operator- (BlockF2D< bool > &rhs)
 
BlockF2D< bool > & operator+ (BlockF2D< bool > &rhs)
 
BlockF2D< bool > & operator* (BlockF2D< bool > &rhs)
 
BlockF2D< bool > & operator/ (BlockF2D< bool > &rhs)
 
- Public Member Functions inherited from olb::GenericF< bool, 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
 
bool operator() (bool output[])
 wrapper that call the pure virtual operator() (T output[], const S input[]) from above
 
bool operator() (bool output[], int input0)
 
bool operator() (bool output[], int input0, int input1)
 
bool operator() (bool output[], int input0, int input1, int input2)
 
bool operator() (bool output[], int input0, int input1, int input2, int input3)
 

Protected Attributes

const std::vector< int > _materials
 
- Protected Attributes inherited from olb::BlockIndicatorF2D< T >
BlockGeometry< T, 2 > & _blockGeometryStructure
 
const BlockData< 2, T, bool > * _cachedData
 
- Protected Attributes inherited from olb::BlockF2D< bool >
BlockStructureD< 2 > * _blockStructure
 

Additional Inherited Members

- Public Types inherited from olb::GenericF< bool, int >
using targetType
 
using sourceType
 
- Public Attributes inherited from olb::GenericF< bool, int >
std::shared_ptr< GenericF< bool, int > > _ptrCalcC
 memory management, frees resouces (calcClass)
 
- Protected Member Functions inherited from olb::BlockF2D< bool >
 BlockF2D (BlockStructureD< 2 > &blockStructure, int targetDim)
 
 BlockF2D (int targetDim)
 
- Protected Member Functions inherited from olb::GenericF< bool, int >
 GenericF (int targetDim, int sourceDim)
 

Detailed Description

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

Block indicator functor from material numbers.

Definition at line 213 of file aliases.h.

Constructor & Destructor Documentation

◆ BlockIndicatorMaterial2D() [1/3]

template<typename T >
olb::BlockIndicatorMaterial2D< T >::BlockIndicatorMaterial2D ( BlockGeometry< T, 2 > & blockGeometry,
std::vector< int > materials )
Parameters
blockGeometryBlock geometry structue to be queried
materialsMaterial number vector

Definition at line 99 of file blockIndicatorF2D.hh.

101 : BlockIndicatorF2D<T>(blockGeometry),
102 _materials(materials)
103{ }
BlockIndicatorF2D(BlockGeometry< T, 2 > &geometry)
const std::vector< int > _materials

◆ BlockIndicatorMaterial2D() [2/3]

template<typename T >
olb::BlockIndicatorMaterial2D< T >::BlockIndicatorMaterial2D ( BlockGeometry< T, 2 > & blockGeometry,
std::list< int > materials )
Parameters
blockGeometryBlock geometry structure to be queried
materialsMaterial number list

Definition at line 106 of file blockIndicatorF2D.hh.

108 : BlockIndicatorMaterial2D(blockGeometry,
109 std::vector<int>(materials.begin(), materials.end()))
110{ }
BlockIndicatorMaterial2D(BlockGeometry< T, 2 > &blockGeometry, std::vector< int > materials)

◆ BlockIndicatorMaterial2D() [3/3]

template<typename T >
olb::BlockIndicatorMaterial2D< T >::BlockIndicatorMaterial2D ( BlockGeometry< T, 2 > & blockGeometry,
int material )
Parameters
blockGeometryBlock geometry structure to be queried
materialMaterial number

Definition at line 113 of file blockIndicatorF2D.hh.

115 : BlockIndicatorMaterial2D(blockGeometry, std::vector<int>(1,material))
116{ }

Member Function Documentation

◆ getMax()

template<typename T >
Vector< int, 2 > olb::BlockIndicatorMaterial2D< T >::getMax ( )
overridevirtual

Returns max lattice position of the indicated domain's bounding box.

Implements olb::BlockIndicatorF2D< T >.

Definition at line 169 of file blockIndicatorF2D.hh.

170{
171 const auto& statistics = this->getBlockGeometry().getStatistics();
172
173 Vector<int,2> globalMax = -this->getBlockGeometry().getPadding();
174
175 for ( int material : _materials ) {
176 if ( statistics.getNvoxel(material) > 0 ) {
177
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];
181 }
182 }
183 }
184
185 return globalMax;
186}
const BlockGeometryStatistics< T, D > & getStatistics() const
Read only access to the associated block statistic.
BlockGeometry< T, 2 > & getBlockGeometry()
Get underlying block geometry structure.
int getPadding() const
Read only access to padding.
constexpr int d() any_platform
Definition functions.h:127
Vector(T &&t, Ts &&... ts) -> Vector< std::remove_cvref_t< T >, 1+sizeof...(Ts)>

◆ getMin()

template<typename T >
Vector< int, 2 > olb::BlockIndicatorMaterial2D< T >::getMin ( )
overridevirtual

Returns min lattice position of the indicated domain's bounding box.

Implements olb::BlockIndicatorF2D< T >.

Definition at line 146 of file blockIndicatorF2D.hh.

147{
148 const auto& blockGeometry = this->getBlockGeometry();
149 const auto& statistics = blockGeometry.getStatistics();
150
151 Vector<int,2> globalMin{
152 blockGeometry.getNx()+blockGeometry.getPadding()-1,
153 blockGeometry.getNy()+blockGeometry.getPadding()-1
154 };
155
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];
161 }
162 }
163 }
164
165 return globalMin;
166}

◆ isEmpty()

template<typename T >
bool olb::BlockIndicatorMaterial2D< T >::isEmpty ( )
overridevirtual

Returns true iff indicated domain subset is empty.

Reimplemented from olb::BlockIndicatorF2D< T >.

Definition at line 136 of file blockIndicatorF2D.hh.

137{
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;
142 });
143}

◆ operator()()

template<typename T >
bool olb::BlockIndicatorMaterial2D< T >::operator() ( bool output[],
const int input[] )
overridevirtual

has to be implemented for 'every' derived class

Implements olb::GenericF< bool, int >.

Definition at line 119 of file blockIndicatorF2D.hh.

120{
121 // read material number explicitly using the const version
122 // of BlockGeometry<T,2>::get to avoid resetting geometry
123 // statistics:
124 const BlockGeometry<T,2>& blockGeometry = this->_blockGeometryStructure;
125 const int current = blockGeometry.getMaterial({input[0], input[1]});
126 output[0] = std::any_of(_materials.cbegin(),
127 _materials.cend(),
128 [current](int material) {
129 return current == material;
130 });
131
132 return true;
133}
int getMaterial(LatticeR< D > latticeR) const
returns the (iX,iY) entry in the 2D scalar field
BlockGeometry< T, 2 > & _blockGeometryStructure

References olb::BlockGeometry< T, D >::getMaterial().

+ Here is the call graph for this function:

Member Data Documentation

◆ _materials

template<typename T >
const std::vector<int> olb::BlockIndicatorMaterial2D< T >::_materials
protected

Definition at line 117 of file blockIndicatorF2D.h.


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