Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
cortes_c
src
Commits
98fecbea
Commit
98fecbea
authored
Jan 07, 2018
by
adelmann
🎗
Browse files
Chritofs implementation of #181
parent
2a1bc2f2
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
698 additions
and
9 deletions
+698
-9
ippl/src/Utility/IpplTimings.cpp
ippl/src/Utility/IpplTimings.cpp
+10
-3
ippl/src/Utility/IpplTimings.h
ippl/src/Utility/IpplTimings.h
+6
-4
src/AbstractObjects/OpalData.cpp
src/AbstractObjects/OpalData.cpp
+15
-0
src/AbstractObjects/OpalData.h
src/AbstractObjects/OpalData.h
+3
-0
src/Distribution/Distribution.cpp
src/Distribution/Distribution.cpp
+5
-1
src/Main.cpp
src/Main.cpp
+2
-1
src/Main.cpp.orig
src/Main.cpp.orig
+652
-0
src/Track/TrackRun.cpp
src/Track/TrackRun.cpp
+5
-0
No files found.
ippl/src/Utility/IpplTimings.cpp
View file @
98fecbea
...
...
@@ -228,7 +228,7 @@ void Timing::print() {
//////////////////////////////////////////////////////////////////////
// save the timing results into a file
void
Timing
::
print
(
const
std
::
string
&
fn
)
{
void
Timing
::
print
(
const
std
::
string
&
fn
,
const
std
::
map
<
std
::
string
,
unsigned
int
>
&
problemSize
)
{
std
::
ofstream
*
timer_stream
;
Inform
*
msg
;
...
...
@@ -239,7 +239,6 @@ void Timing::print(const std::string &fn) {
timer_stream
=
new
std
::
ofstream
;
timer_stream
->
open
(
fn
.
c_str
(),
std
::
ios
::
out
);
msg
=
new
Inform
(
0
,
*
timer_stream
,
0
);
Inform
gmsg
(
"bla "
);
// report the average time for each timer
// Inform msg("Timings");
/*
...
...
@@ -251,6 +250,14 @@ void Timing::print(const std::string &fn) {
*msg << "\n";
*/
if
(
problemSize
.
size
()
>
0
)
{
*
msg
<<
"Problem size:
\n
"
;
for
(
auto
it
:
problemSize
)
{
*
msg
<<
" "
<<
std
::
setw
(
10
)
<<
it
.
first
<<
": "
<<
it
.
second
<<
"
\n
"
;
}
*
msg
<<
endl
;
}
*
msg
<<
std
::
setw
(
27
)
<<
"num Nodes"
<<
std
::
setw
(
10
)
<<
"CPU tot"
<<
std
::
setw
(
11
)
<<
"Wall tot
\n
"
...
...
@@ -346,4 +353,4 @@ void IpplTimings::pop() {
* $RCSfile: addheaderfooter,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:17 $
* IPPL_VERSION_ID: $Id: addheaderfooter,v 1.1.1.1 2003/01/23 07:40:17 adelmann Exp $
***************************************************************************/
***************************************************************************/
\ No newline at end of file
ippl/src/Utility/IpplTimings.h
View file @
98fecbea
...
...
@@ -151,7 +151,8 @@ struct Timing
void
print
();
// print the results to a file
void
print
(
const
std
::
string
&
fn
);
void
print
(
const
std
::
string
&
fn
,
const
std
::
map
<
std
::
string
,
unsigned
int
>
&
problemSize
);
// type of storage for list of TimerInfo
...
...
@@ -208,8 +209,9 @@ public:
}
// print the results to a file
static
void
print
(
std
::
string
fn
)
{
instance
->
print
(
fn
);
static
void
print
(
std
::
string
fn
,
const
std
::
map
<
std
::
string
,
unsigned
int
>
&
problemSize
=
std
::
map
<
std
::
string
,
unsigned
int
>
())
{
instance
->
print
(
fn
,
problemSize
);
}
static
void
stash
();
...
...
@@ -242,4 +244,4 @@ private:
* $RCSfile: addheaderfooter,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:17 $
* IPPL_VERSION_ID: $Id: addheaderfooter,v 1.1.1.1 2003/01/23 07:40:17 adelmann Exp $
***************************************************************************/
***************************************************************************/
\ No newline at end of file
src/AbstractObjects/OpalData.cpp
View file @
98fecbea
...
...
@@ -147,6 +147,8 @@ struct OpalDataImpl {
bool
isInOPALThickTrackerMode_m
;
bool
isInPrepState_m
;
std
::
map
<
std
::
string
,
unsigned
int
>
problemSize_m
;
std
::
vector
<
std
::
string
>
arguments_m
;
};
...
...
@@ -805,6 +807,19 @@ std::vector<std::string> OpalData::getAllNames() {
return
result
;
}
void
OpalData
::
addProblemCharacteristicValue
(
const
std
::
string
&
name
,
unsigned
int
value
)
{
*
gmsg
<<
"OpalData.cpp: "
<<
__LINE__
<<
"
\t
"
<<
name
<<
": "
<<
value
<<
endl
;
if
(
p
->
problemSize_m
.
find
(
name
)
!=
p
->
problemSize_m
.
end
())
{
p
->
problemSize_m
.
insert
(
std
::
make_pair
(
name
,
value
));
}
else
{
p
->
problemSize_m
[
name
]
=
value
;
}
}
const
std
::
map
<
std
::
string
,
unsigned
int
>
&
OpalData
::
getProblemCharacteristicValues
()
const
{
return
p
->
problemSize_m
;
}
void
OpalData
::
storeArguments
(
int
argc
,
char
*
argv
[])
{
p
->
arguments_m
.
clear
();
for
(
int
i
=
0
;
i
<
argc
;
++
i
)
{
...
...
src/AbstractObjects/OpalData.h
View file @
98fecbea
...
...
@@ -259,6 +259,9 @@ public:
void
setMaxTrackSteps
(
unsigned
long
long
s
);
void
incMaxTrackSteps
(
unsigned
long
long
s
);
void
addProblemCharacteristicValue
(
const
std
::
string
&
name
,
unsigned
int
value
);
const
std
::
map
<
std
::
string
,
unsigned
int
>
&
getProblemCharacteristicValues
()
const
;
void
storeArguments
(
int
argc
,
char
*
argv
[]);
std
::
vector
<
std
::
string
>
getArguments
();
private:
...
...
src/Distribution/Distribution.cpp
View file @
98fecbea
...
...
@@ -529,6 +529,7 @@ void Distribution::doRestartOpalT(PartBunchBase<double, 3> *beam, size_t Np, int
size_t
lastParticle
=
firstParticle
+
numParticlesPerNode
-
1
;
if
(
Ippl
::
myNode
()
==
Ippl
::
getNodes
()
-
1
)
lastParticle
=
numParticles
-
1
;
OpalData
::
getInstance
()
->
addProblemCharacteristicValue
(
"NP"
,
numParticles
);
numParticles
=
lastParticle
-
firstParticle
+
1
;
PAssert_GE
(
numParticles
,
0
);
...
...
@@ -569,6 +570,7 @@ void Distribution::doRestartOpalCycl(PartBunchBase<double, 3> *beam,
size_t
lastParticle
=
firstParticle
+
numParticlesPerNode
-
1
;
if
(
Ippl
::
myNode
()
==
Ippl
::
getNodes
()
-
1
)
lastParticle
=
numParticles
-
1
;
OpalData
::
getInstance
()
->
addProblemCharacteristicValue
(
"NP"
,
numParticles
);
numParticles
=
lastParticle
-
firstParticle
+
1
;
PAssert_GE
(
numParticles
,
0
);
...
...
@@ -1546,6 +1548,7 @@ void Distribution::createOpalCycl(PartBunchBase<double, 3> *beam,
injectBeam
(
beam
);
OpalData
::
getInstance
()
->
addProblemCharacteristicValue
(
"NP"
,
numberOfParticles
);
}
void
Distribution
::
createOpalE
(
Beam
*
beam
,
...
...
@@ -1768,6 +1771,7 @@ void Distribution::createOpalT(PartBunchBase<double, 3> *beam,
if
(
!
emitting_m
)
injectBeam
(
beam
);
OpalData
::
getInstance
()
->
addProblemCharacteristicValue
(
"NP"
,
numberOfParticles
);
IpplTimings
::
stopTimer
(
beam
->
distrCreate_m
);
}
...
...
@@ -4779,4 +4783,4 @@ void Distribution::adjustPhaseSpace(double massIneV) {
// mode:c++
// c-basic-offset: 4
// indent-tabs-mode:nil
// End:
// End:
\ No newline at end of file
src/Main.cpp
View file @
98fecbea
...
...
@@ -507,7 +507,8 @@ int mainOPAL(int argc, char *argv[]) {
IpplTimings
::
print
();
IpplTimings
::
print
(
std
::
string
(
"timing.dat"
));
IpplTimings
::
print
(
std
::
string
(
"timing.dat"
),
OpalData
::
getInstance
()
->
getProblemCharacteristicValues
());
if
(
Ippl
::
myNode
()
==
0
)
{
std
::
ifstream
errormsg
(
"errormsg.txt"
);
...
...
src/Main.cpp.orig
0 → 100644
View file @
98fecbea
This diff is collapsed.
Click to expand it.
src/Track/TrackRun.cpp
View file @
98fecbea
...
...
@@ -1006,6 +1006,11 @@ void TrackRun::setupFieldsolver() {
"The number of simulation particles ("
+
std
::
to_string
(
numParticles
)
+
")
\n
"
+
"is smaller than the number of gridpoints ("
+
std
::
to_string
(
numGridPoints
)
+
").
\n
"
+
"Please increase the number of particles or reduce the size of the mesh.
\n
"
);
OpalData
::
getInstance
()
->
addProblemCharacteristicValue
(
"MX"
,
fs
->
getMX
());
OpalData
::
getInstance
()
->
addProblemCharacteristicValue
(
"MY"
,
fs
->
getMY
());
OpalData
::
getInstance
()
->
addProblemCharacteristicValue
(
"MT"
,
fs
->
getMT
());
}
fs
->
initCartesianFields
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment