OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
olb::AnalyticalPorosityVolumeF< T > Class Template Referencefinal

#include <analyticalPorosityVolumeF.h>

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

Public Member Functions

 AnalyticalPorosityVolumeF (std::string fileName, T spacing)
 
Vector< T, 3 > getPhysShape () const
 
bool operator() (T output[], const T physR[]) override
 
- Public Member Functions inherited from olb::AnalyticalF< 3, T, T >
AnalyticalF< D, T, T > & operator- (AnalyticalF< D, T, T > &rhs)
 
AnalyticalF< D, T, T > & operator+ (AnalyticalF< D, T, T > &rhs)
 
AnalyticalF< D, T, T > & operator* (AnalyticalF< D, T, T > &rhs)
 
AnalyticalF< D, T, T > & operator/ (AnalyticalF< D, T, T > &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)
 

Additional Inherited Members

- Public Types inherited from olb::AnalyticalF< 3, T, T >
using identity_functor_type
 
- 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)
 
- Static Public Attributes inherited from olb::AnalyticalF< 3, T, T >
static constexpr unsigned dim
 
- Protected Member Functions inherited from olb::AnalyticalF< 3, T, T >
 AnalyticalF (int n)
 
- Protected Member Functions inherited from olb::GenericF< T, S >
 GenericF (int targetDim, int sourceDim)
 

Detailed Description

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

Definition at line 42 of file analyticalPorosityVolumeF.h.

Constructor & Destructor Documentation

◆ AnalyticalPorosityVolumeF()

template<typename T >
olb::AnalyticalPorosityVolumeF< T >::AnalyticalPorosityVolumeF ( std::string fileName,
T spacing )
inline

Definition at line 56 of file analyticalPorosityVolumeF.h.

57 : AnalyticalF<3,T,T>(1), _spacing{spacing}
58 {
59 OstreamManager clout(std::cout, "PorosityVolumeImporter");
60 _fileName = fileName;
61 #ifdef FEATURE_VDB
62 if (isVDBFile(_fileName)) {
63 openvdb::initialize();
64 openvdb::io::File _vdbFile(_fileName);
65 // Read the OpenVDB file
66 _vdbFile.open();
67 grids = _vdbFile.getGrids();
68 auto grid = openvdb::gridPtrCast<openvdb::FloatGrid>(*grids->begin());
69 _vdbFile.close();
70 openvdb::CoordBBox bounds = grid->evalActiveVoxelBoundingBox();
71 _shape[0] = bounds.max().x() - bounds.min().x();
72 _shape[1] = bounds.max().y() - bounds.min().y();
73 _shape[2] = bounds.max().z() - bounds.min().z();
74 }
75 #endif
76 #if not defined(FEATURE_VTK)
77 if (isVTKFile(_fileName))
78 {
79 std::cerr << "To use the VTK format, add VTK to the FEATURES list in config.mk";
80 exit(1);
81 }
82 #endif
83 #if defined(FEATURE_VTK)
84 if (isVTKFile(_fileName)) {
85 _reader->SetFileName(fileName.c_str());
86 _reader->Update();
87 _reader->SetScalarsName(_reader->GetScalarsNameInFile(0));
88 auto* _data = _reader->GetOutput();
89 _data->GetDimensions(_shape.data());
90 }
91 #endif
92 #ifndef FEATURE_VDB
93 if (isVDBFile(_fileName))
94 {
95 std::cerr << "To use the VDB format, add VDB to the FEATURES list in config.mk";
96 exit(1);
97 }
98 #endif
99 }
constexpr const T * data() const any_platform
Definition vector.h:161
void exit(int exitcode)
Definition singleton.h:165

References olb::Vector< T, D >::data().

+ Here is the call graph for this function:

Member Function Documentation

◆ getPhysShape()

template<typename T >
Vector< T, 3 > olb::AnalyticalPorosityVolumeF< T >::getPhysShape ( ) const
inline

Definition at line 101 of file analyticalPorosityVolumeF.h.

101 {
102 return _shape * _spacing;
103 }

◆ operator()()

template<typename T >
bool olb::AnalyticalPorosityVolumeF< T >::operator() ( T output[],
const T physR[] )
inlineoverride

Definition at line 105 of file analyticalPorosityVolumeF.h.

105 {
106 #ifdef FEATURE_VDB
107 if (isVDBFile(_fileName)) {
108 int iX;
109 int iY;
110 int iZ;
111 iX = util::floor(physR[0] / _spacing);
112 iY = util::floor(physR[1] / _spacing);
113 iZ = util::floor(physR[2] / _spacing);
114 if (iX >= 0 && iY >= 0 && iZ >= 0 && iX < _shape[0] && iY < _shape[1] && iZ < _shape[2]) {
115 auto grid = openvdb::gridPtrCast<openvdb::FloatGrid>(*grids->begin());
116 openvdb::Coord location(iX, iY, iZ);
117 openvdb::FloatGrid::Accessor accessor = grid->getAccessor();
118 output[0] =accessor.getValue(location);
119 } else {
120 output[0]=0;
121 }
122 return true;
123 }
124 #endif
125 #if defined(FEATURE_VTK)
126 if(isVTKFile(_fileName)) {
127 int iX;
128 int iY;
129 int iZ;
130 iX = util::floor(physR[0] / _spacing);
131 iY = util::floor(physR[1] / _spacing);
132 iZ = util::floor(physR[2] / _spacing);
133 if (iX >= 0 && iY >= 0 && iZ >= 0 && iX < _shape[0] && iY < _shape[1] && iZ < _shape[2]) {
134 auto* _data = _reader->GetOutput();
135 output[0] = *static_cast<T*>(_data->GetScalarPointer(iX, iY, iZ));
136 } else {
137 output[0] = 0;
138 }
139 return true;
140 }
141 #endif
142 return false;
143 }
ADf< T, DIM > floor(const ADf< T, DIM > &a)
Definition aDiff.h:869

References olb::util::floor().

+ Here is the call graph for this function:

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