35 typename ComponentTraits<T>::ComponentType
36 ComponentFactoryProxy::CreateHelper(
const CoreData& cd,
bool default_ok,
bool throw_ok)
const
38 auto f = m_factory->Create(cd, T());
39 if (f ==
nullptr && default_ok) {
40 f = m_default->Create(cd, T());
42 if (f ==
nullptr && throw_ok) {
43 throw runtime_error(
"ComponentFactoryProxy::Create> Failed for " + ComponentTraits<T>::Label());
51 ComponentFactoryProxy::ListHelper(
bool default_ok)
const
53 auto vec = m_factory->List(T());
55 const auto v = m_default->List(T());
56 for (
const auto& e : v) {
63 ComponentFactoryProxy::ComponentFactoryProxy(shared_ptr<ComponentFactoryBase> d, shared_ptr<ComponentFactoryBase> f)
64 : m_default(d), m_factory(f)
70 const auto d = make_shared<SimPT_Default::ComponentFactory>() ;
71 shared_ptr<ComponentFactoryBase> f {
nullptr };
72 if ( group_name ==
"Default" ) {
73 f = make_shared<SimPT_Default::ComponentFactory>();
74 }
else if ( group_name ==
"Blad" ) {
75 f = std::make_shared<SimPT_Blad::ComponentFactory>();
78 if (f ==
nullptr && throw_ok) {
80 "ComponentFactoryProxy::ComponetFactoryProxy()> No such factory available for " + group_name);
88 return CreateHelper<CellChemistryTag>(cd, default_ok, throw_ok);
95 if (f ==
nullptr && default_ok) {
98 if (f ==
nullptr && throw_ok) {
107 return CreateHelper<CellDaughtersTag>(cd, default_ok, throw_ok);
112 return CreateHelper<CellHousekeepTag>(cd, default_ok, throw_ok);
117 return CreateHelper<CellSplitTag>(cd, default_ok, throw_ok);
122 return CreateHelper<CellToCellTransportTag>(cd, default_ok, throw_ok);
127 return CreateHelper<DeltaHamiltonianTag>(cd, default_ok, throw_ok);
132 return CreateHelper<HamiltonianTag>(cd, default_ok, throw_ok);
137 return CreateHelper<MoveGeneratorTag>(cd, default_ok, throw_ok);
142 return CreateHelper<TimeEvolverTag>(cd, default_ok, throw_ok);
147 return CreateHelper<WallChemistryTag>(cd, default_ok, throw_ok);
152 return ListHelper<CellChemistryTag>(default_ok);
157 return ListHelper<CellColorTag>(default_ok);
162 return ListHelper<CellDaughtersTag>(default_ok);
167 return ListHelper<CellHousekeepTag>(default_ok);
172 return ListHelper<CellSplitTag>(default_ok);
177 return ListHelper<CellToCellTransportTag>(default_ok);
182 return ListHelper<DeltaHamiltonianTag>(default_ok);
187 return ListHelper<HamiltonianTag>(default_ok);
192 return ListHelper<MoveGeneratorTag>(default_ok);
197 return ListHelper<TimeEvolverTag>(default_ok);
202 return ListHelper<WallChemistryTag>(default_ok);
std::function< double(Cell *)> HamiltonianComponent
Hamiltonian component interface.
CellSplitComponent CreateCellSplit(const CoreData &cd, bool default_ok=true, bool throw_ok=true) const
Create a CellSplit component.
std::function< double(const NeighborNodes &, Node *, std::array< double, 3 >)> DeltaHamiltonianComponent
DeltaHamiltonian component interface.
Core data with mesh, parameters, random engine and time data.
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.
MoveGeneratorComponent CreateMoveGenerator(const CoreData &cd, bool default_ok=true, bool throw_ok=true) const
Create a CellSplit component.
std::vector< std::string > ListCellSplit(bool default_ok=true) const
List components for CellSplit.
static std::shared_ptr< ComponentFactoryProxy > Create(const string &group_name, bool throw_ok=true)
Create a factory proxy.
std::function< void(Cell *, Cell *)> CellDaughtersComponent
CellDaughters component interface.
CellToCellTransportComponent CreateCellToCellTransport(const CoreData &cd, bool default_ok=true, bool throw_ok=true) const
Create a CellToCellTransport component.
Namespace for the core simulator.
Component factory for SimPT_Default model group.
std::vector< std::string > ListTimeEvolver(bool default_ok=true) const
List components for TimeEvolver.
CellHousekeepComponent CreateCellHousekeep(const CoreData &cd, bool default_ok=true, bool throw_ok=true) const
Create a CellHouskeep component.
std::vector< std::string > ListDeltaHamiltonian(bool default_ok=true) const
List components for DeltaHamiltonian.
CellColorComponent CreateCellColor(const string &select, const ptree &pt, bool default_ok=true, bool throw_ok=true) const
Create a CellColor component.
Proxy for dealing with the factories.
std::vector< std::string > ListCellColor(bool default_ok=true) const
List components for CellColor.
WallChemistryComponent CreateWallChemistry(const CoreData &cd, bool default_ok=true, bool throw_ok=true) const
Create a WallChemistry component.
std::function< void(Cell *, double *)> CellChemistryComponent
CellChemistry component interface.
std::vector< std::string > ListCellDaughters(bool default_ok=true) const
List components for CellDaughters.
std::function< void(Cell *)> CellHousekeepComponent
CellHousekeep component interface.
Primary template never gets instantiated.
std::vector< std::string > ListCellHousekeep(bool default_ok=true) const
List components for CellHouseKeep.
Component factory for the Blad model group.
CellDaughtersComponent CreateCellDaughters(const CoreData &cd, bool default_ok=true, bool throw_ok=true) const
Create a CellDaughters component.
std::function< void(Wall *, double *, double *)> WallChemistryComponent
Wall chemistry component interface.
HamiltonianComponent CreateHamiltonian(const CoreData &cd, bool default_ok=true, bool throw_ok=true) const
Create a Hamiltonian component.
std::vector< std::string > ListMoveGenerator(bool default_ok=true) const
List components for MoveGenerator.
std::vector< std::string > ListCellToCellTransport(bool default_ok=true) const
List components for CellToCellTransport.
std::vector< std::string > ListHamiltonian(bool default_ok=true) const
List components for Hamiltonian.
Proxy for interaction with Component Factory of model families.
DeltaHamiltonianComponent CreateDeltaHamiltonian(const CoreData &cd, bool default_ok=true, bool throw_ok=true) const
Create a DeltaHamiltonian component.
std::function< std::array< double, 3 >(Cell *)> CellColorComponent
CellColor component interface.
CellChemistryComponent CreateCellChemistry(const CoreData &cd, bool default_ok=true, bool throw_ok=true) const
Create a CellChemistry component.
std::function< std::tuple< SimTimingTraits::CumulativeTimings, bool >(double, SimPhase)> TimeEvolverComponent
Time Evolver component interface.
std::vector< std::string > ListCellChemistry(bool default_ok=true) const
List components for CellChemistry.
std::function< void(Wall *, double *, double *)> CellToCellTransportComponent
CellToCellTransport component interface.
TimeEvolverComponent CreateTimeEvolver(const CoreData &cd, bool default_ok=true, bool throw_ok=true) const
Create a TimeEvolver component.
std::vector< std::string > ListWallChemistry(bool default_ok=true) const
List components for WallChemistry.