Skip to content
GitLab
Menu
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
35522baa
Commit
35522baa
authored
Sep 07, 2011
by
Praetorius, Simon
Browse files
latest changes in Coupling*-files
parent
249f590b
Changes
3
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/Initfile.cc
View file @
35522baa
...
...
@@ -50,14 +50,14 @@ namespace AMDiS {
/// Fill an initfile from a file with filename fn
void
Initfile
::
read
(
std
::
string
fn
)
void
Initfile
::
read
(
std
::
string
fn
,
bool
force
)
{
// read file if its not parsed already
if
(
fn_include_list
.
find
(
fn
)
==
fn_include_list
.
end
())
{
if
(
fn_include_list
.
find
(
fn
)
==
fn_include_list
.
end
()
||
force
)
{
std
::
ifstream
inputFile
;
inputFile
.
open
(
fn
.
c_str
(),
std
::
ios
::
in
);
if
(
!
inputFile
.
is_open
())
throw
runtime_error
(
"init-file '"
+
fn
+
"' cannot be opened for reading"
);
throw
runtime_error
(
"init-file '"
+
fn
+
"' cannot be opened for reading"
);
fn_include_list
.
insert
(
fn
);
read
(
inputFile
);
...
...
@@ -84,12 +84,26 @@ namespace AMDiS {
Parser
parser
(
sw
);
// add parameter to map after variable replacement
operator
[](
variableReplacement
(
InitfileInternal
::
trim
(
parser
.
name
)))
=
variableReplacement
(
InitfileInternal
::
trim
(
parser
.
value
));
std
::
string
paramName
=
variableReplacement
(
InitfileInternal
::
trim
(
parser
.
name
));
std
::
string
paramValue
=
variableReplacement
(
InitfileInternal
::
trim
(
parser
.
value
));
operator
[](
paramName
)
=
paramValue
;
#ifndef DEBUG
int
info
=
0
;
get
(
"parameter information"
,
info
,
0
);
if
(
info
>=
2
)
#endif
std
::
cout
<<
"read ["
<<
paramName
<<
" => "
<<
paramValue
<<
"]"
<<
std
::
endl
;
}
else
if
(
sw
[
pos0
]
==
'#'
&&
static_cast
<
size_t
>
(
sw
.
find
(
"#include"
))
==
pos0
)
{
// include file by '#include "filename"' or '#include <filename>'
bool
forceRead
=
false
;
int
posAdd
=
1
;
if
(
sw
[
pos0
+
std
::
string
(
"#include"
).
size
()]
==
'!'
)
{
forceRead
=
true
;
posAdd
++
;
}
size_t
pos
=
sw
.
find_first_not_of
(
whitespaces
,
std
::
string
(
"#include"
).
size
()
+
1
);
pos0
+
std
::
string
(
"#include"
).
size
()
+
posAdd
);
size_t
epos
=
0
;
std
::
string
fn
=
""
;
std
::
stringstream
errorMsg
;
...
...
@@ -109,7 +123,7 @@ namespace AMDiS {
default:
throw
std
::
runtime_error
(
"no filename given for #include"
);
}
read
(
fn
);
read
(
fn
,
forceRead
);
}
in
.
getline
(
swap
,
line_length
);
}
...
...
AMDiS/src/Initfile.h
View file @
35522baa
...
...
@@ -596,7 +596,7 @@ protected:
void
read
(
std
::
istream
&
in
);
/// Fill the initfile from a file with filename fn
void
read
(
std
::
string
fn
);
void
read
(
std
::
string
fn
,
bool
force
=
false
);
/** Write data-map to initfile
* @param out: the stream to fill the data in.
...
...
AMDiS/src/Recovery.h
View file @
35522baa
...
...
@@ -92,27 +92,27 @@ namespace AMDiS {
/// Clear recovery structure
inline
void
clear
()
{
if
(
coords
)
{
if
(
coords
!=
NULL
)
{
delete
coords
;
coords
=
NULL
;
}
if
(
A
)
{
if
(
A
!=
NULL
)
{
delete
A
;
A
=
NULL
;
}
if
(
rec_uh
)
{
if
(
rec_uh
!=
NULL
)
{
delete
rec_uh
;
rec_uh
=
NULL
;
}
if
(
rec_grdUh
)
{
if
(
rec_grdUh
!=
NULL
)
{
delete
rec_grdUh
;
rec_grdUh
=
NULL
;
}
if
(
neighbors
)
{
if
(
neighbors
!=
NULL
)
{
delete
neighbors
;
neighbors
=
NULL
;
}
...
...
Write
Preview
Supports
Markdown
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