Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
SWE
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gaurav Kukreja
SWE
Commits
779dfaa7
Commit
779dfaa7
authored
Dec 04, 2012
by
Sebastian Rettenberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add iteration counter
parent
290f0766
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
15 deletions
+37
-15
swe_mpi.cpp
src/examples/swe_mpi.cpp
+6
-0
swe_wavepropagation.cpp
src/examples/swe_wavepropagation.cpp
+16
-14
Logger.hpp
src/tools/Logger.hpp
+14
-0
swe_solvers
submodules/swe_solvers
+1
-1
No files found.
src/examples/swe_mpi.cpp
View file @
779dfaa7
...
...
@@ -413,6 +413,8 @@ int main( int argc, char** argv ) {
float
l_t
=
0.0
;
progressBar
.
update
(
l_t
);
unsigned
int
l_iterations
;
// loop over checkpoints
for
(
int
c
=
1
;
c
<=
l_numberOfCheckPoints
;
c
++
)
{
//reset CPU-Communication clock
...
...
@@ -452,6 +454,7 @@ int main( int argc, char** argv ) {
// update simulation time with time step width.
l_t
+=
l_maxTimeStepWidthGlobal
;
l_iterations
++
;
// print the current simulation time
progressBar
.
clear
();
...
...
@@ -494,6 +497,9 @@ int main( int argc, char** argv ) {
// print the wall clock time (includes plotting)
tools
::
Logger
::
logger
.
printWallClockTime
(
time
(
NULL
));
// printer iteration counter
tools
::
Logger
::
logger
.
printIterationsDone
(
l_iterations
);
// print the finish message
tools
::
Logger
::
logger
.
printFinishMessage
();
...
...
src/examples/swe_wavepropagation.cpp
View file @
779dfaa7
...
...
@@ -56,11 +56,7 @@
#include "../tools/CXMLConfig.hpp"
#endif
#ifndef STATICLOGGER
#define STATICLOGGER
#include "../tools/Logger.hpp"
static
tools
::
Logger
s_sweLogger
;
#endif
#include "tools/ProgressBar.hh"
/**
...
...
@@ -183,7 +179,7 @@ int main( int argc, char** argv ) {
tools
::
ProgressBar
progressBar
(
l_endSimulation
);
// write the output at time zero
s_sweL
ogger
.
printOutputTime
((
float
)
0.
);
tools
::
Logger
::
l
ogger
.
printOutputTime
((
float
)
0.
);
progressBar
.
update
(
0.
);
std
::
string
l_fileName
=
generateBaseFileName
(
l_baseName
,
0
,
0
);
...
...
@@ -217,17 +213,19 @@ int main( int argc, char** argv ) {
*/
// print the start message and reset the wall clock time
progressBar
.
clear
();
s_sweL
ogger
.
printStartMessage
();
s_sweL
ogger
.
initWallClockTime
(
time
(
NULL
));
tools
::
Logger
::
l
ogger
.
printStartMessage
();
tools
::
Logger
::
l
ogger
.
initWallClockTime
(
time
(
NULL
));
//! simulation time.
float
l_t
=
0.0
;
progressBar
.
update
(
l_t
);
unsigned
int
l_iterations
;
// loop over checkpoints
for
(
int
c
=
1
;
c
<=
l_numberOfCheckPoints
;
c
++
)
{
// reset the cpu clock
s_sweL
ogger
.
resetCpuClockToCurrentTime
();
tools
::
Logger
::
l
ogger
.
resetCpuClockToCurrentTime
();
// do time steps until next checkpoint is reached
while
(
l_t
<
l_checkPoints
[
c
]
)
{
...
...
@@ -250,19 +248,20 @@ int main( int argc, char** argv ) {
// update simulation time with time step width.
l_t
+=
l_maxTimeStepWidth
;
l_iterations
++
;
// print the current simulation time
progressBar
.
clear
();
s_sweL
ogger
.
printSimulationTime
(
l_t
);
tools
::
Logger
::
l
ogger
.
printSimulationTime
(
l_t
);
progressBar
.
update
(
l_t
);
}
// update the cpu time in the logger
s_sweL
ogger
.
updateCpuTime
();
tools
::
Logger
::
l
ogger
.
updateCpuTime
();
// print current simulation time of the output
progressBar
.
clear
();
s_sweL
ogger
.
printOutputTime
(
l_t
);
tools
::
Logger
::
l
ogger
.
printOutputTime
(
l_t
);
progressBar
.
update
(
l_t
);
// write output
...
...
@@ -277,13 +276,16 @@ int main( int argc, char** argv ) {
*/
// write the statistics message
progressBar
.
clear
();
s_sweL
ogger
.
printStatisticsMessage
();
tools
::
Logger
::
l
ogger
.
printStatisticsMessage
();
// print the cpu time
s_sweL
ogger
.
printCpuTime
();
tools
::
Logger
::
l
ogger
.
printCpuTime
();
// print the wall clock time (includes plotting)
s_sweLogger
.
printWallClockTime
(
time
(
NULL
));
tools
::
Logger
::
logger
.
printWallClockTime
(
time
(
NULL
));
// printer iteration counter
tools
::
Logger
::
logger
.
printIterationsDone
(
l_iterations
);
return
0
;
}
src/tools/Logger.hpp
View file @
779dfaa7
...
...
@@ -508,6 +508,20 @@ class tools::Logger {
<<
cpuCommTime
<<
" seconds"
<<
std
::
endl
;
}
/**
* Print number of iterations done
*
* @param i_iterations Number of iterations done
* @param i_interationMessage Iterations done message
*/
void
printIterationsDone
(
unsigned
int
i_iterations
,
std
::
string
i_iterationMessage
=
"iterations done"
)
{
if
(
processRank
==
0
)
{
timeCout
()
<<
indentation
<<
i_iterations
<<
' '
<<
i_iterationMessage
<<
std
::
endl
;
}
}
public
:
/** The logger all classes shoud use */
static
Logger
logger
;
...
...
swe_solvers
@
47999975
Subproject commit
c77510646a9e26849507c14c234731f95ebb3d16
Subproject commit
479999755e660f1969c294fe6cb68615d140ea19
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