Commit 610dca44 authored by ese ovie's avatar ese ovie Committed by Gauthier Quesnel
Browse files

model:add empty filter model

parent 64f70b11
......@@ -1789,6 +1789,12 @@ static void
show_dynamics_inputs(editor& /*ed*/, none& /*dyn*/)
{}
static void
show_dynamics_values(simulation& /*sim*/, const filter& dyn)
{
ImGui::Text("number %ld", dyn.x);
}
static void
show_dynamics_values(simulation& /*sim*/, const flow& dyn)
{
......@@ -2311,6 +2317,10 @@ static void
show_dynamics_inputs(editor& /*ed*/, accumulator_2& /*dyn*/)
{}
static void
show_dynamics_inputs(editor& /*ed*/, filter& /*dyn*/)
{}
static void
show_dynamics_inputs(editor& /*ed*/, flow& /*dyn*/)
{}
......@@ -2675,6 +2685,7 @@ editor::show_editor() noexcept
add_popup_menuitem(*this, dynamics_type::constant, &new_model);
add_popup_menuitem(*this, dynamics_type::time_func, &new_model);
add_popup_menuitem(*this, dynamics_type::accumulator_2, &new_model);
add_popup_menuitem(*this, dynamics_type::filter, &new_model);
add_popup_menuitem(*this, dynamics_type::flow, &new_model);
ImGui::EndPopup();
......
......@@ -3063,6 +3063,7 @@ enum class dynamics_type : i32
cross,
time_func,
accumulator_2,
filter,
flow
};
......@@ -5219,6 +5220,13 @@ struct constant
}
};
struct filter
{
port x[1];
port y[1];
time sigma = time_domain<time>::infinity;
};
struct flow
{
port y[1];
......
......@@ -67,6 +67,7 @@ static inline const char* dynamics_type_names[] = { "none",
"cross",
"time_func",
"accumulator_2",
"filter",
"flow" };
static_assert(std::size(dynamics_type_names) ==
......@@ -137,6 +138,7 @@ get_input_port_names() noexcept
if constexpr (std::is_same_v<Dynamics, quantifier> ||
std::is_same_v<Dynamics, counter> ||
std::is_same_v<Dynamics, filter> ||
std::is_same_v<Dynamics, queue> ||
std::is_same_v<Dynamics, dynamic_queue> ||
std::is_same_v<Dynamics, priority_queue> ||
......@@ -216,6 +218,7 @@ get_input_port_names(const dynamics_type type) noexcept
case dynamics_type::quantifier:
case dynamics_type::counter:
case dynamics_type::filter:
case dynamics_type::queue:
case dynamics_type::dynamic_queue:
case dynamics_type::priority_queue:
......@@ -303,6 +306,7 @@ get_output_port_names() noexcept
std::is_same_v<Dynamics, generator> ||
std::is_same_v<Dynamics, constant> ||
std::is_same_v<Dynamics, time_func> ||
std::is_same_v<Dynamics, filter> ||
std::is_same_v<Dynamics, flow>)
return str_out_1;
......@@ -370,6 +374,7 @@ get_output_port_names(const dynamics_type type) noexcept
case dynamics_type::generator:
case dynamics_type::constant:
case dynamics_type::time_func:
case dynamics_type::filter:
case dynamics_type::flow:
return str_out_1;
......@@ -965,6 +970,7 @@ private:
{ "counter", dynamics_type::counter },
{ "cross", dynamics_type::cross },
{ "dynamic_queue", dynamics_type::dynamic_queue },
{ "filter", dynamics_type::filter },
{ "flow", dynamics_type::flow },
{ "generator", dynamics_type::generator },
{ "integrator", dynamics_type::integrator },
......@@ -1507,6 +1513,11 @@ private:
return true;
}
bool read(simulation& /*sim*/, filter& /*dyn*/) noexcept
{
return true;
}
bool read(simulation& /*sim*/, flow& dyn) noexcept
{
return !!(is >> dyn.default_samplerate);
......@@ -2100,6 +2111,11 @@ private:
<< (dyn.default_f == &time_function ? "time\n" : "square\n");
}
void write(const simulation& /*sim*/, const filter& /*dyn*/) noexcept
{
os << "filter\n";
}
void write(const simulation& /*sim*/, const flow& dyn) noexcept
{
os << "flow " << dyn.default_samplerate << '\n';
......
Markdown is supported
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