Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
amdis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iwr
amdis
Commits
68712ed4
Commit
68712ed4
authored
13 years ago
by
Praetorius, Simon
Browse files
Options
Downloads
Patches
Plain Diff
Initfiles with arithmetic expressions
parent
c514d77b
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
AMDiS/AMDiSConfig.cmake.in
+2
-1
2 additions, 1 deletion
AMDiS/AMDiSConfig.cmake.in
AMDiS/CMakeLists.txt
+13
-1
13 additions, 1 deletion
AMDiS/CMakeLists.txt
AMDiS/src/Initfile.h
+29
-3
29 additions, 3 deletions
AMDiS/src/Initfile.h
demo/CMakeLists.txt
+1
-0
1 addition, 0 deletions
demo/CMakeLists.txt
with
45 additions
and
5 deletions
AMDiS/AMDiSConfig.cmake.in
+
2
−
1
View file @
68712ed4
...
...
@@ -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;${AMDIS_LIBRARY_DIR}/libreinit.so" CACHE STRING "amdis libraries")
set(AMDIS_LIBRARIES "${_AMDIS_LIB};${AMDIS_LIBRARY_DIR}/libcompositeFEM.so;${AMDIS_LIBRARY_DIR}/libreinit.so
;${AMDIS_LIBRARY_DIR}/libmuparser.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()
...
...
@@ -129,6 +129,7 @@ endif(AMDiS_NEED_UMFPACK)
#add directories for reinit
list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/reinit)
list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/compositeFEM)
list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/muparser)
if(${AMDIS_FIND_COMPONENTS} MATCHES umfpack )
if( NOT AMDiS_NEED_UMFPACK )
...
...
This diff is collapsed.
Click to expand it.
AMDiS/CMakeLists.txt
+
13
−
1
View file @
68712ed4
...
...
@@ -336,6 +336,12 @@ set(REINIT_SOURCE_DIR ${SOURCE_DIR}/reinit)
file
(
GLOB REINIT_SRC
${
REINIT_SOURCE_DIR
}
/*.cc
)
include_directories
(
${
REINIT_SOURCE_DIR
}
)
#muparser includes
set
(
MUPARSER_SOURCE_DIR
${
AMDiS_SOURCE_DIR
}
/lib/muparser_v134
)
file
(
GLOB MUPARSER_SRC
${
MUPARSER_SOURCE_DIR
}
/src/*.cpp
)
list
(
APPEND AMDiS_INCLUDE_DIRS
${
MUPARSER_SOURCE_DIR
}
/include
)
#mtl4 includes
list
(
APPEND AMDiS_INCLUDE_DIRS
${
MTL_INCLUDE_DIR
}
)
#include_directories(${MTL_INCLUDE_DIR})
...
...
@@ -346,6 +352,7 @@ include_directories(${AMDiS_INCLUDE_DIRS})
add_library
(
amdis SHARED
${
AMDIS_SRC
}
${
PARALLEL_DOMAIN_AMDIS_SRC
}
)
add_library
(
compositeFEM SHARED
${
COMPOSITE_FEM_SRC
}
)
add_library
(
reinit SHARED
${
REINIT_SRC
}
)
add_library
(
muparser SHARED
${
MUPARSER_SRC
}
)
#target_link_libraries(compositeFEM amdis)
#target_link_libraries(reinit amdis)
list
(
APPEND AMDiS_LIBS amdis
${
Boost_LIBRARIES
}
)
...
...
@@ -406,8 +413,13 @@ INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/compositeFEM
)
list
(
APPEND deb_add_dirs
"include/amdis/compositeFEM"
)
FILE
(
GLOB HEADERS
"
${
MUPARSER_SOURCE_DIR
}
/include/*.h"
)
INSTALL
(
FILES
${
HEADERS
}
DESTINATION include/amdis/muparser
)
list
(
APPEND deb_add_dirs
"include/amdis/muparser"
)
list
(
APPEND deb_add_dirs
"lib/amdis"
)
install
(
TARGETS amdis compositeFEM reinit
install
(
TARGETS amdis compositeFEM reinit
muparser
LIBRARY DESTINATION lib/amdis/
)
configure_file
(
${
AMDiS_SOURCE_DIR
}
/AMDiSConfig.cmake.in
...
...
This diff is collapsed.
Click to expand it.
AMDiS/src/Initfile.h
+
29
−
3
View file @
68712ed4
...
...
@@ -15,8 +15,12 @@
#include
<boost/algorithm/string/trim.hpp>
#include
<boost/lexical_cast.hpp>
#include
<boost/numeric/conversion/cast.hpp>
#include
<boost/type_traits.hpp>
// a parser for arithmetic expressions
#include
"muParser.h"
namespace
AMDiS
{
...
...
@@ -43,7 +47,18 @@ namespace AMDiS {
WrongValueFormat
(
std
::
string
value
)
:
std
::
runtime_error
(
std
::
string
(
"cannot convert '"
)
+
value
+
std
::
string
(
"' into <"
)
+
name
(
T
())
+
">"
)
{}
};
template
<
typename
T
>
struct
BadArithmeticExpression
:
std
::
runtime_error
{
static
std
::
string
name
(
int
)
{
return
"int"
;
}
static
std
::
string
name
(
bool
)
{
return
"bool"
;
}
static
std
::
string
name
(
double
)
{
return
"double"
;
}
static
std
::
string
name
(
unsigned
int
)
{
return
"unsigned int"
;
}
template
<
typename
G
>
static
std
::
string
name
(
G
)
{
return
std
::
string
(
typeid
(
G
).
name
());
}
BadArithmeticExpression
(
std
::
string
m
,
std
::
string
value
)
:
std
::
runtime_error
(
std
::
string
(
"cannot evaluate expression '"
)
+
value
+
std
::
string
(
"' into <"
)
+
name
(
T
())
+
">
\n
Parser message: '"
+
m
+
"'"
)
{}
};
/// trim std::string
...
...
@@ -125,11 +140,22 @@ namespace AMDiS {
typename
boost
::
disable_if
<
boost
::
is_enum
<
T
>
>::
type
*
p2
=
NULL
)
{
using
boost
::
lexical_cast
;
using
boost
::
numeric_cast
;
mu
::
Parser
parser
;
parser
.
DefineConst
(
_T
(
"M_PI"
),
m_pi
);
parser
.
DefineConst
(
_T
(
"M_E"
),
m_e
);
try
{
value
=
lexical_cast
<
T
>
(
trim
(
valStr
));
}
catch
(
boost
::
bad_lexical_cast
e
)
{
parser
.
SetExpr
(
valStr
);
// value = lexical_cast< T >(trim(valStr));
value
=
numeric_cast
<
T
>
(
parser
.
Eval
());
}
catch
(
boost
::
bad_lexical_cast
e
)
{
throw
WrongValueFormat
<
T
>
(
valStr
);
}
catch
(
boost
::
bad_numeric_cast
e
)
{
throw
WrongValueFormat
<
T
>
(
valStr
);
}
catch
(
mu
::
Parser
::
exception_type
&
e
)
{
throw
BadArithmeticExpression
<
T
>
(
e
.
GetMsg
(),
valStr
);
}
}
...
...
This diff is collapsed.
Click to expand it.
demo/CMakeLists.txt
+
1
−
0
View file @
68712ed4
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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment