本文整理汇总了C++中OdeSolution::SetOdeSystemInformation方法的典型用法代码示例。如果您正苦于以下问题:C++ OdeSolution::SetOdeSystemInformation方法的具体用法?C++ OdeSolution::SetOdeSystemInformation怎么用?C++ OdeSolution::SetOdeSystemInformation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OdeSolution
的用法示例。
在下文中一共展示了OdeSolution::SetOdeSystemInformation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Compute
OdeSolution AbstractRushLarsenCardiacCell::Compute(double tStart, double tEnd, double tSamp)
{
// In this method, we iterate over timesteps, doing the following for each:
// - update V using a forward Euler step
// - do as in ComputeExceptVoltage(t) to update the remaining state variables
// using Rush Larsen method or forward Euler as appropriate
// Check length of time interval
if (tSamp < mDt)
{
tSamp = mDt;
}
const unsigned n_steps = (unsigned) floor((tEnd - tStart)/tSamp + 0.5);
assert(fabs(tStart+n_steps*tSamp - tEnd) < 1e-12);
const unsigned n_small_steps = (unsigned) floor(tSamp/mDt+0.5);
assert(fabs(mDt*n_small_steps - tSamp) < 1e-12);
// Initialise solution store
OdeSolution solutions;
solutions.SetNumberOfTimeSteps(n_steps);
solutions.rGetSolutions().push_back(rGetStateVariables());
solutions.rGetTimes().push_back(tStart);
solutions.SetOdeSystemInformation(this->mpSystemInfo);
std::vector<double> dy(mNumberOfStateVariables, 0);
std::vector<double> alpha(mNumberOfStateVariables, 0);
std::vector<double> beta(mNumberOfStateVariables, 0);
// Loop over time
for (unsigned i=0; i<n_steps; i++)
{
double curr_time = tStart;
for (unsigned j=0; j<n_small_steps; j++)
{
curr_time = tStart + i*tSamp + j*mDt;
EvaluateEquations(curr_time, dy, alpha, beta);
UpdateTransmembranePotential(dy);
ComputeOneStepExceptVoltage(dy, alpha, beta);
VerifyStateVariables();
}
// Update solutions
solutions.rGetSolutions().push_back(rGetStateVariables());
solutions.rGetTimes().push_back(curr_time+mDt);
}
return solutions;
}