Commit 8c534baf authored by Christoph Rettinger's avatar Christoph Rettinger
Browse files

Added field traversal option to LBM boundary handling factories

parent c95e416e
......@@ -89,7 +89,18 @@ public:
const real_t pressure0,
const real_t pressure1 )
{
DefaultBoundaryHandlingFactory factory ( flagFieldID, pdfFieldID, flagUIDSet, velocity0, velocity1, pressure0, pressure1 );
return addBoundaryHandlingToStorage(bs, identifier, flagFieldID, pdfFieldID, flagUIDSet, velocity0, velocity1, pressure0, pressure1, BoundaryHandling::Mode::OPTIMIZED_SPARSE_TRAVERSAL);
}
static BlockDataID addBoundaryHandlingToStorage( const shared_ptr< StructuredBlockStorage > & bs, const std::string & identifier,
BlockDataID flagFieldID, BlockDataID pdfFieldID, const Set< FlagUID > & flagUIDSet,
const Vector3<real_t> & velocity0,
const Vector3<real_t> & velocity1,
const real_t pressure0,
const real_t pressure1,
const typename BoundaryHandling::Mode boundaryHandlingTraversalMode )
{
DefaultBoundaryHandlingFactory factory ( flagFieldID, pdfFieldID, flagUIDSet, velocity0, velocity1, pressure0, pressure1, boundaryHandlingTraversalMode );
return bs->addStructuredBlockData< BoundaryHandling >( factory, identifier );
}
......@@ -110,8 +121,9 @@ public:
DefaultBoundaryHandlingFactory( const BlockDataID & flagField, const BlockDataID & pdfField, const Set< FlagUID > & flagUIDSet,
const Velocity velocity0, const Velocity velocity1,
const real_t pressure0, const real_t pressure1 );
const Velocity velocity0, const Velocity velocity1,
const real_t pressure0, const real_t pressure1,
const typename BoundaryHandling::Mode boundaryHandlingTraversalMode );
BoundaryHandling * operator()( walberla::IBlock * const block, const walberla::StructuredBlockStorage * const storage ) const;
......@@ -124,6 +136,8 @@ private:
Velocity velocity0_, velocity1_;
real_t pressure0_, pressure1_;
const typename BoundaryHandling::Mode boundaryHandlingTraversalMode_;
}; // class DefaultBoundaryHandlingFactory
......@@ -143,16 +157,17 @@ template <typename LatticeModel, typename FlagFieldT >
DefaultBoundaryHandlingFactory<LatticeModel, FlagFieldT>::DefaultBoundaryHandlingFactory(
const BlockDataID & flagField, const BlockDataID & pdfField, const Set< FlagUID > & flagUIDSet,
const Velocity velocity0, const Velocity velocity1,
const real_t pressure0, const real_t pressure1 ) :
const real_t pressure0, const real_t pressure1,
const typename BoundaryHandling::Mode boundaryHandlingTraversalMode ) :
flagField_( flagField ), pdfField_( pdfField ), flagUIDSet_(flagUIDSet), velocity0_( velocity0 ), velocity1_( velocity1 ),
pressure0_( pressure0 ), pressure1_( pressure1 )
pressure0_( pressure0 ), pressure1_( pressure1 ), boundaryHandlingTraversalMode_( boundaryHandlingTraversalMode )
{
}
template <typename LatticeModel, typename FlagFieldT >
typename DefaultBoundaryHandlingFactory<LatticeModel, FlagFieldT>::BoundaryHandling *
DefaultBoundaryHandlingFactory<LatticeModel, FlagFieldT>::operator()( walberla::IBlock * const block,
const walberla::StructuredBlockStorage * const /*storage*/ ) const
const walberla::StructuredBlockStorage * const /*storage*/ ) const
{
PdfFieldLM * const pdfField = block->getData< PdfFieldLM >( pdfField_ );
FlagFieldT * const flagField = block->getData< FlagFieldT >( flagField_ );
......@@ -167,7 +182,8 @@ DefaultBoundaryHandlingFactory<LatticeModel, FlagFieldT>::operator()( walberla::
BcSimpleUBB ( getVelocity0BoundaryUID(), getVelocity0(), pdfField, velocity0_ ),
BcSimpleUBB ( getVelocity1BoundaryUID(), getVelocity1(), pdfField, velocity1_ ),
BcSimplePressure( getPressure0BoundaryUID(), getPressure0(), pdfField, pressure0_ ),
BcSimplePressure( getPressure1BoundaryUID(), getPressure1(), pdfField, pressure1_ )
BcSimplePressure( getPressure1BoundaryUID(), getPressure1(), pdfField, pressure1_ ),
boundaryHandlingTraversalMode_
);
return handling;
......
......@@ -87,9 +87,16 @@ public:
typedef walberla::boundary::BoundaryHandling< FlagFieldT, Stencil, BcNoSlip, BcFreeSlip, BcPressure, BcUBB, BcOutlet, BcCurved > BoundaryHandling;
static BlockDataID addBoundaryHandlingToStorage( const shared_ptr< StructuredBlockStorage > & bs, const std::string & identifier,
BlockDataID flagFieldID, BlockDataID pdfFieldID, const Set< FlagUID > & flagUIDSet )
BlockDataID flagFieldID, BlockDataID pdfFieldID, const Set< FlagUID > & flagUIDSet)
{
ExtendedBoundaryHandlingFactory factory ( flagFieldID, pdfFieldID, flagUIDSet );
return addBoundaryHandlingToStorage(bs, identifier, pdfFieldID, pdfFieldID, flagUIDSet,BoundaryHandling::Mode::OPTIMIZED_SPARSE_TRAVERSAL );
}
static BlockDataID addBoundaryHandlingToStorage( const shared_ptr< StructuredBlockStorage > & bs, const std::string & identifier,
BlockDataID flagFieldID, BlockDataID pdfFieldID, const Set< FlagUID > & flagUIDSet,
const typename BoundaryHandling::Mode boundaryHandlingTraversalMode )
{
ExtendedBoundaryHandlingFactory factory ( flagFieldID, pdfFieldID, flagUIDSet, boundaryHandlingTraversalMode );
return bs->addStructuredBlockData< BoundaryHandling >( factory, identifier );
}
......@@ -109,7 +116,8 @@ public:
static const walberla::BoundaryUID & getCurvedBoundaryUID() { static BoundaryUID uid( "Curved" ); return uid; }
ExtendedBoundaryHandlingFactory( const BlockDataID & flagField, const BlockDataID & pdfField, const Set< FlagUID > & flagUIDSet );
ExtendedBoundaryHandlingFactory( const BlockDataID & flagField, const BlockDataID & pdfField, const Set< FlagUID > & flagUIDSet,
const typename BoundaryHandling::Mode boundaryHandlingTraversalMode );
BoundaryHandling * operator()( walberla::IBlock * const block, const walberla::StructuredBlockStorage * const storage ) const;
......@@ -119,6 +127,8 @@ private:
const Set< FlagUID > flagUIDSet_;
const typename BoundaryHandling::Mode boundaryHandlingTraversalMode_;
}; // class ExtendedBoundaryHandlingFactory
......@@ -132,8 +142,9 @@ private:
//**********************************************************************************************************************
template <typename LatticeModel, typename FlagFieldT >
ExtendedBoundaryHandlingFactory<LatticeModel, FlagFieldT>::ExtendedBoundaryHandlingFactory(
const BlockDataID & flagField, const BlockDataID & pdfField, const Set< FlagUID > & flagUIDSet ) :
flagField_( flagField ), pdfField_( pdfField ), flagUIDSet_(flagUIDSet)
const BlockDataID & flagField, const BlockDataID & pdfField, const Set< FlagUID > & flagUIDSet,
const typename BoundaryHandling::Mode boundaryHandlingTraversalMode ) :
flagField_( flagField ), pdfField_( pdfField ), flagUIDSet_(flagUIDSet), boundaryHandlingTraversalMode_(boundaryHandlingTraversalMode)
{
}
......@@ -158,7 +169,8 @@ ExtendedBoundaryHandlingFactory<LatticeModel, FlagFieldT>::operator()( IBlock *
BcPressure ( getPressureBoundaryUID(), getPressure(), pdfField ),
BcUBB ( getUBBBoundaryUID(), getUBB(), pdfField, flagField, storage->getLevel(*block), block->getAABB() ),
BcOutlet ( getOutletBoundaryUID(), getOutlet(), pdfField, flagField, mask ),
BcCurved ( getCurvedBoundaryUID(), getCurved(), pdfField, flagField, mask )
BcCurved ( getCurvedBoundaryUID(), getCurved(), pdfField, flagField, mask ),
boundaryHandlingTraversalMode_
);
return handling;
......
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