Commit 5f071be4 authored by Markus Holzer's avatar Markus Holzer
Browse files

Fix VTK writer

parent 7ffef9c6
Pipeline #38626 failed with stages
in 8 minutes and 7 seconds
......@@ -37,24 +37,24 @@ namespace lbm {
* @tparam OutputType
*/
template< typename VelocityField_T, typename Filter_T, typename OutputType = float >
class CurlMagnitudeVTKWriter : public vtk::BlockCellDataWriter< OutputType, 1 >
class CurlMagnitudeVTKWriter : public vtk::BlockCellDataWriter< OutputType >
{
public:
CurlMagnitudeVTKWriter(const shared_ptr<StructuredBlockStorage> blockStorage, Filter_T & filter,
const ConstBlockDataID & velocityFieldId, const std::string & id, const real_t lengthScaleWeight = real_t(-1)) :
vtk::BlockCellDataWriter< OutputType, 1 >(id), blockStorage_(blockStorage), filter_(filter),
velocityFieldId_(velocityFieldId), velocityField_(NULL), lengthScaleWeight_(lengthScaleWeight) {}
vtk::BlockCellDataWriter< OutputType >(id, 1), blockStorage_(blockStorage), filter_(filter),
velocityFieldId_(velocityFieldId), velocityField_(nullptr), lengthScaleWeight_(lengthScaleWeight) {}
protected:
void configure() {
WALBERLA_ASSERT_NOT_NULLPTR( this->block_ );
WALBERLA_ASSERT_NOT_NULLPTR( this->block_ )
velocityField_ = this->block_->template getData< VelocityField_T >(velocityFieldId_ );
}
OutputType evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t /*f*/ )
{
WALBERLA_ASSERT_NOT_NULLPTR(velocityField_ );
WALBERLA_ASSERT_NOT_NULLPTR(velocityField_ )
const real_t dx = blockStorage_->dx(blockStorage_->getLevel(*this->block_));
const real_t dy = blockStorage_->dy(blockStorage_->getLevel(*this->block_));
......
......@@ -39,15 +39,15 @@ public:
using PdfField_T = PdfField<LatticeModel_T>;
DensityVTKWriter( const ConstBlockDataID & pdf, const std::string & id ) :
vtk::BlockCellDataWriter< OutputType >( id ), bdid_( pdf ), pdf_( nullptr ) {}
vtk::BlockCellDataWriter< OutputType >( id, 1 ), bdid_( pdf ), pdf_( nullptr ) {}
protected:
void configure() override { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ); pdf_ = this->block_->template getData< PdfField_T >( bdid_ ); }
void configure() override { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ) pdf_ = this->block_->template getData< PdfField_T >( bdid_ ); }
OutputType evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t /*f*/ ) override
{
WALBERLA_ASSERT_NOT_NULLPTR( pdf_ );
WALBERLA_ASSERT_NOT_NULLPTR( pdf_ )
return numeric_cast< OutputType >( pdf_->getDensity(x,y,z) );
}
......@@ -66,15 +66,15 @@ public:
using PdfField_T = PdfField<LatticeModel_T>;
DensitySIVTKWriter( const ConstBlockDataID & pdf, const real_t rho_SI, const std::string & id ) :
vtk::BlockCellDataWriter< OutputType >( id ), bdid_( pdf ), pdf_( NULL ), rho_SI_( rho_SI ) {}
vtk::BlockCellDataWriter< OutputType >( id ), bdid_( pdf ), pdf_( nullptr ), rho_SI_( rho_SI ) {}
protected:
void configure() { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ); pdf_ = this->block_->template getData< PdfField_T >( bdid_ ); }
void configure() { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ) pdf_ = this->block_->template getData< PdfField_T >( bdid_ ); }
OutputType evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t /*f*/ )
{
WALBERLA_ASSERT_NOT_NULLPTR( pdf_ );
WALBERLA_ASSERT_NOT_NULLPTR( pdf_ )
return numeric_cast< OutputType >( pdf_->getDensitySI( x, y, z, rho_SI_ ) );
}
......
......@@ -37,7 +37,7 @@ namespace lbm {
template< typename LatticeModel_T, typename OutputType = float >
class NonEqulibriumVTKWriter : public vtk::BlockCellDataWriter< OutputType, LatticeModel_T::Stencil::Size >
class NonEqulibriumVTKWriter : public vtk::BlockCellDataWriter< OutputType >
{
public:
......@@ -45,15 +45,15 @@ public:
using Stencil = typename LatticeModel_T::Stencil;
NonEqulibriumVTKWriter( const ConstBlockDataID & pdf, const std::string & id ) :
vtk::BlockCellDataWriter< OutputType, Stencil::Size >( id ), bdid_( pdf ), pdf_( nullptr ) {}
vtk::BlockCellDataWriter< OutputType >( id, uint_c(Stencil::Q) ), bdid_( pdf ), pdf_( nullptr ) {}
protected:
void configure() override { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ); pdf_ = this->block_->template getData< PdfField_T >( bdid_ ); }
void configure() override { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ) pdf_ = this->block_->template getData< PdfField_T >( bdid_ ); }
OutputType evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f ) override
{
WALBERLA_ASSERT_NOT_NULLPTR( pdf_ );
WALBERLA_ASSERT_NOT_NULLPTR( pdf_ )
Vector3<real_t> v;
......
......@@ -32,22 +32,22 @@ namespace lbm {
template< typename LatticeModel_T, typename OutputType = float >
class PressureTensorVTKWriter : public vtk::BlockCellDataWriter< OutputType, 9 >
class PressureTensorVTKWriter : public vtk::BlockCellDataWriter< OutputType>
{
public:
using PdfField_T = PdfField<LatticeModel_T>;
PressureTensorVTKWriter( const ConstBlockDataID & pdfFieldId, const std::string & id ) :
vtk::BlockCellDataWriter< OutputType, 9 >( id ), bdid_( pdfFieldId ), pdf_( NULL ) {}
vtk::BlockCellDataWriter< OutputType >( id, uint_c(9) ), bdid_( pdfFieldId ), pdf_( nullptr ) {}
protected:
void configure() { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ); pdf_ = this->block_->template getData< PdfField_T >( bdid_ ); }
void configure() { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ) pdf_ = this->block_->template getData< PdfField_T >( bdid_ ); }
OutputType evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f )
{
WALBERLA_ASSERT_NOT_NULLPTR( pdf_ );
WALBERLA_ASSERT_NOT_NULLPTR( pdf_ )
return numeric_cast< OutputType >( (pdf_->getPressureTensor(x,y,z))[ uint_c(f) ] );
}
......
......@@ -38,7 +38,7 @@ class QCriterionVTKWriter : public vtk::BlockCellDataWriter< OutputType>
public:
QCriterionVTKWriter(const shared_ptr<StructuredBlockStorage> blockStorage, Filter_T & filter,
const ConstBlockDataID & velocityFieldId, const std::string & id ) :
vtk::BlockCellDataWriter< OutputType>(id), blockStorage_(blockStorage), filter_(filter), velocityFieldId_(velocityFieldId), velocityField_(nullptr) {}
vtk::BlockCellDataWriter< OutputType>(id, uint_c(1)), blockStorage_(blockStorage), filter_(filter), velocityFieldId_(velocityFieldId), velocityField_(nullptr) {}
protected:
......
......@@ -42,7 +42,7 @@ public:
void operator()( CellSet& filteredCells, const IBlock& block, const StructuredBlockStorage& storage,
const uint_t ghostLayers = uint_t(0) ) {
const VelocityField_T* velocityField = block.getData< VelocityField_T >( velocityFieldId_ );
WALBERLA_CHECK_NOT_NULLPTR(velocityField);
WALBERLA_CHECK_NOT_NULLPTR(velocityField)
const real_t dx = storage.dx(storage.getLevel(block));
const real_t dy = storage.dy(storage.getLevel(block));
......
......@@ -32,22 +32,22 @@ namespace lbm {
template< typename LatticeModel_T, typename OutputType = float >
class VelocityVTKWriter : public vtk::BlockCellDataWriter< OutputType, 3 >
class VelocityVTKWriter : public vtk::BlockCellDataWriter< OutputType >
{
public:
using PdfField_T = PdfField<LatticeModel_T>;
VelocityVTKWriter( const ConstBlockDataID & pdfFieldId, const std::string & id ) :
vtk::BlockCellDataWriter< OutputType, 3 >( id ), bdid_( pdfFieldId ), pdf_( nullptr ) {}
vtk::BlockCellDataWriter< OutputType >( id, uint_c(3) ), bdid_( pdfFieldId ), pdf_( nullptr ) {}
protected:
void configure() override { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ); pdf_ = this->block_->template getData< PdfField_T >( bdid_ ); }
void configure() override { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ) pdf_ = this->block_->template getData< PdfField_T >( bdid_ ); }
OutputType evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f ) override
{
WALBERLA_ASSERT_NOT_NULLPTR( pdf_ );
WALBERLA_ASSERT_NOT_NULLPTR( pdf_ )
return numeric_cast< OutputType >( (pdf_->getVelocity(x,y,z))[ uint_c(f) ] );
}
......@@ -59,22 +59,22 @@ protected:
template< typename LatticeModel_T, typename OutputType = float >
class VelocityMagnitudeVTKWriter : public vtk::BlockCellDataWriter< OutputType, 1 >
class VelocityMagnitudeVTKWriter : public vtk::BlockCellDataWriter< OutputType >
{
public:
using PdfField_T = PdfField<LatticeModel_T>;
VelocityMagnitudeVTKWriter( const ConstBlockDataID & pdfFieldId, const std::string & id ) :
vtk::BlockCellDataWriter< OutputType, 1 >( id ), bdid_( pdfFieldId ), pdf_( nullptr ) {}
vtk::BlockCellDataWriter< OutputType >( id, uint_c(1) ), bdid_( pdfFieldId ), pdf_( nullptr ) {}
protected:
void configure() override { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ); pdf_ = this->block_->template getData< PdfField_T >( bdid_ ); }
void configure() override { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ) pdf_ = this->block_->template getData< PdfField_T >( bdid_ ); }
OutputType evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t /*f*/ ) override
{
WALBERLA_ASSERT_NOT_NULLPTR( pdf_ );
WALBERLA_ASSERT_NOT_NULLPTR( pdf_ )
return numeric_cast< OutputType >( pdf_->getVelocity(x,y,z).length() );
}
......@@ -86,22 +86,22 @@ protected:
template< typename LatticeModel_T, typename OutputType = float >
class VelocitySIVTKWriter : public vtk::BlockCellDataWriter< OutputType, 3 >
class VelocitySIVTKWriter : public vtk::BlockCellDataWriter< OutputType >
{
public:
using PdfField_T = PdfField<LatticeModel_T>;
VelocitySIVTKWriter( const ConstBlockDataID & pdfFieldId, const real_t dx_SI, const real_t dt_SI, const std::string & id ) :
vtk::BlockCellDataWriter< OutputType, 3 >( id ), bdid_( pdfFieldId ), pdf_( NULL ), dxDividedByDt_SI_( dx_SI / dt_SI ) {}
vtk::BlockCellDataWriter< OutputType >( id, uint_c(3)), bdid_( pdfFieldId ), pdf_( nullptr ), dxDividedByDt_SI_( dx_SI / dt_SI ) {}
protected:
void configure() { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ); pdf_ = this->block_->template getData< PdfField_T >( bdid_ ); }
void configure() { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ) pdf_ = this->block_->template getData< PdfField_T >( bdid_ ); }
OutputType evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f )
{
WALBERLA_ASSERT_NOT_NULLPTR( pdf_ );
WALBERLA_ASSERT_NOT_NULLPTR( pdf_ )
return numeric_cast< OutputType >( (pdf_->getVelocitySI( x, y, z, dxDividedByDt_SI_ ))[ uint_c(f) ] );
}
......@@ -114,22 +114,22 @@ protected:
template< typename LatticeModel_T, typename OutputType = float >
class VelocitySIMagnitudeVTKWriter : public vtk::BlockCellDataWriter< OutputType, 1 >
class VelocitySIMagnitudeVTKWriter : public vtk::BlockCellDataWriter< OutputType >
{
public:
using PdfField_T = PdfField<LatticeModel_T>;
VelocitySIMagnitudeVTKWriter( const ConstBlockDataID & pdfFieldId, const real_t dx_SI, const real_t dt_SI, const std::string & id ) :
vtk::BlockCellDataWriter< OutputType, 1 >( id ), bdid_( pdfFieldId ), pdf_( NULL ), dxDividedByDt_SI_( dx_SI / dt_SI ) {}
vtk::BlockCellDataWriter< OutputType >( id, uint_c(1) ), bdid_( pdfFieldId ), pdf_( nullptr ), dxDividedByDt_SI_( dx_SI / dt_SI ) {}
protected:
void configure() { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ); pdf_ = this->block_->template getData< PdfField_T >( bdid_ ); }
void configure() { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ) pdf_ = this->block_->template getData< PdfField_T >( bdid_ ); }
OutputType evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t /*f*/ )
{
WALBERLA_ASSERT_NOT_NULLPTR( pdf_ );
WALBERLA_ASSERT_NOT_NULLPTR( pdf_ )
return numeric_cast< OutputType >( pdf_->getVelocitySI( x, y, z, dxDividedByDt_SI_ ).length() );
}
......
......@@ -41,7 +41,7 @@ public:
void operator()( CellSet& filteredCells, const IBlock& block, const StructuredBlockStorage& storage,
const uint_t ghostLayers = uint_t(0) ) {
const PdfField_T* pdf = block.getData< PdfField_T >( pdfFieldId_ );
WALBERLA_CHECK_NOT_NULLPTR(pdf);
WALBERLA_CHECK_NOT_NULLPTR(pdf)
filter_(block);
......
......@@ -33,14 +33,14 @@ namespace lbm {
template< typename VelocityField_T, typename Filter_T, typename OutputType = float >
class VorticityComponentVTKWriter : public vtk::BlockCellDataWriter< OutputType, 1 >
class VorticityComponentVTKWriter : public vtk::BlockCellDataWriter< OutputType>
{
public:
VorticityComponentVTKWriter(const shared_ptr<StructuredBlockStorage> blockStorage, Filter_T & filter,
const ConstBlockDataID & velocityFieldId, const uint_t componentIdx, const std::string & id,
const real_t normalizationConstant = real_t(1)) :
vtk::BlockCellDataWriter< OutputType, 1 >(id), blockStorage_(blockStorage), filter_(filter),
velocityFieldId_(velocityFieldId), componentIdx_(componentIdx), velocityField_(NULL),
vtk::BlockCellDataWriter< OutputType >(id, uint_c(1)), blockStorage_(blockStorage), filter_(filter),
velocityFieldId_(velocityFieldId), componentIdx_(componentIdx), velocityField_(nullptr),
normalizationConstant_(normalizationConstant) {
WALBERLA_ASSERT(componentIdx < uint_t(3),
"The vorticity vector only has three components, i.e. the highest possible component index is 2.");
......@@ -49,12 +49,12 @@ public:
protected:
void configure() {
WALBERLA_ASSERT_NOT_NULLPTR( this->block_ );
WALBERLA_ASSERT_NOT_NULLPTR( this->block_ )
velocityField_ = this->block_->template getData< VelocityField_T >(velocityFieldId_ );
}
OutputType evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t /*f*/ ) {
WALBERLA_ASSERT_NOT_NULLPTR(velocityField_ );
WALBERLA_ASSERT_NOT_NULLPTR(velocityField_ )
const real_t dx = blockStorage_->dx(blockStorage_->getLevel(*this->block_));
const real_t dy = blockStorage_->dy(blockStorage_->getLevel(*this->block_));
......
......@@ -219,7 +219,7 @@ public:
using value_type = T;
BlockCellDataWriter( const std::string & id) : BlockCellDataWriterInterface( id ), fSize_(0) {}
BlockCellDataWriter( const std::string & id) : BlockCellDataWriterInterface( id ), fSize_(uint_t(1)) {}
BlockCellDataWriter( const std::string & id, const uint_t fSize) : BlockCellDataWriterInterface( id ), fSize_(fSize) {}
~BlockCellDataWriter() override = default;
void push( std::ostream & os, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f ) override
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment