Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class StatesDocument #3902

Merged
merged 61 commits into from
Oct 18, 2024
Merged

Class StatesDocument #3902

merged 61 commits into from
Oct 18, 2024

Commits on May 27, 2024

  1. Added class StatesDocument

    fcanderson committed May 27, 2024
    Configuration menu
    Copy the full SHA
    6789e7f View commit details
    Browse the repository at this point in the history
  2. Update StatesDocument.cpp

    - Modified the names of the Trajectory methods to match the latest names in Component.h.
    - Reintroduced the precision argument in SimTK::Xml::Elment::setValueAs<T>.
    fcanderson committed May 27, 2024
    Configuration menu
    Copy the full SHA
    03b15d9 View commit details
    Browse the repository at this point in the history

Commits on May 28, 2024

  1. Create testStatesDocument.cpp

    Added a place holder for the Catch2 unit test for class StatesDocument.
    
    testStatesDocument.cpp is now being incorporated in the build, and the test case runs when "build" executed on the target "RUN_TESTS_PARALLEL".
    fcanderson committed May 28, 2024
    Configuration menu
    Copy the full SHA
    cc9954f View commit details
    Browse the repository at this point in the history

Commits on May 29, 2024

  1. Update StatesDocument.cpp

    - Moved all utility methods into a struct with local linkage.
    - Streamlined code by adding `getEltValue()`. Use of this method reduced some code repetition.
    fcanderson committed May 29, 2024
    Configuration menu
    Copy the full SHA
    21b1c81 View commit details
    Browse the repository at this point in the history
  2. Update StatesDocument.cpp

    - Minor changes to line formatting.
    fcanderson committed May 29, 2024
    Configuration menu
    Copy the full SHA
    bb99e94 View commit details
    Browse the repository at this point in the history

Commits on May 30, 2024

  1. Update testComponentInterface.cpp

    - Minor corrections/additions to comments
    fcanderson committed May 30, 2024
    Configuration menu
    Copy the full SHA
    0538766 View commit details
    Browse the repository at this point in the history
  2. Update testStatesDocument.cpp

    - Added code borrowed from testComponentInterface.cpp to generate a dummy model with a variety of states.
    
    The code compiles and runs with all test cases passing, but this is just a starting point. De/serialization using class StatesDocument is not yet being tested.
    fcanderson committed May 30, 2024
    Configuration menu
    Copy the full SHA
    b799c0b View commit details
    Browse the repository at this point in the history
  3. Update testStatesDocument.cpp

    - Removed code borrowed from testComponentInterface.cpp. That code was not the way to go. A legitimate model is needed.
    
    I'm starting over.
    fcanderson committed May 30, 2024
    Configuration menu
    Copy the full SHA
    03a6229 View commit details
    Browse the repository at this point in the history

Commits on May 31, 2024

  1. Update StatesDocument.h

    - Made small improvements and corrections in the documentation.
    fcanderson committed May 31, 2024
    Configuration menu
    Copy the full SHA
    368f123 View commit details
    Browse the repository at this point in the history
  2. Update testStatesDocument.cpp

    - Now building a simple model and running a simulation.
    fcanderson committed May 31, 2024
    Configuration menu
    Copy the full SHA
    9585d98 View commit details
    Browse the repository at this point in the history
  3. Update testStatesDocument.cpp

    - Added code to serialize, deserialize, and then re-serialize the state trajectory recorded during a simulation.
    
    The code is functioning as expected!
    fcanderson committed May 31, 2024
    Configuration menu
    Copy the full SHA
    7a76982 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    3cf98fa View commit details
    Browse the repository at this point in the history
  5. Update StatesTrajectory.h

    - Changed member variable `m_states` from type std::vector<SimTK::State> to SimTK::Array_<SimTK::State>
    - Added `exportToStatesDocument()`
    fcanderson committed May 31, 2024
    Configuration menu
    Copy the full SHA
    842cca6 View commit details
    Browse the repository at this point in the history

