Page 1 of 1

getworkingstate() and get a state at a specific time ?

Posted: Fri Feb 09, 2018 10:43 pm
by jackzhao123
Dear All:
What is the meaning of Model::getworkingstate() ? How to use it ?

Regards

Re: getworkingstate() and get a state at a specific time ?

Posted: Sat Feb 10, 2018 1:10 pm
by tkuchida
What is the meaning of Model::getworkingstate() ?
Please see the API documentation here: https://simtk.org/api_docs/opensim/api_ ... ebb8f8f7cc. In most cases, you can probably just hold onto the State returned by initSystem():

Code: Select all

//C++
State& s = myModel.initSystem();

%MATLAB
s = myModel.initSystem();

Re: getworkingstate() and get a state at a specific time ?

Posted: Wed Jul 11, 2018 2:52 am
by jackzhao123
tkuchida wrote:
Sat Feb 10, 2018 1:10 pm
What is the meaning of Model::getworkingstate() ?
Please see the API documentation here: https://simtk.org/api_docs/opensim/api_ ... ebb8f8f7cc. In most cases, you can probably just hold onto the State returned by initSystem():

Code: Select all

//C++
State& s = myModel.initSystem();

%MATLAB
s = myModel.initSystem();

Hi Dr. Uchida:
Sorry for the late reply! Hence, we can get the state at a specific time step using "initSystem" API ?

Best regards
Jack

Re: getworkingstate() and get a state at a specific time ?

Posted: Tue Jul 17, 2018 1:42 am
by tkuchida
we can get the state at a specific time step using "initSystem" API ?
initSystem() constructs the underlying computational system from scratch; it's very inefficient to call initSystem() repeatedly. An appropriate strategy for reading the State at a particular instant of time depends on the application. Perhaps the easiest strategy would be to run the entire simulation first and then read in the results.