Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dune-amdis
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Praetorius, Simon
dune-amdis
Commits
bb9b82d4
Commit
bb9b82d4
authored
Jan 22, 2018
by
Praetorius, Simon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initfile cleaned up slightly
parent
0756da59
Pipeline
#960
passed with stage
in 8 minutes and 8 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
149 deletions
+51
-149
dune/amdis/Initfile.hpp
dune/amdis/Initfile.hpp
+31
-149
init/ellipt.ini.2d
init/ellipt.ini.2d
+20
-0
No files found.
dune/amdis/Initfile.hpp
View file @
bb9b82d4
...
...
@@ -22,151 +22,34 @@
namespace
AMDiS
{
namespace
detail
{
// double mu_parser_eval(std::string const& valStr);
template
<
class
T
>
inline
T
numeric_cast
(
double
value
)
{
return
boost
::
numeric_cast
<
T
>
(
value
);
}
template
<
>
inline
bool
numeric_cast
<
bool
>
(
double
value
)
{
return
value
!=
0.0
;
}
/// convert string to intrinsic type
template
<
class
T
,
class
Enable
=
void
>
struct
Convert
{
static
void
eval
(
std
::
string
valStr
,
T
&
value
)
{
value
=
boost
::
lexical_cast
<
T
>
(
valStr
);
}
};
// template <class T>
// struct Convert<T, std::enable_if_t<std::is_arithmetic<T>::value> >
// {
// static void eval(std::string valStr, T& value)
// {
// try {
// value = numeric_cast< T >(mu_parser_eval(valStr));
// } catch(...) {
// error_exit("Could not parse '", valStr, "' to '", typeid(T).name(), "'\n");
// }
// }
// };
// template <class T>
// struct Convert<T, std::enable_if_t<std::is_enum<T>::value> >
// {
// static void eval(std::string valStr, T& value)
// {
// EnumParser<T>()(valStr, value);
// }
// };
// convert string to vector
template
<
class
V
,
int
dim
>
struct
Convert
<
Dune
::
FieldVector
<
V
,
dim
>>
{
using
T
=
Dune
::
FieldVector
<
V
,
dim
>
;
static
void
eval
(
std
::
string
valStr
,
T
&
values
)
{
using
value_type
=
typename
T
::
value_type
;
using
Tokenizer
=
boost
::
tokenizer
<
boost
::
char_separator
<
char
>>
;
boost
::
char_separator
<
char
>
sep
(
",; "
);
Tokenizer
tokens
(
valStr
,
sep
);
int
i
=
0
;
for
(
auto
token
:
tokens
)
{
test_exit
(
i
<
dim
,
"Vector data exceeds field-vector dimension!"
);
value_type
v
;
Convert
<
value_type
>::
eval
(
token
,
v
);
values
[
i
++
]
=
v
;
}
}
};
// convert string to vector
template
<
class
V
,
std
::
size_t
dim
>
struct
Convert
<
std
::
array
<
V
,
dim
>>
{
using
T
=
std
::
array
<
V
,
dim
>
;
static
void
eval
(
std
::
string
valStr
,
T
&
values
)
{
using
value_type
=
typename
T
::
value_type
;
using
Tokenizer
=
boost
::
tokenizer
<
boost
::
char_separator
<
char
>>
;
boost
::
char_separator
<
char
>
sep
(
",; "
);
Tokenizer
tokens
(
valStr
,
sep
);
std
::
size_t
i
=
0
;
for
(
auto
token
:
tokens
)
{
test_exit
(
i
<
dim
,
"Vector data exceeds array dimension!"
);
value_type
v
;
Convert
<
value_type
>::
eval
(
token
,
v
);
values
[
i
++
]
=
v
;
}
}
};
// convert string to vector
template
<
class
T
,
class
Alloc
>
struct
Convert
<
std
::
vector
<
T
,
Alloc
>>
{
static
void
eval
(
std
::
string
valStr
,
std
::
vector
<
T
>&
values
)
{
using
value_type
=
T
;
using
Tokenizer
=
boost
::
tokenizer
<
boost
::
char_separator
<
char
>>
;
boost
::
char_separator
<
char
>
sep
(
",; "
);
Tokenizer
tokens
(
valStr
,
sep
);
for
(
auto
token
:
tokens
)
{
value_type
v
;
Convert
<
value_type
>::
eval
(
token
,
v
);
values
.
push_back
(
v
);
}
}
};
}
// end namespace detail
/// output-stream for std::list
template
<
class
T
,
class
Alloc
>
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
std
::
list
<
T
,
Alloc
>
const
&
l
)
{
auto
it
=
l
.
begin
();
out
<<
"["
;
if
(
l
.
size
()
>
0
)
out
<<
*
it
;
for
(;
it
!=
l
.
end
();
++
it
)
out
<<
", "
<<
*
it
;
out
<<
"]"
;
return
out
;
}
/// output-stream for std::vector
template
<
class
T
,
class
Alloc
>
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
std
::
vector
<
T
,
Alloc
>
const
&
l
)
{
auto
it
=
l
.
begin
();
out
<<
"["
;
if
(
l
.
size
()
>
0
)
out
<<
*
it
;
for
(;
it
!=
l
.
end
();
++
it
)
out
<<
", "
<<
*
it
;
out
<<
"]"
;
return
out
;
}
// /// output-stream for std::list
// template <class T, class Alloc>
// std::ostream& operator<<(std::ostream& out, std::list<T,Alloc> const& l)
// {
// auto it = l.begin();
// out << "[";
// if (l.size() > 0)
// out << *it;
// for (; it != l.end(); ++it)
// out << ", " << *it;
// out << "]";
// return out;
// }
// /// output-stream for std::vector
// template <class T, class Alloc>
// std::ostream& operator<<(std::ostream& out, std::vector<T,Alloc> const& l)
// {
// auto it = l.begin();
// out << "[";
// if (l.size() > 0)
// out << *it;
// for (; it != l.end(); ++it)
// out << ", " << *it;
// out << "]";
// return out;
// }
inline
void
replaceAll
(
std
::
string
&
str
,
std
::
string
const
&
from
,
std
::
string
const
&
to
)
{
...
...
@@ -217,11 +100,10 @@ namespace AMDiS
* \param value: The result.
*/
template
<
class
T
>
static
void
get
(
std
::
string
tag
,
T
&
value
)
static
void
get
(
std
::
string
key
,
T
&
value
)
{
auto
v
=
get
<
std
::
string
>
(
tag
);
if
(
v
)
detail
::
Convert
<
T
>::
eval
(
v
.
value
(),
value
);
replaceAll
(
key
,
"->"
,
"."
);
value
=
singlett
().
pt
.
get
(
key
,
value
);
}
...
...
init/ellipt.ini.2d
0 → 100644
View file @
bb9b82d4
dimension of world = 2
[elliptMesh]
macro file name = ./macro/macro.stand.2d
global refinements = 5
[ellipt]
mesh = elliptMesh
[ellipt.solver]
name = cg
max iteration = 1000
absolute tolerance = 1e-6
info = 1
left precon = diag
[ellipt.output[0]]
filename = ellipt.2d
name = u
output directory = ./output
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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