*
*/
/*--------------------------------------------------------------------------*/
+#ifndef __CHECK_ODE_ERROR__
+#define __CHECK_ODE_ERROR__
+
+#include <string>
#include "dynlib_differential_equations.h"
DIFFERENTIAL_EQUATIONS_IMPEXP int checkOdeError(int meth, int istate);
-DIFFERENTIAL_EQUATIONS_IMPEXP int checkDasslError(int idid);
+DIFFERENTIAL_EQUATIONS_IMPEXP int checkError(int idid, std::string strName);
+
+#endif // __CHECK_ODE_ERROR__
#include "callable.hxx"
#include "differentialequationfunctions.hxx"
#include "runvisitor.hxx"
+#include "checkodeerror.hxx"
extern "C"
{
#include "sciprint.h"
#include "scifunctions.h"
#include "elem_common.h"
-#include "checkodeerror.h"
}
/*--------------------------------------------------------------------------*/
if (pDblTemp->getSize() == 0)
{
// maxl and kmp need default values
- maxl = min(5, pDblX0->getSize());
+ maxl = min(5, pDblX0->getRows());
kmp = maxl;
}
else
//compute itol and set the tolerances rtol and atol.
double* rtol = NULL;
double* atol = NULL;
- double rpar[2] = {0, 0};
+ double rpar[2] = {0, 0 };
int ipar[30];
memset(ipar, 0x00, 30 * sizeof(int));
// LENWP is the length ot the rwork segment containing
// the matrix elements of the preconditioner P
- LENWP = 7 * pDblX0->getRows();
+ LENWP = pDblX0->getRows() * pDblX0->getRows();
rworksize += (maxord + 5) * pDblX0->getRows() + 3 * ng
+ (maxl + 3 + min(1, maxl - kmp)) * pDblX0->getRows()
+ (maxl + 3) * maxl + 1 + LENWP;
// LENIWP is the length ot the iwork segment containing
// the matrix indexes of the preconditioner P
// (compressed sparse row format)
- LENIWP = 25 * pDblX0->getRows() + 1;
+ LENIWP = 2 * pDblX0->getRows() * pDblX0->getRows();
iworksize += LENIWP;
}
ipar[3] = 2;
ipar[4] = 1;
rpar[0] = 0.005;
- rpar[1] = 0.005;
+ rpar[1] = 0.05;
}
if (info[15] == 1)
}
// use the same error function that dasrt
- iret = checkDasslError(idid);
+ iret = checkError(idid, "daskr");
if (iret == 1) // error
{
Scierror(999, _("%s: ddaskr return with state %d.\n"), "daskr", ididtmp);
#include "callable.hxx"
#include "differentialequationfunctions.hxx"
#include "runvisitor.hxx"
+#include "checkodeerror.hxx"
extern "C"
{
#include "sciprint.h"
#include "scifunctions.h"
#include "elem_common.h"
-#include "checkodeerror.h"
}
/*--------------------------------------------------------------------------*/
try
{
C2F(ddasrt)(dassl_f, YSize, &t0, pdYData, pdYdotData, &t, info, rtol, atol, &idid, rwork, &rworksize, iwork, &iworksize, &rpar, &ipar, dassl_jac, dasrt_g, &ng, root);
- iret = checkDasslError(idid);
+ iret = checkError(idid, "dasrt");
if (iret == 1) // error
{
Scierror(999, _("%s: ddasrt return with state %d.\n"), "dasrt", idid);
#include "callable.hxx"
#include "differentialequationfunctions.hxx"
#include "runvisitor.hxx"
+#include "checkodeerror.hxx"
extern "C"
{
#include "sciprint.h"
#include "scifunctions.h"
#include "elem_common.h"
-#include "checkodeerror.h"
#include "xerhlt.h"
-
}
/*--------------------------------------------------------------------------*/
{
C2F(dassl)(dassl_f, YSize, &t0, pdYData, pdYdotData, &t, info, rtol, atol, &idid, rwork, &rworksize, iwork, &iworksize, &rpar, &ipar, dassl_jac);
- iret = checkDasslError(idid);
+ iret = checkError(idid, "dassl");
if (iret == 1) // error
{
Scierror(999, _("%s: dassl return with state %d.\n"), "dassl", idid);
#include "callable.hxx"
#include "differentialequationfunctions.hxx"
#include "runvisitor.hxx"
+#include "checkodeerror.hxx"
extern "C"
{
#include "Scierror.h"
#include "scifunctions.h"
#include "elem_common.h"
-#include "checkodeerror.h"
#include "sciprint.h"
#include "common_structure.h"
}
nyh = C2F(ls0001).nyh;
}
- rworkSize = 20 + nyh * (maxord + 1) + 3 * *YSize + *YSize * *YSize + 2;
+ rworkSize = 20 + nyh * (maxord + 1) + 3 * *YSize + *YSize **YSize + 2;
iworkSize = 20 + *YSize;
rwSize = rworkSize + dStructTabSize;
#include "differentialequationfunctions.hxx"
#include "runvisitor.hxx"
#include "context.hxx"
+#include "checkodeerror.hxx"
extern "C"
{
#include "configvariable_interface.h"
#include "sciprint.h"
#include "common_structure.h"
-#include "checkodeerror.h"
#include "sci_malloc.h"
}
/*--------------------------------------------------------------------------*/
#include "differentialequationfunctions.hxx"
#include "runvisitor.hxx"
#include "context.hxx"
+#include "checkodeerror.hxx"
extern "C"
{
#include "sciprint.h"
#include "common_structure.h"
#include "scifunctions.h"
-#include "checkodeerror.h"
}
/*--------------------------------------------------------------------------*/
*/
/*--------------------------------------------------------------------------*/
-extern "C" {
-#include "checkodeerror.h"
+#include "checkodeerror.hxx"
+
+extern "C"
+{
#include "sciprint.h"
#include "localization.h"
#include "configvariable_interface.h"
return 0;
}
-int checkDasslError(int idid)
+int checkError(int idid, std::string strName)
{
switch (idid)
{
//when invalid input is detected.
if (getWarningMode())
{
- sciprint(_("encountered trouble.\n"));
+ sciprint(_("%s encountered trouble.\n"), strName.c_str());
}
return 2;
}
C2F(dcopy)(&m_odeYRows, pDblOutDelta->get(), &one, delta, &one);
*ires = (int)pDblOutIres->get(0);
+
if (out[0]->isDeletable())
{
delete out[0];
}
+
+ if (out[1]->isDeletable())
+ {
+ delete out[1];
+ }
}
void DifferentialEquationFunctions::callDasslMacroJac(double* t, double* y, double* ydot, double* pd, double* cj, double* rpar, int* ipar)
}
out[0]->IncreaseRef();
+ out[1]->IncreaseRef();
+ out[2]->IncreaseRef();
pDblNeq->DecreaseRef();
if (pDblNeq->isDeletable())
ast::ExecVisitor execFunc;
// input arguments psol(R, iR, b)
- types::Double* pDblR = new types::Double(1, *neq **neq);
+ types::Double* pDblR = new types::Double(*neq **neq, 1);
pDblR->set(wp);
pDblR->IncreaseRef();
in.push_back(pDblR);
- types::Double* pDblIR = new types::Double(1, 2 * *neq **neq);
+ types::Double* pDblIR = new types::Double(*neq **neq, 2);
double* pdblIR = pDblIR->get();
for (int i = 0; i < pDblIR->getSize(); i++)
{
pDblIR->IncreaseRef();
in.push_back(pDblIR);
- types::Double* pDblB = new types::Double(1, *neq);
+ types::Double* pDblB = new types::Double(*neq, 1);
pDblB->set(b);
pDblB->IncreaseRef();
in.push_back(pDblB);
}
out[0]->IncreaseRef();
+ out[1]->IncreaseRef();
// free input arguments
pDblR->DecreaseRef();