A list for the developers of CellML tools

Text archives Help


[cellml-dev] r2499 - in CellML_DOM_API/trunk: CIS/sources interfaces


Chronological Thread 
  • From: ak.miller at auckland.ac.nz (Andrew Miller)
  • Subject: [cellml-dev] r2499 - in CellML_DOM_API/trunk: CIS/sources interfaces
  • Date: Mon, 28 Jul 2008 13:43:13 +1200

CellML Automated Notifications wrote:
> Author: jmar150
> Date: 2008-07-28 12:43:07 +1200 (Mon, 28 Jul 2008)
> New Revision: 2499
>
> Modified:
> CellML_DOM_API/trunk/CIS/sources/CISImplementation.cxx
> CellML_DOM_API/trunk/CIS/sources/CISImplementation.hxx
> CellML_DOM_API/trunk/CIS/sources/CISSolve.cxx
> CellML_DOM_API/trunk/interfaces/CIS.idl
> Log:
> First cut of solution to Tracker Item 31; this allows a tabulation step
> size to
> be specified, and will produce results at those points. Note that the
> interface
> to CIS was changed.
>

Hi all,

One potential problem with the code as implemented (which I'm not yet
entirely sure of the best way to fix) is that it is comparing floating
point numbers for equality, which I believe will often not work out
exactly with the numerical integrator codes due to finite precision,
except in cases where the numbers can be represented exactly.

One option might be to allow time values which are within tolerance of
the requested one through instead of a strict equality test.

Best regards,
Andrew

