Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
OPAL
src
Commits
692b53ad
Commit
692b53ad
authored
May 02, 2019
by
kraus
Browse files
replace all tabs with 4 spaces
parent
6d4ff07f
Changes
65
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
220 additions
and
222 deletions
+220
-222
src/AbstractObjects/OpalData.cpp
src/AbstractObjects/OpalData.cpp
+6
-6
src/Algorithms/CavityAutophaser.cpp
src/Algorithms/CavityAutophaser.cpp
+2
-2
src/Algorithms/CavityAutophaser.h
src/Algorithms/CavityAutophaser.h
+2
-2
src/Algorithms/Ctunes.cpp
src/Algorithms/Ctunes.cpp
+4
-4
src/Algorithms/ParallelSliceTracker.cpp
src/Algorithms/ParallelSliceTracker.cpp
+3
-3
src/Algorithms/ParallelTTracker.cpp
src/Algorithms/ParallelTTracker.cpp
+2
-2
src/Algorithms/bet/EnvelopeBunch.cpp
src/Algorithms/bet/EnvelopeBunch.cpp
+5
-5
src/Algorithms/bet/error.C
src/Algorithms/bet/error.C
+42
-43
src/Algorithms/bet/profile.cpp
src/Algorithms/bet/profile.cpp
+2
-3
src/Amr/BoxLibLayout.hpp
src/Amr/BoxLibLayout.hpp
+86
-86
src/BasicActions/Option.cpp
src/BasicActions/Option.cpp
+3
-3
src/Classic/AbsBeamline/Bend.cpp
src/Classic/AbsBeamline/Bend.cpp
+7
-7
src/Classic/AbsBeamline/CyclotronValley.cpp
src/Classic/AbsBeamline/CyclotronValley.cpp
+2
-2
src/Classic/AbsBeamline/MultipoleT.h
src/Classic/AbsBeamline/MultipoleT.h
+21
-21
src/Classic/AbsBeamline/Offset.cpp
src/Classic/AbsBeamline/Offset.cpp
+3
-3
src/Classic/AbsBeamline/RFCavity.cpp
src/Classic/AbsBeamline/RFCavity.cpp
+6
-6
src/Classic/AbsBeamline/RFCavity.h
src/Classic/AbsBeamline/RFCavity.h
+2
-2
src/Classic/AbsBeamline/TravelingWave.cpp
src/Classic/AbsBeamline/TravelingWave.cpp
+10
-10
src/Classic/Algebra/ComplexEigen.cpp
src/Classic/Algebra/ComplexEigen.cpp
+7
-7
src/Classic/Algorithms/PartBunch.cpp
src/Classic/Algorithms/PartBunch.cpp
+5
-5
No files found.
src/AbstractObjects/OpalData.cpp
View file @
692b53ad
...
...
@@ -458,27 +458,27 @@ energyEvolution_t::iterator OpalData::getLastEnergyData() {
// Mesh_t* OpalData::getMesh() {
//
return p->mesh_m;
//
return p->mesh_m;
// }
// FieldLayout_t* OpalData::getFieldLayout() {
//
return p->FL_m;
//
return p->FL_m;
// }
// Layout_t* OpalData::getLayout() {
//
return p->PL_m;
//
return p->PL_m;
// }
// void OpalData::setMesh(Mesh_t *mesh) {
//
p->mesh_m = mesh;
//
p->mesh_m = mesh;
// }
// void OpalData::setFieldLayout(FieldLayout_t *fieldlayout) {
//
p->FL_m = fieldlayout;
//
p->FL_m = fieldlayout;
// }
// void OpalData::setLayout(Layout_t *layout) {
//
p->PL_m = layout;
//
p->PL_m = layout;
// }
void
OpalData
::
setGlobalPhaseShift
(
double
shift
)
{
...
...
src/Algorithms/CavityAutophaser.cpp
View file @
692b53ad
...
...
@@ -266,7 +266,7 @@ double CavityAutophaser::track(Vector_t R,
double
t
,
const
double
dt
,
const
double
phase
,
std
::
ofstream
*
out
)
const
{
std
::
ofstream
*
out
)
const
{
const
Vector_t
&
refP
=
initialP_m
;
RFCavity
*
rfc
=
static_cast
<
RFCavity
*>
(
itsCavity_m
.
get
());
...
...
@@ -278,7 +278,7 @@ double CavityAutophaser::track(Vector_t R,
dt
,
itsReference_m
.
getQ
(),
itsReference_m
.
getM
()
*
1e-6
,
out
);
out
);
rfc
->
setPhasem
(
initialPhase
);
double
finalKineticEnergy
=
Util
::
getEnergy
(
Vector_t
(
0.0
,
0.0
,
pe
.
first
),
itsReference_m
.
getM
()
*
1e-6
);
...
...
src/Algorithms/CavityAutophaser.h
View file @
692b53ad
...
...
@@ -27,7 +27,7 @@ private:
double
t
,
const
double
dt
,
const
double
phase
,
std
::
ofstream
*
out
=
NULL
)
const
;
std
::
ofstream
*
out
=
NULL
)
const
;
double
getEnergyMeV
(
const
Vector_t
&
P
);
double
getMomentum
(
double
kineticEnergyMeV
);
...
...
@@ -49,4 +49,4 @@ double CavityAutophaser::getMomentum(double kineticEnergyMeV) {
return
sqrt
(
std
::
pow
(
kineticEnergyMeV
/
(
itsReference_m
.
getM
()
*
1e-6
)
+
1
,
2
)
-
1
);
}
#endif
#endif
\ No newline at end of file
src/Algorithms/Ctunes.cpp
View file @
692b53ad
...
...
@@ -126,7 +126,7 @@ int TUNE_class::lombAnalysis(std::vector<double> &x, std::vector<double> &y, int
if
(
pairy
[
pairc
]
>
4.
)
{
memset
(
mess
,
'\0'
,
sizeof
(
mess
));
sprintf
(
mess
,
"%12.8f %8.2f %8.3f %d"
,
pairx
[
pairc
]
*
Norm
,
pairy
[
pairc
],
probi
,
i
);
*
gmsg
<<
"* "
<<
mess
<<
endl
;
*
gmsg
<<
"* "
<<
mess
<<
endl
;
}
}
pairc
++
;
...
...
@@ -188,7 +188,7 @@ int TUNE_class::lombAnalysis(double *x, double *y, int Ndat, int nhis)
if
(
datcnt
>
(
q
-
p
-
10
))
{
memset
(
mess
,
'\0'
,
sizeof
(
mess
));
sprintf
(
mess
,
"Just found %d data points that are == 0!"
,
datcnt
);
*
gmsg
<<
"* "
<<
mess
<<
endl
;
*
gmsg
<<
"* "
<<
mess
<<
endl
;
return
(
-
1
);
}
...
...
@@ -205,7 +205,7 @@ int TUNE_class::lombAnalysis(double *x, double *y, int Ndat, int nhis)
if
(
stat
!=
0
)
{
memset
(
mess
,
'\0'
,
sizeof
(
mess
));
sprintf
(
mess
,
"@C3ERROR: Lomb analysis failed!"
);
*
gmsg
<<
"* "
<<
mess
<<
endl
;
*
gmsg
<<
"* "
<<
mess
<<
endl
;
delete
la
;
la
=
NULL
;
...
...
@@ -245,7 +245,7 @@ int TUNE_class::lombAnalysis(double *x, double *y, int Ndat, int nhis)
memset
(
mess
,
'\0'
,
sizeof
(
mess
));
sprintf
(
mess
,
"%12.8f %8.2f %8.3f %d"
,
pairx
[
pairc
],
pairy
[
pairc
],
probi
,
i
);
*
gmsg
<<
"* "
<<
mess
<<
endl
;
*
gmsg
<<
"* "
<<
mess
<<
endl
;
}
}
pairc
++
;
...
...
src/Algorithms/ParallelSliceTracker.cpp
View file @
692b53ad
...
...
@@ -154,10 +154,10 @@ void ParallelSliceTracker::printRFPhases() {
if
(
element
->
getType
()
==
ElementBase
::
TRAVELINGWAVE
)
{
phase
=
static_cast
<
TravelingWave
*>
(
element
.
get
())
->
getPhasem
();
frequency
=
static_cast
<
TravelingWave
*>
(
element
.
get
())
->
getFrequencym
();
frequency
=
static_cast
<
TravelingWave
*>
(
element
.
get
())
->
getFrequencym
();
}
else
{
phase
=
static_cast
<
RFCavity
*>
(
element
.
get
())
->
getPhasem
();
frequency
=
static_cast
<
RFCavity
*>
(
element
.
get
())
->
getFrequencym
();
frequency
=
static_cast
<
RFCavity
*>
(
element
.
get
())
->
getFrequencym
();
}
msg
<<
(
it
==
cl
.
begin
()
?
""
:
"
\n
"
)
...
...
@@ -167,7 +167,7 @@ void ParallelSliceTracker::printRFPhases() {
}
msg
<<
"-------------------------------------------------------------------------------------
\n
"
<<
endl
;
<<
endl
;
}
void
ParallelSliceTracker
::
applyEntranceFringe
(
double
angle
,
double
curve
,
...
...
src/Algorithms/ParallelTTracker.cpp
View file @
692b53ad
...
...
@@ -1023,7 +1023,7 @@ void ParallelTTracker::writePhaseSpace(const long long step, bool psDump, bool s
if
(
statDump
)
{
std
::
vector
<
std
::
pair
<
std
::
string
,
unsigned
int
>
>
collimatorLosses
;
FieldList
collimators
=
itsOpalBeamline_m
.
getElementByType
(
ElementBase
::
CCOLLIMATOR
);
if
(
collimators
.
size
()
!=
0
)
{
if
(
collimators
.
size
()
!=
0
)
{
for
(
FieldList
::
iterator
it
=
collimators
.
begin
();
it
!=
collimators
.
end
();
++
it
)
{
FlexibleCollimator
*
coll
=
static_cast
<
FlexibleCollimator
*>
(
it
->
getElement
().
get
());
std
::
string
name
=
coll
->
getName
();
...
...
@@ -1044,7 +1044,7 @@ void ParallelTTracker::writePhaseSpace(const long long step, bool psDump, bool s
for
(
size_t
i
=
0
;
i
<
collimatorLosses
.
size
();
++
i
){
collimatorLosses
[
i
].
second
=
bareLosses
[
i
];
}
}
}
// Write statistical data.
itsDataSink_m
->
writeStatData
(
itsBunch_m
,
FDext
,
collimatorLosses
);
...
...
src/Algorithms/bet/EnvelopeBunch.cpp
View file @
692b53ad
...
...
@@ -577,7 +577,7 @@ void EnvelopeBunch::setBinnedLShape(EnvelopeBunchShape shape, double z0, double
case
bsRect
:
bunch_width
=
Physics
::
c
*
emission_time_s
*
slices_m
[
0
]
->
p
[
SLI_beta
];
// std::cout << "bunch_width = " << bunch_width << " SLI_beta= " << slices_m[0]->p[SLI_beta] << std::endl;
// std::cout << "bunch_width = " << bunch_width << " SLI_beta= " << slices_m[0]->p[SLI_beta] << std::endl;
for
(
int
i
=
0
;
i
<
numMySlices_m
;
i
++
)
{
slices_m
[
i
]
->
p
[
SLI_z
]
=
-
(((
numSlices_m
-
1
)
-
(
mySliceStartOffset_m
+
i
))
*
bunch_width
)
/
numSlices_m
;
}
...
...
@@ -634,10 +634,10 @@ void EnvelopeBunch::setBinnedLShape(EnvelopeBunchShape shape, double z0, double
/*
for(unsigned int i = 0; i < bins_m.size(); i++) {
if(bins_m[i].size() > 0) {
std::cout << Ippl::Comm->myNode() << ": Bin " << i << ": ";
for(unsigned int j = 0; j < bins_m[i].size(); j++)
std::cout << " " << mySliceStartOffset_m + bins_m[i][j] << "(" << slices_m[j]->p[SLI_z] << ")";
std::cout << std::endl;
std::cout << Ippl::Comm->myNode() << ": Bin " << i << ": ";
for(unsigned int j = 0; j < bins_m[i].size(); j++)
std::cout << " " << mySliceStartOffset_m + bins_m[i][j] << "(" << slices_m[j]->p[SLI_z] << ")";
std::cout << std::endl;
}
}
*/
...
...
src/Algorithms/bet/error.C
View file @
692b53ad
...
...
@@ -29,18 +29,18 @@
#include "error.h"
#include "libprf/prf.h"
static
int
static
int
firstTime
=
1
,
reportLevel
=
0
,
// verbosity level
nodeID
=
0
;
// required to be MPI compatible
static
char
*
fName
=
NULL
;
*
fName
=
NULL
;
void
initErrorMsg
(
int
level
,
const
char
*
fbase
)
{
stdprf
();
/* set standard functions */
extprf
();
/* set extended standard functions */
fltprf
();
/* set floating standard functions */
stdprf
();
/* set standard functions */
extprf
();
/* set extended standard functions */
fltprf
();
/* set floating standard functions */
reportLevel
=
level
;
...
...
@@ -60,7 +60,7 @@ void initErrorFilename(const char *fbase) {
if
(
fName
)
{
free
(
fName
);
}
fName
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
(
strlen
(
fbase
)
+
10
));
if
(
fName
)
{
#ifdef USE_MPI
...
...
@@ -69,14 +69,14 @@ void initErrorFilename(const char *fbase) {
#else
sprintf
(
fName
,
"%s.msg"
,
fbase
);
#endif
sprintf
(
cmd
,
"rm -f %s"
,
fName
);
system
(
cmd
);
free
(
cmd
);
firstTime
=
1
;
}
else
{
fprintf
(
stderr
,
"ERROR in initErrorFilename: %s (%s)
\n
"
,
"Insufficient memory to allocate filename"
,
fbase
);
"Insufficient memory to allocate filename"
,
fbase
);
}
}
}
/* initErrorFileName() */
...
...
@@ -86,15 +86,15 @@ void setReportLevel(int level) {
}
void
writeError
(
ErrorMode
m
,
ErrorType
t
,
const
char
*
fmt
,
...)
{
if
((
m
==
errModeAll
)
||
((
m
==
errModeMaster
)
&&
(
nodeID
==
0
))
||
if
((
m
==
errModeAll
)
||
((
m
==
errModeMaster
)
&&
(
nodeID
==
0
))
||
((
m
==
errModeSlave
)
&&
(
nodeID
>
0
)))
{
va_list
ap
;
char
str
[
4096
],
mpiStr
[
20
];
va_start
(
ap
,
fmt
);
switch
(
t
)
{
case
errMessage
:
sprf
(
str
,
"MSG:.. "
);
break
;
case
errWarning
:
sprf
(
str
,
"WAR:.. "
);
break
;
...
...
@@ -109,23 +109,23 @@ void writeError(ErrorMode m,ErrorType t,const char* fmt, ...) {
sprfv
(
str
,
fmt
,
&
ap
);
va_end
(
ap
);
fprintf
(
stderr
,
"%s
\n
"
,
str
);
fflush
(
stderr
);
if
(
fName
)
{
FILE
*
ofp
=
fopen
(
fName
,(
firstTime
==
1
?
"w"
:
"a"
));
if
(
ofp
)
{
fprintf
(
ofp
,
"%s
\n
"
,
str
);
fclose
(
ofp
);
}
else
if
(
firstTime
==
1
)
{
int
myerr
=
errno
;
fprintf
(
stderr
,
"writeError cannot open %s (%d)
\n
%s
\n
"
,
fName
,
myerr
,
strerror
(
myerr
));
}
firstTime
=
0
;
FILE
*
ofp
=
fopen
(
fName
,(
firstTime
==
1
?
"w"
:
"a"
));
if
(
ofp
)
{
fprintf
(
ofp
,
"%s
\n
"
,
str
);
fclose
(
ofp
);
}
else
if
(
firstTime
==
1
)
{
int
myerr
=
errno
;
fprintf
(
stderr
,
"writeError cannot open %s (%d)
\n
%s
\n
"
,
fName
,
myerr
,
strerror
(
myerr
));
}
firstTime
=
0
;
}
}
if
(
t
==
errFatal
)
{
...
...
@@ -138,23 +138,23 @@ void writeError(ErrorMode m,ErrorType t,const char* fmt, ...) {
}
void
writeError
(
int
level
,
ErrorMode
m
,
ErrorType
t
,
const
char
*
fmt
,
...)
{
if
((
m
==
errModeAll
)
||
((
m
==
errModeMaster
)
&&
(
nodeID
==
0
))
||
if
((
m
==
errModeAll
)
||
((
m
==
errModeMaster
)
&&
(
nodeID
==
0
))
||
((
m
==
errModeSlave
)
&&
(
nodeID
>
0
)))
{
if
((
level
<=
reportLevel
)
||
(
t
==
errFatal
))
{
va_list
ap
;
char
str
[
4096
],
mpiStr
[
20
];
va_start
(
ap
,
fmt
);
switch
(
t
)
{
case
errMessage
:
sprf
(
str
,
"MSG:.. "
);
break
;
case
errWarning
:
sprf
(
str
,
"WAR:.. "
);
break
;
case
errGeneral
:
sprf
(
str
,
"ERR:.. "
);
break
;
case
errFatal
:
sprf
(
str
,
"FATAL: "
);
break
;
}
#ifdef USE_MPI
sprintf
(
mpiStr
,
"%2d "
,
mpi_rank
);
sprf
(
str
,
mpiStr
);
...
...
@@ -167,18 +167,18 @@ void writeError(int level,ErrorMode m,ErrorType t,const char* fmt, ...) {
fflush
(
stderr
);
if
(
fName
)
{
FILE
*
ofp
=
fopen
(
fName
,(
firstTime
==
1
?
"w"
:
"a"
));
if
(
ofp
)
{
fprintf
(
ofp
,
"%s
\n
"
,
str
);
fclose
(
ofp
);
}
else
if
(
firstTime
==
1
)
{
int
myerr
=
errno
;
fprintf
(
stderr
,
"writeError cannot open %s (%d)
\n
%s
\n
"
,
fName
,
myerr
,
strerror
(
myerr
));
}
firstTime
=
0
;
FILE
*
ofp
=
fopen
(
fName
,(
firstTime
==
1
?
"w"
:
"a"
));
if
(
ofp
)
{
fprintf
(
ofp
,
"%s
\n
"
,
str
);
fclose
(
ofp
);
}
else
if
(
firstTime
==
1
)
{
int
myerr
=
errno
;
fprintf
(
stderr
,
"writeError cannot open %s (%d)
\n
%s
\n
"
,
fName
,
myerr
,
strerror
(
myerr
));
}
firstTime
=
0
;
}
}
}
...
...
@@ -189,5 +189,4 @@ void writeError(int level,ErrorMode m,ErrorType t,const char* fmt, ...) {
#endif
exit
(
1
);
}
}
}
\ No newline at end of file
src/Algorithms/bet/profile.cpp
View file @
692b53ad
...
...
@@ -93,7 +93,7 @@ Profile::Profile(char *fname, double eps) {
for
(
i
=
0
;
i
<
n
;
i
++
)
{
int
res
=
fscanf
(
f
,
"%lf %lf"
,
&
x
[
i
],
&
y
[
i
]);
if
(
res
!=
0
)
ERRORMSG
(
"fscanf in profile.cpp has res!=0"
<<
endl
);
ERRORMSG
(
"fscanf in profile.cpp has res!=0"
<<
endl
);
}
fclose
(
f
);
...
...
@@ -294,5 +294,4 @@ double Profile::Labs() {
cProfile
=
this
;
return
(((
x
==
NULL
)
||
(
x
[
n
-
1
]
==
x
[
0
])
||
(
ym
==
0.0
))
?
0.0
:
fabs
(
qromb
(
f3
,
x
[
0
],
x
[
n
-
1
])
/
ym
));
}
}
\ No newline at end of file
src/Amr/BoxLibLayout.hpp
View file @
692b53ad
...
...
@@ -23,19 +23,19 @@ BoxLibLayout<T, Dim>::BoxLibLayout()
refRatio_m
(
0
)
{
/* FIXME There might be a better solution
*
*
*
*
* Figure out the number of grid points in each direction
* such that all processes have some data at the beginning
*
*
* ( nGridPoints / maxGridSize ) ^3 = max. #procs
*
*
*/
int
nProcs
=
Ippl
::
getNodes
();
int
maxGridSize
=
16
;
int
nGridPoints
=
std
::
ceil
(
std
::
cbrt
(
nProcs
)
)
*
maxGridSize
;
this
->
initBaseBox_m
(
nGridPoints
,
maxGridSize
);
}
...
...
@@ -88,11 +88,11 @@ BoxLibLayout<T, Dim>::BoxLibLayout(const AmrGeomContainer_t &geom,
template
<
class
T
,
unsigned
Dim
>
void
BoxLibLayout
<
T
,
Dim
>::
setBoundingBox
(
double
dh
)
{
// cubic box
int
nGridPoints
=
this
->
m_geom
[
0
].
Domain
().
length
(
0
);
int
maxGridSize
=
this
->
m_ba
[
0
][
0
].
length
(
0
);
this
->
initBaseBox_m
(
nGridPoints
,
maxGridSize
,
dh
);
}
...
...
@@ -122,32 +122,32 @@ void BoxLibLayout<T, Dim>::update(AmrParticleBase< BoxLibLayout<T,Dim> >& PData,
*/
PData
.
domainMapping
();
}
int
nGrow
=
0
;
unsigned
N
=
Ippl
::
getNodes
();
unsigned
myN
=
Ippl
::
myNode
();
int
theEffectiveFinestLevel
=
this
->
finestLevel
();
while
(
!
this
->
LevelDefined
(
theEffectiveFinestLevel
))
{
theEffectiveFinestLevel
--
;
}
if
(
lev_max
==
-
1
)
lev_max
=
theEffectiveFinestLevel
;
else
if
(
lev_max
>
theEffectiveFinestLevel
)
lev_max
=
theEffectiveFinestLevel
;
//loop trough the particles and assign the grid and level where each particle belongs
size_t
LocalNum
=
PData
.
getLocalNum
();
auto
&
LocalNumPerLevel
=
PData
.
getLocalNumPerLevel
();
if
(
LocalNum
!=
LocalNumPerLevel
.
getLocalNumAllLevel
()
)
throw
OpalException
(
"BoxLibLayout::update()"
,
"Local #particles disagrees with sum over levels"
);
std
::
multimap
<
unsigned
,
unsigned
>
p2n
;
//node ID, particle
std
::
multimap
<
unsigned
,
unsigned
>
p2n
;
//node ID, particle
int
*
msgsend
=
new
int
[
N
];
std
::
fill
(
msgsend
,
msgsend
+
N
,
0
);
...
...
@@ -157,30 +157,30 @@ void BoxLibLayout<T, Dim>::update(AmrParticleBase< BoxLibLayout<T,Dim> >& PData,
unsigned
sent
=
0
;
size_t
lBegin
=
LocalNumPerLevel
.
begin
(
lev_min
);
size_t
lEnd
=
LocalNumPerLevel
.
end
(
lev_max
);
//loop trough particles and assign grid and level to each particle
//if particle doesn't belong to this process save the index of the particle to be sent
for
(
unsigned
int
ip
=
lBegin
;
ip
<
lEnd
;
++
ip
)
{
// old level
const
size_t
&
lold
=
PData
.
Level
[
ip
];
// /*
// * AMReX sets m_grid = -1 and m_lev = -1
// */
// PData.Level[ip] = -1;
// PData.Grid[ip] = -1;
//check to which level and grid the particle belongs to
locateParticle
(
PData
,
ip
,
lev_min
,
lev_max
,
nGrow
);
// The owner of the particle is the CPU owning the finest grid
// in state data that contains the particle.
const
size_t
&
lnew
=
PData
.
Level
[
ip
];
const
unsigned
int
who
=
ParticleDistributionMap
(
lnew
)[
PData
.
Grid
[
ip
]];
--
LocalNumPerLevel
[
lold
];
if
(
who
!=
myN
)
{
// we lost the particle to another process
msgsend
[
who
]
=
1
;
...
...
@@ -210,7 +210,7 @@ void BoxLibLayout<T, Dim>::update(AmrParticleBase< BoxLibLayout<T,Dim> >& PData,
while
(
i
!=
p2n
.
end
())
{
unsigned
cur_destination
=
i
->
first
;
MsgBuffer
*
msgbuf
=
new
MsgBuffer
(
format
,
p2n
.
count
(
i
->
first
));
for
(;
i
!=
p2n
.
end
()
&&
i
->
first
==
cur_destination
;
++
i
)
...
...
@@ -220,17 +220,17 @@ void BoxLibLayout<T, Dim>::update(AmrParticleBase< BoxLibLayout<T,Dim> >& PData,
PData
.
destroy
(
1
,
i
->
second
);
msgbuf
->
add
(
&
msg
);
}
MPI_Request
request
=
Ippl
::
Comm
->
raw_isend
(
msgbuf
->
getBuffer
(),
msgbuf
->
getSize
(),
MPI_Request
request
=
Ippl
::
Comm
->
raw_isend
(
msgbuf
->
getBuffer
(),
msgbuf
->
getSize
(),
cur_destination
,
tag
);
//remember request and buffer so we can delete them later
requests
.
push_back
(
request
);
buffers
.
push_back
(
msgbuf
);
}
//destroy the particles that are sent to other domains
if
(
LocalNum
<
PData
.
getDestroyNum
()
)
throw
OpalException
(
"BoxLibLayout::update()"
,
...
...
@@ -240,13 +240,13 @@ void BoxLibLayout<T, Dim>::update(AmrParticleBase< BoxLibLayout<T,Dim> >& PData,
LocalNum
-=
PData
.
getDestroyNum
();
// update local num
PData
.
performDestroy
();
}
for
(
int
lev
=
lev_min
;
lev
<=
lev_max
;
++
lev
)
{
if
(
LocalNumPerLevel
[
lev
]
<
0
)
throw
OpalException
(
"BoxLibLayout::update()"
,
"Negative particle level count."
);
}
//receive new particles
for
(
int
k
=
0
;
k
<
msgrecv
[
myN
];
++
k
)
{
...
...
@@ -254,7 +254,7 @@ void BoxLibLayout<T, Dim>::update(AmrParticleBase< BoxLibLayout<T,Dim> >& PData,
char
*
buffer
=
0
;
int
bufsize
=
Ippl
::
Comm
->
raw_probe_receive
(
buffer
,
node
,
tag
);
MsgBuffer
recvbuf
(
format
,
buffer
,
bufsize
);
Message
*
msg
=
recvbuf
.
get
();
while
(
msg
!=
0
)
{
...
...
@@ -262,26 +262,26 @@ void BoxLibLayout<T, Dim>::update(AmrParticleBase< BoxLibLayout<T,Dim> >& PData,
* pEndIdx is the last index of the new particle data
*/
size_t
pBeginIdx
=
LocalNum
;
LocalNum
+=
PData
.
getSingleMessage
(
*
msg
);
size_t
pEndIdx
=
LocalNum
;
for
(
size_t
idx
=
pBeginIdx
;
idx
<
pEndIdx
;
++
idx
)
++
LocalNumPerLevel
[
PData
.
Level
[
idx
]
];
delete
msg
;
msg
=
recvbuf
.
get
();
}
}
}
//wait for communication to finish and clean up buffers
MPI_Waitall
(
requests
.
size
(),
&
(
requests
[
0
]),
MPI_STATUSES_IGNORE
);
for
(
unsigned
int
j
=
0
;
j
<
buffers
.
size
();
++
j
)
{
delete
buffers
[
j
];
}
delete
[]
msgsend
;
delete
[]
msgrecv
;
delete
format
;
...
...
@@ -297,12 +297,12 @@ void BoxLibLayout<T, Dim>::update(AmrParticleBase< BoxLibLayout<T,Dim> >& PData,
// update our particle number counts
PData
.
setTotalNum
(
TotalNum
);
// set the total atom count
PData
.
setLocalNum
(
LocalNum
);
// set the number of local atoms
// final check
if
(
LocalNum
!=
LocalNumPerLevel
.
getLocalNumAllLevel
()
)
throw
OpalException
(
"BoxLibLayout::update()"
,
"Local #particles disagrees with sum over levels"
);
if
(
!
PData
.
isForbidTransform
()
)
{
// undo domain transformation + undo Lorentz transform
PData
.
domainMapping
(
true
);
...
...
@@ -345,39 +345,39 @@ void BoxLibLayout<T, Dim>::buildLevelMask(int lev, const int ncells) {
int
notcovered
=
1
;
int
physbnd
=
1
;
int
interior
=
0
;
if
(
lev
>=
(
int
)
masks_m
.
size
()
)
masks_m
.
resize
(
lev
+
1
);
masks_m
[
lev
].
reset
(
new
mask_t
(
ParticleBoxArray
(
lev
),
ParticleDistributionMap
(
lev
),
1
,
1
));
masks_m
[
lev
]
->
setVal
(
1
,
1
);
mask_t
tmp_mask
(
ParticleBoxArray
(
lev
),
ParticleDistributionMap
(
lev
),
1
,
ncells
);
tmp_mask
.
setVal
(
0
,
ncells
);
tmp_mask
.
BuildMask
(
Geom
(
lev
).
Domain
(),
Geom
(
lev
).
periodicity
(),
covered
,
notcovered
,
physbnd
,
interior
);
tmp_mask
.
FillBoundary
(
Geom
(
lev
).
periodicity
());
for
(
amrex
::
MFIter
mfi
(
tmp_mask
);
mfi
.
isValid
();
++
mfi
)
{
const
AmrBox_t
&
bx
=
mfi
.
validbox
();
const
int
*
lo
=
bx
.
loVect
();
const
int
*
hi
=
bx
.
hiVect
();
basefab_t
&
mfab
=
(
*
masks_m
[
lev
])[
mfi
];
const
basefab_t
&
fab
=
tmp_mask
[
mfi
];