OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
olb::BlockIndicatorMaterial3D< T > Class Template Reference

Block indicator functor from material numbers. More...

#include <blockIndicatorF3D.h>

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

Public Member Functions

 BlockIndicatorMaterial3D (BlockGeometry< T, 3 > &blockGeometry, std::vector< int > materials)
 
 BlockIndicatorMaterial3D (BlockGeometry< T, 3 > &blockGeometry, std::list< int > materials)
 
 BlockIndicatorMaterial3D (BlockGeometry< T, 3 > &blockGeometry, int material)
 
bool operator() (bool output[], const int input[]) override
 
bool isEmpty () override
 Returns true iff indicated domain subset is empty.
 
Vector< int, 3 > getMin () override
 Returns min lattice position of the indicated domain's bounding box.
 
Vector< int, 3 > getMax () override
 Returns max lattice position of the indicated domain's bounding box.
 
- Public Member Functions inherited from olb::BlockIndicatorF3D< T >
 BlockIndicatorF3D (BlockGeometry< T, 3 > &geometry)
 
BlockGeometry< T, 3 > & getBlockGeometry ()
 Get underlying block geometry structure.
 
bool operator() (const int input[])
 Block indicator specific function operator overload.
 
bool operator() (int iX, int iY, int iZ)
 
bool operator() (LatticeR< 3 > loc)
 
void setCache (const BlockData< 3, T, bool > &cache)
 Set bool-mask cache to be used by indicator operator overloads.
 
- Public Member Functions inherited from olb::BlockF3D< bool >
 ~BlockF3D () override
 virtual destructor for defined behaviour
 
virtual BlockStructureD< 3 > & getBlockStructure () const
 
BlockF3D< bool > & operator- (BlockF3D< bool > &rhs)
 
BlockF3D< bool > & operator+ (BlockF3D< bool > &rhs)
 
BlockF3D< bool > & operator* (BlockF3D< bool > &rhs)
 
BlockF3D< bool > & operator/ (BlockF3D< bool > &rhs)
 
- Public Member Functions inherited from olb::GenericF< T, S >
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 S 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[], S input0)
 
bool operator() (T output[], S input0, S input1)
 
bool operator() (T output[], S input0, S input1, S input2)
 
bool operator() (T output[], S input0, S input1, S input2, S input3)
 

Protected Attributes

const std::vector< int > _materials
 
- Protected Attributes inherited from olb::BlockIndicatorF3D< T >
BlockGeometry< T, 3 > & _block
 
const BlockData< 3, T, bool > * _cachedData
 
- Protected Attributes inherited from olb::BlockF3D< bool >
BlockStructureD< 3 > & _blockStructure
 

Additional Inherited Members

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

Detailed Description

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

Block indicator functor from material numbers.

Definition at line 82 of file blockIndicatorF3D.h.

Constructor & Destructor Documentation

◆ BlockIndicatorMaterial3D() [1/3]

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

Definition at line 113 of file blockIndicatorF3D.hh.

115 : BlockIndicatorF3D<T>(blockGeometry),
116 _materials(materials)
117{ }
const std::vector< int > _materials

◆ BlockIndicatorMaterial3D() [2/3]

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

Definition at line 120 of file blockIndicatorF3D.hh.

122 : BlockIndicatorMaterial3D(blockGeometry,
123 std::vector<int>(materials.begin(), materials.end()))
124{ }
BlockIndicatorMaterial3D(BlockGeometry< T, 3 > &blockGeometry, std::vector< int > materials)

◆ BlockIndicatorMaterial3D() [3/3]

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

Definition at line 127 of file blockIndicatorF3D.hh.

129 : BlockIndicatorMaterial3D(blockGeometry, std::vector<int>(1,material))
130{ }

Member Function Documentation

◆ getMax()

template<typename T >
Vector< int, 3 > olb::BlockIndicatorMaterial3D< T >::getMax ( )
overridevirtual

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

Implements olb::BlockIndicatorF3D< T >.

Definition at line 185 of file blockIndicatorF3D.hh.

186{
187 auto& statistics = this->getBlockGeometry().getStatistics();
188
189 Vector<int,3> globalMax = -this->getBlockGeometry().getPadding();
190
191 for ( int material : _materials ) {
192 if ( statistics.getNvoxel(material) > 0 ) {
193 const Vector<int,3> localMax = statistics.getMaxLatticeR(material);
194 for ( int d = 0; d < 3; ++d ) {
195 globalMax[d] = localMax[d] > globalMax[d] ? localMax[d] : globalMax[d];
196 }
197 }
198 }
199
200 return globalMax;
201}
const BlockGeometryStatistics< T, D > & getStatistics() const
Read only access to the associated block statistic.
BlockGeometry< T, 3 > & getBlockGeometry()
Get underlying block geometry structure.
int getPadding() const
Read only access to padding.
constexpr int d() any_platform

◆ getMin()

template<typename T >
Vector< int, 3 > olb::BlockIndicatorMaterial3D< T >::getMin ( )
overridevirtual

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

Implements olb::BlockIndicatorF3D< T >.

Definition at line 161 of file blockIndicatorF3D.hh.

162{
163 auto& blockGeometry = this->getBlockGeometry();
164 auto& statistics = blockGeometry.getStatistics();
165
166 Vector<int,3> globalMin{
167 blockGeometry.getNx()+blockGeometry.getPadding()-1,
168 blockGeometry.getNy()+blockGeometry.getPadding()-1,
169 blockGeometry.getNz()+blockGeometry.getPadding()-1,
170 };
171
172 for ( int material : _materials ) {
173 if ( statistics.getNvoxel(material) > 0 ) {
174 const Vector<int,3> localMin = statistics.getMinLatticeR(material);
175 for ( int d = 0; d < 3; ++d ) {
176 globalMin[d] = localMin[d] < globalMin[d] ? localMin[d] : globalMin[d];
177 }
178 }
179 }
180
181 return globalMin;
182}

◆ isEmpty()

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

Returns true iff indicated domain subset is empty.

Reimplemented from olb::BlockIndicatorF3D< T >.

Definition at line 150 of file blockIndicatorF3D.hh.

151{
152 auto& statistics = this->getBlockGeometry().getStatistics();
153
154 return std::none_of(_materials.cbegin(), _materials.cend(),
155 [&statistics](int material) -> bool {
156 return statistics.getNvoxel(material) > 0;
157 });
158}

◆ operator()()

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

Definition at line 133 of file blockIndicatorF3D.hh.

134{
135 // read material number explicitly using the const version
136 // of BlockGeometry<T,3>::get to avoid resetting geometry
137 // statistics:
138 const auto& blockGeometry = this->getBlockGeometry();
139 const int current = blockGeometry.getMaterial({input[0], input[1], input[2]});
140 output[0] = std::any_of(_materials.cbegin(),
141 _materials.cend(),
142 [current](int material) {
143 return current == material;
144 });
145
146 return true;
147}

Member Data Documentation

◆ _materials

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

Definition at line 84 of file blockIndicatorF3D.h.


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