Commit d370dac2 authored by Christian Godenschwager's avatar Christian Godenschwager Committed by Sebastian Eibl

Use _r for all real_t literals

parent 39b7b9cb
Pipeline #14065 failed with stages
in 302 minutes and 17 seconds
......@@ -211,7 +211,7 @@ int main( int argc, char * argv[] )
meshWorkloadMemory.setOutsideCellWorkload(1);
bfc.setWorkloadMemorySUIDAssignmentFunction( meshWorkloadMemory );
bfc.setPeriodicity( Vector3<bool>(true) );
bfc.setRefinementSelectionFunction( makeRefinementSelection( distanceOctree, numLevels - uint_t(1), dx, dx * real_t(1) ) );
bfc.setRefinementSelectionFunction( makeRefinementSelection( distanceOctree, numLevels - uint_t(1), dx, dx * 1_r ) );
auto structuredBlockforest = bfc.createStructuredBlockForest( blockSize );
......@@ -225,7 +225,7 @@ int main( int argc, char * argv[] )
static const uint_t NUM_GHOSTLAYERS = 4;
BlockDataID pdfFieldId = lbm::addPdfFieldToStorage( structuredBlockforest, "pdf field", latticeModel, Vector3<real_t>(0), real_t(1), NUM_GHOSTLAYERS, field::fzyx );
BlockDataID pdfFieldId = lbm::addPdfFieldToStorage( structuredBlockforest, "pdf field", latticeModel, Vector3<real_t>(0), 1_r, NUM_GHOSTLAYERS, field::fzyx );
BlockDataID flagFieldId = field::addFlagFieldToStorage< FlagField_T >( structuredBlockforest, "flag field", NUM_GHOSTLAYERS );
const FlagUID fluidFlagUID( "Fluid" );
......
......@@ -307,7 +307,7 @@ static shared_ptr< SetupBlockForest > createSetupBlockForest( const blockforest:
if( blocksPerProcess != 0 )
numberOfProcesses = uint_c( std::ceil( real_c( forest->getNumberOfBlocks() ) / real_c( blocksPerProcess ) ) );
forest->balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), numberOfProcesses, real_t(0), processMemoryLimit, true );
forest->balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), numberOfProcesses, 0_r, processMemoryLimit, true );
if( outputSetupForest )
{
......@@ -408,7 +408,7 @@ MyBoundaryHandling<LatticeModel_T>::operator()( IBlock * const block ) const
return new BoundaryHandling_T( "boundary handling", flagField, fluid,
boost::tuples::make_tuple( NoSlip_T( "no slip", NoSlip_Flag, pdfField ),
UBB_T( "velocity bounce back", UBB_Flag, pdfField, topVelocity_, real_t(0), real_t(0) ) ) );
UBB_T( "velocity bounce back", UBB_Flag, pdfField, topVelocity_, 0_r, 0_r ) ) );
}
......@@ -570,7 +570,7 @@ real_t exactFlowRate( const real_t flowRate )
Vector3< real_t > exactVelocity( const Vector3< real_t > & p, const math::AABB & domain, const real_t maxLatticeVelocity )
{
return Vector3< real_t >( maxLatticeVelocity * ( p[1] - domain.yMin() ) / domain.ySize(), real_t(0), real_t(0) );
return Vector3< real_t >( maxLatticeVelocity * ( p[1] - domain.yMin() ) / domain.ySize(), 0_r, 0_r );
}
......@@ -667,8 +667,8 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod
setup.viscosity_L = latticeModel.collisionModel().viscosity( uint_t(0) );
setup.meanVelocity_L = ( setup.Re * setup.viscosity_L ) / real_c( setup.yBlocks * setup.yCells );
setup.maxVelocity_L = real_t(2) * setup.meanVelocity_L;
setup.flowRate_L = ( setup.maxVelocity_L * real_c( setup.yBlocks * setup.yCells ) * real_c( setup.zBlocks * setup.zCells ) ) / real_t(2);
setup.maxVelocity_L = 2_r * setup.meanVelocity_L;
setup.flowRate_L = ( setup.maxVelocity_L * real_c( setup.yBlocks * setup.yCells ) * real_c( setup.zBlocks * setup.zCells ) ) / 2_r;
// creating the block structure
......@@ -676,13 +676,13 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod
// add pdf field to blocks
const real_t initVelocity = ( configBlock.getParameter< bool >( "initWithMeanVelocity", false ) ) ? setup.meanVelocity_L : real_t(0);
const real_t initVelocity = ( configBlock.getParameter< bool >( "initWithMeanVelocity", false ) ) ? setup.meanVelocity_L : 0_r;
BlockDataID pdfFieldId = fzyx ? lbm::addPdfFieldToStorage( blocks, "pdf field (fzyx)", latticeModel,
Vector3< real_t >( initVelocity, real_c(0), real_c(0) ), real_t(1),
Vector3< real_t >( initVelocity, real_c(0), real_c(0) ), 1_r,
FieldGhostLayers, field::fzyx ) :
lbm::addPdfFieldToStorage( blocks, "pdf field (zyxf)", latticeModel,
Vector3< real_t >( initVelocity, real_c(0), real_c(0) ), real_t(1),
Vector3< real_t >( initVelocity, real_c(0), real_c(0) ), 1_r,
FieldGhostLayers, field::zyxf );
using VelocityAdaptor_T = typename lbm::Adaptor< LatticeModel_T >::VelocityVector;
......@@ -743,18 +743,18 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod
flagFieldId, Fluid_Flag,
std::bind( exactFlowRate, setup.flowRate_L ),
exactSolutionFunction );
volumetricFlowRate->setNormalizationFactor( real_t(1) / setup.maxVelocity_L );
volumetricFlowRate->setDomainNormalization( Vector3<real_t>( real_t(1) ) );
volumetricFlowRate->setNormalizationFactor( 1_r / setup.maxVelocity_L );
volumetricFlowRate->setDomainNormalization( Vector3<real_t>( 1_r ) );
timeloop.addFuncBeforeTimeStep( makeSharedFunctor( volumetricFlowRate ), "volumetric flow rate evaluation" );
auto accuracyEvaluation = field::makeAccuracyEvaluation< VelocityAdaptor_T >( configBlock, blocks, velocityAdaptorId, exactSolutionFunction );
accuracyEvaluation->setNormalizationFactor( real_t(1) / setup.maxVelocity_L );
accuracyEvaluation->setNormalizationFactor( 1_r / setup.maxVelocity_L );
timeloop.addFuncBeforeTimeStep( makeSharedFunctor( accuracyEvaluation ), "accuracy evaluation" );
auto linePlot = field::makeAccuracyEvaluationLinePlot< VelocityAdaptor_T >( configBlock, blocks, velocityAdaptorId, exactSolutionFunction );
linePlot->setNormalizationFactor( real_t(1) / setup.maxVelocity_L );
linePlot->setNormalizationFactor( 1_r / setup.maxVelocity_L );
timeloop.addFuncBeforeTimeStep( makeSharedFunctor( field::makeAccuracyEvaluationLinePlotter( configBlock, linePlot ) ), "accuracy evaluation (line plot)" );
......@@ -1024,7 +1024,7 @@ int main( int argc, char **argv )
setup.yCells = configBlock.getParameter< uint_t >( "yCells", uint_t(50) );
setup.zCells = configBlock.getParameter< uint_t >( "zCells", uint_t(10) );
setup.Re = configBlock.getParameter< real_t >( "Re", real_t(10) );
setup.Re = configBlock.getParameter< real_t >( "Re", 10_r );
// ... in bytes
const memory_t memoryPerCell = configBlock.getParameter< memory_t >( "memoryPerCell", memory_t( 19 * 8 + 1 ) );
......@@ -1047,7 +1047,7 @@ int main( int argc, char **argv )
if( !configBlock.isDefined("borderRefinementLevel") )
WALBERLA_ABORT( "You have to specify \'borderRefinementLevel\' in the \"CouetteFlow\" block of the configuration file (" << argv[1] << ")" );
const real_t borderRefinementBuffer = configBlock.getParameter< real_t >( "borderRefinementBuffer", real_t(0) );
const real_t borderRefinementBuffer = configBlock.getParameter< real_t >( "borderRefinementBuffer", 0_r );
BorderRefinementSelection borderRefinementSelection( setup, configBlock.getParameter< uint_t >( "borderRefinementLevel" ),
borderRefinementBuffer );
......@@ -1144,19 +1144,19 @@ int main( int argc, char **argv )
// executing benchmark
const real_t omega = configBlock.getParameter< real_t >( "omega", real_t(1.4) );
const real_t omega = configBlock.getParameter< real_t >( "omega", 1.4_r );
const real_t magicNumber = configBlock.getParameter< real_t >( "magicNumber", real_t(3) / real_t(16) );
const real_t magicNumber = configBlock.getParameter< real_t >( "magicNumber", 3_r / 16_r );
const real_t lambda_e = configBlock.getParameter< real_t >( "lambda_e", real_t(1.4) );
const real_t lambda_d = configBlock.getParameter< real_t >( "lambda_d", real_t(1.4) );
const real_t lambda_e = configBlock.getParameter< real_t >( "lambda_e", 1.4_r );
const real_t lambda_d = configBlock.getParameter< real_t >( "lambda_d", 1.4_r );
const real_t s1 = configBlock.getParameter< real_t >( "s1", real_t(1.4) );
const real_t s2 = configBlock.getParameter< real_t >( "s2", real_t(1.4) );
const real_t s4 = configBlock.getParameter< real_t >( "s4", real_t(1.4) );
const real_t s9 = configBlock.getParameter< real_t >( "s9", real_t(1.4) );
const real_t s10 = configBlock.getParameter< real_t >( "s10", real_t(1.4) );
const real_t s16 = configBlock.getParameter< real_t >( "s16", real_t(1.4) );
const real_t s1 = configBlock.getParameter< real_t >( "s1", 1.4_r );
const real_t s2 = configBlock.getParameter< real_t >( "s2", 1.4_r );
const real_t s4 = configBlock.getParameter< real_t >( "s4", 1.4_r );
const real_t s9 = configBlock.getParameter< real_t >( "s9", 1.4_r );
const real_t s10 = configBlock.getParameter< real_t >( "s10", 1.4_r );
const real_t s16 = configBlock.getParameter< real_t >( "s16", 1.4_r );
const uint_t relaxationParametersLevel = configBlock.getParameter< uint_t >( "relaxationParametersLevel", uint_t(0) );
......
......@@ -233,8 +233,8 @@ static void refinementSelection( SetupBlockForest& forest )
{
const AABB & domain = forest.getDomain();
real_t xSize = ( domain.xSize() / real_t(12) ) * real_c( 0.99 );
real_t zSize = ( domain.zSize() / real_t(12) ) * real_c( 0.99 );
real_t xSize = ( domain.xSize() / 12_r ) * real_c( 0.99 );
real_t zSize = ( domain.zSize() / 12_r ) * real_c( 0.99 );
AABB leftCorner( domain.xMin(), domain.yMin(), domain.zMax() - zSize,
domain.xMin() + xSize, domain.yMax(), domain.zMax() );
......@@ -283,7 +283,7 @@ void createSetupBlockForest( blockforest::SetupBlockForest & sforest, const Conf
sforest.addRefinementSelectionFunction( refinementSelection );
sforest.addWorkloadMemorySUIDAssignmentFunction( std::bind( workloadAndMemoryAssignment, std::placeholders::_1, memoryPerBlock ) );
sforest.init( AABB( real_t(0), real_t(0), real_t(0), real_c( numberOfXBlocks * numberOfXCellsPerBlock ),
sforest.init( AABB( 0_r, 0_r, 0_r, real_c( numberOfXBlocks * numberOfXCellsPerBlock ),
real_c( numberOfYBlocks * numberOfYCellsPerBlock ),
real_c( numberOfZBlocks * numberOfZCellsPerBlock ) ),
numberOfXBlocks, numberOfYBlocks, numberOfZBlocks, false, false, false );
......@@ -387,8 +387,8 @@ void ReGrid::operator()( std::vector< std::pair< const Block *, uint_t > > & min
{
const AABB & domain = forest.getDomain();
const real_t xSize = domain.xSize() / real_t(12);
const real_t zSize = domain.zSize() / real_t(12);
const real_t xSize = domain.xSize() / 12_r;
const real_t zSize = domain.zSize() / 12_r;
AABB left;
AABB right;
......@@ -677,10 +677,10 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod
// add pdf field to blocks
BlockDataID pdfFieldId = fzyx ? lbm::addPdfFieldToStorage( blocks, "pdf field (fzyx)", latticeModel,
Vector3< real_t >( real_c(0), real_c(0), real_c(0) ), real_t(1),
Vector3< real_t >( real_c(0), real_c(0), real_c(0) ), 1_r,
FieldGhostLayers, field::fzyx ) :
lbm::addPdfFieldToStorage( blocks, "pdf field (zyxf)", latticeModel,
Vector3< real_t >( real_c(0), real_c(0), real_c(0) ), real_t(1),
Vector3< real_t >( real_c(0), real_c(0), real_c(0) ), 1_r,
FieldGhostLayers, field::zyxf );
// add flag field to blocks
......@@ -689,7 +689,7 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod
// add LB boundary handling to blocks
const real_t velocity = configBlock.getParameter< real_t >( "velocity", real_t(0.05) );
const real_t velocity = configBlock.getParameter< real_t >( "velocity", 0.05_r );
BlockDataID boundaryHandlingId = blocks->addBlockData( make_shared< MyBoundaryHandling< LatticeModel_T > >( blocks, flagFieldId, pdfFieldId, velocity ),
"boundary handling" );
......@@ -1264,7 +1264,7 @@ int main( int argc, char **argv )
pure = false;
}
const real_t omega = configBlock.getParameter< real_t >( "omega", real_t(1.4) ); // on the coarsest grid!
const real_t omega = configBlock.getParameter< real_t >( "omega", 1.4_r ); // on the coarsest grid!
// executing benchmark
......
......@@ -210,9 +210,9 @@ static inline void getCellsAndProcesses( const Config::BlockHandle & configBlock
getCells( configBlock, xCells, yCells, zCells );
std::vector< real_t > weighting;
weighting.push_back( configBlock.getParameter< real_t >( "xWeight", real_t(1) ) / real_c(xCells) );
weighting.push_back( configBlock.getParameter< real_t >( "yWeight", real_t(1) ) / real_c(yCells) );
weighting.push_back( configBlock.getParameter< real_t >( "zWeight", real_t(1) ) / real_c(zCells) );
weighting.push_back( configBlock.getParameter< real_t >( "xWeight", 1_r ) / real_c(xCells) );
weighting.push_back( configBlock.getParameter< real_t >( "yWeight", 1_r ) / real_c(yCells) );
weighting.push_back( configBlock.getParameter< real_t >( "zWeight", 1_r ) / real_c(zCells) );
std::vector< uint_t > processes = math::getFactors( numberOfProcesses, 3, weighting );
......@@ -252,7 +252,7 @@ void createSetupBlockForest( blockforest::SetupBlockForest & sforest, const Conf
sforest.addWorkloadMemorySUIDAssignmentFunction( blockforest::uniformWorkloadAndMemoryAssignment );
sforest.init( AABB( real_t(0), real_t(0), real_t(0), real_c( numberOfXBlocks * numberOfXCellsPerBlock ),
sforest.init( AABB( 0_r, 0_r, 0_r, real_c( numberOfXBlocks * numberOfXCellsPerBlock ),
real_c( numberOfYBlocks * numberOfYCellsPerBlock ),
real_c( numberOfZBlocks * numberOfZCellsPerBlock ) ),
numberOfXBlocks, numberOfYBlocks, numberOfZBlocks, false, false, false );
......@@ -297,7 +297,7 @@ void createSetupBlockForest( blockforest::SetupBlockForest & sforest, const Conf
MPIManager::instance()->useWorldComm();
sforest.balanceLoad( blockforest::CartesianDistribution( numberOfXProcesses, numberOfYProcesses, numberOfZProcesses, nullptr ),
numberOfXProcesses * numberOfYProcesses * numberOfZProcesses, real_t(0), 0, true );
numberOfXProcesses * numberOfYProcesses * numberOfZProcesses, 0_r, 0, true );
}
WALBERLA_LOG_INFO_ON_ROOT( "SetupBlockForest created successfully:\n" << sforest );
......@@ -679,10 +679,10 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod
// add pdf field to blocks
BlockDataID pdfFieldId = fzyx ? lbm::addPdfFieldToStorage( blocks, "pdf field (fzyx)", latticeModel,
Vector3< real_t >( real_c(0), real_c(0), real_c(0) ), real_t(1),
Vector3< real_t >( real_c(0), real_c(0), real_c(0) ), 1_r,
FieldGhostLayers, field::fzyx ) :
lbm::addPdfFieldToStorage( blocks, "pdf field (zyxf)", latticeModel,
Vector3< real_t >( real_c(0), real_c(0), real_c(0) ), real_t(1),
Vector3< real_t >( real_c(0), real_c(0), real_c(0) ), 1_r,
FieldGhostLayers, field::zyxf );
// add flag field to blocks
......@@ -691,7 +691,7 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod
// add LB boundary handling to blocks
const real_t velocity = configBlock.getParameter< real_t >( "velocity", real_t(0.05) );
const real_t velocity = configBlock.getParameter< real_t >( "velocity", 0.05_r );
BlockDataID boundaryHandlingId = blocks->template addStructuredBlockData< typename MyBoundaryHandling< LatticeModel_T >::BoundaryHandling_T >(
MyBoundaryHandling< LatticeModel_T >( flagFieldId, pdfFieldId, velocity ), "boundary handling" );
......@@ -959,7 +959,7 @@ int main( int argc, char **argv )
directComm = false;
}
const real_t omega = configBlock.getParameter< real_t >( "omega", real_t(1.4) ); // on the coarsest grid!
const real_t omega = configBlock.getParameter< real_t >( "omega", 1.4_r ); // on the coarsest grid!
// executing benchmark
......
......@@ -22,6 +22,7 @@
#include "geometry/mesh/TriangleMeshIO.h"
#include "core/Regex.h"
#include "core/Filesystem.h"
#include "core/DataTypes.h"
#include <fstream>
#include <iomanip>
......@@ -58,14 +59,16 @@ int main(int argc, char** argv)
return EXIT_SUCCESS;
}
if( argc < 3 || argv[argc-1][0] == '-' || argv[argc-2][0] == '-' )
PRINT_ERR( "Usage: PovrayFileCompressor [-q|-v|-n|-s|-o ${count}] <inDir> <outDir>\n" )
if (argc < 3 || argv[argc - 1][0] == '-' || argv[argc - 2][0] == '-')
PRINT_ERR("Usage: PovrayFileCompressor [-q|-v|-n|-s|-o ${count}] <inDir> <outDir>\n")
using walberla::operator"" _r;
verbose = false;
quiet = false;
size_t n = 9000u;
size_t s = 0u;
walberla::real_t o = walberla::real_t(0);
walberla::real_t o = 0_r;
if( argc > 3 ) {
for( walberla::uint_t i = 1; i < walberla::uint_c(argc-2); ++i ) {
......@@ -153,7 +156,7 @@ int main(int argc, char** argv)
PRINT_VER( "Remove Duplicate Vertices ... \n" )
size_t removed;
if( o > walberla::real_t(0) )
if( o > 0_r )
removed = mesh.removeDuplicateVertices( o );
else
removed = mesh.removeDuplicateVertices( );
......
......@@ -102,7 +102,7 @@ int main( int argc, char ** argv )
shared_ptr< StructuredBlockForest > blocks = blockforest::createUniformBlockGrid (
uint_t(1) , uint_t(2), uint_t(1), // number of blocks in x,y,z direction
image.size( uint_t(0) ), image.size( uint_t(1) ) / uint_t(2), uint_t(1), // how many cells per block (x,y,z)
real_t(1), // dx: length of one cell in physical coordinates
1_r, // dx: length of one cell in physical coordinates
false, // one block per process - "false" means all blocks to one process
false, false, false ); // no periodicity
......
......@@ -61,7 +61,7 @@ int main( int argc, char ** argv )
// create fields
LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::SRT( omega ) );
BlockDataID pdfFieldId = lbm::addPdfFieldToStorage( blocks, "pdf field", latticeModel, initialVelocity, real_t(1) );
BlockDataID pdfFieldId = lbm::addPdfFieldToStorage( blocks, "pdf field", latticeModel, initialVelocity, 1_r );
BlockDataID flagFieldId = field::addFlagFieldToStorage< FlagField_T >( blocks, "flag field" );
// create and initialize boundary handling
......
......@@ -574,7 +574,7 @@ int main( int argc, char ** argv )
// create fields
BlockDataID pdfFieldId = lbm::addPdfFieldToStorage( blocks, "pdf field", latticeModel, initialVelocity, real_t(1) );
BlockDataID pdfFieldId = lbm::addPdfFieldToStorage( blocks, "pdf field", latticeModel, initialVelocity, 1_r );
BlockDataID flagFieldId = field::addFlagFieldToStorage< FlagField_T >( blocks, "flag field" );
// create and initialize boundary handling
......
......@@ -84,7 +84,7 @@ int main( int argc, char ** argv )
cr::HCSITS cr(globalBodyStorage, forest, storageID, ccdID, fcdID);
cr.setMaxIterations( 10 );
cr.setRelaxationModel( cr::HardContactSemiImplicitTimesteppingSolvers::ApproximateInelasticCoulombContactByDecoupling );
cr.setRelaxationParameter( real_t(0.7) );
cr.setRelaxationParameter( 0.7_r );
cr.setGlobalLinearAcceleration( Vec3(0,0,0) );
//! [Integrator]
......
......@@ -148,7 +148,7 @@ int main( int argc, char ** argv )
cr::HCSITS cr(globalBodyStorage, forest, storageID, ccdID, fcdID);
cr.setMaxIterations( 10 );
cr.setRelaxationModel( cr::HardContactSemiImplicitTimesteppingSolvers::ApproximateInelasticCoulombContactByDecoupling );
cr.setRelaxationParameter( real_t(0.7) );
cr.setRelaxationParameter( 0.7_r );
cr.setGlobalLinearAcceleration( Vec3(0,0,0) );
WALBERLA_LOG_INFO_ON_ROOT("*** SYNCCALL ***");
......
......@@ -60,7 +60,7 @@ BlockForestEvaluation::BlockForestEvaluation( const BlockForest & forest ) :
blockStatistics_[i].avg = sample.mean();
blockStatistics_[i].stdDev = sample.stdDeviation();
const auto relStdDev = sample.relativeStdDeviation();
blockStatistics_[i].relStdDev = math::isnan( relStdDev ) ? real_t(0) : relStdDev;
blockStatistics_[i].relStdDev = math::isnan( relStdDev ) ? 0_r : relStdDev;
}
}
}
......
......@@ -841,7 +841,7 @@ uint_t GlobalLoadBalancing::metis( const std::vector< BLOCK* >& blocks, const me
// second call to METIS: try to balance both workload and memory as good as possible ...
real_t minUbvec = real_t(1);
real_t minUbvec = 1_r;
ubvec[1] = minUbvec;
ret = core::METIS_PartGraphRecursive( &nvtxs, &ncon, &(xadj[0]), &(adjncy[0]), &(vwgt[0]), NULL, &(adjwgt[0]), &nparts, NULL,
......@@ -969,7 +969,7 @@ void GlobalLoadBalancing::metis2( const std::vector< BLOCK* >& blocks, const uin
{
if( block->getNeighbor( k )->getLevel() == block->getLevel() && block->getNeighbor( k )->getWorkload() > workload_t(0) )
{
if( communicationWeights[ commIdx ] > real_t(0) )
if( communicationWeights[ commIdx ] > 0_r )
{
adjncy.push_back( numeric_cast<int64_t>( block->getNeighbor( k )->getIndex() ) );
WALBERLA_ASSERT_LESS( commIdx, communicationWeights.size() );
......
......@@ -111,7 +111,7 @@ shared_ptr< StructuredBlockForest > createUniformBlockGridFromConfig( const Conf
const bool keepGlobalBlockInformation )
{
const Vector3<bool> periodic = configBlock.getParameter<Vector3<bool> >( "periodic", Vector3<bool> (false) );
const real_t dx = configBlock.getParameter<real_t >( "dx", real_t(1) );
const real_t dx = configBlock.getParameter<real_t >( "dx", 1_r );
Vector3<uint_t> cellsPerBlock;
Vector3<uint_t> blocks;
......
......@@ -1152,7 +1152,7 @@ void SetupBlockForest::balanceLoad( const TargetProcessAssignmentFunction & func
{
WALBERLA_LOG_PROGRESS( "Balancing SetupBlockForest: Creating a process distribution for " << numberOfProcesses_ << " process(es) ..." );
if( minBufferProcessesFraction < real_t(0) || !(minBufferProcessesFraction < real_t(1)) )
if( minBufferProcessesFraction < 0_r || !(minBufferProcessesFraction < 1_r) )
WALBERLA_ABORT( "Load balancing failed: \'buffer processes fraction\' must be in [0,1). "
"The value you provided was \'" << minBufferProcessesFraction << "\'." );
......@@ -1166,7 +1166,7 @@ void SetupBlockForest::balanceLoad( const TargetProcessAssignmentFunction & func
//
// integer = cast< integer >( 0.5 + floating point ) [for correct rounding]
const uint_t numberOfWorkerProcesses = uint_c( real_c(0.5) + ( real_t(1) - minBufferProcessesFraction ) * real_c( numberOfProcesses ) );
const uint_t numberOfWorkerProcesses = uint_c( real_c(0.5) + ( 1_r - minBufferProcessesFraction ) * real_c( numberOfProcesses ) );
WALBERLA_CHECK_LESS_EQUAL( numberOfWorkerProcesses, numberOfProcesses );
const uint_t numberOfBufferProcesses = numberOfProcesses - numberOfWorkerProcesses;
......@@ -1978,7 +1978,7 @@ void SetupBlockForest::toStream( std::ostream & os ) const
<< "- initial decomposition: " << size_[0] << " x " << size_[1] << " x " << size_[2] << " (= forest size)\n"
<< std::boolalpha << "- periodicity: " << periodic_[0] << " x " << periodic_[1] << " x " << periodic_[2] << "\n"
<< "- number of blocks discarded from the initial grid: " << discardedRootBlocks << " (= "
<< ( real_t(100) * real_c(discardedRootBlocks) / real_c(size_[0]*size_[1]*size_[2]) ) << " %)\n"
<< ( 100_r * real_c(discardedRootBlocks) / real_c(size_[0]*size_[1]*size_[2]) ) << " %)\n"
<< "- number of levels: " << getNumberOfLevels() << "\n"
<< "- tree ID digits: " << treeIdDigits_ << " (-> block ID bytes = " << getBlockIdBytes() << ")\n"
<< "- total number of blocks: " << numberOfBlocks_ << "\n";
......@@ -1991,9 +1991,9 @@ void SetupBlockForest::toStream( std::ostream & os ) const
{
os << "\n- distribution of space/memory/work to different grid levels:\n";
std::vector< real_t > space ( depth_ + 2, real_t(0) );
std::vector< real_t > memory ( depth_ + 2, real_t(0) );
std::vector< real_t > workload ( depth_ + 2, real_t(0) );
std::vector< real_t > space ( depth_ + 2, 0_r );
std::vector< real_t > memory ( depth_ + 2, 0_r );
std::vector< real_t > workload ( depth_ + 2, 0_r );
std::vector< uint_t > numberOfBlocks( depth_ + 2, uint_t(0) );
for( auto block = begin(); block != end(); ++block )
......@@ -2017,9 +2017,9 @@ void SetupBlockForest::toStream( std::ostream & os ) const
{
os << " + level " << l << ":\n"
<< " - " << numberOfBlocks[l] << " blocks ...\n"
<< " - ... cover " << ( real_t(100) * space[l] / space.back() ) << " % of the total simulation space\n"
<< " - ... account for " << ( real_t(100) * memory[l] / memory.back() ) << " % of the total memory foot print\n"
<< " - ... generate " << ( real_t(100) * workload[l] / workload.back() ) << " % of the total workload";
<< " - ... cover " << ( 100_r * space[l] / space.back() ) << " % of the total simulation space\n"
<< " - ... account for " << ( 100_r * memory[l] / memory.back() ) << " % of the total memory foot print\n"
<< " - ... generate " << ( 100_r * workload[l] / workload.back() ) << " % of the total workload";
if( l != depth_ ) os << "\n";
}
}
......@@ -2087,7 +2087,7 @@ void SetupBlockForest::toStream( std::ostream & os ) const
{
os << "\n- distribution of space/memory/work to different grid levels:\n";
std::vector< real_t > space( depth_ + 2, real_t(0) );
std::vector< real_t > space( depth_ + 2, 0_r );
std::vector< uint_t > numberOfBlocks( depth_ + 2, uint_t(0) );
for( auto block = begin(); block != end(); ++block )
......@@ -2107,9 +2107,9 @@ void SetupBlockForest::toStream( std::ostream & os ) const
{
os << " + level " << l << ":\n"
<< " - " << numberOfBlocks[l] << " blocks ...\n"
<< " - ... cover " << ( real_t(100) * space[l] / space.back() ) << " % of the total simulation space\n"
<< " - ... account for " << ( real_t(100) * memory[l].sum() / memory.back().sum() ) << " % of the total memory foot print\n"
<< " - ... generate " << ( real_t(100) * workload[l].sum() / workload.back().sum() ) << " % of the total work load\n"
<< " - ... cover " << ( 100_r * space[l] / space.back() ) << " % of the total simulation space\n"
<< " - ... account for " << ( 100_r * memory[l].sum() / memory.back().sum() ) << " % of the total memory foot print\n"
<< " - ... generate " << ( 100_r * workload[l].sum() / workload.back().sum() ) << " % of the total work load\n"
<< " - blocks per process:\n"
<< " + min = " << blocks[l].min() << "\n"
<< " + max = " << blocks[l].max() << "\n"
......
......@@ -275,7 +275,7 @@ public:
void assignAllBlocksToRootProcess();
void balanceLoad( const TargetProcessAssignmentFunction & function,
const uint_t numberOfProcesses, const real_t minBufferProcessesFraction = real_t(0),
const uint_t numberOfProcesses, const real_t minBufferProcessesFraction = 0_r,
const memory_t perProcessMemoryLimit = memory_t(0),
const bool reorderProcessesByBFS = false, const bool insertBufferProcesses = false );
......
......@@ -51,7 +51,7 @@ public:
const WeightsToUse weightsToUse = PARMETIS_BOTH_WEIGHTS,
const EdgeSource edgeSource = PARMETIS_EDGES_FROM_EDGE_WEIGHTS,
const uint_t ncon = uint_t(1))
: algorithm_( algorithm ), weightsToUse_( weightsToUse ), edgeSource_( edgeSource ), ncon_( ncon ), ubvec_( ncon, real_t(1.05) ) {}
: algorithm_( algorithm ), weightsToUse_( weightsToUse ), edgeSource_( edgeSource ), ncon_( ncon ), ubvec_( ncon, 1.05_r ) {}
bool operator()( std::vector< std::pair< const PhantomBlock *, uint_t > > & targetProcess,
std::set< uint_t > & processesToRecvFrom,
......
......@@ -102,9 +102,9 @@ uint_t realToByteArray( const REAL_T value, std::vector< uint8_t >& array, const
int exp;
const REAL_T x = std::frexp( value, &exp );
const REAL_T sign = ( x < REAL_T(0) ) ? REAL_T(-1) : REAL_T(1);
const REAL_T sign = ( x < 0_r ) ? -1_r : 1_r;
uint_t signByte = ( ( exp >= 0 ) ? uint_c(0) : uint_c(1) ) + ( ( sign < REAL_T(0) ) ? uint_c(2) : uint_c(0) );
uint_t signByte = ( ( exp >= 0 ) ? uint_c(0) : uint_c(1) ) + ( ( sign < 0_r ) ? uint_c(2) : uint_c(0) );
array[ offset ] = uint8_c( signByte );
uint32_t uexp = ( exp >= 0 ) ? uint32_c( exp ) : uint32_c( -1 * exp );
......@@ -141,7 +141,7 @@ REAL_T byteArrayToReal( const std::vector< uint8_t >& array, const uint_t offset
for( uint_t i = 0; i != sizeof( REAL_T ); ++i )
mant |= uint64_c( array[ offset + 3 + i ] ) << ( i * 8 );
const REAL_T sign = ( ( uint_c( array[ offset ] ) & uint_c(2) ) == uint_c(0) ) ? REAL_T(1) : REAL_T(-1);
const REAL_T sign = ( ( uint_c( array[ offset ] ) & uint_c(2) ) == uint_c(0) ) ? 1_r : -1_r;
return std::ldexp( sign * numeric_cast<REAL_T>( mant ) / numeric_cast<REAL_T>( uint64_c(1) << uint64_c( 1 + std::numeric_limits<REAL_T>::digits ) ), exp );
}
......
......@@ -39,7 +39,7 @@ namespace math {
**********************************************************************************************************************/
void DistributedSample::mpiAllGather()
{
sum_ = real_t(0);
sum_ = 0_r;