VPTissue Reference Manual
Housekeep.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Universiteit Antwerpen
3  *
4  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
5  * the European Commission - subsequent versions of the EUPL (the "Licence");
6  * You may not use this work except in compliance with the Licence.
7  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the Licence is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the Licence for the specific language governing
13  * permissions and limitations under the Licence.
14  */
20 #include "Housekeep.h"
21 
22 #include "algo/CellDivider.h"
23 #include "algo/CellHousekeeper.h"
24 
25 #include <cassert>
26 #include <boost/property_tree/ptree.hpp>
27 
28 namespace SimPT_Default {
29 namespace TimeEvolver {
30 
31 using namespace std;
32 
34 {
35  Initialize(cd);
36 }
37 
39 {
40  assert( cd.Check() && "CoreData not ok.");
41  m_cd = cd;
42 }
43 
44 std::tuple<SimTimingTraits::CumulativeTimings, bool> Housekeep::operator()(double, SimPhase)
45 {
46  // -------------------------------------------------------------------------------
47  // Intro
48  // -------------------------------------------------------------------------------
49  Stopclock chrono_hk("housekeeping", true);
50  CumulativeTimings timings;
51 
52  // -------------------------------------------------------------------------------
53  // Cell division. Time does not increase during the division process.
54  // -------------------------------------------------------------------------------
55  CellDivider cell_divider(m_cd);
56  const unsigned int div_count = cell_divider.DivideCells();
57  const bool is_stationary = (div_count == 0U);
58 
59  // -------------------------------------------------------------------------------
60  // Cell housekeeping. Time does not increase during the division process.
61  // -------------------------------------------------------------------------------
62  CellHousekeeper cell_housekeeper;
63  cell_housekeeper.Initialize(m_cd);
64  cell_housekeeper.Exec();
65 
66  // -------------------------------------------------------------------------------
67  // We are done ...
68  // -------------------------------------------------------------------------------
69  timings.Record(chrono_hk.GetName(), chrono_hk.Get());
70  return make_tuple(timings, is_stationary);
71 }
72 
73 } // namespace
74 } // namespace
Interface for CellHousekeeper.
Core data with mesh, parameters, random engine and time data.
Definition: CoreData.h:38
STL namespace.
Interface for CellDivider.
void Initialize(const CoreData &cd)
Initialize or re-initialize.
Definition: Housekeep.cpp:38
unsigned int DivideCells()
Execute cell divisions.
Class for handling maintenance of cell mechanics (cell housekeeping).
std::string GetName() const
Return name of this stopwatch.
Definition: Stopwatch.h:88
Time evolver for Housekeeping only.
Namespace for components of the Default model group.
Utility class to record durations in a cumulative manner.
void Initialize(const CoreData &cd)
Initializes.
Class for handling cell division.
Definition: CellDivider.h:48
Housekeep(const CoreData &cd)
Initializing constructor.
Definition: Housekeep.cpp:33
std::tuple< SimTimingTraits::CumulativeTimings, bool > operator()(double time_slice=0.0, SimPhase phase=SimPhase::NONE)
Take a time step.
Definition: Housekeep.cpp:44
T::duration Get() const
Returns the accumulated value without altering the stopwatch state.
Definition: Stopwatch.h:94
boost::property_tree::ptree Exec() const
Housekeeping rules.
Provides a stopwatch interface to time: it accumulates time between start/stop pairs.
Definition: Stopwatch.h:39
void Record(const std::string &name, const std::chrono::duration< R, P > &duration)
Record the duration for the given name.
bool Check() const
Verify all pointers non-null.
Definition: CoreData.h:53