Commit 356b1788 authored by Markus Holzer's avatar Markus Holzer
Browse files

Adapted more functions

parent ae22ac7e
Pipeline #38615 failed with stages
in 7 minutes and 17 seconds
......@@ -189,6 +189,20 @@ BlockDataID addToStorage( const shared_ptr< BlockStorage_T > & blocks,
alwaysInitialize, initFunction, requiredSelectors, incompatibleSelectors );
}
template< typename GhostLayerField_T, typename BlockStorage_T >
BlockDataID addToStorage( const shared_ptr< BlockStorage_T > & blocks,
const std::string & identifier,
const typename GhostLayerField_T::value_type & initValue,
const Layout layout,
const uint_t nrOfGhostLayers,
const bool alwaysInitialize,
const Set<SUID> & requiredSelectors, const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() )
{
return addToStorage< GhostLayerField_T >( blocks, identifier, GhostLayerField_T::F_SIZE, initValue, layout, nrOfGhostLayers, alwaysInitialize,
std::function< void ( GhostLayerField_T * field, IBlock * const block ) >(),
requiredSelectors, incompatibleSelectors );
}
template< typename GhostLayerField_T, typename BlockStorage_T >
......@@ -207,6 +221,25 @@ BlockDataID addToStorage( const shared_ptr< BlockStorage_T > & blocks,
}
template< typename GhostLayerField_T, typename BlockStorage_T >
BlockDataID addToStorage( const shared_ptr< BlockStorage_T > & blocks,
const std::string & identifier,
const std::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize,
const typename GhostLayerField_T::value_type & initValue = typename GhostLayerField_T::value_type(),
const Layout layout = zyxf,
const uint_t nrOfGhostLayers = uint_t(1),
const bool alwaysInitialize = false,
const std::function< void ( GhostLayerField_T * field, IBlock * const block ) > & initFunction =
std::function< void ( GhostLayerField_T * field, IBlock * const block ) >(),
const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(),
const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet(),
const shared_ptr< field::FieldAllocator<typename GhostLayerField_T::value_type> > alloc = nullptr)
{
return internal::AddToStorage< GhostLayerField_T, BlockStorage_T >::add( blocks, identifier, GhostLayerField_T::F_SIZE, initValue, layout, nrOfGhostLayers,
alwaysInitialize, initFunction, requiredSelectors,
incompatibleSelectors, calculateSize, alloc );
}
template< typename GhostLayerField_T, typename BlockStorage_T >
BlockDataID addToStorage( const shared_ptr< BlockStorage_T > & blocks,
......@@ -229,6 +262,21 @@ BlockDataID addToStorage( const shared_ptr< BlockStorage_T > & blocks,
}
template< typename GhostLayerField_T, typename BlockStorage_T >
BlockDataID addToStorage( const shared_ptr< BlockStorage_T > & blocks,
const std::string & identifier,
const std::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize,
const typename GhostLayerField_T::value_type & initValue,
const Layout layout,
const uint_t nrOfGhostLayers,
const bool alwaysInitialize,
const Set<SUID> & requiredSelectors, const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() )
{
return addToStorage< GhostLayerField_T >( blocks, identifier, GhostLayerField_T::F_SIZE, initValue, layout, nrOfGhostLayers, alwaysInitialize,
std::function< void ( GhostLayerField_T * field, IBlock * const block ) >(),
requiredSelectors, incompatibleSelectors, calculateSize );
}
template< typename GhostLayerField_T, typename BlockStorage_T >
BlockDataID addToStorage( const shared_ptr< BlockStorage_T > & blocks,
const std::string & identifier,
......
......@@ -429,25 +429,25 @@ class Field<T, fSize_> : public Field<T> {
}
template<typename ...Args>
Field<T, fSize_> * clone()
Field<T, fSize_> * clone() const
{
return dynamic_cast<Field<T, fSize_>* > (Field<T>::clone());
}
template<typename ...Args>
Field<T, fSize_> * cloneUninitialized()
Field<T, fSize_> * cloneUninitialized() const
{
return dynamic_cast<Field<T, fSize_>* > (Field<T>::cloneUninitialized());
}
template<typename ...Args>
Field<T, fSize_> * cloneShallowCopy()
Field<T, fSize_> * cloneShallowCopy() const
{
return dynamic_cast<Field<T, fSize_>* > (Field<T>::cloneShallowCopy());
}
template<typename ...Args>
FlattenedField* flattenedShallowCopy()
FlattenedField* flattenedShallowCopy() const
{
return dynamic_cast<FlattenedField* > (Field<T>::flattenedShallowCopy());
}
......
......@@ -113,9 +113,9 @@ public:
const shared_ptr<FieldAllocator<T> > &alloc = make_shared<StdFieldAlloc<T> >());
~FlagField() override;
inline FlagField<T> * clone() const;
inline FlagField<T> * cloneUninitialized() const;
inline FlagField<T> * cloneShallowCopy() const;
inline FlagField<T> * clone() const override;
inline FlagField<T> * cloneUninitialized() const override;
inline FlagField<T> * cloneShallowCopy() const override;
//@}
//*******************************************************************************************************************
......@@ -183,7 +183,7 @@ public:
//** Slicing *******************************************************************************************************
/*! \name Slicing */
//@{
FlagField<T> * getSlicedField( const CellInterval & interval ) const;
FlagField<T> * getSlicedField( const CellInterval & interval ) const override;
//@}
//*******************************************************************************************************************
......
......@@ -256,25 +256,25 @@ class GhostLayerField<T, fSize_> : public GhostLayerField<T> {
}
template<typename ...Args>
GhostLayerField<T, fSize_> * clone()
GhostLayerField<T, fSize_> * clone() const
{
return dynamic_cast<GhostLayerField<T, fSize_>* > (GhostLayerField<T>::clone());
}
template<typename ...Args>
GhostLayerField<T, fSize_> * cloneUninitialized()
GhostLayerField<T, fSize_> * cloneUninitialized() const
{
return dynamic_cast<GhostLayerField<T, fSize_>* > (GhostLayerField<T>::cloneUninitialized());
}
template<typename ...Args>
GhostLayerField<T, fSize_> * cloneShallowCopy()
GhostLayerField<T, fSize_> * cloneShallowCopy() const
{
return dynamic_cast<GhostLayerField<T, fSize_>* > (GhostLayerField<T>::cloneShallowCopy());
}
template<typename ...Args>
FlattenedField* flattenedShallowCopy()
FlattenedField* flattenedShallowCopy() const
{
return dynamic_cast<FlattenedField* > (GhostLayerField<T>::flattenedShallowCopy());
}
......
......@@ -176,11 +176,11 @@ private:
/// For each value of a cell, either '0' or '1' is stored in the VTK file.
/// If the value is non-finite (= infinite or NaN), '1' is written to file - otherwise '0'.
class FValueVTKWriter : public vtk::BlockCellDataWriter< uint8_t, Field_T::F_SIZE >
class FValueVTKWriter : public vtk::BlockCellDataWriter< uint8_t >
{
public:
FValueVTKWriter( BlockCellsMap & map, const std::string & id ) : vtk::BlockCellDataWriter< uint8_t, Field_T::F_SIZE >( id ), map_( map ) {}
FValueVTKWriter( BlockCellsMap & map, const std::string & id ) : vtk::BlockCellDataWriter< uint8_t >( id ), map_( map ) {}
protected:
......@@ -188,8 +188,8 @@ private:
uint8_t evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f ) override
{
WALBERLA_ASSERT( map_.find( this->block_ ) != map_.end() );
WALBERLA_ASSERT( map_[ this->block_ ].find( Cell(x,y,z) ) != map_[ this->block_ ].end() );
WALBERLA_ASSERT( map_.find( this->block_ ) != map_.end() )
WALBERLA_ASSERT( map_[ this->block_ ].find( Cell(x,y,z) ) != map_[ this->block_ ].end() )
return ( map_[ this->block_ ][ Cell(x,y,z) ].find( f ) != map_[ this->block_ ][ Cell(x,y,z) ].end() ) ? uint8_t(1) : uint8_t(0);
}
......@@ -200,10 +200,10 @@ private:
};
/// For each cell, the corresponding block local cell coordinates are stored in the VTK file.
class LocalCoordVTKWriter : public vtk::BlockCellDataWriter< cell_idx_t, 3 >
class LocalCoordVTKWriter : public vtk::BlockCellDataWriter< cell_idx_t >
{
public:
LocalCoordVTKWriter( const std::string & id ) : vtk::BlockCellDataWriter< cell_idx_t, 3 >( id ) {}
LocalCoordVTKWriter( const std::string & id ) : vtk::BlockCellDataWriter< cell_idx_t >( id ) {}
protected:
void configure() override {}
cell_idx_t evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f ) override
......@@ -213,10 +213,10 @@ private:
};
/// For each cell, the corresponding global cell coordinates are stored in the VTK file.
class GlobalCoordVTKWriter : public vtk::BlockCellDataWriter< cell_idx_t, 3 >
class GlobalCoordVTKWriter : public vtk::BlockCellDataWriter< cell_idx_t >
{
public:
GlobalCoordVTKWriter( const std::string & id ) : vtk::BlockCellDataWriter< cell_idx_t, 3 >( id ) {}
GlobalCoordVTKWriter( const std::string & id ) : vtk::BlockCellDataWriter< cell_idx_t >( id ) {}
protected:
void configure() override {}
cell_idx_t evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f ) override
......@@ -339,7 +339,7 @@ void StabilityChecker< Field_T, Filter_T >::operator()()
return;
auto blocks = blocks_.lock();
WALBERLA_CHECK_NOT_NULLPTR( blocks, "Trying to access 'StabilityChecker' for a block storage object that doesn't exist anymore" );
WALBERLA_CHECK_NOT_NULLPTR( blocks, "Trying to access 'StabilityChecker' for a block storage object that doesn't exist anymore" )
for( auto block = blocks->begin( requiredSelectors_, incompatibleSelectors_ ); block != blocks->end(); ++block )
checkBlock( block.get() );
......@@ -377,7 +377,7 @@ void StabilityChecker< Field_T, Filter_T >::operator()()
}
if( !failedCells_.empty() )
WALBERLA_LOG_WARNING( oss.str() );
WALBERLA_LOG_WARNING( oss.str() )
}
bool abort = !failedCells_.empty();
......@@ -577,7 +577,7 @@ inline void stabilityCheckerConfigParser( const shared_ptr< Config > & config, c
std::string & defaultVTKBaseFolder, std::string & defaultVTKExecutionFolder, std::string & defaultVTKIdentifier,
bool & defaultVTKBinary, bool & defaultVTKLittleEndian, bool & defaultVTKMPIIO, bool & defaultVTKForcePVTU )
{
if( !!config )
if(config)
stabilityCheckerConfigParser( config->getGlobalBlock(), configBlockName, defaultCheckFrequency, defaultOutputToStream, defaultOutputVTK,
defaultVTKBaseFolder, defaultVTKExecutionFolder, defaultVTKIdentifier,
defaultVTKBinary, defaultVTKLittleEndian, defaultVTKMPIIO, defaultVTKForcePVTU );
......
......@@ -33,23 +33,23 @@ namespace lbm {
template< typename VelocityField_T, typename Filter_T, typename OutputType = float >
class QCriterionVTKWriter : public vtk::BlockCellDataWriter< OutputType, 1 >
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, 1 >(id), blockStorage_(blockStorage), filter_(filter), velocityFieldId_(velocityFieldId), velocityField_(NULL) {}
vtk::BlockCellDataWriter< OutputType>(id), blockStorage_(blockStorage), filter_(filter), velocityFieldId_(velocityFieldId), velocityField_(nullptr) {}
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_));
......
//======================================================================================================================
//
// This file is part of waLBerla. waLBerla is free software: you can
// This file is part of waLBerla. waLBerla is free software: you can
// redistribute it and/or modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation, either version 3 of
// License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// waLBerla is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
//
// waLBerla is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
//
// You should have received a copy of the GNU General Public License along
// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
//
......@@ -22,14 +22,13 @@
//
//======================================================================================================================
#include "field/AddToStorage.h"
#include "field/GhostLayerField.h"
#include "blockforest/Initialization.h"
#include "core/debug/TestSubsystem.h"
#include "core/Environment.h"
#include "core/debug/TestSubsystem.h"
#include "field/AddToStorage.h"
#include "field/GhostLayerField.h"
#include "field/communication/PackInfo.h"
#include "field/communication/UniformPullReductionPackInfo.h"
......@@ -39,159 +38,153 @@
#include "ScalarFieldCommunication.h"
#include "ScalarFieldPullReduction.h"
namespace walberla
{
namespace walberla {
void testScalarField( IBlock * block, BlockDataID fieldId )
void testScalarField(IBlock* block, BlockDataID fieldId)
{
GhostLayerField<int,1> & field = *(block->getData<GhostLayerField<int,1> > (fieldId));
field.setWithGhostLayer( 0 );
GhostLayerField< int, 1 >& field = *(block->getData< GhostLayerField< int, 1 > >(fieldId));
field.setWithGhostLayer(0);
WALBERLA_CHECK_EQUAL(field.xSize(), 2);
WALBERLA_CHECK_EQUAL(field.ySize(), 2);
WALBERLA_CHECK_EQUAL(field.zSize(), 2);
WALBERLA_CHECK_EQUAL(field.xSize(), 2)
WALBERLA_CHECK_EQUAL(field.ySize(), 2)
WALBERLA_CHECK_EQUAL(field.zSize(), 2)
// initialize the bottom boundary
field(0,0,0) = 1;
field(0,1,0) = 2;
field(1,0,0) = 3;
field(1,1,0) = 4;
field(0, 0, 0) = 1;
field(0, 1, 0) = 2;
field(1, 0, 0) = 3;
field(1, 1, 0) = 4;
// -------------- Local Communication Test ----------------------
// communicate periodic from bottom to top
pystencils::ScalarFieldCommunication pi(fieldId);
pi.communicateLocal( block, block, stencil::B );
pi.communicateLocal(block, block, stencil::B);
WALBERLA_CHECK_EQUAL ( field(0,0,+2), 1 );
WALBERLA_CHECK_EQUAL ( field(0,1,+2), 2 );
WALBERLA_CHECK_EQUAL ( field(1,0,+2), 3 );
WALBERLA_CHECK_EQUAL ( field(1,1,+2), 4 );
WALBERLA_CHECK_EQUAL(field(0, 0, +2), 1)
WALBERLA_CHECK_EQUAL(field(0, 1, +2), 2)
WALBERLA_CHECK_EQUAL(field(1, 0, +2), 3)
WALBERLA_CHECK_EQUAL(field(1, 1, +2), 4)
// -------------- Buffer Communication Test ---------------------
// Reset
field(0,0,2) = 0;
field(0,1,2) = 0;
field(1,0,2) = 0;
field(1,1,2) = 0;
field(0, 0, 2) = 0;
field(0, 1, 2) = 0;
field(1, 0, 2) = 0;
field(1, 1, 2) = 0;
mpi::GenericSendBuffer<> sendBuf;
pi.packData( block, stencil::B, sendBuf );
pi.packData(block, stencil::B, sendBuf);
// Manually copy over the send to the receive buffer
mpi::GenericRecvBuffer<> recvBuf;
recvBuf.resize( sendBuf.size() );
memcpy( recvBuf.ptr(), sendBuf.ptr(), sendBuf.size()* sizeof(mpi::GenericSendBuffer<>::ElementType) );
recvBuf.resize(sendBuf.size());
memcpy(recvBuf.ptr(), sendBuf.ptr(), sendBuf.size() * sizeof(mpi::GenericSendBuffer<>::ElementType));
pi.unpackData( block, stencil::T, recvBuf );
pi.unpackData(block, stencil::T, recvBuf);
WALBERLA_CHECK_EQUAL ( field(0,0,+2), 1 );
WALBERLA_CHECK_EQUAL ( field(0,1,+2), 2 );
WALBERLA_CHECK_EQUAL ( field(1,0,+2), 3 );
WALBERLA_CHECK_EQUAL ( field(1,1,+2), 4 );
WALBERLA_CHECK_EQUAL(field(0, 0, +2), 1)
WALBERLA_CHECK_EQUAL(field(0, 1, +2), 2)
WALBERLA_CHECK_EQUAL(field(1, 0, +2), 3)
WALBERLA_CHECK_EQUAL(field(1, 1, +2), 4)
}
void testScalarFieldPullReduction( IBlock * block, BlockDataID fieldId )
void testScalarFieldPullReduction(IBlock* block, BlockDataID fieldId)
{
GhostLayerField<int,1> & field = *(block->getData<GhostLayerField<int,1> > (fieldId));
field.setWithGhostLayer( 0 );
GhostLayerField< int, 1 >& field = *(block->getData< GhostLayerField< int, 1 > >(fieldId));
field.setWithGhostLayer(0);
WALBERLA_CHECK_EQUAL(field.xSize(), 2);
WALBERLA_CHECK_EQUAL(field.ySize(), 2);
WALBERLA_CHECK_EQUAL(field.zSize(), 2);
WALBERLA_CHECK_EQUAL(field.xSize(), 2)
WALBERLA_CHECK_EQUAL(field.ySize(), 2)
WALBERLA_CHECK_EQUAL(field.zSize(), 2)
// initialize the bottom ghost layer cells
field(0,0,-1) = 1;
field(0,1,-1) = 2;
field(1,0,-1) = 3;
field(1,1,-1) = 4;
field(0, 0, -1) = 1;
field(0, 1, -1) = 2;
field(1, 0, -1) = 3;
field(1, 1, -1) = 4;
// initialize the top interior cells
field(0,0,1) = 1;
field(0,1,1) = 1;
field(1,0,1) = 1;
field(1,1,1) = 1;
field(0, 0, 1) = 1;
field(0, 1, 1) = 1;
field(1, 0, 1) = 1;
field(1, 1, 1) = 1;
// communicate periodic from bottom to top with uniform pull scheme
pystencils::ScalarFieldPullReduction pi1(fieldId);
pi1.communicateLocal( block, block, stencil::B );
pi1.communicateLocal(block, block, stencil::B);
// check values in top ghost layer
WALBERLA_CHECK_EQUAL ( field(0,0,2), 0 );
WALBERLA_CHECK_EQUAL ( field(0,1,2), 0 );
WALBERLA_CHECK_EQUAL ( field(1,0,2), 0 );
WALBERLA_CHECK_EQUAL ( field(1,1,2), 0 );
WALBERLA_CHECK_EQUAL(field(0, 0, 2), 0)
WALBERLA_CHECK_EQUAL(field(0, 1, 2), 0)
WALBERLA_CHECK_EQUAL(field(1, 0, 2), 0)
WALBERLA_CHECK_EQUAL(field(1, 1, 2), 0)
// check values in top interior cells
WALBERLA_CHECK_EQUAL ( field(0,0,1), 2 );
WALBERLA_CHECK_EQUAL ( field(0,1,1), 3 );
WALBERLA_CHECK_EQUAL ( field(1,0,1), 4 );
WALBERLA_CHECK_EQUAL ( field(1,1,1), 5 );
WALBERLA_CHECK_EQUAL(field(0, 0, 1), 2)
WALBERLA_CHECK_EQUAL(field(0, 1, 1), 3)
WALBERLA_CHECK_EQUAL(field(1, 0, 1), 4)
WALBERLA_CHECK_EQUAL(field(1, 1, 1), 5)
// communicate periodic from top to bottom with standard form to sync ghost layers
pystencils::ScalarFieldCommunication pi2 (fieldId);
pi2.communicateLocal( block, block, stencil::T );
pystencils::ScalarFieldCommunication pi2(fieldId);
pi2.communicateLocal(block, block, stencil::T);
// check values in bottom ghost layer
WALBERLA_CHECK_EQUAL ( field(0,0,-1), 2 );
WALBERLA_CHECK_EQUAL ( field(0,1,-1), 3 );
WALBERLA_CHECK_EQUAL ( field(1,0,-1), 4 );
WALBERLA_CHECK_EQUAL ( field(1,1,-1), 5 );
WALBERLA_CHECK_EQUAL(field(0, 0, -1), 2)
WALBERLA_CHECK_EQUAL(field(0, 1, -1), 3)
WALBERLA_CHECK_EQUAL(field(1, 0, -1), 4)
WALBERLA_CHECK_EQUAL(field(1, 1, -1), 5)
// check values in top interior cells
WALBERLA_CHECK_EQUAL ( field(0,0,1), 2 );
WALBERLA_CHECK_EQUAL ( field(0,1,1), 3 );
WALBERLA_CHECK_EQUAL ( field(1,0,1), 4 );
WALBERLA_CHECK_EQUAL ( field(1,1,1), 5 );
WALBERLA_CHECK_EQUAL(field(0, 0, 1), 2)
WALBERLA_CHECK_EQUAL(field(0, 1, 1), 3)
WALBERLA_CHECK_EQUAL(field(1, 0, 1), 4)
WALBERLA_CHECK_EQUAL(field(1, 1, 1), 5)
}
int main(int argc, char **argv)
int main(int argc, char** argv)
{
using blockforest::createUniformBlockGrid;
debug::enterTestMode();
Environment walberlaEnv(argc,argv);
Environment walberlaEnv(argc, argv);
// Create a BlockForest with 2x2x2 cells per block
uint_t processes = uint_c( MPIManager::instance()->numProcesses() );
auto blocks = createUniformBlockGrid(processes,1 ,1, //blocks
2,2,2, //cells
1, //dx
false, //one block per process
true,true,true);//periodicity
uint_t processes = uint_c(MPIManager::instance()->numProcesses());
auto blocks = createUniformBlockGrid(processes, 1, 1, // blocks
2, 2, 2, // cells
1, // dx
false, // one block per process
true, true, true); // periodicity
// Create a Field with the same number of cells as the block
BlockDataID scalarFieldId = field::addToStorage<GhostLayerField<int,1> > ( blocks, "ScalarField" );
BlockDataID scalarFieldId = field::addToStorage< GhostLayerField< int, 1 > >(blocks, "ScalarField");
for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) // block loop
testScalarField( &(*blockIt), scalarFieldId );
for (auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt) // block loop
testScalarField(&(*blockIt), scalarFieldId);
// Create a BlockForest with 8x8x8 cells per block
blocks = createUniformBlockGrid(processes,1 ,1, //blocks
8,8,8, //cells
1, //dx
false, //one block per process
true,true,true);//periodicity
blocks = createUniformBlockGrid(processes, 1, 1, // blocks
8, 8, 8, // cells
1, // dx
false, // one block per process
true, true, true); // periodicity
// Create a Field with one quarter as many cells per dimension, i.e. a field with the same size as the one above
auto getSize = []( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) {
return Vector3<uint_t>(2,2,2);
};
scalarFieldId = field::addToStorage<GhostLayerField<int,1> > ( blocks, "ScalarField", getSize );
auto getSize = [](const shared_ptr< StructuredBlockStorage >&, IBlock* const) { return Vector3< uint_t >(2, 2, 2); };
scalarFieldId = field::addToStorage< GhostLayerField< int, 1 > >(blocks, "ScalarField", getSize);
for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) // block loop
testScalarField( &(*blockIt), scalarFieldId );
for (auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt) // block loop
testScalarField(&(*blockIt), scalarFieldId);
for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) // block loop
testScalarFieldPullReduction( &(*blockIt), scalarFieldId );
for (auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt) // block loop
testScalarFieldPullReduction(&(*blockIt), scalarFieldId);
return 0;
}
} // namespace walberla
int main( int argc, char* argv[] ) {
return walberla::main( argc, argv );
}
\ No newline at end of file
int main(int argc, char* argv[]) { return walberla::main(argc, argv); }
\ No newline at end of file
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