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
Aland, Sebastian
amdis
Commits
bf5b2316
Commit
bf5b2316
authored
Jun 06, 2011
by
Praetorius, Simon
Browse files
readArgv method for Initfile-class
parent
d71df77e
Changes
4
Hide whitespace changes
Inline
Side-by-side
AMDiS/AMDiSConfig.cmake.in
View file @
bf5b2316
...
...
@@ -41,7 +41,7 @@ find_library(_AMDIS_LIB amdis PATHS ${AMDIS_LIBRARY_DIR} ${AMDIS_DIR}/../../lib/
if(_AMDIS_LIB)
get_filename_component(AMDIS_LIBRARY_DIR ${_AMDIS_LIB} PATH CACHE)
set(AMDIS_LIBRARY_DIRS ${AMDIS_LIBRARY_DIR})
set(AMDIS_LIBRARIES "${_AMDIS_LIB};${AMDIS_LIBRARY_DIR}/libcompositeFEM.so" CACHE STRING "amdis libraries")
set(AMDIS_LIBRARIES "${_AMDIS_LIB};${AMDIS_LIBRARY_DIR}/libcompositeFEM.so
;${AMDIS_LIBRARY_DIR}/libreinit.so
" CACHE STRING "amdis libraries")
else()
message(ERROR "could not detect the AMDiS library directory. Please set the variable AMDIS_LIBRARY_DIR to the directory containg the AMDiS library")
endif()
...
...
AMDiS/src/Initfile.cc
View file @
bf5b2316
...
...
@@ -98,10 +98,20 @@ void Initfile::read(istream& in) {
}
};
void
Initfile
::
readArgv
(
int
argc
,
char
**
argv
)
{
for
(
int
i
=
0
;
i
<
argc
;
++
i
)
{
if
(
strcmp
(
"-rs"
,
argv
[
i
])
==
0
)
{
std
::
string
input
(
argv
[
i
+
1
]);
add
(
"argv->rs"
,
input
,
0
);
}
}
}
/// read standard values for output and information of parameter-values
void
Initfile
::
getInternalParameters
()
{
int
val
=
1
0
;
int
val
=
0
;
get
(
"level of information"
,
val
,
0
);
msgInfo
=
val
;
...
...
@@ -113,6 +123,10 @@ void Initfile::getInternalParameters()
get
(
"parameter information"
,
val
,
0
);
paramInfo
=
val
;
val
=
0
;
get
(
"break on missing tag"
,
val
,
0
);
breakOnMissingTag
=
val
;
if
(
msgInfo
==
0
)
paramInfo
=
0
;
};
...
...
AMDiS/src/Initfile.h
View file @
bf5b2316
...
...
@@ -240,6 +240,9 @@ struct Initfile : public std::map< std::string, std::string > {
struct
TagNotFound
:
std
::
invalid_argument
{
TagNotFound
(
std
::
string
m
)
:
std
::
invalid_argument
(
m
)
{}
};
struct
TagNotFoundBreak
:
std
::
invalid_argument
{
// print 'tag not found' and exit
TagNotFoundBreak
(
std
::
string
m
)
:
std
::
invalid_argument
(
m
)
{}
};
/** initialize init-file from file with filename in, read data and save it to singleton-map
* @param in: filename string
...
...
@@ -313,6 +316,9 @@ struct Initfile : public std::map< std::string, std::string > {
set
(
tag
,
value
,
debug_info
);
}
/// rescheduling parameter
static
void
readArgv
(
int
argc
,
char
**
argv
);
/// Returns specified info level
static
int
getMsgInfo
()
{
...
...
@@ -355,7 +361,7 @@ struct Initfile : public std::map< std::string, std::string > {
}
protected:
Initfile
()
:
msgInfo
(
1
0
),
msgWait
(
1
),
paramInfo
(
1
)
{}
Initfile
()
:
msgInfo
(
0
),
msgWait
(
1
),
paramInfo
(
1
)
,
breakOnMissingTag
(
0
)
{}
static
void
initIntern
()
{
if
(
singlett
==
NULL
)
...
...
@@ -371,8 +377,12 @@ protected:
/// return the value of the given tag or throws an exception if the tag does not exist
std
::
string
checkedGet
(
const
std
::
string
&
tag
)
const
{
super
::
const_iterator
it
=
find
(
tag
);
if
(
it
==
end
())
throw
TagNotFound
(
"there is no tag '"
+
tag
+
"'"
);
if
(
it
==
end
())
{
if
(
breakOnMissingTag
==
0
||
msgInfo
<=
2
)
throw
TagNotFound
(
"there is no tag '"
+
tag
+
"'"
);
else
throw
TagNotFoundBreak
(
"required tag '"
+
tag
+
"' not found"
);
}
return
it
->
second
;
}
...
...
@@ -398,7 +408,7 @@ protected:
/// read parameters for msgInfo, msgWait, paramInfo
void
getInternalParameters
();
int
msgInfo
,
msgWait
,
paramInfo
;
int
msgInfo
,
msgWait
,
paramInfo
,
breakOnMissingTag
;
};
...
...
demo/CMakeLists.txt
View file @
bf5b2316
project
(
"amdis_demo"
)
cmake_minimum_required
(
VERSION 2.8
)
set
(
AMDIS_DIR /u/spraetor/amdis-trunk/AMDiS_seq/share/amdis
)
#find_package(AMDIS REQUIRED COMPONENTS umfpack )
find_package
(
AMDIS REQUIRED
)
...
...
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