Skip to content

Commit ffe0ad1

Browse files
committed
Updeat of stuff for warnings etc
1 parent e5613ab commit ffe0ad1

File tree

6 files changed

+37
-44
lines changed

6 files changed

+37
-44
lines changed

System/generalProcess/MainProcess.cxx

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
* File: generalProcess/MainProcess.cxx
55
*
6-
* Copyright (c) 2004-2023 by Stuart Ansell
6+
* Copyright (c) 2004-2024 by Stuart Ansell
77
*
88
* This program is free software: you can redistribute it and/or modify
99
* it under the terms of the GNU General Public License as published by
@@ -699,9 +699,6 @@ buildFullSimulation(Simulation* SimPtr,
699699
{
700700
ELog::RegMethod RegA("MainProcess[F]","buildFullSimulation");
701701

702-
static int count(0);
703-
count++;
704-
705702
ModelSupport::objectAddition(*SimPtr,IParam);
706703

707704
SimPtr->removeComplements();

System/geometry/SurInter.cxx

+1-1
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ calcIntersect(const Geometry::Cone& Cne,
488488
Geometry::M2<double> Rprime=R.prime();
489489
Geometry::M2<double> lambda=MR.getEigValues();
490490

491-
Geometry::M2<double> CRcheck=R*lambda*Rprime;
491+
// Geometry::M2<double> CRcheck=R*lambda*Rprime;
492492
lambda.invert();
493493
Geometry::Vec2D t=R*(lambda*(Rprime*cTrans));
494494

scatMatInc/SQWmaterial.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
* File: scatMatInc/SQWmaterial.h
55
*
6-
* Copyright (c) 2004-2019 by Stuart Ansell
6+
* Copyright (c) 2004-2024 by Stuart Ansell
77
*
88
* This program is free software: you can redistribute it and/or modify
99
* it under the terms of the GNU General Public License as published by

src/SimValid.cxx

-4
Original file line numberDiff line numberDiff line change
@@ -399,10 +399,7 @@ SimValid::runPoint(const Simulation& System,
399399
ELog::RegMethod RegA("SimValid","runPoint");
400400

401401
std::set<Geometry::Vec3D> MultiPoint;
402-
const ModelSupport::ObjSurfMap* OSMPtr =System.getOSM();
403402
MonteCarlo::Object* InitObj(0);
404-
const Geometry::Surface* SPtr; // Output surface
405-
double aDist;
406403

407404
// Note for sphere that you can use X,Y,Z in any orthogonal
408405
// directiron
@@ -428,7 +425,6 @@ SimValid::runPoint(const Simulation& System,
428425

429426
// check surfaces
430427
ELog::EM<<"NAngle == "<<nAngle<<" :: "<<CP<<ELog::endDiag;
431-
double fullTime(0.0);
432428
for(size_t i=0;i<nAngle;i++)
433429
{
434430
if (nAngle>10000 && i*10==nAngle)

transport/BandDetector.cxx

+30-30
Original file line numberDiff line numberDiff line change
@@ -194,16 +194,17 @@ BandDetector::setEnergy(const double ES,const double EE)
194194
}
195195

196196
void
197-
BandDetector::setDataSize(const int Hpts,const int Vpts,
198-
const int Epts)
197+
BandDetector::setDataSize(const size_t Hpts,const size_t Vpts,
198+
const size_t Epts)
199199
/*!
200200
Set the data Size
201201
\param Hpts :: Horizontal size
202202
\param Vpts :: Vertical size
203203
\param Epts :: Energy size
204204
*/
205205
{
206-
if (Hpts>0 && Vpts>0 && (Hpts!=nH || Vpts!=nV) )
206+
if (Hpts>0 && Vpts>0 &&
207+
(Hpts!=nH || Vpts!=nV || Epts!=nE) )
207208
{
208209
nH=Hpts;
209210
nV=Vpts;
@@ -227,7 +228,7 @@ BandDetector::getAxis() const
227228

228229
int
229230
BandDetector::calcCell(const MonteCarlo::particle& N,
230-
int& NH,int& NV) const
231+
size_t& NH,size_t& NV) const
231232
/*!
232233
Calc a cell
233234
Tracks from the point to the detector.
@@ -242,19 +243,24 @@ BandDetector::calcCell(const MonteCarlo::particle& N,
242243

243244
const double OdotN=N.Pos.dotProd(PlnNorm);
244245
const double DdotN=N.uVec.dotProd(PlnNorm);
245-
if (fabs(DdotN)<Geometry::parallelTol) // Plane and line parallel
246+
if (std::abs(DdotN)<Geometry::parallelTol) // Plane and line parallel
246247
return 0;
247248
const double u=(PlnDist-OdotN)/DdotN;
248249
Geometry::Vec3D Pnt=N.Pos+N.uVec*u;
249250
// Now determine if Pnt is within detector:
250251
Pnt-=(Cent-H*0.5*hSize-V*0.5*vSize);
251-
NH=static_cast<int>(nH*Pnt.dotProd(H)/hSize);
252-
NV=static_cast<int>(nV*Pnt.dotProd(V)/vSize);
252+
const double hFrac(Pnt.dotProd(H)/hSize);
253+
const double vFrac(Pnt.dotProd(V)/vSize);
254+
if (hFrac<0.0 || hFrac>=1.0 || vFrac<0.0 || vFrac>1.0)
255+
return 0;
256+
NH=static_cast<size_t>(static_cast<double>(nH)*hFrac);
257+
NV=static_cast<size_t>(static_cast<double>(nV)*vFrac);
258+
253259
ELog::EM<<"Point == "<<Pnt<<" ("<<NH<<","<<NV<<")"<<ELog::endDebug;
254260
ELog::EM<<"Det == "<<Cent<<" ("<<H<<","<<V<<")::"<<PlnNorm<<ELog::endDebug;
255261
ELog::EM<<"U == "<<u<<" "<<PlnDist<<" "<<hSize<<" "<<vSize<<ELog::endDebug;
256262
ELog::EM<<ELog::endDebug;
257-
return (NH<0 || NV<0 || NH>=nH || NV>=nV) ? 0 : 1;
263+
return 1;
258264
}
259265

260266

@@ -278,24 +284,23 @@ BandDetector::addEvent(const MonteCarlo::particle& N)
278284
Geometry::Vec3D Pnt=N.Pos+N.uVec*u;
279285
// Now determine if Pnt is within detector:
280286
Pnt-=(Cent-H*(hSize/2.0)-V*(vSize/2.0));
281-
const int hpt=static_cast<int>(static_cast<double>(nH)*
282-
Pnt.dotProd(H)/hSize);
283-
const int vpt=static_cast<int>(nV*Pnt.dotProd(V)/vSize);
284-
if (hpt<0 || vpt<0 || hpt>=nH || vpt>=nV) return;
287+
const size_t hpt=static_cast<size_t>
288+
(static_cast<double>(nH)*Pnt.dotProd(H)/hSize);
289+
const size_t vpt=static_cast<size_t>
290+
(static_cast<double>(nV)*Pnt.dotProd(V)/vSize);
291+
if (hpt>=nH || vpt>=nV) return;
285292
// Scale for (i) distance to scattering point:
286293
// (ii) solid angle
287294
// Distance is u + travel
288-
const long int ePoint=calcWavePoint(N.wavelength);
289-
if (ePoint>=0 || ePoint<static_cast<long int>(EGrid.size())-1)
290-
{
291-
EData.get()[vpt][hpt][ePoint]+=
292-
N.weight/((N.travel+u)*(N.travel+u)*fabs(DdotN));
293-
nps++;
294-
}
295+
const size_t ePoint=calcWavePoint(N.wavelength);
296+
EData.get()[vpt][hpt][ePoint]+=
297+
N.weight/((N.travel+u)*(N.travel+u)*std::abs(DdotN));
298+
nps++;
299+
295300
return;
296301
}
297302

298-
long int
303+
size_t
299304
BandDetector::calcWavePoint(const double W) const
300305
/*!
301306
Given the wavelength calculate the
@@ -308,16 +313,11 @@ BandDetector::calcWavePoint(const double W) const
308313

309314
if (EGrid.empty()) return 0;
310315
const double E((0.5*RefCon::h2_mneV*1e20)/(W*W));
311-
const long int res=indexPos(EGrid,E);
312-
if (res<0 || res>=static_cast<long int>(EData.shape()[0]))
313-
{
314-
ELog::EM<<"Bins failed on : "<<W<<" "<<
315-
E<<" == "<<EGrid.front()<<" "<<EGrid.back()<<ELog::endCrit;
316-
}
316+
const size_t res=rangePos(EGrid,E);
317317
return res;
318318
}
319319

320-
long int
320+
size_t
321321
BandDetector::calcEnergyPoint(const double E) const
322322
/*!
323323
Given the wavelength calculate the
@@ -327,7 +327,7 @@ BandDetector::calcEnergyPoint(const double E) const
327327
*/
328328
{
329329
if (EGrid.empty()) return 0;
330-
return indexPos(EGrid,E);
330+
return rangePos(EGrid,E);
331331
}
332332

333333
double
@@ -392,9 +392,9 @@ BandDetector::write(std::ostream& OX) const
392392
OX<<"#hvn "<<nH<<" "<<nV<<" from "<<nps<<std::endl;
393393
OX<<"#cvh "<<Cent<<" : "<<H*hSize<<" : "<<V*vSize<<std::endl;
394394

395-
for(int i=0;i<nV;i++)
395+
for(size_t i=0;i<nV;i++)
396396
{
397-
for(int j=0;j<nH;j++)
397+
for(size_t j=0;j<nH;j++)
398398
{
399399
const double E=EData.get()[i][j][EBin];
400400
OX<<E<<" ";

transportInc/BandDetector.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,16 @@ class BandDetector : public Detector
7575
Geometry::Vec3D getRandPos() const;
7676
double project(const MonteCarlo::particle&,
7777
MonteCarlo::particle&) const override;
78-
int calcCell(const MonteCarlo::particle&,int&,int&) const;
78+
int calcCell(const MonteCarlo::particle&,size_t&,size_t&) const;
7979
void addEvent(const MonteCarlo::particle&) override;
8080

8181
void clear() override;
82-
void setDataSize(const int,const int,const int);
82+
void setDataSize(const size_t,const size_t,const size_t);
8383
void setCentre(const Geometry::Vec3D&);
8484
void setEnergy(const double,const double);
8585

86-
long int calcWavePoint(const double) const;
87-
long int calcEnergyPoint(const double) const;
86+
size_t calcWavePoint(const double) const;
87+
size_t calcEnergyPoint(const double) const;
8888

8989
// Output stuff
9090
void write(std::ostream&) const override;

0 commit comments

Comments
 (0)