Skip to content

Commit

Permalink
Change to initialise from references, rather than Teuchos RCP.
Browse files Browse the repository at this point in the history
  • Loading branch information
Merijn Verstraaten committed Oct 29, 2019
1 parent 611afa5 commit 6ee6a0e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
44 changes: 24 additions & 20 deletions src/ocean/Ocean.C
Original file line number Diff line number Diff line change
Expand Up @@ -52,38 +52,42 @@ extern "C" _SUBROUTINE_(set_seaice_parameters)(SeaIce::CommPars*);

//=====================================================================
// Constructor:
Ocean::Ocean(RCP<Epetra_Comm> Comm, ParameterList oceanParamList)
Ocean::Ocean(RCP<Epetra_Comm> Comm, Model::ParameterList paramListPtr)
: Ocean(Comm, *paramListPtr)
{}

Ocean::Ocean(RCP<Epetra_Comm> Comm, Teuchos::ParameterList& oceanParamList)
:
solverInitialized_ (false), // Solver needs initialization
precInitialized_ (false), // Preconditioner needs initialization
recompPreconditioner_ (true), // We need a preconditioner to start with
recompMassMat_ (true), // We need a mass matrix to start with

loadSalinityFlux_ (oceanParamList->get("Load salinity flux", false)),
saveSalinityFlux_ (oceanParamList->get("Save salinity flux", true)),
loadTemperatureFlux_ (oceanParamList->get("Load temperature flux", false)),
saveTemperatureFlux_ (oceanParamList->get("Save temperature flux", true)),
loadSalinityFlux_ (oceanParamList.get("Load salinity flux", false)),
saveSalinityFlux_ (oceanParamList.get("Save salinity flux", true)),
loadTemperatureFlux_ (oceanParamList.get("Load temperature flux", false)),
saveTemperatureFlux_ (oceanParamList.get("Save temperature flux", true)),

useFort3_ (oceanParamList->get("Use legacy fort.3 output", false)),
useFort44_ (oceanParamList->get("Use legacy fort.44 output", true)),
saveColumnIntegral_ (oceanParamList->get("Save column integral", false)),
maxMaskFixes_ (oceanParamList->get("Max mask fixes", 5)),
useFort3_ (oceanParamList.get("Use legacy fort.3 output", false)),
useFort44_ (oceanParamList.get("Use legacy fort.44 output", true)),
saveColumnIntegral_ (oceanParamList.get("Save column integral", false)),
maxMaskFixes_ (oceanParamList.get("Max mask fixes", 5)),

landmaskFile_ (oceanParamList->sublist("THCM").get("Land Mask", "none")),
landmaskFile_ (oceanParamList.sublist("THCM").get("Land Mask", "none")),

analyzeJacobian_ (oceanParamList->get("Analyze Jacobian", true))
analyzeJacobian_ (oceanParamList.get("Analyze Jacobian", true))
{
INFO("Ocean: constructor...");

// inherited input/output datamembers
inputFile_ = oceanParamList->get("Input file", "ocean_input.h5");
outputFile_ = oceanParamList->get("Output file", "ocean_output.h5");
saveMask_ = oceanParamList->get("Save mask", true);
loadMask_ = oceanParamList->get("Load mask", true);
inputFile_ = oceanParamList.get("Input file", "ocean_input.h5");
outputFile_ = oceanParamList.get("Output file", "ocean_output.h5");
saveMask_ = oceanParamList.get("Save mask", true);
loadMask_ = oceanParamList.get("Load mask", true);

loadState_ = oceanParamList->get("Load state", false);
saveState_ = oceanParamList->get("Save state", true);
saveEvery_ = oceanParamList->get("Save frequency", 0);
loadState_ = oceanParamList.get("Load state", false);
saveState_ = oceanParamList.get("Save state", true);
saveEvery_ = oceanParamList.get("Save frequency", 0);

// initialize postprocessing counter
ppCtr_ = 0;
Expand All @@ -96,7 +100,7 @@ Ocean::Ocean(RCP<Epetra_Comm> Comm, ParameterList oceanParamList)
// instance at a time. The Ocean class can access THCM with a call
// to THCM::Instance()
const Teuchos::ParameterList &thcmList =
oceanParamList->sublist("THCM");
oceanParamList.sublist("THCM");

thcm_ = rcp(new THCM(thcmList, comm_));

Expand Down Expand Up @@ -202,7 +206,7 @@ Ocean::Ocean(RCP<Epetra_Comm> Comm, ParameterList oceanParamList)
surfaceSimporter_ =
Teuchos::rcp(new Epetra_Import(*sIndexMap_, state_->Map()));

INFO(*oceanParamList);
INFO(oceanParamList);
INFO("\n");
INFO("Ocean couplings: coupled_T = " << getCoupledT() );
INFO(" coupled_S = " << getCoupledS() );
Expand Down
4 changes: 2 additions & 2 deletions src/ocean/Ocean.H
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ protected:

public:
//! constructor
Ocean(Teuchos::RCP<Epetra_Comm> Comm,
ParameterList oceanParamList);
Ocean(Teuchos::RCP<Epetra_Comm> Comm, Model::ParameterList oceanParamList);
Ocean(Teuchos::RCP<Epetra_Comm> Comm, Teuchos::ParameterList& oceanParamList);

//! destructor
~Ocean();
Expand Down

0 comments on commit 6ee6a0e

Please sign in to comment.