Skip to content

Commit

Permalink
use OPENSIM_ASSERT instead of SimTK_ASSERT
Browse files Browse the repository at this point in the history
  • Loading branch information
pepbos committed Dec 15, 2023
1 parent 971f018 commit fe280e9
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 22 deletions.
13 changes: 8 additions & 5 deletions OpenSim/Actuators/ActiveForceLengthCurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,24 +153,26 @@ void ActiveForceLengthCurve::setMinValue(double minimumValue)
//==============================================================================
double ActiveForceLengthCurve::calcValue(double normFiberLength) const
{
SimTK_ASSERT(isObjectUpToDateWithProperties(),
OPENSIM_ASSERT(
isObjectUpToDateWithProperties() &&
"ActiveForceLengthCurve: Curve is not up-to-date with its properties");
return m_curve.calcValue(normFiberLength);
}

SmoothSegmentedFunction::ValueAndDerivative ActiveForceLengthCurve::
calcValueAndDerivative(double normFiberLength) const
{
SimTK_ASSERT(
isObjectUpToDateWithProperties(),
OPENSIM_ASSERT(
isObjectUpToDateWithProperties() &&
"ActiveForceLengthCurve: Curve is not up-to-date with its properties");
return m_curve.calcValueAndFirstDerivative(normFiberLength);
}

double ActiveForceLengthCurve::calcDerivative(double normFiberLength,
int order) const
{
SimTK_ASSERT(isObjectUpToDateWithProperties(),
OPENSIM_ASSERT(
isObjectUpToDateWithProperties() &&
"ActiveForceLengthCurve: Curve is not up-to-date with its properties");
SimTK_ERRCHK1_ALWAYS(order >= 0 && order <= 2,
"ActiveForceLengthCurve::calcDerivative",
Expand All @@ -188,7 +190,8 @@ double ActiveForceLengthCurve::

SimTK::Vec2 ActiveForceLengthCurve::getCurveDomain() const
{
SimTK_ASSERT(isObjectUpToDateWithProperties(),
OPENSIM_ASSERT(
isObjectUpToDateWithProperties() &&
"ActiveForceLengthCurve: Curve is not up-to-date with its properties");

return m_curve.getCurveDomain();
Expand Down
16 changes: 10 additions & 6 deletions OpenSim/Actuators/FiberForceLengthCurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,24 +214,26 @@ void FiberForceLengthCurve::setOptionalProperties(double aStiffnessAtLowForce,
//==============================================================================
double FiberForceLengthCurve::calcValue(double normFiberLength) const
{
SimTK_ASSERT(isObjectUpToDateWithProperties(),
OPENSIM_ASSERT(
isObjectUpToDateWithProperties() &&
"FiberForceLengthCurve: Curve is not up-to-date with its properties");
return m_curve.calcValue(normFiberLength);
}

SmoothSegmentedFunction::ValueAndDerivative FiberForceLengthCurve::
calcValueAndDerivative(double normFiberLength) const
{
SimTK_ASSERT(
isObjectUpToDateWithProperties(),
OPENSIM_ASSERT(
isObjectUpToDateWithProperties() &&
"FiberForceLengthCurve: Curve is not up-to-date with its properties");
return m_curve.calcValueAndFirstDerivative(normFiberLength);
}

double FiberForceLengthCurve::calcDerivative(double normFiberLength,
int order) const
{
SimTK_ASSERT(isObjectUpToDateWithProperties(),
OPENSIM_ASSERT(
isObjectUpToDateWithProperties() &&
"FiberForceLengthCurve: Curve is not up-to-date with its properties");
SimTK_ERRCHK1_ALWAYS(order >= 0 && order <= 2,
"FiberForceLengthCurve::calcDerivative",
Expand All @@ -249,7 +251,8 @@ double FiberForceLengthCurve::

double FiberForceLengthCurve::calcIntegral(double normFiberLength) const
{
SimTK_ASSERT(isObjectUpToDateWithProperties(),
OPENSIM_ASSERT(
isObjectUpToDateWithProperties() &&
"FiberForceLengthCurve: Curve is not up-to-date with its properties");

if(!m_curve.isIntegralAvailable()) {
Expand All @@ -263,7 +266,8 @@ double FiberForceLengthCurve::calcIntegral(double normFiberLength) const

SimTK::Vec2 FiberForceLengthCurve::getCurveDomain() const
{
SimTK_ASSERT(isObjectUpToDateWithProperties(),
OPENSIM_ASSERT(
isObjectUpToDateWithProperties() &&
"FiberForceLengthCurve: Curve is not up-to-date with its properties");
return m_curve.getCurveDomain();
}
Expand Down
13 changes: 8 additions & 5 deletions OpenSim/Actuators/ForceVelocityCurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,24 +171,26 @@ void ForceVelocityCurve::setEccentricCurviness(double aEccentricCurviness)
//==============================================================================
double ForceVelocityCurve::calcValue(double normFiberVelocity) const
{
SimTK_ASSERT(isObjectUpToDateWithProperties(),
OPENSIM_ASSERT(
isObjectUpToDateWithProperties() &&
"ForceVelocityCurve: Curve is not up-to-date with its properties");
return m_curve.calcValue(normFiberVelocity);
}

SmoothSegmentedFunction::ValueAndDerivative ForceVelocityCurve::
calcValueAndDerivative(double normFiberVelocity) const
{
SimTK_ASSERT(
isObjectUpToDateWithProperties(),
OPENSIM_ASSERT(
isObjectUpToDateWithProperties() &&
"ForceVelocityCurve: Curve is not up-to-date with its properties");
return m_curve.calcValueAndFirstDerivative(normFiberVelocity);
}

double ForceVelocityCurve::calcDerivative(double normFiberVelocity,
int order) const
{
SimTK_ASSERT(isObjectUpToDateWithProperties(),
OPENSIM_ASSERT(
isObjectUpToDateWithProperties() &&
"ForceVelocityCurve: Curve is not up-to-date with its properties");
SimTK_ERRCHK1_ALWAYS(order >= 0 && order <= 2,
"ForceVelocityCurve::calcDerivative",
Expand All @@ -206,7 +208,8 @@ double ForceVelocityCurve::

SimTK::Vec2 ForceVelocityCurve::getCurveDomain() const
{
SimTK_ASSERT(isObjectUpToDateWithProperties(),
OPENSIM_ASSERT(
isObjectUpToDateWithProperties() &&
"ForceVelocityCurve: Curve is not up-to-date with its properties");
return m_curve.getCurveDomain();
}
Expand Down
16 changes: 10 additions & 6 deletions OpenSim/Actuators/TendonForceLengthCurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,24 +218,26 @@ SimTK::Function* TendonForceLengthCurve::createSimTKFunction() const
//==============================================================================
double TendonForceLengthCurve::calcValue(double aNormLength) const
{
SimTK_ASSERT(isObjectUpToDateWithProperties(),
OPENSIM_ASSERT(
isObjectUpToDateWithProperties() &&
"TendonForceLengthCurve: Tendon is not up-to-date with its properties");
return m_curve.calcValue(aNormLength);
}

SmoothSegmentedFunction::ValueAndDerivative TendonForceLengthCurve::
calcValueAndDerivative(double aNormLength) const
{
SimTK_ASSERT(
isObjectUpToDateWithProperties(),
OPENSIM_ASSERT(
isObjectUpToDateWithProperties() &&
"TendonForceLengthCurve: Tendon is not up-to-date with its properties");
return m_curve.calcValueAndFirstDerivative(aNormLength);
}

double TendonForceLengthCurve::calcDerivative(double aNormLength,
int order) const
{
SimTK_ASSERT(isObjectUpToDateWithProperties(),
OPENSIM_ASSERT(
isObjectUpToDateWithProperties() &&
"TendonForceLengthCurve: Tendon is not up-to-date with its properties");
SimTK_ERRCHK1_ALWAYS(order >= 0 && order <= 2,
"TendonForceLengthCurve::calcDerivative",
Expand All @@ -253,7 +255,8 @@ double TendonForceLengthCurve::

double TendonForceLengthCurve::calcIntegral(double aNormLength) const
{
SimTK_ASSERT(isObjectUpToDateWithProperties(),
OPENSIM_ASSERT(
isObjectUpToDateWithProperties() &&
"TendonForceLengthCurve: Tendon is not up-to-date with its properties");

if (!m_curve.isIntegralAvailable()) {
Expand All @@ -267,7 +270,8 @@ double TendonForceLengthCurve::calcIntegral(double aNormLength) const

SimTK::Vec2 TendonForceLengthCurve::getCurveDomain() const
{
SimTK_ASSERT(isObjectUpToDateWithProperties(),
OPENSIM_ASSERT(
isObjectUpToDateWithProperties() &&
"TendonForceLengthCurve: Tendon is not up-to-date with its properties");
return m_curve.getCurveDomain();
}
Expand Down

0 comments on commit fe280e9

Please sign in to comment.