Commit f8565a26 authored by Andreas Lauser's avatar Andreas Lauser
Browse files

box problem: convert the newton method and the model attributes from pointers to objects

this was made possible by the two-stage initialization approach introduced
half a year ago

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@4907 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 97f69f0e
......@@ -364,8 +364,7 @@ public:
* model can overload.
*/
void updateSuccessful()
{
};
{ };
/*!
* \brief Called by the update() method if it was
......
......@@ -83,6 +83,7 @@ public:
elementMapper_(gridView),
vertexMapper_(gridView),
timeManager_(&timeManager),
newtonMethod_(asImp_()),
resultWriter_(asImp_().name())
{
// calculate the bounding box of the grid view
......@@ -98,14 +99,10 @@ public:
bboxMin_[i] = gridView.comm().min(bboxMin_[i]);
bboxMax_[i] = gridView.comm().max(bboxMax_[i]);
}
model_ = new Model();
}
~BoxProblem()
{
delete model_;
delete newtonMethod_;
};
/*!
......@@ -119,7 +116,6 @@ public:
{
// set the initial condition of the model
model().init(asImp_());
newtonMethod_ = new NewtonMethod(asImp_());
}
/*!
......@@ -158,7 +154,7 @@ public:
std::cout << "Newton solver did not converge. Retrying with time step of "
<< timeManager().timeStepSize() << "sec\n";
if (model_->update(*newtonMethod_, newtonCtl_))
if (model_.update(newtonMethod_, newtonCtl_))
return;
// update failed
......@@ -174,6 +170,18 @@ public:
<< timeManager().timeStepSize());
}
/*!
* \brief Returns the newton method object
*/
NewtonMethod &newtonMethod()
{ return newtonMethod_; }
/*!
* \copydoc newtonMethod()
*/
const NewtonMethod &newtonMethod() const
{ return newtonMethod_; }
/*!
* \brief Returns the newton contoller object
*/
......@@ -235,7 +243,7 @@ public:
*/
void advanceTimeLevel()
{
model_->advanceTimeLevel();
model_.advanceTimeLevel();
}
/*!
......@@ -325,13 +333,13 @@ public:
* \brief Returns numerical model used for the problem.
*/
Model &model()
{ return *model_; }
{ return model_; }
/*!
* \copydoc model()
*/
const Model &model() const
{ return *model_; }
{ return model_; }
// \}
/*!
......@@ -461,9 +469,9 @@ private:
TimeManager *timeManager_;
Model *model_;
Model model_;
NewtonMethod *newtonMethod_;
NewtonMethod newtonMethod_;
NewtonController newtonCtl_;
VtkMultiWriter resultWriter_;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment