Comments (4)
Apparently a commented void should do a part of the job in simulation-editor.cpp ?
// static void
// initialize_observation(window_logger& log_w, irt::editor& ed) noexcept
//{
// observer* obs = nullptr;
// while (ed.sim.observers.next(obs)) {
// auto& output = ed.observation_outputs.emplace_back(obs->name.sv());
//
//
// if (output.plot) {
// output.xs.clear();
// output.ys.clear();
// output.xs.reserve(length);
// output.ys.reserve(length);
// }
//
// if (!obs->name.empty()) {
// const std::filesystem::path obs_file_path =
// ed.observation_directory / obs->name.c_str();
//
// if (output.file) {
// if (output.ofs.open(obs_file_path); !output.ofs.is_open())
// log_w.log(4,
// "Fail to open "
// "observation file: %s in "
// "%s\n",
// obs->name.c_str(),
//#if _WIN32
// ed.observation_directory.u8string().c_str());
//#else
// reinterpret_cast<const char*>(
// ed.observation_directory.u8string().c_str()));
//#endif
// }
// }
//
// obs->initialize = &observation_output_initialize;
// obs->observe = &observation_output_observe;
// obs->free = &observation_output_free;
// obs->user_data = static_cast<void*>(&output);
// }
//}
from irritator.
I confirm the bug. I will correct it.
from irritator.
Thanks
I introduced a member with output directory in observers and initialized it in the initialize_observation routine, if it may bring a little help.
It works but may not be well written, especially for linux as well as in terms of string management...
In simulation-editor.cpp :
void
observation_file_output_initialize(const irt::observer& obs,
const irt::time t) noexcept
{
if (!obs.user_data)
return;
auto* output = reinterpret_cast<file_output*>(obs.user_data);
output->tl = t;
//if (output->ofs.is_open())
//fmt::print(output->ofs, "t,{}\n", output->name.c_str());
// Nedelec
char strFileName [110];
sprintf(strFileName,
"%s\\%s.txt",
obs.output_directory,
output->name.c_str());
output->ofs.open(strFileName);
fmt::print(output->ofs, "t,{}\n", output->name.c_str());
}
...
static void
initialize_observation(window_logger& log_w, irt::editor& ed) noexcept
{
observer* obs = nullptr;
while (ed.sim.observers.next(obs)) {
// Nedelec
obs->output_directory = ed.observation_directory.string().c_str();
//auto& output = ed.observation_outputs.emplace_back(obs->name.sv());
// if (output.plot) {
// output.xs.clear();
// output.ys.clear();
// output.xs.reserve(length);
// output.ys.reserve(length);
// }
//
//if (!obs->name.empty()) {
//Nedelec
//output->strOutputDirectory = ed.observation_directory;
// const std::filesystem::path obs_file_path =
// ed.observation_directory / obs->name.c_str();
//
// if (output.file) {
// if (output.ofs.open(obs_file_path); !output.ofs.is_open())
// log_w.log(4,
// "Fail to open "
// "observation file: %s in "
// "%s\n",
// obs->name.c_str(),
//#if _WIN32
// ed.observation_directory.u8string().c_str());
//#else
// reinterpret_cast<const char*>(
// ed.observation_directory.u8string().c_str()));
//#endif
// }
//}
//
// obs->initialize = &observation_output_initialize;
// obs->observe = &observation_output_observe;
// obs->free = &observation_output_free;
// obs->user_data = static_cast<void*>(&output);
}
}
...
The three calls to initialize_observation are uncommented
In core.hpp :
observer(const time time_step_,
const char* name_,
void* user_data_,
void (*initialize_)(const observer& obs, const time t) noexcept,
void (*observe_)(const observer& obs,
const time t,
const message& msg) noexcept,
void (*free_)(const observer& obs, const time t) noexcept)
: time_step(std::clamp(time_step_, 0.0, time_domain<time>::infinity))
, name(name_)
, user_data(user_data_)
, initialize(initialize_)
, observe(observe_)
, free(free_)
{}
double tl = 0.0;
double time_step = 0.0;
small_string<8> name;
small_string<100> output_directory; // Nedelec
model_id model = static_cast<model_id>(0);
...
from irritator.
Thank you for the report. I fix the problem but for now, output files are open in the application directory (where you launch the irritator.exe
).
from irritator.
Related Issues (20)
- [negative]lif internal component -> no observation
- core: time-function model can be observed
- gui: missing hsm editor control
- abandon (core dumped)
- Allocator -> noexcept and never return nullptr
- Update containers to the new allocator
- Crash HOT 1
- crash: visualization does not work HOT 3
- Crash : can not import model into simulation tab. HOT 1
- Crash when setting parameter value HOT 1
- Crash with view setting
- component-list and observation layout problem
- refactor InputSmallString functions
- refactor is-compatible ports with constexpr
- Frequent death of application when clearing the simulation editor panel (Windows) HOT 2
- fix cmake warnings
- Add more behaviour to constant model.
- Split hierarchical state machine: model/simulation
- Observation of aggregated values HOT 1
- core: remove small_string from irt::observer
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from irritator.