mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
use finishInit() properly for all problems
this means that all code which could potentially throw an exception is moved to this method(). (In particular FluidSystem::init() proved troublesome in the past.) Besides avoiding segmentation the faults which stem from exceptions thrown in constructors, this also has the advantage that simulations which spend a noticable amount of time to initialize stop at the "correct" place, i.e. after the "Finish init of the problem" message was printed by the simulator...
This commit is contained in:
@@ -163,11 +163,20 @@ class Tutorial1Problem
|
||||
enum { contiNonWettingEqIdx = Indices::conti0EqIdx + nonWettingPhaseIdx };
|
||||
|
||||
public:
|
||||
//! The constructor of the problem
|
||||
//! The constructor of the problem. This only _allocates_ the memory required by the
|
||||
//! problem. The constructor is supposed to _never ever_ throw an exception.
|
||||
Tutorial1Problem(Simulator &simulator)
|
||||
: ParentType(simulator)
|
||||
, eps_(3e-6)
|
||||
{ }
|
||||
|
||||
//! This method initializes the data structures allocated by the problem
|
||||
//! constructor. In contrast to the constructor, exceptions thrown from within this
|
||||
//! method won't lead to segmentation faults.
|
||||
void finishInit()
|
||||
{
|
||||
ParentType::finishInit();
|
||||
|
||||
// Use an isotropic and homogeneous intrinsic permeability
|
||||
K_ = this->toDimMatrix_(1e-7);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user