Commit 1c24bbcc authored by Gauthier Quesnel's avatar Gauthier Quesnel
Browse files

next12

parent b605f021
Pipeline #2308 failed with stage
in 25 seconds
...@@ -377,13 +377,6 @@ template<typename T, typename Identifier> ...@@ -377,13 +377,6 @@ template<typename T, typename Identifier>
Identifier Identifier
data_array<T, Identifier>::get_id(const T& t) data_array<T, Identifier>::get_id(const T& t)
{ {
using type = data_array<T, Identifier>::item;
// auto offset = offsetof(type, id);
// auto* ptr = reinterpret_cast<const char*>(&t);
// ptr += offset;
// return static_cast<int>(*reinterpret_cast<const int*>(ptr));
auto* ptr = reinterpret_cast<const item*>(&t); auto* ptr = reinterpret_cast<const item*>(&t);
return ptr->id; return ptr->id;
} }
......
...@@ -145,7 +145,7 @@ private: ...@@ -145,7 +145,7 @@ private:
iterator(this_type* list_, iterator(this_type* list_,
DataArray* dataarray_, DataArray* dataarray_,
Identifier elem_) noexcept int elem_) noexcept
: list(list_) : list(list_)
, dataarray(dataarray_) , dataarray(dataarray_)
, elem(elem_) , elem(elem_)
......
...@@ -185,7 +185,7 @@ struct Vpz ...@@ -185,7 +185,7 @@ struct Vpz
bits::multi_linker<ID, ID> model_children{ 4096 }; bits::multi_linker<ID, ID> model_children{ 4096 };
bits::multi_linker<ID, ID> condition_named_values{ 4096 }; bits::multi_linker<ID, ID> condition_named_values{ 4096 };
void init(int object_capacity, int list_capacity) void init(int object_capacity, int /*list_capacity*/)
{ {
dynamics.init(object_capacity); dynamics.init(object_capacity);
views.init(object_capacity); views.init(object_capacity);
...@@ -260,10 +260,34 @@ struct Vpz ...@@ -260,10 +260,34 @@ struct Vpz
fprintf(&f, " <experiment name=\"%s\">\n", name.c_str()); fprintf(&f, " <experiment name=\"%s\">\n", name.c_str());
fprintf(&f, " <conditions>\n"); fprintf(&f, " <conditions>\n");
// Condition* cond = nullptr; Condition* cond = nullptr;
// while (conditions.next(cond)) { while (conditions.next(cond)) {
// write(f, *cond); fprintf(&f, " <condition name=\"%s\">\n",
// } cond->name.c_str());
for (auto it = condition_named_values.begin(
&conditions, conditions.get_id(*cond)),
et = condition_named_values.end(&conditions);
it != et; ++it) {
auto* namedvalue = named_values.try_to_get(*it);
fprintf(&f, " <port name=\"%s\">\n",
namedvalue->name.c_str());
switch (namedvalue->type) {
case value_type::real32: {
auto *v = real32.try_to_get(namedvalue_links[*it]);
fprintf(&f, " <double>%f</double>\n",
static_cast<double>(*v));
}
break;
default:
break;
// to be continued
}
}
fprintf(&f, " </condition>\n");
}
fprintf(&f, " </experiment>\n"); fprintf(&f, " </experiment>\n");
} }
...@@ -380,7 +404,7 @@ struct Vpz ...@@ -380,7 +404,7 @@ struct Vpz
{ {
auto id_coupledmodel = models.get_id(coupledmodel); auto id_coupledmodel = models.get_id(coupledmodel);
auto id_port_source = output_ports.get_id(port_source); auto id_port_source = output_ports.get_id(port_source);
auto id_port_destination = input_ports.get_id(port_source); auto id_port_destination = input_ports.get_id(port_destination);
model_connections.emplace(id_coupledmodel, model_connections.emplace(id_coupledmodel,
ID2(id_port_source, id_port_destination)); ID2(id_port_source, id_port_destination));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment