|
@@ -38,6 +38,8 @@ struct ModelParameters
|
|
|
|
|
|
using Model = artis::kernel::AbstractModel < artis::utils::DoubleTime,
|
|
using Model = artis::kernel::AbstractModel < artis::utils::DoubleTime,
|
|
ModelParameters >;
|
|
ModelParameters >;
|
|
|
|
+using Models = artis::kernel::AbstractModels < artis::utils::DoubleTime,
|
|
|
|
+ ModelParameters >;
|
|
|
|
|
|
using Trace = artis::utils::Trace < artis::utils::DoubleTime >;
|
|
using Trace = artis::utils::Trace < artis::utils::DoubleTime >;
|
|
using TraceElement = artis::utils::TraceElement < artis::utils::DoubleTime >;
|
|
using TraceElement = artis::utils::TraceElement < artis::utils::DoubleTime >;
|
|
@@ -57,7 +59,7 @@ public:
|
|
|
|
|
|
enum internals { DX, BX, IX };
|
|
enum internals { DX, BX, IX };
|
|
|
|
|
|
- AModel()
|
|
|
|
|
|
+ AModel(Models = Models())
|
|
{
|
|
{
|
|
Internal(IX, &AModel::_ix);
|
|
Internal(IX, &AModel::_ix);
|
|
Internal(BX, &AModel::_bx);
|
|
Internal(BX, &AModel::_bx);
|
|
@@ -103,7 +105,7 @@ public:
|
|
enum internals { IY, IZ, BY, DY };
|
|
enum internals { IY, IZ, BY, DY };
|
|
enum states { N };
|
|
enum states { N };
|
|
|
|
|
|
- BModel()
|
|
|
|
|
|
+ BModel(Models = Models())
|
|
{
|
|
{
|
|
// external(IX, &BModel::_ix);
|
|
// external(IX, &BModel::_ix);
|
|
Externals(int, (( IX, &BModel::_ix )));
|
|
Externals(int, (( IX, &BModel::_ix )));
|
|
@@ -172,15 +174,32 @@ public:
|
|
enum internals { IY, BY, DY, IZ, DX };
|
|
enum internals { IY, BY, DY, IZ, DX };
|
|
enum states { N };
|
|
enum states { N };
|
|
|
|
|
|
|
|
+ RootModel(Models submodels) :
|
|
|
|
+ _a(dynamic_cast < AModel* >(submodels[0])),
|
|
|
|
+ _b(dynamic_cast < BModel* >(submodels[1]))
|
|
|
|
+ {
|
|
|
|
+ // submodels
|
|
|
|
+ Submodels(((A, _a), (B, _b)));
|
|
|
|
+
|
|
|
|
+ // internals
|
|
|
|
+ Internal(DX, &RootModel::_dx);
|
|
|
|
+ InternalsS(((IY, _b, BModel::IY), (IZ, _b, BModel::IZ)));
|
|
|
|
+ InternalS(BY, _b, BModel::BY);
|
|
|
|
+
|
|
|
|
+ // states
|
|
|
|
+ States(int, ((N, &RootModel::_n)));
|
|
|
|
+ // State(N, &RootModel::_n);
|
|
|
|
+ }
|
|
|
|
+
|
|
RootModel() : _a(new AModel), _b(new BModel)
|
|
RootModel() : _a(new AModel), _b(new BModel)
|
|
{
|
|
{
|
|
// submodels
|
|
// submodels
|
|
- Submodels(((A, _a.get()), (B, _b.get())));
|
|
|
|
|
|
+ Submodels(((A, _a), (B, _b)));
|
|
|
|
|
|
// internals
|
|
// internals
|
|
Internal(DX, &RootModel::_dx);
|
|
Internal(DX, &RootModel::_dx);
|
|
- InternalsS(((IY, _b.get(), BModel::IY), (IZ, _b.get(), BModel::IZ)));
|
|
|
|
- InternalS(BY, _b.get(), BModel::BY);
|
|
|
|
|
|
+ InternalsS(((IY, _b, BModel::IY), (IZ, _b, BModel::IZ)));
|
|
|
|
+ InternalS(BY, _b, BModel::BY);
|
|
|
|
|
|
// states
|
|
// states
|
|
States(int, ((N, &RootModel::_n)));
|
|
States(int, ((N, &RootModel::_n)));
|
|
@@ -188,11 +207,15 @@ public:
|
|
}
|
|
}
|
|
|
|
|
|
virtual ~RootModel()
|
|
virtual ~RootModel()
|
|
- { }
|
|
|
|
|
|
+ {
|
|
|
|
+ delete _a;
|
|
|
|
+ delete _b;
|
|
|
|
+ }
|
|
|
|
|
|
void compute(double t, bool /* update */)
|
|
void compute(double t, bool /* update */)
|
|
{
|
|
{
|
|
- ::Trace::trace() << ::TraceElement(this->path(this), t, artis::utils::COMPUTE)
|
|
|
|
|
|
+ ::Trace::trace() << ::TraceElement(this->path(this), t,
|
|
|
|
+ artis::utils::COMPUTE)
|
|
<< "Start";
|
|
<< "Start";
|
|
::Trace::trace().flush();
|
|
::Trace::trace().flush();
|
|
(*_a)(t);
|
|
(*_a)(t);
|
|
@@ -216,8 +239,8 @@ public:
|
|
|
|
|
|
private:
|
|
private:
|
|
// submodels
|
|
// submodels
|
|
- std::unique_ptr < AModel > _a;
|
|
|
|
- std::unique_ptr < BModel > _b;
|
|
|
|
|
|
+ AModel* _a;
|
|
|
|
+ BModel* _b;
|
|
|
|
|
|
//internals
|
|
//internals
|
|
double _dx;
|
|
double _dx;
|