VPTissue Reference Manual
VPTissue.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 "VPTissue.h"
21 #include "HousekeepGrow.h"
22 #include "Transport.h"
23 
24 #include "util/misc/Exception.h"
25 #include "util/misc/log_debug.h"
26 
27 #include <cassert>
28 #include <boost/property_tree/ptree.hpp>
29 
30 namespace SimPT_Default {
31 namespace TimeEvolver {
32 
33 using namespace std;
34 using namespace SimPT_Sim::ClockMan;
35 
37 {
38  Initialize(cd);
39 }
40 
42 {
43  assert( cd.Check() && "CoreData not ok.");
44  m_cd = cd;
45 }
46 
47 std::tuple<SimTimingTraits::CumulativeTimings, bool> VPTissue::operator()(double time_slice, SimPhase phase)
48 {
49  CumulativeTimings timings;
50  bool is_stationary = true;
51 
52  if (phase == SimPhase::_1 || phase == SimPhase::NONE) {
53  // -------------------------------------------------------------------------------
54  // Reaction and transport dynamics.
55  // -------------------------------------------------------------------------------
56  Transport transporter(m_cd);
57  const auto tup1 = transporter(time_slice);
58  timings.Merge(get<0>(tup1));
59  is_stationary &= get<1>(tup1);
60  }
61 
62  if (phase == SimPhase::_2 || phase == SimPhase::NONE) {
63  // -------------------------------------------------------------------------------
64  // Housekeep followed by Metropolis loop until relaxation.
65  // -------------------------------------------------------------------------------
66  HousekeepGrow grow_housekeep(m_cd);
67  const auto tup2 = grow_housekeep();
68  timings.Merge(get<0>(tup2));
69  is_stationary &= get<1>(tup2);
70  }
71 
72  // -------------------------------------------------------------------------------
73  // We are done ...
74  // -------------------------------------------------------------------------------
75  return make_tuple(timings, is_stationary);
76 }
77 
78 } // namespace
79 } // namespace
Interface for SimPT time evolver.
std::tuple< SimTimingTraits::CumulativeTimings, bool > operator()(double time_slice, SimPhase phase=SimPhase::NONE)
Take a time step.
Definition: VPTissue.cpp:47
Core data with mesh, parameters, random engine and time data.
Definition: CoreData.h:38
STL namespace.
Time evolution of reaction, diffusion and active transport process.
Definition: Transport.h:34
VPTissue(const CoreData &cd)
Initializing constructor.
Definition: VPTissue.cpp:36
Namespace for components of the Default model group.
Utility class to record durations in a cumulative manner.
Time evolver for diffusion and active transport.
Macro defs for debug and logging.
HousekeepGrow time step is a composite: Grow then Housekeep.
Definition: HousekeepGrow.h:34
void Initialize(const CoreData &cd)
Initialize or re-initialize.
Definition: VPTissue.cpp:41
void Merge(const CumulativeRecords< U > &extra)
Merge an extra set of records (casting durations if required).
Time evolver for Housekeep plus Grow.
Header file for Exception class.
bool Check() const
Verify all pointers non-null.
Definition: CoreData.h:53
Namespace for clock and timekeeping related classes.
Definition: ClockCLib.h:27