VPTissue Reference Manual
ComponentTraits.h
Go to the documentation of this file.
1 #ifndef MODEL_COMPONENT_TRAITS_H_INLUDED
2 #define MODEL_COMPONENT_TRAITS_H_INLUDED
3 /*
4  * Copyright 2011-2016 Universiteit Antwerpen
5  *
6  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
7  * the European Commission - subsequent versions of the EUPL (the "Licence");
8  * You may not use this work except in compliance with the Licence.
9  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the Licence is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the Licence for the specific language governing
15  * permissions and limitations under the Licence.
16  */
23 #include "sim/CoreData.h"
24 
25 #include <boost/property_tree/ptree_fwd.hpp>
26 #include <string>
27 #include <map>
28 
29 // Notice: we want to treat each component as a different type,
30 // irrespective of the fact that they happen to be implemented by
31 // the same type of std::function (which messes up specialization
32 // because the components are then strictly speaking of the same type.
33 // Hence the use of the Tag classes to disambiguate.
34 
35 namespace SimPT_Sim {
36 
37 using boost::property_tree::ptree;
38 
39 class CellChemistryTag {};
40 class CellDaughtersTag {};
41 class CellColorTag {};
42 class CellHousekeepTag {};
43 class CellSplitTag {};
45 class HamiltonianTag {};
46 class MoveGeneratorTag {};
49 class TimeEvolverTag {};
50 class WallChemistryTag {};
51 
52 template<typename T>
53 struct ComponentTraits {};
54 
56 template<>
58 {
59  using ComponentType = CellChemistryComponent;
60  using MapType = std::map<const std::string, const std::function<ComponentType (const CoreData&)>>;
61  static const std::string Label() { return "model.cell_chemistry"; }
62 };
63 
65 template<>
67 {
68  using ComponentType = CellColorComponent;
69  using MapType = std::map<const std::string, const std::function<ComponentType (const ptree&)>>;
70  static const std::string Label() { return "cell_color"; }
71 };
72 
74 template<>
76 {
77  using ComponentType = CellDaughtersComponent;
78  using MapType = std::map<const std::string, const std::function<ComponentType (const CoreData&)>>;
79  static const std::string Label() { return "model.cell_daughters"; }
80 };
81 
83 template<>
85 {
86  using ComponentType = CellHousekeepComponent;
87  using MapType = std::map<const std::string, const std::function<ComponentType (const CoreData&)>>;
88  static const std::string Label() { return "model.cell_housekeep"; }
89 };
90 
92 template<>
94 {
95  using ComponentType = CellSplitComponent;
96  using MapType = std::map<const std::string, const std::function<ComponentType (const CoreData&)>>;
97  static const std::string Label() { return "model.cell_split"; }
98 };
99 
101 template<>
103 {
104  using ComponentType = CellToCellTransportComponent;
105  using MapType = std::map<const std::string, const std::function<ComponentType (const CoreData&)>>;
106  static const std::string Label() { return "model.cell2cell_transport"; }
107 };
108 
110 template<>
112 {
113  using ComponentType = CellToCellTransportBoundaryComponent;
114  using MapType = std::map<const std::string, const std::function<ComponentType (const CoreData&)>>;
115  static const std::string Label() { return "model.cell2cell_transport_boundary"; }
116 };
117 
119 template<>
121 {
122  using ComponentType = DeltaHamiltonianComponent;
123  using MapType = std::map<const std::string, const std::function<ComponentType (const CoreData&)>>;
124  static const std::string Label() { return "model.mc_hamiltonian"; }
125 };
126 
128 template<>
130 {
131  using ComponentType = HamiltonianComponent;
132  using MapType = std::map<const std::string, const std::function<ComponentType (const CoreData&)>>;
133  static const std::string Label() { return "model.mc_hamiltonian"; }
134 };
135 
137 template<>
139 {
140  using ComponentType = MoveGeneratorComponent;
141  using MapType = std::map<const std::string, const std::function<ComponentType (const CoreData&)>>;
142  static const std::string Label() { return "model.mc_move_generator"; }
143 };
144 
146 template<>
148 {
149  using ComponentType = TimeEvolverComponent;
150  using MapType = std::map<const std::string, const std::function<ComponentType (const CoreData&)>>;
151  static const std::string Label() { return "model.time_evolver"; }
152 };
153 
155 template<>
157 {
158  using ComponentType = WallChemistryComponent;
159  using MapType = std::map<const std::string, const std::function<ComponentType (const CoreData&)>>;
160  static const std::string Label() { return "model.wall_chemistry"; }
161 };
162 
163 } // namespace
164 
165 #endif // end_of_include_guard
std::function< double(Cell *)> HamiltonianComponent
Hamiltonian component interface.
std::function< double(const NeighborNodes &, Node *, std::array< double, 3 >)> DeltaHamiltonianComponent
DeltaHamiltonian component interface.
Core data used during model execution.
std::function< std::tuple< bool, bool, std::array< double, 3 >>(Cell *)> CellSplitComponent
CellSplit component interface.
std::function< std::array< double, 3 >()> MoveGeneratorComponent
MoveGenerator component interface.
Interface of Model Components.
Used in tag forwarding.
Used in tag forwarding.
Used in tag forwarding.
std::function< void(Cell *, Cell *)> CellDaughtersComponent
CellDaughters component interface.
std::function< void(Wall *w, double *dchem_c1, double *dchem_c2)> CellToCellTransportBoundaryComponent
CellToCellTransport boundary condition component interface.
Namespace for the core simulator.
Used in tag forwarding.
Used in tag forwarding.
std::function< void(Cell *, double *)> CellChemistryComponent
CellChemistry component interface.
std::function< void(Cell *)> CellHousekeepComponent
CellHousekeep component interface.
Used in tag forwarding.
Primary template never gets instantiated.
Used in tag forwarding.
Used in tag forwarding.
Used in tag forwarding.
std::function< void(Wall *, double *, double *)> WallChemistryComponent
Wall chemistry component interface.
Used in tag forwarding.
std::function< std::array< double, 3 >(Cell *)> CellColorComponent
CellColor component interface.
std::function< std::tuple< SimTimingTraits::CumulativeTimings, bool >(double, SimPhase)> TimeEvolverComponent
Time Evolver component interface.
Used in tag forwarding.
std::function< void(Wall *, double *, double *)> CellToCellTransportComponent
CellToCellTransport component interface.