Commits on Jun 1, 2024

  1. Update StatesTrajectory.h

    - Added a `get` method that provides access to the underlying SimTK::Array_<SimTK::State> member variable.
    fcanderson committed Jun 1, 2024
    Configuration menu
    Copy the full SHA
    21699ed View commit details
    Browse the repository at this point in the history
  2. Update testStatesDocument.cpp

    - Added a method that tests equality of 2 state trajectories.
    
    The method does not yet test equality for discrete variables or modeling options, but Qs, Us, and Zs are passing.
    fcanderson committed Jun 1, 2024
    Configuration menu
    Copy the full SHA
    dd18f4c View commit details
    Browse the repository at this point in the history

Commits on Jun 2, 2024

  1. Update testStatesDocument.cpp

    - Added a static method that computes maximum rounding error based on the specified precision and value that is rounded.
    fcanderson committed Jun 2, 2024
    Configuration menu
    Copy the full SHA
    651ffb9 View commit details
    Browse the repository at this point in the history

Commits on Jun 3, 2024

  1. Update testStatesDocument.cpp

    - Cleaned up the computation of max_eps.
    fcanderson committed Jun 3, 2024
    Configuration menu
    Copy the full SHA
    82a8b21 View commit details
    Browse the repository at this point in the history

Commits on Jun 6, 2024

  1. Update testStatesDocument.cpp

    - Added equality comparisons for discrete variables and modeling options.
    fcanderson committed Jun 6, 2024
    Configuration menu
    Copy the full SHA
    b71cfa5 View commit details
    Browse the repository at this point in the history

Commits on Jun 11, 2024

  1. Update testStatesDocument.cpp

    - Added ExtendedPointToPointSpring.
    fcanderson committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    902d8f2 View commit details
    Browse the repository at this point in the history

Commits on Jun 26, 2024

  1. Configuration menu
    Copy the full SHA
    7851634 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a5f7cdc View commit details
    Browse the repository at this point in the history
  3. Altered testBoundsCheck()

    Since the trajectory was changed from std::vector<State> to SimTK::Array_<State>, bounds checking behavior has changed.
    
    SimTK::Array_<T> only checks bounds in DEBUG. In other words, an IndexOutOfRange exception will not be thrown in a release build. To account for this, I inserted an #ifdef to skip bounds checking unless in DEBUG.
    fcanderson committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    15bc707 View commit details
    Browse the repository at this point in the history

Commits on Jun 27, 2024

  1. Configuration menu
    Copy the full SHA
    2233470 View commit details
    Browse the repository at this point in the history
  2. Added discrete variables to the test model.

    Added the following types:
    - bool
    - int
    - double
    - Vec2
    - Vec3
    - Vec4
    - Vec5
    - Vec6
    
    All tests are passing, and the .ostates file looks right.
    fcanderson committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    aa45b9d View commit details
    Browse the repository at this point in the history

Commits on Jul 1, 2024

  1. Revamped ExtendedPointToPointSpring

    So that discrete variables can be updated during a simulation, class ExtendedPointToPointSpring is now built on top of class ExtendedTwoPointLinearSpring. ExtendedTwoPointLinearSpring allocates auto-update discrete variables in its own `realizeTopology()` and those discrete variables are updated in its own `realizePosition()`.
    fcanderson committed Jul 1, 2024
    Configuration menu
    Copy the full SHA
    850e1c5 View commit details
    Browse the repository at this point in the history
  2. Reverted to a simpler ExtendedPointToPointSpring class.

    The discrete variables can be added in extendRealizeTopology().
    And, they can be changed in computeForce().
    fcanderson committed Jul 1, 2024
    Configuration menu
    Copy the full SHA
    820c04c View commit details
    Browse the repository at this point in the history

Commits on Jul 2, 2024

  1. Discrete variables are now being altered during simulation

    - Changed the allocation for discrete variables to the DefaultSystemSubsystem.
    - Primarily using the subsystem index instead of the pointer to the subsystem.
    - Discrete variables are being changed during simulation in ExtendedPointToPointSpring::computeForce().
    
    All checks are now passing!
    fcanderson committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    9e0424f View commit details
    Browse the repository at this point in the history

