Clone wells object when constructing from existing.

This installs a measure of safety on the part of the interface in that
the caller is free to dispose of the wells object upon returning from
the WellsManager constructor.
This commit is contained in:
Bård Skaflestad 2012-10-04 23:46:20 +02:00
parent 044c13e9fb
commit d6154d8961
2 changed files with 11 additions and 3 deletions

View File

@ -223,8 +223,12 @@ namespace Opm
: w_(0)
{
}
/// Construct from existing wells object.
WellsManager::WellsManager(struct Wells* W)
: w_(W)
: w_(clone_wells(W))
{
}

View File

@ -42,8 +42,12 @@ namespace Opm
public:
/// Default constructor -- no wells.
WellsManager();
/// Construct from mrst type output.
/// Wellmanger is not properly initialized
/// Construct from existing wells object.
/// WellsManager is not properly initialised in the sense that the logic to
/// manage control switching does not exist.
///
/// @param[in] W Existing wells object.
WellsManager(struct Wells* W);
/// Construct from input deck and grid.