Commit a3998fde authored by Thomas Witkowski's avatar Thomas Witkowski

Start to change pointer usage to reference usage in AMDiS interface.

parent 709a214e
......@@ -20,16 +20,41 @@ namespace AMDiS {
{
FUNCNAME("AdaptInstationary::AdaptInstationary()");
// MSG("You make use of the obsolete constructor AdaptInstationary::AdaptInstationary(...)!\n");
// MSG("Please use the constructor that uses references instead of pointers!\n");
initConstructor(problemStat, info, initialInfo, initialTimestamp);
}
AdaptInstationary::AdaptInstationary(std::string name,
ProblemIterationInterface &problemStat,
AdaptInfo &info,
ProblemTimeInterface &problemInstat,
AdaptInfo &initialInfo,
time_t initialTimestamp)
: AdaptBase(name, &problemStat, &info, &problemInstat, &initialInfo),
breakWhenStable(0),
dbgMode(false)
{
FUNCNAME("AdaptInstationary::AdaptInstationary()");
initConstructor(&problemStat, &info, &initialInfo, initialTimestamp);
}
void AdaptInstationary::initConstructor(ProblemIterationInterface *problemStat,
AdaptInfo *info,
AdaptInfo *initialInfo,
time_t initialTimestamp)
{
initialize(name);
fixedTimestep_ = (info->getMinTimestep() == info->getMaxTimestep());
if (initialTimestamp == 0) {
if (initialTimestamp == 0)
initialTimestamp_ = time(NULL);
} else {
else
initialTimestamp_ = initialTimestamp;
}
// Check if the problem should be deserialized because of the -rs parameter.
std::string serializationFilename = "";
GET_PARAMETER(0, "argv->rs", &serializationFilename);
......
......@@ -43,7 +43,7 @@ namespace AMDiS {
public:
/** \brief
* Creates a AdaptInstationary object with the given name for the time
* dependent problem problemInstat.
* dependent problem problemInstat. TODO: Make obsolete!
*/
AdaptInstationary(std::string name,
ProblemIterationInterface *problemStat,
......@@ -52,6 +52,28 @@ namespace AMDiS {
AdaptInfo *initialInfo,
time_t initialTimestamp = 0);
/** \brief
* Creates a AdaptInstationary object with the given name for the time
* dependent problem problemInstat.
*/
AdaptInstationary(std::string name,
ProblemIterationInterface &problemStat,
AdaptInfo &info,
ProblemTimeInterface &problemInstat,
AdaptInfo &initialInfo,
time_t initialTimestamp = 0);
/** \brief
* This funciton is used only to avoid double code in both constructors. If the
* obsolte constructure, which uses pointers instead of references, will be
* removed, remove also this function.
* TODO: Remove if obsolete constructor will be removed.
*/
void initConstructor(ProblemIterationInterface *problemStat,
AdaptInfo *info,
AdaptInfo *initialInfo,
time_t initialTimestamp);
/// Destructor
virtual ~AdaptInstationary();
......
......@@ -11,6 +11,19 @@ namespace AMDiS {
ProblemIterationInterface *prob,
AdaptInfo *info)
: AdaptBase(name, prob, info)
{
FUNCNAME("AdaptStationary::AdaptStationary()");
// MSG("You make use of the obsolete constructor AdaptStationary::AdaptStationary(...)!\n");
// MSG("Please use the constructor that uses references instead of pointers!\n");
initialize();
}
AdaptStationary::AdaptStationary(std::string name,
ProblemIterationInterface& prob,
AdaptInfo& info)
: AdaptBase(name, &prob, &info)
{
initialize();
}
......
......@@ -45,11 +45,16 @@ namespace AMDiS {
class AdaptStationary : public AdaptBase
{
public:
/// Creates a AdaptStationary object with given name.
/// Creates a AdaptStationary object with given name. TODO: Make obsolete!
AdaptStationary(std::string name,
ProblemIterationInterface *prob,
AdaptInfo *info);
/// Creates a AdaptStationary object with given name.
AdaptStationary(std::string name,
ProblemIterationInterface &prob,
AdaptInfo &info);
/// Destructor
virtual ~AdaptStationary() {}
......
......@@ -50,6 +50,20 @@ namespace AMDiS {
oldSolution(NULL)
{}
ProblemInstatScal::ProblemInstatScal(std::string name_,
ProblemScal& prob)
: ProblemInstat(name_, NULL),
problemStat(&prob),
oldSolution(NULL)
{}
ProblemInstatScal::ProblemInstatScal(std::string name_,
ProblemScal& prob,
ProblemStatBase& initialProb)
: ProblemInstat(name_, &initialProb),
problemStat(&prob),
oldSolution(NULL)
{}
ProblemInstatScal::~ProblemInstatScal()
{
......
......@@ -119,6 +119,10 @@ namespace AMDiS {
ProblemScal *prob,
ProblemStatBase *initialProb = NULL);
ProblemInstatScal(std::string name, ProblemScal& prob);
ProblemInstatScal(std::string name, ProblemScal& prob, ProblemStatBase& initialProb);
/// Destructor.
virtual ~ProblemInstatScal();
......
......@@ -58,6 +58,11 @@ namespace AMDiS {
fileWriters[i]->writeFiles(adaptInfo, force);
}
void ProblemScal::writeFiles(AdaptInfo &adaptInfo, bool force)
{
writeFiles(&adaptInfo, force);
}
void ProblemScal::interpolInitialSolution(AbstractFunction<double, WorldVector<double> > *fct)
{
solution->interpol(fct);
......
......@@ -157,9 +157,12 @@ namespace AMDiS {
return this;
}
/// Writes output files.
/// Writes output files. TODO: Make obsolete.
void writeFiles(AdaptInfo *adaptInfo, bool force);
/// Writes output files.
void writeFiles(AdaptInfo &adaptInfo, bool force);
/// Interpolates fct to \ref solution.
void interpolInitialSolution(AbstractFunction<double, WorldVector<double> > *fct);
......
......@@ -842,6 +842,11 @@ namespace AMDiS {
#endif
}
void ProblemVec::writeFiles(AdaptInfo &adaptInfo, bool force)
{
writeFiles(&adaptInfo, force);
}
void ProblemVec::interpolInitialSolution(std::vector<AbstractFunction<double, WorldVector<double> >*> *fct)
{
FUNCNAME("ProblemVec::interpolInitialSolution()");
......
......@@ -202,9 +202,12 @@ namespace AMDiS {
return this;
}
/// Writes output files.
/// Writes output files. TODO: Make obsolete.
void writeFiles(AdaptInfo *adaptInfo, bool force);
/// Writes output files.
void writeFiles(AdaptInfo &adaptInfo, bool force);
/// Interpolates fct to \ref solution.
void interpolInitialSolution(std::vector<AbstractFunction<double, WorldVector<double> >*> *fct);
......
Markdown is supported
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