Commits on Jul 7, 2024

  1. Added ability to set a note for a states document.

    The note is serialized and deserialized.
    
    All checks are passing.
    fcanderson committed Jul 7, 2024
    Configuration menu
    Copy the full SHA
    a60bf8d View commit details
    Browse the repository at this point in the history

Commits on Aug 28, 2024

  1. Configuration menu
    Copy the full SHA
    8bf1166 View commit details
    Browse the repository at this point in the history

Commits on Aug 30, 2024

  1. Update testStatesDocument.cpp

    1. Now looping over over output precision from precision = 2 to precision = 22.
    2. Added the ability to change the name of a discrete state for the purpose of testing exceptions when a discrete state is not found.
    fcanderson committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    493d73d View commit details
    Browse the repository at this point in the history

Commits on Aug 31, 2024

  1. Update testStatesDocument.cpp

    - Cleaned up the code a little bit.
    - Added code to deserialize with a model that has one discrete variable with a changed name. This was done to check exception handling.
    fcanderson committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    1489842 View commit details
    Browse the repository at this point in the history

Commits on Sep 1, 2024

  1. Configuration menu
    Copy the full SHA
    467d910 View commit details
    Browse the repository at this point in the history
  2. Update testStatesDocument.cpp

    Cleaned up the code.
    
    The following checks are now performed:
    - Serialization / deserialization for precision 1 to 21.
    - Check that exception is thrown when model names don't match.
    - Check that exception is thrown when a discrete state is not found.
    fcanderson committed Sep 1, 2024
    Configuration menu
    Copy the full SHA
    a7eb16b View commit details
    Browse the repository at this point in the history

Commits on Sep 2, 2024

  1. Update testStatesDocument.cpp

    - code cleanup
    - added the ability to omit a discrete state
    
    When a discrete state is omitted, an exception should be thrown but it is not.  Need to look into this.
    
    Previous checks are still running properly.
    fcanderson committed Sep 2, 2024
    Configuration menu
    Copy the full SHA
    bc46144 View commit details
    Browse the repository at this point in the history

Commits on Sep 4, 2024

  1. All checks passing.

    fcanderson committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    231e27d View commit details
    Browse the repository at this point in the history
  2. Removed old code

    fcanderson committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    c8e9133 View commit details
    Browse the repository at this point in the history
  3. Added read-only accessor for low-level state array

    const SimTK::Array_<SimTK::State>& StatesTrajectoryReporter::getStateArray();
    fcanderson committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    8677256 View commit details
    Browse the repository at this point in the history
  4. Code cleanup and refinement

    - Removed StatesDocument::parseDoc().  No reason to have it.
    - Simplified the name of StatesTrajectory::getUnderlyingStateArray() to getStateArray().
    - Refined documentation comments and checked them for accuracy.
    fcanderson committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    3c87d77 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    d5f5341 View commit details
    Browse the repository at this point in the history
  6. Minor code cleanup

    - Deleted unused code.
    - Updated copyright dates.
    fcanderson committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    439db74 View commit details
    Browse the repository at this point in the history
  7. Update StatesTrajectory.h

    - Improved documentation comments.
    fcanderson committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    7c2b595 View commit details
    Browse the repository at this point in the history
  8. Fixed typo in StatesDocument.h

    An error was being issued for Ubuntu and Mac builds because "OPENSIM_STATES_DOCUMENT_H_" was not commented out on line 609. I added the comment token.
    fcanderson committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    4f994e0 View commit details
    Browse the repository at this point in the history
  9. Corrected some type compatibilities in StatesDocument.cpp

    In a number of instances, I changed the type from `int` to `size_t`.
    fcanderson committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    054908b View commit details
    Browse the repository at this point in the history
  10. Using std::string::c_str() for strings in SimTK_ASSERT macros

    Windows can handle a std::string, but Mac and Ubuntu builds are failing.
    fcanderson committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    12d7f09 View commit details
    Browse the repository at this point in the history
  11. Update testStatesDocument.cpp

    - Addressed some type warnings.
    - Removed the method `ComputeMaxRoundingError()`.
    fcanderson committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    4ce36dd View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    5c2ba5f View commit details
    Browse the repository at this point in the history

