Commit 3abdaebe authored by Marcus Mohr's avatar Marcus Mohr
Browse files

Adds copyBoundaryConditionFromFunction() method to BlockFunction

The commit moves the copyBoundaryConditionFromFunction() method up from
the P1CahnHilliardFunction to its base class. Then other children can
also make use of it.
parent ab4ed4c0
Pipeline #34638 passed with stages
in 117 minutes and 31 seconds
......@@ -280,6 +280,16 @@ class BlockFunction
}
}
template < typename OtherType >
void copyBoundaryConditionFromFunction( const BlockFunction< OtherType >& other )
{
WALBERLA_ASSERT_EQUAL( subFunc_.size(), other.getNumberOfBlocks() );
for ( uint_t k = 0; k < subFunc_.size(); k++ )
{
subFunc_[k]->setBoundaryCondition( other.getSubFunction( k ).getBoundaryCondition() );
}
}
protected:
const std::string functionName_;
std::vector< std::shared_ptr< GenericFunction< value_t > > > subFunc_;
......
......@@ -552,16 +552,6 @@ class P1CahnHilliardFunction : public BlockFunction< value_t >
{
return this->getSubFunction( 1 ).template unwrap< P1Function< value_t > >();
}
// TODO: Move this into BlockFunction
template < typename OtherFunctionValueType >
void copyBoundaryConditionFromFunction( const P1CahnHilliardFunction< OtherFunctionValueType >& other )
{
for ( uint_t k = 0; k < BlockFunction< value_t >::getNumberOfBlocks(); ++k )
{
BlockFunction< value_t >::getSubFunction( k ).setBoundaryCondition( other.getSubFunction( k ).getBoundaryCondition() );
}
}
};
/// [CahnHilliardFunction definition]
......
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