Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
iwr
amdis
Commits
832f770b
Commit
832f770b
authored
Aug 15, 2012
by
Thomas Witkowski
Browse files
Fixed at least some compiler warnings.
parent
469bc1cf
Changes
2
Hide whitespace changes
Inline
Side-by-side
extensions/base_problems/BaseProblem.h
View file @
832f770b
...
...
@@ -18,48 +18,52 @@ class BaseProblem : public ProblemIterationInterface,
public
ProblemInstatBase
{
public:
BaseProblem
(
const
std
::
string
&
name_
);
~
BaseProblem
()
{
delete
prob
;
}
/// Initialisation of the problem.
virtual
void
initialize
(
Flag
initFlag
,
ProblemStat
*
adoptProblem
=
NULL
,
Flag
adoptFlag
=
INIT_NOTHING
);
void
initialize
(
Flag
initFlag
,
ProblemStat
*
adoptProblem
=
NULL
,
Flag
adoptFlag
=
INIT_NOTHING
);
/// Initialisation of DOFVectors and AbstractFunctions,
/// is called in \ref initTimeInteface after feSpace and mesh are initialized
virtual
void
initData
()
{};
/// calls \ref initData, \ref fillOperators and \ref fillBoundaryConditions in this ordering
virtual
void
initTimeInterface
()
{
FUNCNAME
(
"BaseProblem::initTimeInterface()"
);
{
FUNCNAME
(
"BaseProblem::initTimeInterface()"
);
initData
();
fillOperators
();
fillBoundaryConditions
();
}
;
}
/// read solution DOFVectors from .arh, .dat or .vtu files
virtual
Flag
initDataFromFile
(
AdaptInfo
*
adaptInfo
);
/// calls \ref initDataFromFile
virtual
void
solveInitialProblem
(
AdaptInfo
*
adaptInfo
)
{
FUNCNAME
(
"BaseProblem::solveInitialProblem()"
);
{
FUNCNAME
(
"BaseProblem::solveInitialProblem()"
);
Flag
initFlag
=
initDataFromFile
(
adaptInfo
);
}
;
}
/// calls \ref writeFiles
virtual
void
transferInitialSolution
(
AdaptInfo
*
adaptInfo
)
{
FUNCNAME
(
"BaseProblem::transferInitialSolution()"
);
{
FUNCNAME
(
"BaseProblem::transferInitialSolution()"
);
oldMeshChangeIdx
=
getMesh
()
->
getChangeIndex
();
writeFiles
(
adaptInfo
,
false
);
}
;
}
/// This method is called before \ref beginIteration, \ref oneIteration and \ref endIteration.
virtual
void
initTimestep
(
AdaptInfo
*
adaptInfo
)
{};
virtual
void
initTimestep
(
AdaptInfo
*
adaptInfo
)
{}
/// calls \ref writeFiles
virtual
void
closeTimestep
(
AdaptInfo
*
adaptInfo
);
...
...
@@ -70,9 +74,10 @@ public:
/// Calls writeFiles of the problem
virtual
void
writeFiles
(
AdaptInfo
*
adaptInfo
,
bool
force
)
{
FUNCNAME
(
"BaseProblem::writeFiles()"
);
{
FUNCNAME
(
"BaseProblem::writeFiles()"
);
prob
->
writeFiles
(
adaptInfo
,
force
);
}
;
}
// getting methods
...
...
@@ -98,25 +103,28 @@ public:
std
::
string
getName
()
{
return
name
;
}
;
}
int
getNumProblems
()
{
return
1
;
}
;
}
int
getNumComponents
()
{
return
prob
->
getNumComponents
();
}
;
}
ProblemType
*
getProblem
(
int
number
=
0
)
ProblemType
*
getProblem
(
int
number
=
0
)
{
if
(
number
<
0
||
number
>=
getNumProblems
())
if
(
number
<
0
||
number
>=
getNumProblems
())
throw
(
std
::
runtime_error
(
"problem with given number does not exist"
));
if
(
number
==
0
)
return
prob
;
};
return
NULL
;
}
ProblemType
*
getProblem
(
std
::
string
name
)
{
...
...
@@ -124,7 +132,7 @@ public:
return
prob
;
else
throw
(
std
::
runtime_error
(
"problem with given name '"
+
name
+
"' does not exist"
));
}
;
}
// setting methods
...
...
@@ -138,14 +146,19 @@ public:
nTimesteps
=
nTimesteps_
;
}
void
serialize
(
std
::
ostream
&
)
{};
void
deserialize
(
std
::
istream
&
)
{};
void
serialize
(
std
::
ostream
&
)
{}
void
deserialize
(
std
::
istream
&
)
{}
/// method where operators are added to the problem
virtual
void
fillOperators
()
{};
virtual
void
fillOperators
()
{}
/// method where boundary conditions are added to the problem
virtual
void
fillBoundaryConditions
()
{};
virtual
void
fillBoundaryConditions
()
{}
/// classical backward-euler time-discretization
void
addTimeOperator
(
ProblemStat
*
prob
,
int
i
,
int
j
);
...
...
extensions/base_problems/BaseProblem.hh
View file @
832f770b
using
namespace
AMDiS
;
template
<
typename
ProblemType
>
BaseProblem
<
ProblemType
>::
BaseProblem
(
const
std
::
string
&
name_
)
:
ProblemInstatBase
(
name_
,
NULL
),
prob
(
NULL
),
secureIteration
(
false
),
oldMeshChangeIdx
(
0
),
nTimesteps
(
-
1
),
dim
(
1
),
dow
(
1
),
oldTimestep
(
0.0
)
BaseProblem
<
ProblemType
>::
BaseProblem
(
const
std
::
string
&
name_
)
:
ProblemInstatBase
(
name_
,
NULL
),
prob
(
NULL
),
secureIteration
(
false
),
oldMeshChangeIdx
(
0
),
nTimesteps
(
-
1
),
dim
(
1
),
dow
(
1
),
oldTimestep
(
0.0
)
{
// create basic problems
prob
=
new
ProblemType
(
name
+
"->space"
);
dow
=
Global
::
getGeo
(
WORLD
);
Initfile
::
get
(
name
+
"->secure iteration"
,
secureIteration
);
};
template
<
typename
ProblemType
>
void
BaseProblem
<
ProblemType
>::
initialize
(
Flag
initFlag
,
ProblemStat
*
adoptProblem
,
Flag
adoptFlag
)
ProblemStat
*
adoptProblem
,
Flag
adoptFlag
)
{
FUNCNAME
(
"BaseProblem::initialize()"
);
prob
->
initialize
(
initFlag
,
adoptProblem
,
adoptFlag
);
dim
=
getMesh
()
->
getDim
();
}
;
}
template
<
typename
ProblemType
>
Flag
BaseProblem
<
ProblemType
>::
initDataFromFile
(
AdaptInfo
*
adaptInfo
)
{
FUNCNAME
(
"BaseProblem::initDataFromFile()"
);
{
FUNCNAME
(
"BaseProblem::initDataFromFile()"
);
Flag
initFlag
;
bool
readDataFromFile
=
false
,
readArhFiles
=
false
,
readDatFiles
=
false
;
Initfile
::
get
(
name
+
"->read data from file"
,
readDataFromFile
,
2
);
if
(
!
readDataFromFile
)
return
initFlag
;
std
::
string
readFormat
=
"arh"
;
Initfile
::
get
(
name
+
"->read format"
,
readFormat
,
2
);
if
(
readFormat
!=
"arh"
&&
readFormat
!=
"dat"
&&
readFormat
!=
"vtu"
)
{
WARNING
(
"You can not read data from formats other than .arh, .dat or .vtu! The .arh-format is selected.
\n
"
);
}
// read data and mesh from arh-files/dat-files
MSG
(
"read data from file...
\n
"
);
if
(
readFormat
==
"arh"
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment