Skip to content

Commit

Permalink
Change THCM to initialise from const parameterlists.
Browse files Browse the repository at this point in the history
  • Loading branch information
Merijn Verstraaten committed Oct 29, 2019
1 parent 6056070 commit 611afa5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/ocean/Ocean.C
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Ocean::Ocean(RCP<Epetra_Comm> Comm, ParameterList oceanParamList)
// THCM is implemented as a Singleton, which allows only a single
// instance at a time. The Ocean class can access THCM with a call
// to THCM::Instance()
Teuchos::ParameterList &thcmList =
const Teuchos::ParameterList &thcmList =
oceanParamList->sublist("THCM");

thcm_ = rcp(new THCM(thcmList, comm_));
Expand Down Expand Up @@ -128,7 +128,7 @@ Ocean::Ocean(RCP<Epetra_Comm> Comm, ParameterList oceanParamList)
grid_ = rcp(new OceanGrid(domain_));

// Read starting parameters from xml
Teuchos::ParameterList& startList =
const Teuchos::ParameterList& startList =
thcmList.sublist("Starting Parameters");
THCM::Instance().ReadParameters(startList);

Expand Down
9 changes: 4 additions & 5 deletions src/ocean/THCM.C
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ extern "C" {

//=============================================================================
// constructor
THCM::THCM(Teuchos::ParameterList& params, Teuchos::RCP<Epetra_Comm> comm) :
THCM::THCM(const Teuchos::ParameterList& params, Teuchos::RCP<Epetra_Comm> comm) :
Singleton<THCM>(Teuchos::rcp(this, false)),
Comm(comm),
nullSpace(Teuchos::null),
Expand Down Expand Up @@ -1891,17 +1891,16 @@ void THCM::printTiming(std::ostream& os)
}

//=============================================================================
void THCM::ReadParameters(Teuchos::ParameterList& plist)
void THCM::ReadParameters(const Teuchos::ParameterList& plist)
{
double val;
std::string label;
try {
for (int i=0; i<= _NPAR_ + _NPAR_TRILI; i++)
{
label = int2par(i);
if (plist.isParameter(label))
{
val = plist.get(label,defaultParameter(label));
if (plist.isParameter(label)) {
val = plist.get<double>(label);
this->setParameter(label,val);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/ocean/THCM.H
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public:
};

//! Constructor
THCM(Teuchos::ParameterList& params, Teuchos::RCP<Epetra_Comm> comm);
THCM(const Teuchos::ParameterList& params, Teuchos::RCP<Epetra_Comm> comm);

//! Destructor

Expand Down Expand Up @@ -364,7 +364,7 @@ public:
std::string const int2par(int ind);

//! read THCM parameters from a ParameterList
void ReadParameters(Teuchos::ParameterList& plist);
void ReadParameters(const Teuchos::ParameterList& plist);

//! Under non-restoring conditions: get an integral from vec and
//! use that to correct the integral condition
Expand Down

0 comments on commit 611afa5

Please sign in to comment.