Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91112949
system_evolution.cc
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Nov 8, 01:16
Size
1 KB
Mime Type
text/x-c
Expires
Sun, Nov 10, 01:16 (2 d)
Engine
blob
Format
Raw Data
Handle
22162269
Attached To
R7571 SP4E-TB-TL-FR
system_evolution.cc
View Options
#include "system_evolution.hh"
#include "csv_writer.hh"
/* -------------------------------------------------------------------------- */
#include <iomanip>
#include <sstream>
/* -------------------------------------------------------------------------- */
SystemEvolution::SystemEvolution(std::unique_ptr<System> system)
: system(std::move(system)) {}
/* -------------------------------------------------------------------------- */
void SystemEvolution::evolve() {
for (UInt i = 0; i < nsteps; ++i) {
for (auto & compute : computes)
compute->compute(*system);
if (i % freq == 0) {
std::stringstream sstr;
sstr << "dumps/step-" << std::setfill('0') << std::setw(5) << i << ".csv";
CsvWriter dumper(sstr.str());
dumper.write(*system);
}
}
}
/* -------------------------------------------------------------------------- */
void SystemEvolution::addCompute(const std::shared_ptr<Compute>& compute) {
computes.push_back(compute);
}
/* -------------------------------------------------------------------------- */
void SystemEvolution::setNSteps(UInt nsteps) { this->nsteps = nsteps; }
/* -------------------------------------------------------------------------- */
void SystemEvolution::setDumpFreq(UInt freq) { this->freq = freq; }
/* -------------------------------------------------------------------------- */
System& SystemEvolution::getSystem() { return *system; }
/* -------------------------------------------------------------------------- */
Event Timeline
Log In to Comment