opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
model.h
Go to the documentation of this file.
1#pragma once
2
8#include <libopynsim/symbol.h>
9
12
13#include <string>
14#include <unordered_map>
15#include <unordered_set>
16#include <vector>
17
18namespace osc { class SceneCache; }
19namespace OpenSim { class Model; }
20namespace opyn { class DataFrame; }
21
22namespace opyn
23{
26 class Model final {
27 private:
28 friend class ModelSpecification;
29 explicit Model(const OpenSim::Model&);
30
31 public:
39
42 std::unordered_set<std::string> rotational_columns_in(const DataFrame& data_frame) const;
43
47 std::unordered_map<std::string, Symbol> column_to_state_variable_mappings(const DataFrame& data_frame) const;
48
60
76 const DataFrame& data_frame,
78 ) const;
79
81 void realize(ModelState& model_state, ModelStateStage model_state_stage) const;
82
84 size_t num_coordinates() const;
85
87 std::vector<Symbol> coordinates() const;
88
90 double get_coordinate_value(const ModelState& model_state, const Symbol& coordinate) const;
91
93 void set_coordinate_value(ModelState& model_state, const Symbol& coordinate, double value) const;
94
96 double get_coordinate_speed(const ModelState& model_state, const Symbol& coordinate) const;
97
99 void set_coordinate_speed(ModelState& model_state, const Symbol& coordinate, double speed) const;
100
102 bool is_coordinate_locked(const ModelState& model_state, const Symbol& coordinate) const;
103
105 void set_coordinate_locked(ModelState& model_state, const Symbol& coordinate, bool locked = true) const;
106
108 bool is_coordinate_rotational(const Symbol& coordinate) const;
109
111 size_t num_outputs() const;
112
114 std::vector<Symbol> outputs() const;
115
117 OutputValue get_output_value(const ModelState& model_state, const Symbol& output) const;
118
120 std::vector<osc::SceneDecoration> decorations(
122 const ModelState& model_state,
123 const OpenSimDecorationOptions& = {}
124 ) const;
125
127 const OpenSim::Model& open_sim_model() const;
128 private:
129 class Impl;
131 };
132}
Represents a sequence of Series with optional associated metadata.
Definition data_frame.h:16
Definition model_specification.h:16
Definition model_state.h:19
Represents a sequence of ModelStates stored in shared handles.
Definition model_states.h:15
Definition model.h:26
std::vector< osc::SceneDecoration > decorations(osc::SceneCache &, const ModelState &model_state, const OpenSimDecorationOptions &={}) const
Returns scene decorations that visually represent *this in model_state.
double get_coordinate_speed(const ModelState &model_state, const Symbol &coordinate) const
Returns the speed of coordinate in model_state.
void set_coordinate_locked(ModelState &model_state, const Symbol &coordinate, bool locked=true) const
Sets the locked state of coordinate in model_state to locked.
double get_coordinate_value(const ModelState &model_state, const Symbol &coordinate) const
Returns the value of coordinate in model_state.
bool is_coordinate_locked(const ModelState &model_state, const Symbol &coordinate) const
Returns true if coordinate is locked in model_state.
std::unordered_set< std::string > rotational_columns_in(const DataFrame &data_frame) const
std::vector< Symbol > coordinates() const
Returns all coordinates in the model.
const OpenSim::Model & open_sim_model() const
Returns the underlying OpenSim::Model (internal method: be careful with this).
ModelStates states_from_data_frame(const DataFrame &data_frame, ModelStateStage realized_to=ModelStateStage::instance) const
void realize(ModelState &model_state, ModelStateStage model_state_stage) const
Realizes model_state to the given model_state_stage.
bool is_coordinate_rotational(const Symbol &coordinate) const
Returns true if coordinate has a rotational (i.e. not translational or coupled).
void set_coordinate_value(ModelState &model_state, const Symbol &coordinate, double value) const
Sets the value of coordinate in model_state to value.
void set_coordinate_speed(ModelState &model_state, const Symbol &coordinate, double speed) const
Sets the speed of coordinate in model_state to speed.
size_t num_coordinates() const
Returns the number of coordinates in the model.
ModelState initial_state(ModelStateStage realized_to=ModelStateStage::instance) const
DataFrame convert_data_frame_to_radians(const DataFrame &data_frame) const
size_t num_outputs() const
Returns the number of outputs in the model.
std::unordered_map< std::string, Symbol > column_to_state_variable_mappings(const DataFrame &data_frame) const
std::vector< Symbol > outputs() const
Returns all outputs in the model.
OutputValue get_output_value(const ModelState &model_state, const Symbol &output) const
Returns the value of output in model_state.
Definition open_sim_decoration_options.h:22
Definition symbol.h:17
Definition copy_on_upd_ptr.h:22
Definition scene_cache.h:25
Definition static_component_registries.h:3
Definition component_registry.h:14
ModelStateStage
Definition model_state_stage.h:11
osc::VariantOfTypelistElements< SupportedOutputValueTypes > OutputValue
Definition output_value.h:22
Definition custom_decoration_generator.h:5