use static_cast instead of old-style casts

This commit is contained in:
dqueteschiner
2015-03-24 12:58:33 +01:00
parent 1307a0ef22
commit 667e806224
2 changed files with 16 additions and 18 deletions

View File

@ -423,10 +423,10 @@ void Foam::clockModel::getRAMUsage() const
MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
int numprocs=-10;
MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
pid_t myPID = getpid(); //get PID of running process
//Pout << myPID << "\n";
std::string fileName = "/proc/"; //build path to /proc/PID/smaps and open file
std::stringstream strs;
strs << myPID;
@ -461,11 +461,10 @@ void Foam::clockModel::getRAMUsage() const
SwapMem = SwapMem + temp;
//Pout << strs.str() << " ";
}
}
}
double SwapMB = (double)SwapMem/1024.0; //kB -> MB
double RssMB = (double)RssMem/1024.0;
double SwapMB = static_cast<double>(SwapMem)/1024.0; //kB -> MB
double RssMB = static_cast<double>(RssMem)/1024.0;
inFile.close();
@ -480,7 +479,6 @@ void Foam::clockModel::getRAMUsage() const
//Pout << "SWAP Memory used: " << SwapMem <<"MB\n";
//Pout << "Rss Memory used: " << RssMem <<"MB\n";
return;
}

View File

@ -413,25 +413,25 @@ double IBVoidFraction::minPeriodicDistance(vector cellCentrePosition,
boundBox globalBb,
vector& minPeriodicPos)const
{
double centreDist=999e32;
double centreDist = 999e32;
vector positionCenterPeriodic;
for(int xDir=-1; xDir<=1; xDir++)
for (int xDir=-1; xDir<=1; xDir++)
{
positionCenterPeriodic[0] = positionCenter[0]
+ (double)xDir
*(globalBb.max()[0]-globalBb.min()[0]);
for(int yDir=-1; yDir<=1; yDir++)
+ static_cast<double>(xDir)
* (globalBb.max()[0] - globalBb.min()[0]);
for (int yDir=-1; yDir<=1; yDir++)
{
positionCenterPeriodic[1] = positionCenter[1]
+ (double)yDir
* (globalBb.max()[1]-globalBb.min()[1]);
for(int zDir=-1; zDir<=1; zDir++)
+ static_cast<double>(yDir)
* (globalBb.max()[1] - globalBb.min()[1]);
for (int zDir=-1; zDir<=1; zDir++)
{
positionCenterPeriodic[2] = positionCenter[2]
+ (double)zDir
* (globalBb.max()[2]-globalBb.min()[2]);
if( mag(cellCentrePosition-positionCenterPeriodic)<centreDist)
+ static_cast<double>(zDir)
* (globalBb.max()[2] - globalBb.min()[2]);
if (mag(cellCentrePosition-positionCenterPeriodic) < centreDist)
{
centreDist = mag(cellCentrePosition-positionCenterPeriodic);
minPeriodicPos = positionCenterPeriodic;