Commits on Sep 25, 2024

  1. Update StatesDocument.h

    I temporarily added a default constructor to see if that would resolve some errors that are occurring in the Continuous Integration.
    fcanderson committed Sep 25, 2024
    Configuration menu
    Copy the full SHA
    f6662d6 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    354f81e View commit details
    Browse the repository at this point in the history
  3. Update testStatesDocument.cpp

    It looks like different return types of size() methods are assumed across operating systems. I inserted a (size_t) cast to address compiler errors on Ubuntu
    fcanderson committed Sep 25, 2024
    Configuration menu
    Copy the full SHA
    e2a2337 View commit details
    Browse the repository at this point in the history

Commits on Sep 30, 2024

  1. Configuration menu
    Copy the full SHA
    eb534f3 View commit details
    Browse the repository at this point in the history

Commits on Oct 11, 2024

  1. Configuration menu
    Copy the full SHA
    0544275 View commit details
    Browse the repository at this point in the history

Commits on Oct 12, 2024

  1. Reverted StatesTrajectory to use std::vector(SimTK::State)

    For reasons of performance and compatibility with Simbody, OpenSim::StatesDocument uses SimTK::Array_<>, instead of std::vector<>, as the container for states trajectories.
    
    However, some user-facing classes, like OpenSim::StatesTrajectory, have opted to use std::vector<> as the container. I migrated OpenSim::StatesTrajectory to use SimTK::Array_<>. Unfortunately, this caused errors when bindings for Python and perhaps Java and Matlab are generated.
    
    To maintain compatibility with existing code and simplify binding generation, this commit reverts to using std::vector as the container for state trajectories.
    
    In addition, several new interface methods were introduced to the StatesDocument API to allow either SimTK::Array_<> or std::vector<> to be used as the container. Internally, however, all state trajectory operations are mediated by SimTK::Array_<>. This flexibility is gained at almost no computational cost by using a shallow copy constructor to convert std::vector<State> objects to SimTK::Array_<State> objects.
    fcanderson committed Oct 12, 2024
    Configuration menu
    Copy the full SHA
    bd764f6 View commit details
    Browse the repository at this point in the history
  2. Update StatesDocument.cpp

    Now settings for `note` and `precision` are updated in the body of the constructor instead of in the initializer list.
    fcanderson committed Oct 12, 2024
    Configuration menu
    Copy the full SHA
    a09c2b3 View commit details
    Browse the repository at this point in the history

Commits on Oct 13, 2024

  1. Configuration menu
    Copy the full SHA
    998e5ad View commit details
    Browse the repository at this point in the history

Commits on Oct 14, 2024

  1. typo corrected

    fcanderson committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    4206e24 View commit details
    Browse the repository at this point in the history
  2. Update StatesDocument.h

    Updated the documentation to reflect the fact that std::vector<SimTK::State> is also an acceptable form of the state trajectory for interfacing with OpenSim.
    fcanderson committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    515d333 View commit details
    Browse the repository at this point in the history
  3. Update StatesTrajectoryReporter.cpp

    Migrated StatesTrajectoryReporter::getStateArray() to getVectorOfStateObjects()
    fcanderson committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    32009c2 View commit details
    Browse the repository at this point in the history
  4. Update StatesTrajectoryReporter.h

    Migrated StatesTrajectoryReporter::getStateArray() to getVectorOfStateObjects().
    fcanderson committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    fa570c9 View commit details
    Browse the repository at this point in the history
  5. Update StatesDocument.cpp

    I added comments for developers should a demand additional supported variable types emerge.
    fcanderson committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    d093cb1 View commit details
    Browse the repository at this point in the history
  6. Update testStatesDocument.cpp

    Corrected a compile error.
    fcanderson committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    aba49bc View commit details
    Browse the repository at this point in the history

Commits on Oct 18, 2024

  1. Configuration menu
    Copy the full SHA
    8501fdd View commit details
    Browse the repository at this point in the history