本文整理汇总了C++中ScalarField::end方法的典型用法代码示例。如果您正苦于以下问题:C++ ScalarField::end方法的具体用法?C++ ScalarField::end怎么用?C++ ScalarField::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScalarField
的用法示例。
在下文中一共展示了ScalarField::end方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv )
{
walberla::Environment env( argc, argv );
const uint_t cells [] = { 6,5,3 };
const uint_t blockCount [] = { 4, 3,2 };
const uint_t nrOfTimeSteps = 20;
// Create BlockForest
auto blocks = blockforest::createUniformBlockGrid(blockCount[0],blockCount[1],blockCount[2], //blocks
cells[0],cells[1],cells[2], //cells
1, //dx
false, //one block per process
true,true,true); //periodicity
LatticeModel latticeModel( lbm::collision_model::SRT(1.5 ) );
// In addition to the normal GhostLayerField's we allocated additionally a field containing the whole global simulation domain for each block
// we can then check if the GhostLayer communication is correct, by comparing the small field to the corresponding part of the big field
BlockDataID pdfField = lbm::addPdfFieldToStorage( blocks, "PdfField", latticeModel );
BlockDataID scalarField1 = field::addToStorage<ScalarField>( blocks, "ScalarFieldOneGl", real_t(0), field::zyxf, 1 );
BlockDataID scalarField2 = field::addToStorage<ScalarField>( blocks, "ScalarFieldTwoGl", real_t(0), field::zyxf, 2 );
BlockDataID vectorField = field::addToStorage<VectorField>( blocks, "VectorField", Vector3<real_t>(0,0,0) );
BlockDataID flagField = field::addFlagFieldToStorage<FField>( blocks, "FlagField" );
// Init src field with some values
for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) // block loop
{
// Init PDF field
PdfField * src = blockIt->getData<PdfField>(pdfField);
for( auto cellIt = src->begin(); cellIt != src->end(); ++cellIt ) // over all x,y,z,f
{
Cell cell ( cellIt.x(), cellIt.y(), cellIt.z() );
blocks->transformBlockLocalToGlobalCell(cell, *blockIt);
*cellIt = real_c( ( cell[0] + cell[1] + cell[2] + cellIt.f() ) % cell_idx_t(42) );
}
// Init scalarField1
ScalarField * sf = blockIt->getData<ScalarField> ( scalarField1 );
for( auto cellIt = sf->beginWithGhostLayer(); cellIt != sf->end(); ++cellIt ) // over all x,y,z
{
Cell cell ( cellIt.x(), cellIt.y(), cellIt.z() );
blocks->transformBlockLocalToGlobalCell(cell, *blockIt);
*cellIt = real_c( ( cell[0] + cell[1] + cell[2] ) % cell_idx_t(42) );
}
// Init scalarField2
sf = blockIt->getData<ScalarField> ( scalarField2 );
for( auto cellIt = sf->beginWithGhostLayer(); cellIt != sf->end(); ++cellIt ) // over all x,y,z
{
Cell cell ( cellIt.x(), cellIt.y(), cellIt.z() );
blocks->transformBlockLocalToGlobalCell(cell, *blockIt);
*cellIt = real_c( ( cell[0] + cell[1] + cell[2] ) % cell_idx_t(42) );
}
// Init vector field
VectorField * vf = blockIt->getData<VectorField> ( vectorField );
for ( auto cellIt = vf->beginWithGhostLayer(); cellIt != vf->end(); ++cellIt )
{
Cell cell ( cellIt.x(), cellIt.y(), cellIt.z() );
blocks->transformBlockLocalToGlobalCell(cell, *blockIt);
*cellIt = Vector3<real_t>( real_c(cell[0]), real_c(cell[1]), real_c(cell[2]) );
}
// Init Flag field
FField * ff = blockIt->getData<FField> ( flagField );
auto flag1 = ff->registerFlag( "AFlag 1" );
auto flag2 = ff->registerFlag( "BFlag 2" );
for ( auto cellIt = ff->beginWithGhostLayer(); cellIt != ff->end(); ++cellIt )
{
Cell cell ( cellIt.x(), cellIt.y(), cellIt.z() );
blocks->transformBlockLocalToGlobalCell( cell, *blockIt );
if ( ( cell[0] + cell[1] + cell[2] ) % 2 )
addFlag( cellIt, flag1);
else
addFlag( cellIt, flag2);
}
}
// Create TimeLoop
SweepTimeloop timeloop (blocks, nrOfTimeSteps );
GUI gui (timeloop, blocks, argc, argv);
lbm::connectToGui<LatticeModel>( gui );
gui.run();
//timeloop.singleStep();
return EXIT_SUCCESS;
}