Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F82684240
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
Thu, Sep 12, 20:58
Size
1 KB
Mime Type
text/x-c
Expires
Sat, Sep 14, 20:58 (2 d)
Engine
blob
Format
Raw Data
Handle
20636149
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