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
amdis
amdis-core
Commits
9880ff48
Commit
9880ff48
authored
Oct 18, 2018
by
Praetorius, Simon
Browse files
replaced string arguments by reference
parent
f126815d
Changes
28
Hide whitespace changes
Inline
Side-by-side
examples/heat.cc
View file @
9880ff48
...
...
@@ -31,7 +31,7 @@ int main(int argc, char** argv)
AdaptInfo
adaptInfo
(
"adapt"
);
double
*
invTau
=
probInstat
.
getInvTau
();
auto
*
invTau
=
probInstat
.
getInvTau
();
auto
opTimeLhs
=
makeOperator
(
tag
::
test_trial
{},
std
::
ref
(
*
invTau
));
prob
.
addMatrixOperator
(
opTimeLhs
,
0
,
0
);
...
...
src/amdis/AMDiS.cpp
View file @
9880ff48
...
...
@@ -6,7 +6,7 @@
namespace
AMDiS
{
Dune
::
MPIHelper
&
init
(
int
&
argc
,
char
**&
argv
,
std
::
string
initFileName
)
Dune
::
MPIHelper
&
init
(
int
&
argc
,
char
**&
argv
,
std
::
string
const
&
initFileName
)
{
// Maybe initialize MPI
Dune
::
MPIHelper
&
mpiHelper
=
Dune
::
MPIHelper
::
instance
(
argc
,
argv
);
...
...
@@ -14,10 +14,8 @@ namespace AMDiS
Parameters
::
clearData
();
if
(
initFileName
==
""
)
{
if
(
argc
>
1
)
Parameters
::
init
(
argv
[
1
]);
else
error_exit
(
"No init file specified!
\n
"
);
test_exit
(
argc
>
1
,
"No init file specified!
\n
"
);
Parameters
::
init
(
argv
[
1
]);
}
else
{
Parameters
::
init
(
initFileName
);
}
...
...
src/amdis/AMDiS.hpp
View file @
9880ff48
...
...
@@ -12,7 +12,7 @@
namespace
AMDiS
{
Dune
::
MPIHelper
&
init
(
int
&
argc
,
char
**&
argv
,
std
::
string
initFileName
=
""
);
Dune
::
MPIHelper
&
init
(
int
&
argc
,
char
**&
argv
,
std
::
string
const
&
initFileName
=
""
);
void
finalize
();
...
...
src/amdis/AdaptBase.hpp
View file @
9880ff48
...
...
@@ -15,12 +15,12 @@ namespace AMDiS
{
public:
/// Constructor
AdaptBase
(
std
::
string
name
,
AdaptBase
(
std
::
string
const
&
name
,
ProblemIterationInterface
*
problemIteration
,
AdaptInfo
&
adaptInfo
,
ProblemTimeInterface
*
problemTime
=
nullptr
,
AdaptInfo
*
initialAdaptInfo
=
nullptr
)
:
name_
(
std
::
move
(
name
)
)
:
name_
(
name
)
,
problemIteration_
(
problemIteration
)
,
adaptInfo_
(
adaptInfo
)
,
problemTime_
(
problemTime
)
...
...
@@ -37,7 +37,7 @@ namespace AMDiS
virtual
int
adapt
()
=
0
;
/// Returns \ref name
std
::
string
getName
()
const
std
::
string
const
&
getName
()
const
{
return
name_
;
}
...
...
src/amdis/AdaptInfo.cpp
View file @
9880ff48
...
...
@@ -9,7 +9,7 @@
namespace
AMDiS
{
AdaptInfo
::
ScalContent
::
ScalContent
(
std
::
string
prefix
)
AdaptInfo
::
ScalContent
::
ScalContent
(
std
::
string
const
&
prefix
)
{
Parameters
::
get
(
prefix
+
"->tolerance"
,
spaceTolerance
);
Parameters
::
get
(
prefix
+
"->time tolerance"
,
timeTolerance
);
...
...
@@ -25,22 +25,22 @@ namespace AMDiS
}
AdaptInfo
::
AdaptInfo
(
std
::
string
name
)
:
name_
(
std
::
move
(
name
)
)
AdaptInfo
::
AdaptInfo
(
std
::
string
const
&
name
)
:
name_
(
name
)
{
// init();
Parameters
::
get
(
name
_
+
"->start time"
,
startTime
);
Parameters
::
get
(
name
+
"->start time"
,
startTime
);
time
=
startTime
;
Parameters
::
get
(
name
_
+
"->timestep"
,
timestep
);
Parameters
::
get
(
name
_
+
"->end time"
,
endTime
);
Parameters
::
get
(
name
_
+
"->max iteration"
,
maxSpaceIteration
);
Parameters
::
get
(
name
_
+
"->max timestep iteration"
,
maxTimestepIteration
);
Parameters
::
get
(
name
_
+
"->max time iteration"
,
maxTimeIteration
);
Parameters
::
get
(
name
_
+
"->min timestep"
,
minTimestep
);
Parameters
::
get
(
name
_
+
"->max timestep"
,
maxTimestep
);
Parameters
::
get
(
name
_
+
"->number of timesteps"
,
nTimesteps
);
Parameters
::
get
(
name
_
+
"->time tolerance"
,
globalTimeTolerance
);
Parameters
::
get
(
name
+
"->timestep"
,
timestep
);
Parameters
::
get
(
name
+
"->end time"
,
endTime
);
Parameters
::
get
(
name
+
"->max iteration"
,
maxSpaceIteration
);
Parameters
::
get
(
name
+
"->max timestep iteration"
,
maxTimestepIteration
);
Parameters
::
get
(
name
+
"->max time iteration"
,
maxTimeIteration
);
Parameters
::
get
(
name
+
"->min timestep"
,
minTimestep
);
Parameters
::
get
(
name
+
"->max timestep"
,
maxTimestep
);
Parameters
::
get
(
name
+
"->number of timesteps"
,
nTimesteps
);
Parameters
::
get
(
name
+
"->time tolerance"
,
globalTimeTolerance
);
}
...
...
src/amdis/AdaptInfo.hpp
View file @
9880ff48
...
...
@@ -37,7 +37,7 @@ namespace AMDiS
{
public:
/// Constructor.
explicit
ScalContent
(
std
::
string
prefix
);
explicit
ScalContent
(
std
::
string
const
&
prefix
);
/// Sum of all error estimates
double
est_sum
=
0.0
;
...
...
@@ -75,7 +75,7 @@ namespace AMDiS
public:
/// Constructor.
explicit
AdaptInfo
(
std
::
string
name
);
explicit
AdaptInfo
(
std
::
string
const
&
name
);
/// Destructor.
virtual
~
AdaptInfo
()
=
default
;
...
...
@@ -468,7 +468,7 @@ namespace AMDiS
}
/// Gets \ref &time
double
*
getTimePtr
()
double
const
*
getTimePtr
()
const
{
return
&
time
;
}
...
...
@@ -538,7 +538,7 @@ namespace AMDiS
}
/// Gets \ref ×tep
double
*
getTimestepPtr
()
double
const
*
getTimestepPtr
()
const
{
return
&
timestep
;
}
...
...
src/amdis/AdaptInstationary.cpp
View file @
9880ff48
...
...
@@ -10,12 +10,12 @@
namespace
AMDiS
{
AdaptInstationary
::
AdaptInstationary
(
std
::
string
name
,
AdaptInstationary
::
AdaptInstationary
(
std
::
string
const
&
name
,
ProblemIterationInterface
&
problemIteration
,
AdaptInfo
&
adaptInfo
,
ProblemTimeInterface
&
problemTime
,
AdaptInfo
&
initialAdaptInfo
)
:
AdaptBase
(
std
::
move
(
name
)
,
&
problemIteration
,
adaptInfo
,
&
problemTime
,
&
initialAdaptInfo
)
:
AdaptBase
(
name
,
&
problemIteration
,
adaptInfo
,
&
problemTime
,
&
initialAdaptInfo
)
{
Parameters
::
get
(
name_
+
"->strategy"
,
strategy_
);
Parameters
::
get
(
name_
+
"->time delta 1"
,
timeDelta1_
);
...
...
src/amdis/AdaptInstationary.hpp
View file @
9880ff48
...
...
@@ -25,7 +25,7 @@ namespace AMDiS
public:
/// Creates a AdaptInstationary object with the given name for the time
/// dependent problem problemInstat.
AdaptInstationary
(
std
::
string
name
,
AdaptInstationary
(
std
::
string
const
&
name
,
ProblemIterationInterface
&
problemStat
,
AdaptInfo
&
info
,
ProblemTimeInterface
&
problemInstat
,
...
...
src/amdis/AdaptStationary.cpp
View file @
9880ff48
...
...
@@ -8,10 +8,10 @@
namespace
AMDiS
{
AdaptStationary
::
AdaptStationary
(
std
::
string
name
,
AdaptStationary
::
AdaptStationary
(
std
::
string
const
&
name
,
ProblemIterationInterface
&
problemIteration
,
AdaptInfo
&
adaptInfo
)
:
AdaptBase
(
std
::
move
(
name
)
,
&
problemIteration
,
adaptInfo
)
:
AdaptBase
(
name
,
&
problemIteration
,
adaptInfo
)
{}
...
...
src/amdis/AdaptStationary.hpp
View file @
9880ff48
...
...
@@ -30,7 +30,7 @@ namespace AMDiS
{
public:
/// Creates a AdaptStationary object with given name.
AdaptStationary
(
std
::
string
name
,
AdaptStationary
(
std
::
string
const
&
name
,
ProblemIterationInterface
&
problemIteration
,
AdaptInfo
&
adaptInfo
);
...
...
src/amdis/FileWriter.hpp
View file @
9880ff48
...
...
@@ -60,7 +60,7 @@ namespace AMDiS
public:
/// Constructor.
FileWriter
(
std
::
string
baseName
,
FileWriter
(
std
::
string
const
&
baseName
,
Vector
const
&
dofvector
)
:
FileWriterInterface
(
baseName
)
,
dofvector_
(
dofvector
)
...
...
src/amdis/Initfile.cpp
View file @
9880ff48
...
...
@@ -20,14 +20,14 @@ namespace AMDiS
// }
// }
void
Initfile
::
init
(
std
::
string
in
)
void
Initfile
::
init
(
std
::
string
const
&
in
)
{
singlett
().
read
(
in
);
singlett
().
getInternalParameters
();
}
void
Initfile
::
read
(
std
::
string
fn
,
bool
/*force*/
)
void
Initfile
::
read
(
std
::
string
const
&
fn
,
bool
/*force*/
)
{
InitfileParser
::
readInitfile
(
fn
,
pt_
);
}
...
...
@@ -35,20 +35,12 @@ void Initfile::read(std::string fn, bool /*force*/)
void
Initfile
::
getInternalParameters
()
{
int
val
=
0
;
get
(
"
level of
information"
,
val
);
msgInfo
=
val
;
get
(
"level of information"
,
msgInfo_
)
;
get
(
"
parameter
information"
,
paramInfo_
);
get
(
"break on missing tag"
,
breakOnMissingTag_
)
;
val
=
1
;
get
(
"parameter information"
,
val
);
paramInfo
=
val
;
val
=
0
;
get
(
"break on missing tag"
,
val
);
breakOnMissingTag
=
val
;
if
(
msgInfo
==
0
)
paramInfo
=
0
;
if
(
msgInfo_
==
0
)
paramInfo_
=
0
;
}
...
...
src/amdis/Initfile.hpp
View file @
9880ff48
...
...
@@ -13,7 +13,7 @@ namespace AMDiS
{
public:
/// initialize singleton object and global parameters
static
void
init
(
std
::
string
in
);
static
void
init
(
std
::
string
const
&
in
);
/// \brief Get parameter-values from parameter-tree
/**
...
...
@@ -23,7 +23,7 @@ namespace AMDiS
* Does not thrown an exception if something goes wrong!
**/
template
<
class
T
>
static
Dune
::
Std
::
optional
<
T
>
get
(
std
::
string
key
)
static
Dune
::
Std
::
optional
<
T
>
get
(
std
::
string
const
&
key
)
{
try
{
return
pt
().
get
<
T
>
(
key
);
...
...
@@ -42,7 +42,7 @@ namespace AMDiS
* \param value: The default value and result.
**/
template
<
class
T
>
static
void
get
(
std
::
string
key
,
T
&
value
)
static
void
get
(
std
::
string
const
&
key
,
T
&
value
)
{
value
=
pt
().
get
(
key
,
value
);
}
...
...
@@ -50,7 +50,7 @@ namespace AMDiS
/// Returns specified info level
static
int
getMsgInfo
()
{
return
singlett
().
msgInfo
;
return
singlett
().
msgInfo
_
;
}
/// print all data in singleton to std::cout
...
...
@@ -75,15 +75,15 @@ namespace AMDiS
}
/// Fill an parametr-tree from a file with filename fn
void
read
(
std
::
string
fn
,
bool
force
=
false
);
void
write
(
std
::
string
fn
);
void
read
(
std
::
string
const
&
fn
,
bool
force
=
false
);
void
write
(
std
::
string
const
&
fn
);
/// read standard values for output and information of parameter-values
void
getInternalParameters
();
int
msgInfo
=
0
;
int
paramInfo
=
1
;
int
breakOnMissingTag
=
0
;
int
msgInfo
_
=
0
;
int
paramInfo
_
=
1
;
bool
breakOnMissingTag
_
=
false
;
/// ParameterTree to read/store parameter values
Dune
::
ParameterTree
pt_
;
...
...
src/amdis/InitfileParser.cpp
View file @
9880ff48
...
...
@@ -6,10 +6,9 @@
namespace
AMDiS
{
void
InitfileParser
::
readInitfile
(
std
::
string
fn
,
Dune
::
ParameterTree
&
pt
,
bool
overwrite
)
void
InitfileParser
::
readInitfile
(
std
::
string
const
&
fn
,
Dune
::
ParameterTree
&
pt
,
bool
overwrite
)
{
test_exit
(
filesystem
::
exists
(
fn
),
"init-file '{}' cannot be opened for reading"
,
fn
);
test_exit
(
filesystem
::
exists
(
fn
),
"Init-file '{}' cannot be opened for reading"
,
fn
);
// read file if its not parsed already
auto
ins
=
includeList
().
insert
(
fn
);
...
...
@@ -37,8 +36,7 @@ void InitfileParser::readInitfile(std::istream& in, Dune::ParameterTree& pt, boo
{
// parse line and extract map: tag->value
std
::
size_t
pos
=
sw
.
find
(
':'
);
if
(
pos
==
std
::
string
::
npos
)
throw
std
::
runtime_error
(
"cannot find the delimiter ':' in line '"
+
sw
+
"'"
);
test_exit
(
pos
!=
std
::
string
::
npos
,
"Cannot find the delimiter ':' in line '{}'"
,
sw
);
std
::
string
name
=
sw
.
substr
(
0
,
pos
);
std
::
string
value
=
sw
.
substr
(
pos
+
1
,
sw
.
length
()
-
(
pos
+
1
));
...
...
@@ -73,11 +71,10 @@ void InitfileParser::readInitfile(std::istream& in, Dune::ParameterTree& pt, boo
epos
=
sw
.
find_first_of
(
delimiter
,
pos
);
fn
=
sw
.
substr
(
pos
,
epos
-
pos
);
if
(
sw
[
epos
]
!=
c
)
throw
std
::
runtime_error
(
"filename in #include not terminated by "
+
std
::
to_string
(
c
));
test_exit
(
sw
[
epos
]
==
c
,
"Filename in #include not terminated by {}."
,
std
::
to_string
(
c
));
break
;
default:
throw
std
::
runtime_
error
(
"
n
o filename given for #include"
);
error
_exit
(
"
N
o filename given for #include"
);
}
readInitfile
(
fn
,
pt
,
overwrite
);
...
...
@@ -89,7 +86,7 @@ void InitfileParser::readInitfile(std::istream& in, Dune::ParameterTree& pt, boo
}
std
::
string
InitfileParser
::
replaceVariable
(
Dune
::
ParameterTree
const
&
pt
,
std
::
string
input
)
std
::
string
InitfileParser
::
replaceVariable
(
Dune
::
ParameterTree
const
&
pt
,
std
::
string
const
&
input
)
{
std
::
string
whitespaces
=
"
\t\r\f
"
;
std
::
string
allowedChars
=
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"
;
...
...
@@ -112,8 +109,8 @@ std::string InitfileParser::replaceVariable(Dune::ParameterTree const& pt, std::
// if varname is found in parameter list then replace variable by value
// otherwise throw tagNotFound exception
if
(
!
pt
.
hasKey
(
varName
)
)
throw
std
::
runtime_error
(
"required tag '"
+
varName
+
"
' for variable substitution not found"
);
test_exit
(
pt
.
hasKey
(
varName
)
,
"Required tag '{}
' for variable substitution not found"
,
varName
);
std
::
string
varParam
=
pt
[
varName
];
...
...
@@ -127,7 +124,7 @@ std::string InitfileParser::replaceVariable(Dune::ParameterTree const& pt, std::
}
std
::
string
InitfileParser
::
replaceExpression
(
Dune
::
ParameterTree
const
&
pt
,
std
::
string
input
)
std
::
string
InitfileParser
::
replaceExpression
(
Dune
::
ParameterTree
const
&
pt
,
std
::
string
const
&
input
)
{
#if 0
std::string whitespaces = " \t\r\f";
...
...
src/amdis/InitfileParser.hpp
View file @
9880ff48
...
...
@@ -30,7 +30,7 @@ namespace AMDiS
static
void
readInitfile
(
std
::
istream
&
in
,
Dune
::
ParameterTree
&
pt
,
bool
overwrite
);
/// Read initfile from input stream into parameter-tree
static
void
readInitfile
(
std
::
string
fn
,
Dune
::
ParameterTree
&
pt
,
bool
overwrite
=
true
);
static
void
readInitfile
(
std
::
string
const
&
fn
,
Dune
::
ParameterTree
&
pt
,
bool
overwrite
=
true
);
private:
/// Provide a list of already read files. This is necessary to not double include the same file.
...
...
@@ -45,13 +45,13 @@ namespace AMDiS
* Replaces variables of the form ${variablename} or $variablename in the `input`
* by a corresponding value already stored in the parameter tree `pt`.
*/
static
std
::
string
replaceVariable
(
Dune
::
ParameterTree
const
&
pt
,
std
::
string
input
);
static
std
::
string
replaceVariable
(
Dune
::
ParameterTree
const
&
pt
,
std
::
string
const
&
input
);
/// \brief Evaluate an expression. NOTE: currently not implemented
/**
* Evaluates expressions of the form $(expression) in the `input`
**/
static
std
::
string
replaceExpression
(
Dune
::
ParameterTree
const
&
pt
,
std
::
string
input
);
static
std
::
string
replaceExpression
(
Dune
::
ParameterTree
const
&
pt
,
std
::
string
const
&
input
);
};
}
// end namespace AMDiS
src/amdis/Marker.hpp
View file @
9880ff48
...
...
@@ -33,7 +33,7 @@ namespace AMDiS {
Marker
()
{}
/// Constructor.
Marker
(
std
::
string
name
,
std
::
string
component
,
Estimates
const
&
est
,
Marker
(
std
::
string
const
&
name
,
std
::
string
const
&
component
,
Estimates
const
&
est
,
std
::
shared_ptr
<
Grid
>
const
&
grid
)
:
name_
(
name
)
,
component_
(
component
)
...
...
@@ -41,10 +41,10 @@ namespace AMDiS {
,
est_
(
est
)
,
maximumMarking_
(
false
)
{
Parameters
::
get
(
name
_
+
"->p"
,
p_
);
Parameters
::
get
(
name
_
+
"->info"
,
info_
);
Parameters
::
get
(
name
_
+
"->max refinement level"
,
maxRefineLevel_
);
Parameters
::
get
(
name
_
+
"->min refinement level"
,
minRefineLevel_
);
Parameters
::
get
(
name
+
"->p"
,
p_
);
Parameters
::
get
(
name
+
"->info"
,
info_
);
Parameters
::
get
(
name
+
"->max refinement level"
,
maxRefineLevel_
);
Parameters
::
get
(
name
+
"->min refinement level"
,
minRefineLevel_
);
}
/// destructor
...
...
@@ -106,13 +106,13 @@ namespace AMDiS {
}
/// Returns \ref name of the Marker
std
::
string
getName
()
const
std
::
string
const
&
getName
()
const
{
return
name_
;
}
/// Creates a scalar marker depending on the strategy set in parameters.
static
std
::
shared
_ptr
<
Marker
<
Traits
>
>
createMarker
(
std
::
string
name
,
std
::
string
component
,
Estimates
const
&
est
,
std
::
shared_ptr
<
Grid
>
const
&
grid
);
static
std
::
unique
_ptr
<
Marker
<
Traits
>
>
createMarker
(
std
::
string
const
&
name
,
std
::
string
const
&
component
,
Estimates
const
&
est
,
std
::
shared_ptr
<
Grid
>
const
&
grid
);
protected:
/// Name of the scalar marker.
...
...
@@ -186,9 +186,9 @@ namespace AMDiS {
public:
/// Constructor.
GRMarker
(
std
::
string
name
,
std
::
string
component
,
Estimates
const
&
est
,
GRMarker
(
std
::
string
const
&
name
,
std
::
string
component
,
Estimates
const
&
est
,
std
::
shared_ptr
<
Grid
>
const
&
grid
)
:
Marker
<
Traits
>
(
std
::
move
(
name
)
,
std
::
move
(
component
),
est
,
grid
)
:
Marker
<
Traits
>
(
name
,
std
::
move
(
component
),
est
,
grid
)
{}
/// Implementation of Marker::markElement().
...
...
@@ -217,12 +217,12 @@ namespace AMDiS {
public:
/// Constructor.
MSMarker
(
std
::
string
name
,
std
::
string
component
,
Estimates
const
&
est
,
MSMarker
(
std
::
string
const
&
name
,
std
::
string
component
,
Estimates
const
&
est
,
std
::
shared_ptr
<
Grid
>
const
&
grid
)
:
Super
{
std
::
move
(
name
)
,
std
::
move
(
component
),
est
,
grid
}
:
Super
{
name
,
std
::
move
(
component
),
est
,
grid
}
{
Parameters
::
get
(
this
->
name
_
+
"->MSGamma"
,
msGamma_
);
Parameters
::
get
(
this
->
name
_
+
"->MSGammaC"
,
msGammaC_
);
Parameters
::
get
(
name
+
"->MSGamma"
,
msGamma_
);
Parameters
::
get
(
name
+
"->MSGammaC"
,
msGammaC_
);
}
/// Implementation of Marker::initMarking().
...
...
@@ -254,12 +254,12 @@ namespace AMDiS {
public:
/// Constructor.
ESMarker
(
std
::
string
name
,
std
::
string
component
,
Estimates
const
&
est
,
ESMarker
(
std
::
string
const
&
name
,
std
::
string
component
,
Estimates
const
&
est
,
std
::
shared_ptr
<
Grid
>
const
&
grid
)
:
Super
{
std
::
move
(
name
)
,
std
::
move
(
component
),
est
,
grid
}
:
Super
{
name
,
std
::
move
(
component
),
est
,
grid
}
{
Parameters
::
get
(
this
->
name
_
+
"->ESTheta"
,
esTheta_
);
Parameters
::
get
(
this
->
name
_
+
"->ESThetaC"
,
esThetaC_
);
Parameters
::
get
(
name
+
"->ESTheta"
,
esTheta_
);
Parameters
::
get
(
name
+
"->ESThetaC"
,
esThetaC_
);
}
/// Implementation of Marker::initMarking().
...
...
@@ -292,13 +292,13 @@ namespace AMDiS {
public:
/// Constructor.
GERSMarker
(
std
::
string
name
,
std
::
string
component
,
Estimates
const
&
est
,
GERSMarker
(
std
::
string
const
&
name
,
std
::
string
component
,
Estimates
const
&
est
,
std
::
shared_ptr
<
Grid
>
const
&
grid
)
:
Super
{
std
::
move
(
name
)
,
std
::
move
(
component
),
est
,
grid
}
:
Super
{
name
,
std
::
move
(
component
),
est
,
grid
}
{
Parameters
::
get
(
this
->
name
_
+
"->GERSThetaStar"
,
gersThetaStar_
);
Parameters
::
get
(
this
->
name
_
+
"->GERSNu"
,
gersNu_
);
Parameters
::
get
(
this
->
name
_
+
"->GERSThetaC"
,
gersThetaC_
);
Parameters
::
get
(
name
+
"->GERSThetaStar"
,
gersThetaStar_
);
Parameters
::
get
(
name
+
"->GERSNu"
,
gersNu_
);
Parameters
::
get
(
name
+
"->GERSThetaC"
,
gersThetaC_
);
}
/// Implementation of Marker::markGrid().
...
...
src/amdis/Marker.inc.hpp
View file @
9880ff48
...
...
@@ -3,37 +3,37 @@
namespace
AMDiS
{
template
<
class
Traits
>
std
::
shared_ptr
<
Marker
<
Traits
>
>
Marker
<
Traits
>::
createMarker
(
std
::
string
name
,
std
::
string
component
,
Estimates
const
&
est
,
std
::
shared_ptr
<
Grid
>
const
&
grid
)
std
::
unique_ptr
<
Marker
<
Traits
>
>
Marker
<
Traits
>::
createMarker
(
std
::
string
const
&
name
,
std
::
string
const
&
component
,
Estimates
const
&
est
,
std
::
shared_ptr
<
Grid
>
const
&
grid
)
{
int
strategy
=
0
;
Parameters
::
get
(
name
+
"->strategy"
,
strategy
);
std
::
shared_ptr
<
Marker
<
Traits
>
>
marker
;
switch
(
strategy
)
{
case
0
:
// no refinement/coarsening
break
;
case
1
:
msg
(
"Creating global refinement (GR) marker"
);
marker
=
std
::
make_
shared
<
GRMarker
<
Traits
>
>
(
name
,
component
,
est
,
grid
);
return
std
::
make_
unique
<
GRMarker
<
Traits
>
>
(
name
,
component
,
est
,
grid
);
break
;
case
2
:
msg
(
"Creating maximum strategy (MS) marker"
);
marker
=
std
::
make_
shared
<
MSMarker
<
Traits
>
>
(
name
,
component
,
est
,
grid
);
return
std
::
make_
unique
<
MSMarker
<
Traits
>
>
(
name
,
component
,
est
,
grid
);
break
;
case
3
:
msg
(
"Creating equidistribution strategy (ES) marker"
);
marker
=
std
::
make_
shared
<
ESMarker
<
Traits
>
>
(
name
,
component
,
est
,
grid
);
return
std
::
make_
unique
<
ESMarker
<
Traits
>
>
(
name
,
component
,
est
,
grid
);
break
;
case
4
:
msg
(
"Creating guaranteed error reduction strategy (GERS) marker"
);
marker
=
std
::
make_
shared
<
GERSMarker
<
Traits
>
>
(
name
,
component
,
est
,
grid
);
return
std
::
make_
unique
<
GERSMarker
<
Traits
>
>
(
name
,
component
,
est
,
grid
);
break
;
default:
error_exit
(
"invalid strategy"
);
}
return
marker
;
return
{}
;
}
...
...
src/amdis/Mesh.hpp
View file @
9880ff48
...
...
@@ -70,7 +70,7 @@ namespace AMDiS
template
<
class
Grid
>
struct
MeshCreator
{
static
std
::
unique_ptr
<
Grid
>
create
(
std
::
string
meshName
)
static
std
::
unique_ptr
<
Grid
>
create
(
std
::
string
const
&
meshName
)
{
error_exit
(
"Creator not yet implemented for this mesh type."
);
return
{};
...
...
@@ -83,7 +83,7 @@ namespace AMDiS
{
using
Grid
=
Dune
::
AlbertaGrid
<
dim
,
dimworld
>
;
static
std
::
unique_ptr
<
Grid
>
create
(
std
::
string
meshName
)
static
std
::
unique_ptr
<
Grid
>
create
(
std
::
string
const
&
meshName
)
{
std
::
string
macro_filename
=
""
;
Parameters
::
get
(
meshName
+
"->macro file name"
,
macro_filename
);
...
...
@@ -103,31 +103,30 @@ namespace AMDiS
{
using
Grid
=
Dune
::
UGGrid
<
dim
>
;
static
std
::
unique_ptr
<
Grid
>
create
(
std
::
string
meshName
)
static
std
::
unique_ptr
<
Grid
>
create
(
std
::
string
const
&
meshName
)
{
std
::
string
filename
=
""
;
Parameters
::
get
(
meshName
+
"->macro file name"
,
filename
);
if
(
!
filename
.
empty
())
{
filesystem
::
path
fn
(
filename
);
auto
ext
=
fn
.
extension
();
test_exit
(
!
filename
.
empty
(),
"Construction of UGGrid without filename not yet implemented!"
);
filesystem
::
path
fn
(
filename
);
auto
ext
=
fn
.
extension
();
if
(
ext
==
".msh"
)
{
Dune
::
GmshReader
<
Grid
>
reader
;
return
std
::
unique_ptr
<
Grid
>
{
reader
.
read
(
filename
)};
}
#if HAVE_ALBERTA
if
(
ext
==
".1d"
||
ext
==
".2d"
||
ext
==
".3d"
)
{
Dune
::
GridFactory
<
Grid
>
factory
;
Dune
::
AlbertaReader
<
Grid
>
reader
;
reader
.
readGrid
(
filename
,
factory
);
return
std
::
unique_ptr
<
Grid
>
{
factory
.
createGrid
()};
}
#endif
if
(
ext
==
".msh"
)
{
Dune
::
GmshReader
<
Grid
>
reader
;
return
std
::
unique_ptr
<
Grid
>
{
reader
.
read
(
filename
)};
}
}
else
{
error_exit
(
"Construction of UGGrid without filename not yet implemented!"
);
else
if
(
ext
==
".1d"
||
ext
==
".2d"
||
ext
==
".3d"
)
{
Dune
::
GridFactory
<
Grid
>
factory
;
Dune
::
AlbertaReader
<
Grid
>
reader
;
reader
.
readGrid
(
filename
,
factory
);
return
std
::
unique_ptr
<
Grid
>
{
factory
.
createGrid
()};
}
#endif