Skip to content

Commit

Permalink
-added initialization of pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
RuedKamp committed Sep 29, 2015
1 parent ee793f0 commit 6af90d9
Showing 1 changed file with 28 additions and 18 deletions.
46 changes: 28 additions & 18 deletions SimulationRuntime/cpp/Solver/Newton/Newton.cpp
Expand Up @@ -22,25 +22,26 @@
Newton::Newton(IAlgLoop* algLoop, INonLinSolverSettings* settings)
: _algLoop (algLoop)
, _newtonSettings ((INonLinSolverSettings*)settings)
, _y (NULL)
, _yHelp (NULL)
, _fnew (NULL)
, _fold (NULL)
, _f (NULL)
, _ihelpArray (NULL)

, _fHelp (NULL)
, _y (NULL)
, _yHelp (NULL)
, _fnew (NULL)
, _fold (NULL)
, _f (NULL)
, _ihelpArray (NULL)
, _fHelp (NULL)
, _delta_s (NULL)
, _delta_b (NULL)
, _iHelp (NULL)

, _iHelp (NULL)
, _jac (NULL)
, _jacHelpVec1 (NULL)
, _jacHelpVec2 (NULL)
, _jacHelpMat1 (NULL)
, _jacHelpMat2 (NULL)
, _jacHelpVec1 (NULL)
, _jacHelpVec2 (NULL)
, _jacHelpMat1 (NULL)
, _jacHelpMat2 (NULL)
, _work (NULL)
,_zeroVec (NULL)
, _identity (NULL)


, _work (NULL)
/*
, _kluSymbolic (NULL)
, _kluNumeric (NULL)
Expand All @@ -59,7 +60,7 @@ Newton::Newton(IAlgLoop* algLoop, INonLinSolverSettings* settings)
, _dMINUSONE (-1.0)
, _N ('n')
,_T ('t')
, _identity (NULL)

{
_sparse = _algLoop->getUseSparseFormat();
}
Expand All @@ -80,6 +81,12 @@ Newton::~Newton()
if(_jacHelpMat1) delete [] _jacHelpMat1;
if(_jacHelpMat2) delete [] _jacHelpMat2;
if(_work) delete [] _work;
if(_identity) delete [] _identity;
if(_zeroVec) delete [] _zeroVec;
if(_f) delete [] _f;
if(_ihelpArray) delete [] _ihelpArray;


/*
if(_sparse == true)
{
Expand Down Expand Up @@ -141,6 +148,9 @@ void Newton::initialize()
if(_jacHelpMat2) delete [] _jacHelpMat2;
if(_work) delete [] _work;
if(_identity) delete [] _identity;
if(_zeroVec) delete [] _zeroVec;
if(_f) delete [] _f;
if(_ihelpArray) delete [] _ihelpArray;

_y = new double[_dimSys];
_yHelp = new double[_dimSys];
Expand All @@ -162,7 +172,7 @@ void Newton::initialize()

_zeroVec = new double[_dimSys];
_f = new double[_dimSys];
_ihelpArray = new long int[_dimSys];
_ihelpArray = new long int[_dimSys];


_algLoop->getReal(_y);
Expand Down Expand Up @@ -471,7 +481,7 @@ void Newton::solve()
//Stopping Criterion
if( fnorm < _fNormTol)
{
std::cout << totStps << std::endl;
//std::cout << totStps << std::endl;
_iterationStatus = DONE;
break;
}
Expand Down

0 comments on commit 6af90d9

Please sign in to comment.