>
> Modified: CellML_DOM_API/trunk/CIS/sources/CISImplementation.cxx
> ===================================================================
> --- CellML_DOM_API/trunk/CIS/sources/CISImplementation.cxx 2008-07-25
> 05:00:57 UTC (rev 2498)
> +++ CellML_DOM_API/trunk/CIS/sources/CISImplementation.cxx 2008-07-28
> 00:43:07 UTC (rev 2499)
> @@ -248,7 +248,7 @@
> mStepType(iface::cellml_services::RUNGE_KUTTA_FEHLBERG_4_5),
> mEpsAbs(1E-6), mEpsRel(1E-6), mScalVar(1.0), mScalRate(0.0),
> mStepSizeMax(1.0), mStartBvar(0.0), mStopBvar(10.0),
> mMaxPointDensity(10000.0),
> - mObserver(NULL), mCancelIntegration(false)
> + mTabStepSize(0.0), mObserver(NULL), mCancelIntegration(false),
> mStrictTab(false)
> {
> mModel = dynamic_cast<CDA_CellMLCompiledModel*>(aModel);
> if (mModel == NULL)
> @@ -298,6 +298,17 @@
> }
>
> void
> +CDA_CellMLIntegrationRun::setTabulationStepControl
> +(
> + double tabStepSize, bool strictTab
> +)
> + throw (std::exception&)
> +{
> + mTabStepSize = tabStepSize;
> + mStrictTab = strictTab;
> +}
> +
> +void
> CDA_CellMLIntegrationRun::setResultRange
> (
> double startBvar, double stopBvar, double maxPointDensity
>
> Modified: CellML_DOM_API/trunk/CIS/sources/CISImplementation.hxx
> ===================================================================
> --- CellML_DOM_API/trunk/CIS/sources/CISImplementation.hxx 2008-07-25
> 05:00:57 UTC (rev 2498)
> +++ CellML_DOM_API/trunk/CIS/sources/CISImplementation.hxx 2008-07-28
> 00:43:07 UTC (rev 2499)
> @@ -80,6 +80,8 @@
>
> void setStepSizeControl(double epsAbs, double epsRel, double scalVar,
> double scalRate, double maxStep) throw
> (std::exception&);
> + void setTabulationStepControl(double tabStepSize, bool strictTab)
> + throw (std::exception&);
> void setResultRange(double startBvar, double stopBvar, double
> incrementBvar)
> throw (std::exception&);
> void
> setProgressObserver(iface::cellml_services::IntegrationProgressObserver*
> @@ -108,11 +110,12 @@
> CDA_CellMLCompiledModel* mModel;
> iface::cellml_services::IntegrationStepType mStepType;
> double mEpsAbs, mEpsRel, mScalVar, mScalRate, mStepSizeMax;
> - double mStartBvar, mStopBvar, mMaxPointDensity;
> + double mStartBvar, mStopBvar, mMaxPointDensity, mTabStepSize;
> iface::cellml_services::IntegrationProgressObserver* mObserver;
> typedef std::list<std::pair<uint32_t,double> > OverrideList;
> OverrideList mConstantOverrides, mIVOverrides;
> volatile bool mCancelIntegration;
> + bool mStrictTab;
> };
>
> class CDA_CellMLIntegrationService
>
> Modified: CellML_DOM_API/trunk/CIS/sources/CISSolve.cxx
> ===================================================================
> --- CellML_DOM_API/trunk/CIS/sources/CISSolve.cxx 2008-07-25 05:00:57
> UTC (rev 2498)
> +++ CellML_DOM_API/trunk/CIS/sources/CISSolve.cxx 2008-07-28 00:43:07
> UTC (rev 2499)
> @@ -230,12 +230,18 @@
> bool isFirst = true;
>
> double minReportForDensity = (mStopBvar - mStartBvar) / mMaxPointDensity;
> + double nextStopPoint = mTabStepSize + voi;
> + if (mTabStepSize == 0.0)
> + nextStopPoint = mStopBvar;
>
> while (voi < mStopBvar)
> {
> double bhl = mStopBvar;
> if (bhl - voi > mStepSizeMax)
> bhl = voi + mStepSizeMax;
> + if(bhl > nextStopPoint)
> + bhl = nextStopPoint;
> +
> gsl_odeiv_evolve_apply(e, c, s, &sys, &voi, bhl,
> &stepSize, states);
>
> @@ -244,9 +250,14 @@
>
> if (isFirst)
> isFirst = false;
> - else if (voi - lastVOI < minReportForDensity)
> + else if (voi - lastVOI < minReportForDensity && !(voi==nextStopPoint))
> continue;
> + else if(mStrictTab && voi!=nextStopPoint)
> + continue;
>
> + if (voi==nextStopPoint)
> + nextStopPoint += mTabStepSize;
> +
> lastVOI = voi;
>
> // Compute the extra variables that are only computed for display
> @@ -338,12 +349,18 @@
> bool isFirst = true;
>
> double minReportForDensity = (mStopBvar - mStartBvar) / mMaxPointDensity;
> + double nextStopPoint = mTabStepSize + voi;
> + if (mTabStepSize == 0.0)
> + nextStopPoint = mStopBvar;
>
> while (voi < mStopBvar)
> {
> double bhl = mStopBvar;
> if (bhl - voi > mStepSizeMax)
> bhl = voi + mStepSizeMax;
> + if(bhl > nextStopPoint)
> + bhl = nextStopPoint;
> +
> CVodeSetStopTime(solver, bhl);
> CVode(solver, bhl, y, &voi, CV_ONE_STEP_TSTOP);
>
> @@ -352,9 +369,14 @@
>
> if (isFirst)
> isFirst = false;
> - else if (voi - lastVOI < minReportForDensity)
> + else if (voi - lastVOI < minReportForDensity && !(voi==nextStopPoint))
> continue;
> + else if(mStrictTab && voi!=nextStopPoint)
> + continue;
>
> + if (voi==nextStopPoint)
> + nextStopPoint += mTabStepSize;
> +
> lastVOI = voi;
>
> f->ComputeVariables(voi, constants, rates, states, algebraic);
>
> Modified: CellML_DOM_API/trunk/interfaces/CIS.idl
> ===================================================================
> --- CellML_DOM_API/trunk/interfaces/CIS.idl 2008-07-25 05:00:57 UTC (rev
> 2498)
> +++ CellML_DOM_API/trunk/interfaces/CIS.idl 2008-07-28 00:43:07 UTC (rev
> 2499)
> @@ -102,6 +102,17 @@
> in double maxStep);
>
> /**
> + * Sets a tabulation interval.
> + * @param tabStepSize The tabulation step size. If set to zero, it
> will be
> + * internally set to the final value of the bound
> + * variable.
> + * @param strict If true, only tabulate at tabulation points.
> Otherwise, at
> + * least ensure that there are data points at the
> tabulation
> + * points.
> + **/
> + void setTabulationStepControl(in double tabStepSize, in boolean
> strictTab);
> +
> + /**
> * Sets the range of results to be returned.
> * @param startBvar The first value of the bound variable.
> * @param stopBvar The final value of the bound variable.
>
> _______________________________________________
> automated-notifications mailing list
> automated-notifications at cellml.org
> http://www.cellml.org/mailman/listinfo/automated-notifications
>





Archive powered by MHonArc 2.6.18.

Top of page