Skip to content

Commit e5cc076

Browse files
committed
LSP
1 parent 816c4d8 commit e5cc076

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

source/sledgehamr.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ void Sledgehamr::Evolve() {
9797
amrex::Print() << "Full step took " << utils::DurationSeconds(timer)
9898
<< "s.\n"
9999
<< std::endl;
100+
last_full_time = utils::DurationSeconds(timer);
100101
io_module->Write();
101102

102103
#ifdef AMREX_MEM_PROFILING

source/sledgehamr.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ class Sledgehamr : public amrex::AmrCore {
245245
/** @brief Initialize project specific details. To be overriden by each
246246
* project if required.
247247
*/
248-
virtual void Init(){};
248+
virtual void Init() {};
249249

250250
/** @brief Function to check whether a given level is allowed to be created
251251
* by a given time. Will always allow a level to be created by
@@ -269,7 +269,7 @@ class Sledgehamr : public amrex::AmrCore {
269269
/** @brief Any work that should be done before a coarse level time step.
270270
* To be overriden by the project class.
271271
*/
272-
virtual void BeforeTimestep(const double time){};
272+
virtual void BeforeTimestep(const double time) {};
273273

274274
/** @brief Stopping condition of the simulation. Can be overriden by the
275275
* project class.
@@ -284,7 +284,7 @@ class Sledgehamr : public amrex::AmrCore {
284284
* @param lev Current level.
285285
*/
286286
virtual void SetParamsRhs(std::vector<double> &params, const double time,
287-
const int lev){};
287+
const int lev) {};
288288

289289
/** @brief Function to be overriden by the project class to set user-defined
290290
* parameters that will be passed to the Rhs computation of
@@ -295,7 +295,7 @@ class Sledgehamr : public amrex::AmrCore {
295295
*/
296296
virtual void SetParamsGravitationalWaveRhs(std::vector<double> &params,
297297
const double time,
298-
const int lev){};
298+
const int lev) {};
299299

300300
/** @brief Function to be overriden by the project class to set user-defined
301301
* parameters that will be passed to the tagging procedure.
@@ -305,7 +305,7 @@ class Sledgehamr : public amrex::AmrCore {
305305
*/
306306
virtual void SetParamsTagCellForRefinement(std::vector<double> &params,
307307
const double time,
308-
const int lev){};
308+
const int lev) {};
309309

310310
/** @brief Function to be overriden by the project class to set user-defined
311311
* parameters that will be available when modifying the truncation
@@ -316,7 +316,7 @@ class Sledgehamr : public amrex::AmrCore {
316316
*/
317317
virtual void SetParamsTruncationModifier(std::vector<double> &params,
318318
const double time,
319-
const int lev){};
319+
const int lev) {};
320320

321321
/** @brief Function to be overriden by the project class to set user-defined
322322
* parameters that will be passed to the spectrum computation.
@@ -325,7 +325,7 @@ class Sledgehamr : public amrex::AmrCore {
325325
* @param lev Current level.
326326
*/
327327
virtual void SetParamsSpectra(std::vector<double> &params,
328-
const double time){};
328+
const double time) {};
329329

330330
/** @brief Function to be overriden by the project class to set user-defined
331331
* parameters that will be passed to the computation of projections.
@@ -334,7 +334,7 @@ class Sledgehamr : public amrex::AmrCore {
334334
* @param lev Current level.
335335
*/
336336
virtual void SetParamsProjections(std::vector<double> &params,
337-
const double time){};
337+
const double time) {};
338338

339339
void CreateShadowLevel();
340340

@@ -443,6 +443,8 @@ class Sledgehamr : public amrex::AmrCore {
443443
*/
444444
bool restart_sim = false;
445445

446+
double last_full_time = 0;
447+
446448
private:
447449
void DoErrorEstCpu(int lev, amrex::TagBoxArray &tags, double time);
448450
void DoErrorEstGpu(int lev, amrex::TagBoxArray &tags, double time);

source/timer.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ void Timer::Start() {
88
if (is_running)
99
return;
1010

11-
//amrex::ParallelDescriptor::Barrier();
11+
// amrex::ParallelDescriptor::Barrier();
1212
start_time = std::chrono::steady_clock::now();
1313
is_running = true;
1414
}
@@ -19,9 +19,9 @@ void Timer::Stop() {
1919
if (!is_running)
2020
return;
2121

22-
//amrex::ParallelDescriptor::Barrier();
22+
// amrex::ParallelDescriptor::Barrier();
2323
CheckClock();
24-
total_micro += static_cast<double>(last_duration_micro.count());
24+
total_micro += static_cast<double>(last_duration_micro.count());
2525
is_running = false;
2626
}
2727

@@ -36,27 +36,26 @@ double Timer::GetTotalTimeSeconds() {
3636
extra_micro = static_cast<double>(last_duration_micro.count());
3737
}
3838

39-
return (total_micro + extra_micro)/1e6;
39+
return (total_micro + extra_micro) / 1e6;
4040
};
4141

42-
/** @brief Same as GetTotalTimeSeconds() but only time since the timer was
42+
/** @brief Same as GetTotalTimeSeconds() but only time since the timer was
4343
* last started.
4444
*/
4545
double Timer::GetLastDurationSeconds() {
4646
if (is_running)
4747
CheckClock();
4848

49-
return static_cast<double>(last_duration_micro.count())/1e6;
49+
return static_cast<double>(last_duration_micro.count()) / 1e6;
5050
};
5151

5252
/** @brief Computes time passed between now and the last starting time point
5353
internally.
5454
*/
5555
void Timer::CheckClock() {
5656
stop_time = std::chrono::steady_clock::now();
57-
last_duration_micro =
58-
std::chrono::duration_cast<std::chrono::microseconds>(
59-
stop_time - start_time);
57+
last_duration_micro = std::chrono::duration_cast<std::chrono::microseconds>(
58+
stop_time - start_time);
6059
}
6160

6261
}; // namespace sledgehamr

0 commit comments

Comments
 (0)