71 lines
1.4 KiB
C++
71 lines
1.4 KiB
C++
#include <fesa/results/results.hpp>
|
|
|
|
#include <stdexcept>
|
|
#include <utility>
|
|
|
|
namespace fesa::results {
|
|
|
|
ResultFrame::ResultFrame(int frame_id, double time)
|
|
: frame_id_(frame_id), time_(time)
|
|
{
|
|
}
|
|
|
|
int ResultFrame::frame_id() const
|
|
{
|
|
return frame_id_;
|
|
}
|
|
|
|
double ResultFrame::time() const
|
|
{
|
|
return time_;
|
|
}
|
|
|
|
void ResultFrame::add_field_output(FieldOutput output)
|
|
{
|
|
if (output.components.empty()) {
|
|
throw std::invalid_argument("field output must have components");
|
|
}
|
|
if (output.entity_ids.size() * output.components.size() != output.values.size()) {
|
|
throw std::invalid_argument("field output values do not match row shape");
|
|
}
|
|
field_outputs_.push_back(std::move(output));
|
|
}
|
|
|
|
void ResultFrame::add_history_output(HistoryOutput output)
|
|
{
|
|
history_outputs_.push_back(std::move(output));
|
|
}
|
|
|
|
const std::vector<FieldOutput>& ResultFrame::field_outputs() const
|
|
{
|
|
return field_outputs_;
|
|
}
|
|
|
|
const std::vector<HistoryOutput>& ResultFrame::history_outputs() const
|
|
{
|
|
return history_outputs_;
|
|
}
|
|
|
|
ResultStep::ResultStep(std::string name)
|
|
: name_(std::move(name))
|
|
{
|
|
}
|
|
|
|
const std::string& ResultStep::name() const
|
|
{
|
|
return name_;
|
|
}
|
|
|
|
ResultFrame& ResultStep::add_frame(int frame_id, double time)
|
|
{
|
|
frames_.push_back(ResultFrame{frame_id, time});
|
|
return frames_.back();
|
|
}
|
|
|
|
const std::vector<ResultFrame>& ResultStep::frames() const
|
|
{
|
|
return frames_;
|
|
}
|
|
|
|
} // namespace fesa::results
|