...
  View open merge request
Commits (2)
......@@ -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,
......
......@@ -167,6 +167,16 @@ typedef double real_t;
typedef float real_t;
#endif
constexpr real_t operator"" _r( long double r )
{
return static_cast<real_t>(r);
}
constexpr real_t operator"" _r( unsigned long long int r )
{
return static_cast<real_t>(r);
}
template< typename T > inline real_t real_c ( T t ) { return numeric_cast< real_t >(t); } ///< cast to type real_t using "real_c(x)"
template< typename T > inline double double_c( T t ) { return numeric_cast< double >(t); } ///< cast to type double
template< typename T > inline float float_c ( T t ) { return numeric_cast< float > (t); } ///< cast to type float
......
......@@ -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;
min_ = std::numeric_limits< real_t >::max();
max_ = -std::numeric_limits< real_t >::max();
size_ = uint_c( data_.size() );
......@@ -60,7 +60,7 @@ void DistributedSample::mpiAllGather()
}
mean_ = sum_ / real_c(size_);
variance_ = real_t(0);
variance_ = 0_r;
for( auto it = data_.begin(); it != data_.end(); ++it )
{
......@@ -77,10 +77,10 @@ void DistributedSample::mpiAllGather()
if( size_ == uint_t(0) )
{
min_ = real_t(0);
max_ = real_t(0);
mean_ = real_t(0);
variance_ = real_t(0);
min_ = 0_r;
max_ = 0_r;
mean_ = 0_r;
variance_ = 0_r;
}
}
......@@ -98,7 +98,7 @@ void DistributedSample::mpiGather( int rank )
WALBERLA_ASSERT( rank == 0 );
}
sum_ = real_t(0);
sum_ = 0_r;
min_ = std::numeric_limits< real_t >::max();
max_ = -std::numeric_limits< real_t >::max();
size_ = uint_c( data_.size() );
......@@ -119,7 +119,7 @@ void DistributedSample::mpiGather( int rank )
}
mean_ = sum_ / real_c(size_);
variance_ = real_t(0);
variance_ = 0_r;
for( auto it = data_.begin(); it != data_.end(); ++it )
{
......@@ -136,10 +136,10 @@ void DistributedSample::mpiGather( int rank )
if( size_ == uint_t(0) )
{
min_ = real_t(0);
max_ = real_t(0);
mean_ = real_t(0);
variance_ = real_t(0);
min_ = 0_r;
max_ = 0_r;
mean_ = 0_r;
variance_ = 0_r;
}
}
......
......@@ -42,7 +42,7 @@ class DistributedSample
public:
DistributedSample() :
sum_( real_t(0) ), min_( real_t(0) ), max_( real_t(0) ), size_( uint_t(0) ), mean_( real_t(0) ), variance_( real_t(0) ) {}
sum_( 0_r ), min_( 0_r ), max_( 0_r ), size_( uint_t(0) ), mean_( 0_r ), variance_( 0_r ) {}
// insert
......@@ -57,7 +57,7 @@ public:
template <class InputIterator>
void castToRealAndInsert( InputIterator first, InputIterator last );
void clear() { data_.clear(); sum_ = real_t(0); min_ = real_t(0); max_ = real_t(0); size_ = uint_t(0); mean_ = real_t(0); variance_ = real_t(0); }
void clear() { data_.clear(); sum_ = 0_r; min_ = 0_r; max_ = 0_r; size_ = uint_t(0); mean_ = 0_r; variance_ = 0_r; }
// synchronization
......
......@@ -66,7 +66,7 @@ private:
};
Plane::Plane() :
normal_( Vec3Real( real_t(1), real_t(0), real_t(0) ) ), d_( real_t(0) )
normal_( Vec3Real( 1_r, 0_r, 0_r ) ), d_( 0_r )
{
}
......
......@@ -262,7 +262,7 @@ inline Quaternion<Type>::Quaternion( Vector3<Axis> axis, Type angle )
static_assert(boost::is_floating_point<Axis>::value, "Axis has to be floating point!" );
auto axisLength = axis.length();
if( (floatIsEqual(axisLength, 0)) || (math::equal(std::fabs(angle), real_t(0))) ) {
if( (floatIsEqual(axisLength, 0)) || (math::equal(std::fabs(angle), 0_r)) ) {
reset();
return;
}
......@@ -270,7 +270,7 @@ inline Quaternion<Type>::Quaternion( Vector3<Axis> axis, Type angle )
const Type sina( std::sin( angle*Type(0.5) ) );
const Type cosa( std::cos( angle*Type(0.5) ) );
auto invAxisLength = real_t(1) / axisLength;
auto invAxisLength = 1_r / axisLength;
axis *= invAxisLength;
v_[0] = cosa;
......
......@@ -193,7 +193,7 @@ private:
inline bool boolRandom() { ///< Randomly returns 'true' or 'false'
return realRandom<real_t>() >= real_t(0.5);
return realRandom<real_t>() >= 0.5_r;
}
......
......@@ -187,7 +187,7 @@ real_t Sample::mad() const
real_t upperMedian = *upperMedianPosition;
real_t lowerMedian = *std::max_element( deviations.begin(), upperMedianPosition );
return ( lowerMedian + upperMedian ) / real_t(2);
return ( lowerMedian + upperMedian ) / 2_r;
}
}
......@@ -204,7 +204,7 @@ real_t Sample::mad() const
real_t Sample::giniCoefficient() const
{
WALBERLA_ASSERT_GREATER( size(), 1LU );
WALBERLA_ASSERT_GREATER( mean(), real_t(0) );
WALBERLA_ASSERT_GREATER( mean(), 0_r );
real_t sum0 = 0;
real_t sum1 = 0;
......@@ -217,7 +217,7 @@ real_t Sample::giniCoefficient() const
}
const real_t theSize = real_c( size() );
return real_t(1) - ( real_t(2) / ( theSize - real_t(1) ) ) * ( theSize - sum0 / sum1 );
return 1_r - ( 2_r / ( theSize - 1_r ) ) * ( theSize - sum0 / sum1 );
}
/*******************************************************************************************************************//**
......
......@@ -371,7 +371,7 @@ inline bool equal( T1 a, T2 b )
*/
inline real_t round( real_t a )
{
return std::floor( a + real_t(0.5) );
return std::floor( a + 0.5_r );
}
//**********************************************************************************************************************
......
......@@ -107,7 +107,7 @@ inline std::string timeToString(real_t time)
time -= tmp * sPerMin;
}
result << std::floor(time + real_t(0.5)) << "s ";
result << std::floor(time + 0.5_r) << "s ";
return result.str();
}
......
......@@ -37,7 +37,7 @@ void mapPointToPeriodicDomain( const std::array< bool, 3 > & periodic, const AAB
if( x < domain.xMin() )
{
real_t shift = ( domain.xMin() - x ) - ( std::floor( ( domain.xMin() - x ) / domainSize ) * domainSize );
shift = std::max( shift, real_t(0) );
shift = std::max( shift, 0_r );
x = domain.xMax() - shift;
if( isIdentical( x, domain.xMax() ) || x < domain.xMin() )
x = std::nextafter(domain.xMax(), domain.xMin());
......@@ -45,7 +45,7 @@ void mapPointToPeriodicDomain( const std::array< bool, 3 > & periodic, const AAB
else if( x >= domain.xMax() )
{
real_t shift = ( x - domain.xMax() ) - ( std::floor( ( x - domain.xMax() ) / domainSize ) * domainSize );
shift = std::max( shift, real_t(0) );
shift = std::max( shift, 0_r );
x = domain.xMin() + shift;
if( x >= domain.xMax() )
x = domain.xMin();
......@@ -58,7 +58,7 @@ void mapPointToPeriodicDomain( const std::array< bool, 3 > & periodic, const AAB
if( y < domain.yMin() )
{
real_t shift = ( domain.yMin() - y ) - ( std::floor( ( domain.yMin() - y ) / domainSize ) * domainSize );
shift = std::max( shift, real_t(0) );
shift = std::max( shift, 0_r );
y = domain.yMax() - shift;
if( isIdentical( y, domain.yMax() ) || y < domain.yMin() )
y = std::nextafter(domain.yMax(), domain.yMin());
......@@ -66,7 +66,7 @@ void mapPointToPeriodicDomain( const std::array< bool, 3 > & periodic, const AAB
else if( y >= domain.yMax() )
{
real_t shift = ( y - domain.yMax() ) - ( std::floor( ( y - domain.yMax() ) / domainSize ) * domainSize );
shift = std::max( shift, real_t(0) );
shift = std::max( shift, 0_r );
y = domain.yMin() + shift;
if( y >= domain.yMax() )
y = domain.yMin();
......@@ -79,7 +79,7 @@ void mapPointToPeriodicDomain( const std::array< bool, 3 > & periodic, const AAB
if( z < domain.zMin() )
{
real_t shift = ( domain.zMin() - z ) - ( std::floor( ( domain.zMin() - z ) / domainSize ) * domainSize );
shift = std::max( shift, real_t(0) );
shift = std::max( shift, 0_r );
z = domain.zMax() - shift;
if( isIdentical( z, domain.zMax() ) || z < domain.zMin() )
z = std::nextafter(domain.zMax(), domain.zMin());
......@@ -87,7 +87,7 @@ void mapPointToPeriodicDomain( const std::array< bool, 3 > & periodic, const AAB
else if( z >= domain.zMax() )
{
real_t shift = ( z - domain.zMax() ) - ( std::floor( ( z - domain.zMax() ) / domainSize ) * domainSize );
shift = std::max( shift, real_t(0) );
shift = std::max( shift, 0_r );
z = domain.zMin() + shift;
if( z >= domain.zMax() )
z = domain.zMin();
......
......@@ -27,7 +27,7 @@ namespace domain_decomposition {
real_t periodicIntersectionVolume( const std::array< bool, 3 > & periodic, const math::AABB & domain, const math::AABB & box1, const math::AABB & box2 )
{
const auto diagonal = (domain.maxCorner() - domain.minCorner());
const auto halfDiagonal = real_t(0.5) * diagonal;
const auto halfDiagonal = 0.5_r * diagonal;
const auto center1 = box1.center();
auto center2 = box2.center();
......
......@@ -146,7 +146,7 @@ public:
const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) :
blocks_( blocks ), fieldId_( fieldId ), solution_( solution ), filter_( filter ),
executionCounter_( uint_t(0) ), plotFrequency_( plotFrequency ), logFrequency_( logFrequency ),
filename_( internal::accuracyEvaluationFilename ), normalizationFactor_( real_t(1) ),
filename_( internal::accuracyEvaluationFilename ), normalizationFactor_( 1_r ),
requiredSelectors_(requiredSelectors), incompatibleSelectors_( incompatibleSelectors )
{}
......@@ -157,8 +157,8 @@ public:
const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) :
blocks_( blocks ), fieldId_( fieldId ), solution_( solution ), filter_( Filter_T() ),
executionCounter_( uint_t(0) ), plotFrequency_( plotFrequency ), logFrequency_( logFrequency ),
filename_( internal::accuracyEvaluationFilename ), normalizationFactor_( real_t(1) ),
L1_( real_t(0) ), L2_( real_t(0) ), Lmax_( real_t(0) ),
filename_( internal::accuracyEvaluationFilename ), normalizationFactor_( 1_r ),
L1_( 0_r ), L2_( 0_r ), Lmax_( 0_r ),
requiredSelectors_(requiredSelectors), incompatibleSelectors_( incompatibleSelectors )
{
static_assert( (boost::is_same< Filter_T, DefaultEvaluationFilter >::value),
......@@ -221,9 +221,9 @@ void AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::operator()()
const auto & domainAABB = blocks->getDomain();
real_t _L1( real_t(0) );
real_t _L2( real_t(0) );
real_t _Lmax( real_t(0) );
real_t _L1( 0_r );
real_t _L2( 0_r );
real_t _Lmax( 0_r );
for( auto block = blocks->begin( requiredSelectors_, incompatibleSelectors_ ); block != blocks->end(); ++block )
{
......@@ -236,7 +236,7 @@ void AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::operator()()
#ifdef _OPENMP
std::vector< real_t > lmax( numeric_cast<size_t>( omp_get_max_threads() ), real_t(0) );
std::vector< real_t > lmax( numeric_cast<size_t>( omp_get_max_threads() ), 0_r );
#pragma omp parallel
{
......
......@@ -202,7 +202,7 @@ public:
const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(),
const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) :
blocks_( blocks ), fieldId_( fieldId ), solution_( solution ), filter_( filter ), yAxis_( yAxis ),
relLinePoint_( Vector3<real_t>( real_c(0.5) ) ), normalizationFactor_( real_t(1) ),
relLinePoint_( Vector3<real_t>( real_c(0.5) ) ), normalizationFactor_( 1_r ),
requiredSelectors_(requiredSelectors), incompatibleSelectors_( incompatibleSelectors )
{
auto _blocks = blocks_.lock();
......@@ -215,7 +215,7 @@ public:
const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(),
const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) :
blocks_( blocks ), fieldId_( fieldId ), solution_( solution ), filter_( Filter_T() ), yAxis_( yAxis ),
relLinePoint_( Vector3<real_t>( real_c(0.5) ) ), normalizationFactor_( real_t(1) ),
relLinePoint_( Vector3<real_t>( real_c(0.5) ) ), normalizationFactor_( 1_r ),
requiredSelectors_(requiredSelectors), incompatibleSelectors_( incompatibleSelectors )
{
static_assert( (boost::is_same< Filter_T, DefaultEvaluationFilter >::value),
......@@ -469,7 +469,7 @@ inline void accuracyEvaluationLinePlotConfigParser( const shared_ptr< Config > &
#define WALBERLA_FIELD_MAKE_ACCURACY_EVALUATION_LINE_PLOT_CONFIG_PARSER( config ) \
bool defaultYAxis( true ); \
Vector3<real_t> defaultRelLinePoint( real_c(0.5) ); \
real_t defaultNormalizationFactor( real_t(1) ); \
real_t defaultNormalizationFactor( 1_r ); \
auto _blocks = blocks.lock(); \
WALBERLA_CHECK_NOT_NULLPTR( _blocks, "Trying to execute 'makeAccuracyEvaluationLinePlot' for a block storage object that doesn't exist anymore" ); \
math::AABB defaultDomainNormalization( _blocks->getDomain() ); \
......
......@@ -135,7 +135,7 @@ public:
blocks_( blocks ), filter_( filter ),
executionCounter_( uint_c(0) ), plotFrequency_( plotFrequency ), logFrequency_( logFrequency ), filename_( filename ),
fieldId_( fieldId ),
initialMass_( real_t(0) ), minMass_( real_t(0) ), maxMass_( real_t(0) ),
initialMass_( 0_r ), minMass_( 0_r ), maxMass_( 0_r ),
requiredSelectors_(requiredSelectors), incompatibleSelectors_( incompatibleSelectors )
{
auto _blocks = blocks.lock();
......@@ -152,7 +152,7 @@ public:
blocks_( blocks ), filter_( Filter_T() ),
executionCounter_( uint_c(0) ), plotFrequency_( plotFrequency ), logFrequency_( logFrequency ), filename_( filename ),
fieldId_( fieldId ),
initialMass_( real_t(0) ), minMass_( real_t(0) ), maxMass_( real_t(0) ),
initialMass_( 0_r ), minMass_( 0_r ), maxMass_( 0_r ),
requiredSelectors_(requiredSelectors), incompatibleSelectors_( incompatibleSelectors )
{
static_assert( (boost::is_same< Filter_T, DefaultEvaluationFilter >::value),
......@@ -209,7 +209,7 @@ void MassEvaluation< DensityField_T, Filter_T, Pseudo2D >::operator()()
if( !log && !plot )
return;
real_t mass( real_t(0) );
real_t mass( 0_r );
auto blocks = blocks_.lock();
WALBERLA_CHECK_NOT_NULLPTR( blocks, "Trying to access 'MassEvaluation' for a block storage object that doesn't exist anymore" );
......
......@@ -51,7 +51,7 @@ typedef std::function< real_t () > FlowRateSolution_T;
typedef std::function< Vector3< real_t > ( const Vector3< real_t > & ) > FlowRateVelocitySolution_T;
const std::string volumetricFlowRateEvaluationFilename("flowrate.dat");
const real_t volumetricFlowRateEvaluationNormalization( real_t(1) );
const real_t volumetricFlowRateEvaluationNormalization( 1_r );
const Vector3<bool> volumetricFlowRateEvaluationAxis( Vector3<bool>( true, false, false ) );
const Vector3<real_t> volumetricFlowRateEvaluationPoint( Vector3<real_t>( real_c(0.5) ) );
......@@ -164,7 +164,7 @@ public:
filename_( internal::volumetricFlowRateEvaluationFilename ),
normalizationFactor_( internal::volumetricFlowRateEvaluationNormalization ),
axis_( internal::volumetricFlowRateEvaluationAxis ), surfacePoint_( internal::volumetricFlowRateEvaluationPoint ),
flowRate_( real_t(0) ), velocitySolutionFlowRate_( real_t(0) ),
flowRate_( 0_r ), velocitySolutionFlowRate_( 0_r ),
requiredSelectors_(requiredSelectors), incompatibleSelectors_( incompatibleSelectors )
{
auto _blocks = blocks.lock();
......@@ -183,7 +183,7 @@ public:
filename_( internal::volumetricFlowRateEvaluationFilename ),
normalizationFactor_( internal::volumetricFlowRateEvaluationNormalization ),
axis_( internal::volumetricFlowRateEvaluationAxis ), surfacePoint_( internal::volumetricFlowRateEvaluationPoint ),
flowRate_( real_t(0) ), velocitySolutionFlowRate_( real_t(0) ),
flowRate_( 0_r ), velocitySolutionFlowRate_( 0_r ),
requiredSelectors_(requiredSelectors), incompatibleSelectors_( incompatibleSelectors )
{
static_assert( (boost::is_same< Filter_T, DefaultEvaluationFilter >::value),
......@@ -206,7 +206,7 @@ public:
real_t solution() const
{
if( !solution_ )
return real_t(0);
return 0_r;
auto blocks = blocks_.lock();
WALBERLA_CHECK_NOT_NULLPTR( blocks, "Trying to access 'VolumetricFlowRateEvaluation' for a block storage object that doesn't exist anymore" );
......@@ -287,8 +287,8 @@ void VolumetricFlowRateEvaluation< VelocityField_T, Filter_T >::operator()()
sp[1] += surfacePoint_[1] * domainAABB.ySize();
sp[2] += surfacePoint_[2] * domainAABB.zSize();
real_t _flowRate( real_t(0) );
real_t _velocitySolutionFlowRate( real_t(0) );
real_t _flowRate( 0_r );
real_t _velocitySolutionFlowRate( 0_r );
for( auto block = blocks->begin( requiredSelectors_, incompatibleSelectors_ ); block != blocks->end(); ++block )
{
......@@ -468,8 +468,8 @@ void VolumetricFlowRateEvaluation< VelocityField_T, Filter_T >::operator()()
{
std::ofstream file( filename_.c_str(), std::ofstream::out | std::ofstream::app );
file << ( executionCounter_ - uint_t(1) ) << " " << flowRate_ << " " << velocitySolutionFlowRate_ << " " << _solution << " "
<< ( isIdentical( velocitySolutionFlowRate_, real_t(0) ) ? real_t(0) : std::abs( ( flowRate_ - velocitySolutionFlowRate_ ) / velocitySolutionFlowRate_ ) ) << " "
<< ( isIdentical( _solution, real_t(0) ) ? real_t(0) : std::abs( ( flowRate_ - _solution ) / _solution ) ) << std::endl;
<< ( isIdentical( velocitySolutionFlowRate_, 0_r ) ? 0_r : std::abs( ( flowRate_ - velocitySolutionFlowRate_ ) / velocitySolutionFlowRate_ ) ) << " "
<< ( isIdentical( _solution, 0_r ) ? 0_r : std::abs( ( flowRate_ - _solution ) / _solution ) ) << std::endl;
file.close();
}
}
......
......@@ -109,7 +109,7 @@ void GradientRefinement< VectorField_T, Filter_T, Pseudo2D >::operator()( std::v
real_t gradient[gradients];
for( int i = 0; i < gradients; ++i )
gradient[i] = real_t(0);
gradient[i] = 0_r;
if( innerInterval.contains(x,y,z) )
{
......@@ -184,7 +184,7 @@ void GradientRefinement< VectorField_T, Filter_T, Pseudo2D >::operator()( std::v
}
}
real_t magnitute( real_t(0) );
real_t magnitute( 0_r );
for( int i = 0; i < gradients; ++i )
magnitute += gradient[i];
......
......@@ -92,11 +92,11 @@ public:
centerCell[0] + cell_idx_c(neighborhoodSize), centerCell[1] + cell_idx_c(neighborhoodSize), centerCell[2] + cell_idx_c(neighborhoodSize) );
const uint_t kernelSizeOneDirection = uint_t(2) * neighborhoodSize + uint_t(1);
std::vector<real_t> weights( kernelSizeOneDirection * kernelSizeOneDirection * kernelSizeOneDirection, real_t(0) );
std::vector<real_t> weights( kernelSizeOneDirection * kernelSizeOneDirection * kernelSizeOneDirection, 0_r );
uint_t counter = uint_t(0);
real_t sumOfWeights = real_t(0);
real_t sumOfWeightsUnavailable = real_t(0);
real_t sumOfWeights = 0_r;
real_t sumOfWeightsUnavailable = 0_r;
// get distribution weights and count available cells in surrounding cells
for( auto cellIt = cellNeighborhood.begin(); cellIt != cellNeighborhood.end(); ++cellIt )
......@@ -109,24 +109,24 @@ public:
}
else
{
weights[counter] = real_t(0);
weights[counter] = 0_r;
sumOfWeightsUnavailable += kernelweights::kernelWeightFunction( x, y, z, curCellCenter[0], curCellCenter[1], curCellCenter[2], dx, dy, dz );
}
++counter;
}