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
Aland, Sebastian
amdis
Commits
0f34c01d
Commit
0f34c01d
authored
Oct 22, 2010
by
Naumann, Andreas
Browse files
merged windows port into trunk
parent
3596e3ca
Changes
8
Hide whitespace changes
Inline
Side-by-side
AMDiS/AMDiSConfig.cmake.in
View file @
0f34c01d
...
...
@@ -2,11 +2,11 @@ set(MTL_DIR ${AMDiS_DIR}/mtl4 CACHE PATH "the mtl directory")
set(AMDiS_INCLUDE_DIR ${AMDiS_DIR}/include ${MTL_DIR})
set(AMDiS_LIBRARIES amdis compositeFEM)
set(AMDiS_LIBRARY_DIRS ${AMDiS_DIR}/lib)
find_package(Boost 1.42 REQUIRED)
find_package(Boost 1.42 REQUIRED system iostreams)
if(Boost_FOUND)
set(AMDiS_LIBRARIES ${AMDiS_LIBRARIES} boost_system boost_iostreams)
set(AMDiS_LIBRARY_DIRS ${AMDiS_LIBRARY_DIRS} ${Boost_INCLUDE_DIR})
set(AMDiS_LIBRARIES ${AMDiS_LIBRARIES} ${Boost_LIBRARIES})
set(AMDiS_LIBRARY_DIRS ${AMDiS_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS})
list(APPEND AMDiS_INCLUDE_DIR ${Boost_INCLUDE_DIR})
endif(Boost_FOUND)
set(AMDiS_NEED_PARMETIS @ENABLE_PARMETIS@)
...
...
@@ -31,7 +31,7 @@ if(AMDiS_NEED_UMFPACK)
)
endif(AMDiS_NEED_UMFPACK)
if(${AMDiS_FIND_COMPONENTS} MATCHES umfpack )
if( AMDiS_NEED_UMFPACK )
if(
${
AMDiS_NEED_UMFPACK
}
)
set(AMDiS_LIBRARIES ${AMDiS_LIBRARIES} umfpack blas)
else()
set( AMDiS_umfpack_FOUND FALSE)
...
...
AMDiS/CMakeLists.txt
View file @
0f34c01d
...
...
@@ -6,19 +6,24 @@ set(AMDiS_SOURCE_DIR "${AMDiS_SOURCE_DIR}/src")
#needs: --enable-debug, enable-intel --enable-openmp --enable-parmetis --enable-parallel-domain --enable-umfpack --enable-mkl --enable-boost --enable-marmot
SET
(
LIB_DIR ./lib
)
SET
(
SOURCE_DIR
${
AMDiS_SOURCE_DIR
}
)
#TODO: use the cmake build type
SET
(
MTL_DIR
${
LIB_DIR
}
/mtl4/ CACHE PATH
"mtl4 directory"
)
option
(
ENABLE_DEBUG
"debug"
false
)
#option(ENABLE_INTEL "use intel compiler" false)
option
(
ENABLE_OPENMP
"use openmp"
false
)
option
(
ENABLE_PARMETIS
"use partion of unity and enable parmetis"
false
)
option
(
ENABLE_PARALLEL_DOMAIN
"use parallel domain decomposition"
false
)
SET
(
PETSC_DIR
""
CACHE
STRING
"Petsc directory for parallel domain decomposition"
)
SET
(
PETSC_DIR
""
CACHE
PATH
"Petsc directory for parallel domain decomposition"
)
SET
(
PETSC_ARCH
""
CACHE STRING
"Petsc architecture"
)
option
(
ENABLE_UMFPACK
"use umfpack solver"
false
)
option
(
ENABLE_MKL
"use the mkl"
false
)
SET
(
MKL_DIR
""
CACHE
STRING
"MKL directory"
)
SET
(
MKL_DIR
""
CACHE
PATH
"MKL directory"
)
option
(
ENABLE_DUNE
"use dune"
false
)
SET
(
DUNE_DIR
""
CACHE
STRING
"Dune directory"
)
SET
(
DUNE_DIR
""
CACHE
PATH
"Dune directory"
)
#option(ENABLE_BOOST "use the boost library" false)
option
(
ENABLE_MARMOT
"use marmot"
false
)
option
(
ENABLE_GUI
"compile the gui"
false
)
...
...
@@ -36,6 +41,16 @@ endif(ENABLE_INTEL)
#if(ENABLE_BOOST)
SET
(
COMPILEFLAGS
"
${
COMPILEFLAGS
}
-DHAVE_BOOST=1"
)
find_package
(
Boost 1.42 REQUIRED
)
if
(
Boost_FOUND
)
include_directories
(
${
Boost_INCLUDE_DIR
}
)
message
(
"boost lib-dirs:
${
Boost_LIBRARY_DIRS
}
"
)
message
(
"use the boost dir:
${
Boost_INCLUDE_DIR
}
"
)
if
(
WIN32
)
message
(
"the windows find_boost does not set the boost library paths, please set it"
)
SET
(
Boost_LIBRARY_DIRS CACHE PATH
"The directory containing the boost libraries"
)
endif
(
WIN32
)
link_directories
(
${
Boost_LIBRARY_DIRS
}
)
endif
(
Boost_FOUND
)
#endif(ENABLE_BOOST)
SET
(
LIB_DIR ./lib
)
...
...
@@ -152,7 +167,7 @@ if(ENABLE_PARMETIS)
${
SOURCE_DIR
}
/ParallelProblem.cc
${
SOURCE_DIR
}
/ParMetisPartitioner.cc
${
SOURCE_DIR
}
/PollutionError.cc
)
SET
(
COMPILEFLAGS
"
${
COMPILEFLAGS
}
-DHAVE_PARALLEL_AMDIS=1"
)
INSTALL
(
FILES
${
LIB_DIR
}
/ParMetis-3.1/parmetis.h
INSTALL
(
FILES
${
LIB_DIR
}
/ParMetis-3.1/parmetis.h
${
LIB_DIR
}
/ParMetis-3.1/libparmetis.a
${
LIB_DIR
}
/ParMetis-3.1/libmetis.a
DESTINATION amdis/parmetis
...
...
@@ -186,21 +201,20 @@ endif(ENABLE_OPENMP)
if
(
ENABLE_UMFPACK
)
include_directories
(
${
LIB_DIR
}
/UFconfig
${
LIB_DIR
}
/AMD/Include
${
LIB_DIR
}
/UMFPACK/Include
)
SET
(
COMPILEFLAGS
"
${
COMPILEFLAGS
}
-DHAVE_UMFPACK=1 -DMTL_HAS_UMFPACK"
)
FILE
(
GLOB UMFPACK_HEADERS
"
${
LIB_DIR
}
/UMFPACK/Include/*.h"
)
INSTALL
(
FILES
${
UMFPACK_HEADERS
}
DESTINATION amdis/umfpack/include
)
FILE
(
GLOB UMFPACK_HEADERS
"
${
LIB_DIR
}
/AMD/Include/*.h"
)
INSTALL
(
FILES
${
UMFPACK_HEADERS
}
DESTINATION amdis/amd/include
)
FILE
(
GLOB UMFPACK_HEADERS
"
${
LIB_DIR
}
/UMFPACK/Include/*.h"
)
INSTALL
(
FILES
${
UMFPACK_HEADERS
}
DESTINATION amdis/umfpack/include
)
FILE
(
GLOB HEADERS
"
${
LIB_DIR
}
/
UFconfig
/*.h"
)
INSTALL
(
FILES
${
HEADERS
}
DESTINATION amdis/
ufconfig/
)
FILE
(
GLOB
UMFPACK_
HEADERS
"
${
LIB_DIR
}
/
AMD/Include
/*.h"
)
INSTALL
(
FILES
${
UMFPACK_
HEADERS
}
DESTINATION amdis/
amd/include
)
FILE
(
GLOB HEADERS
"
${
LIB_DIR
}
/UFconfig/
xerbla/
*.h"
)
INSTALL
(
FILES
${
HEADERS
}
DESTINATION amdis/ufconfig/
xerbla
)
FILE
(
GLOB HEADERS
"
${
LIB_DIR
}
/UFconfig/*.h"
)
INSTALL
(
FILES
${
HEADERS
}
DESTINATION amdis/ufconfig/
)
INSTALL
(
FILE
S
${
LIB_DIR
}
/U
MFPACK/Lib/libumfpack.a DESTINATION amdis/umfpack/
)
INSTALL
(
FILES
${
LIB_DIR
}
/AMD/Lib/libamd.a
DESTINATION amdis/
amd/
)
FILE
(
GLOB HEADER
S
"
${
LIB_DIR
}
/U
Fconfig/xerbla/*.h"
)
INSTALL
(
FILES
${
HEADERS
}
DESTINATION amdis/
ufconfig/xerbla
)
INSTALL
(
FILES
${
LIB_DIR
}
/UMFPACK/Lib/libumfpack.a DESTINATION amdis/umfpack/
)
INSTALL
(
FILES
${
LIB_DIR
}
/AMD/Lib/libamd.a DESTINATION amdis/amd/
)
endif
(
ENABLE_UMFPACK
)
if
(
ENABLE_MKL
)
...
...
@@ -221,12 +235,16 @@ SET(COMPOSITE_FEM_SRC ${COMPOSITE_SOURCE_DIR}/CFE_Integration.cc ${COMPOSITE_SOU
${
COMPOSITE_SOURCE_DIR
}
/SubElementAssembler.cc
)
#mtl4 includes
include_directories
(
${
LIB
_DIR
}
/mtl4
)
include_directories
(
${
MTL
_DIR
}
)
include_directories
(
${
SOURCE_DIR
}
)
add_library
(
amdis SHARED
${
AMDIS_SRC
}
${
PARALLEL_AMDIS_SRC
}
${
PARALLEL_DOMAIN_AMDIS_SRC
}
)
add_library
(
compositeFEM SHARED
${
COMPOSITE_FEM_SRC
}
)
target_link_libraries
(
compositeFEM amdis
)
if
(
WIN32
)
SET
(
COMPILEFLAGS
"
${
COMPILEFLAGS
}
-D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS"
)
endif
(
WIN32
)
message
(
"compileflags:
${
COMPILEFLAGS
}
"
)
SET_TARGET_PROPERTIES
(
amdis PROPERTIES COMPILE_FLAGS
"
${
COMPILEFLAGS
}
"
)
if
(
ENABLE_MARMOT
)
...
...
@@ -244,6 +262,8 @@ FILE(GLOB HEADERS "${AMDiS_SOURCE_DIR}/parallel/*.h")
INSTALL
(
FILES
${
HEADERS
}
DESTINATION amdis/include/parallel/
)
FILE
(
GLOB HEADERS
"
${
AMDiS_SOURCE_DIR
}
/time/*.h"
)
INSTALL
(
FILES
${
HEADERS
}
DESTINATION amdis/include/time/
)
FILE
(
GLOB HEADERS
"
${
AMDiS_SOURCE_DIR
}
/itl/*.hpp"
)
INSTALL
(
FILES
${
HEADERS
}
DESTINATION amdis/include/itl
)
configure_file
(
${
AMDiS_BINARY_DIR
}
/AMDiSConfig.cmake.in
${
AMDiS_BINARY_DIR
}
/AMDiSConfig.cmake
...
...
AMDiS/src/Debug.cc
View file @
0f34c01d
...
...
@@ -301,10 +301,17 @@ namespace AMDiS {
}
std
::
cout
<<
"value = 0: "
<<
counter0
<<
std
::
endl
;
#ifdef WIN32
for
(
std
::
map
<
int
,
int
>::
iterator
it
=
counter
.
begin
();
it
!=
counter
.
end
();
++
it
)
std
::
cout
<<
pow
(
10
,
it
->
first
)
<<
" <= values <= "
std
::
cout
<<
pow
(
double
(
10
),
it
->
first
)
<<
" <= values <= "
<<
pow
(
double
(
10
),
it
->
first
+
1
)
<<
": "
<<
it
->
second
<<
std
::
endl
;
#else
for
(
std
::
map
<
int
,
int
>::
iterator
it
=
counter
.
begin
();
it
!=
counter
.
end
();
++
it
)
std
::
cout
<<
pow
(
10
,
it
->
first
)
<<
" <= values <= "
<<
pow
(
10
,
it
->
first
+
1
)
<<
": "
<<
it
->
second
<<
std
::
endl
;
#endif
}
...
...
AMDiS/src/ITL_Solver.h
View file @
0f34c01d
...
...
@@ -33,7 +33,7 @@
#include <boost/numeric/itl/krylov/idr_s.hpp>
#include <boost/numeric/itl/krylov/qmr.hpp>
#include <boost/numeric/itl/krylov/tfqmr.hpp>
#include
<boost/numeric/itl/krylov
/minres.hpp
>
#include
"itl
/minres.hpp
"
namespace
AMDiS
{
...
...
AMDiS/src/MathFunctions.h
View file @
0f34c01d
...
...
@@ -2,7 +2,9 @@
#define AMDIS_MATHFUNCTIONS_H
#include "Global.h"
#include <limits>
using
namespace
std
;
namespace
AMDiS
{
//converts signed distance to phasefield
inline
double
Phi1
(
double
r
,
double
eps
)
{
return
0.5
*
(
1
-
tanh
(
3
*
r
/
eps
));
}
...
...
@@ -18,13 +20,17 @@ namespace AMDiS {
return
0
;
}
//convert Phi1 to r
inline
double
Phi1ToR
(
double
p1
,
double
eps
)
{
return
eps
/
3.0
*
atanh
(
max
(
-
1
+
1.0e-14
,
min
(
1
-
1.0e-14
,
1
-
2
*
p1
))
);
double
x
=
max
(
-
1.0
+
numeric_limits
<
double
>::
epsilon
(),
min
(
1.0
-
numeric_limits
<
double
>::
epsilon
(),
p1
));
return
eps
/
3.0
*
log
((
1
+
x
)
/
(
1
-
x
))
*
0.5
;
}
//convert Phi2 to r
inline
double
Phi2ToR
(
double
p2
,
double
eps
)
{
return
eps
/
3.0
*
atanh
(
max
(
-
1
+
1.0e-14
,
min
(
1
-
1.0e-14
,
1
+
2
*
p2
))
);
double
x
=
max
(
-
1.0
+
numeric_limits
<
double
>::
epsilon
(),
min
(
1.0
-
numeric_limits
<
double
>::
epsilon
(),
1
+
2
*
p2
));
return
eps
/
3.0
*
log
(
(
1
+
x
)
/
(
1
-
x
)
);
}
}
#endif
AMDiS/src/Parameters.cc
View file @
0f34c01d
...
...
@@ -6,7 +6,11 @@
#include <cstring>
#include <sys/types.h>
#include <sys/stat.h>
#ifndef WIN32
#include <unistd.h>
#endif
#include "Parameters.h"
#include "Serializer.h"
...
...
@@ -581,7 +585,9 @@ namespace AMDiS {
lfn
.
insert
(
fpos
,
".#"
);
#ifdef WIN32
int
val
(
0
);
#else
struct
stat
buf
;
int
val
=
lstat
(
lfn
.
c_str
(),
&
buf
);
...
...
@@ -589,6 +595,7 @@ namespace AMDiS {
if
(
buf
.
st_mode
&
S_IFLNK
&&
buf
.
st_size
>
0
)
ERROR_EXIT
(
"Unsaved version of init file exists
\n
"
);
#endif
initIntern
();
if
(
0
==
fn
.
size
())
{
Global
::
init
();
...
...
AMDiS/src/PeriodicBC.h
View file @
0f34c01d
...
...
@@ -34,7 +34,7 @@ namespace AMDiS {
class
DimVecLess
{
public:
bool
operator
()(
const
DimVec
<
T
>
&
v1
,
const
DimVec
<
T
>
&
v2
)
bool
operator
()(
const
DimVec
<
T
>
&
v1
,
const
DimVec
<
T
>
&
v2
)
const
{
int
size
=
v1
.
getSize
();
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
...
...
AMDiS/src/itl/minres.hpp
0 → 100644
View file @
0f34c01d
// Software License for MTL
//
// Copyright (c) 2007 The Trustees of Indiana University.
// 2008 Dresden University of Technology and the Trustees of Indiana University.
// All rights reserved.
// Authors: Peter Gottschling and Andrew Lumsdaine
//
// This file is part of the Matrix Template Library
//
// See also license.mtl.txt in the distribution.
// Written by Thomas Witkowski
#ifndef ITL_MINRES_INCLUDE
#define ITL_MINRES_INCLUDE
#include <boost/numeric/mtl/concept/collection.hpp>
namespace
itl
{
template
<
typename
Matrix
,
typename
Vector
,
typename
LeftPreconditioner
,
typename
RightPreconditioner
,
typename
Iteration
>
int
minres
(
const
Matrix
&
A
,
Vector
&
x
,
const
Vector
&
b
,
const
LeftPreconditioner
&
L
,
const
RightPreconditioner
&
R
,
Iteration
&
iter
)
{
using
std
::
abs
;
using
mtl
::
irange
;
using
mtl
::
imax
;
using
math
::
reciprocal
;
typedef
typename
mtl
::
Collection
<
Vector
>::
value_type
Scalar
;
typedef
typename
mtl
::
Collection
<
Vector
>::
size_type
Size
;
if
(
size
(
b
)
==
0
)
throw
mtl
::
logic_error
(
"empty rhs vector"
);
Scalar
zero
=
math
::
zero
(
b
[
0
]),
one
=
math
::
one
(
b
[
0
]);
Vector
v0
(
size
(
x
),
zero
),
v1
(
b
-
A
*
x
),
v2
(
v1
),
z1
(
solve
(
L
,
v1
)),
z2
(
size
(
x
),
zero
);
Vector
w0
(
size
(
x
),
zero
),
w1
(
size
(
x
),
zero
),
w2
(
size
(
x
),
zero
);
Scalar
s0
(
zero
),
s1
(
zero
),
c0
(
one
),
c1
(
one
),
gamma0
(
one
);
Scalar
gamma1
(
sqrt
(
dot
(
z1
,
v1
))),
gamma2
(
zero
),
eta
(
gamma1
);
Scalar
sigma1
(
one
),
alpha0
(
zero
),
alpha1
(
zero
),
alpha2
(
zero
),
alpha3
(
zero
);
while
(
!
iter
.
finished
(
abs
(
eta
)))
{
z1
*=
reciprocal
(
gamma1
);
v2
=
A
*
z1
;
sigma1
=
dot
(
v2
,
z1
);
v2
+=
-
(
sigma1
/
gamma1
)
*
v1
-
(
gamma1
/
gamma0
)
*
v0
;
z2
=
solve
(
L
,
v2
);
gamma2
=
sqrt
(
dot
(
z2
,
v2
));
alpha0
=
c1
*
sigma1
-
c0
*
s1
*
gamma1
;
alpha1
=
sqrt
(
alpha0
*
alpha0
+
gamma2
*
gamma2
);
alpha2
=
s1
*
sigma1
+
c0
*
c1
*
gamma1
;
alpha3
=
s0
*
gamma1
;
c0
=
c1
;
c1
=
alpha0
/
alpha1
;
s0
=
s1
;
s1
=
gamma2
/
alpha1
;
w2
=
z1
-
alpha3
*
w0
-
alpha2
*
w1
;
w2
*=
reciprocal
(
alpha1
);
x
+=
c1
*
eta
*
w2
;
eta
*=
-
s1
;
w0
=
w1
;
w1
=
w2
;
v0
=
v1
;
v1
=
v2
;
z1
=
z2
;
gamma0
=
gamma1
;
gamma1
=
gamma2
;
++
iter
;
}
return
iter
;
}
}
// namespace itl;
#endif // ITL_MINRES_INCLUDE
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