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
3d5c3720
Commit
3d5c3720
authored
Mar 05, 2013
by
Praetorius, Simon
Browse files
windows compatibility changes
parent
e0d9f8a0
Changes
6
Hide whitespace changes
Inline
Side-by-side
extensions/BoundaryFunctions.h
View file @
3d5c3720
...
...
@@ -86,7 +86,7 @@ public:
BoundaryFct2
()
:
AbstractFunction
<
double
,
WorldVector
<
double
>
>
(
1
),
y
(
0.205
),
c
(
6.0
)
{};
BoundaryFct2
(
double
y_
,
double
c_
)
:
AbstractFunction
<
double
,
WorldVector
<
double
>
>
(
1
),
y
(
y_
),
c
(
c_
)
{};
double
operator
()(
const
WorldVector
<
double
>&
x
)
const
{
return
1.0
/
sqr
(
2.0
*
y
)
*
sin
(
M_PI
*
(
*
timePtr
)
/
8.0
)
*
c
*
(
y
+
x
[
1
])
*
(
y
-
x
[
1
]);
return
1.0
/
sqr
(
2.0
*
y
)
*
sin
(
m_pi
*
(
*
timePtr
)
/
8.0
)
*
c
*
(
y
+
x
[
1
])
*
(
y
-
x
[
1
]);
};
protected:
double
y
,
c
;
...
...
@@ -98,7 +98,7 @@ public:
BoundaryFct2_robin
()
:
AbstractFunction
<
double
,
WorldVector
<
double
>
>
(
1
),
y
(
0.205
),
c
(
6.0
)
{};
BoundaryFct2_robin
(
double
y_
,
double
c_
)
:
AbstractFunction
<
double
,
WorldVector
<
double
>
>
(
1
),
y
(
y_
),
c
(
c_
)
{};
double
operator
()(
const
WorldVector
<
double
>&
x
)
const
{
double
result
=
1.0
/
sqr
(
2.0
*
y
)
*
sin
(
M_PI
*
(
*
timePtr
)
/
8.0
)
*
c
*
(
y
+
x
[
1
])
*
(
y
-
x
[
1
]);
double
result
=
1.0
/
sqr
(
2.0
*
y
)
*
sin
(
m_pi
*
(
*
timePtr
)
/
8.0
)
*
c
*
(
y
+
x
[
1
])
*
(
y
-
x
[
1
]);
double
n
=
(
x
[
0
]
<
0.0
?-
1.0
:
1.0
);
return
-
1.0
*
result
*
n
;
};
...
...
@@ -116,8 +116,8 @@ class StokesFlow : public AbstractFunction<WorldVector<double>, WorldVector<doub
Initfile
::
get
(
"user parameter->colloidal radius"
,
R
,
1
);
Initfile
::
get
(
"pfc-parameter->density"
,
density
,
1
);
Initfile
::
get
(
"pfc-parameter->r"
,
r
,
1
);
radius
=
R
/
(
1.0
-
R
)
*
2.0
*
M_PI
/
sqrt
(
3.0
);
D
=
radius
+
2.0
*
M_PI
/
sqrt
(
3.0
);
radius
=
R
/
(
1.0
-
R
)
*
2.0
*
m_pi
/
sqrt
(
3.0
);
D
=
radius
+
2.0
*
m_pi
/
sqrt
(
3.0
);
center
.
set
(
0.0
);
Initfile
::
get
(
"user parameter->colloids position[0]"
,
center
,
1
);
...
...
@@ -152,8 +152,8 @@ class StokesFlow_component : public AbstractFunction<double, WorldVector<double>
Initfile
::
get
(
"user parameter->colloidal radius"
,
R
,
1
);
Initfile
::
get
(
"pfc-parameter->density"
,
density
,
1
);
Initfile
::
get
(
"pfc-parameter->r"
,
r
,
1
);
radius
=
R
/
(
1.0
-
R
)
*
2.0
*
M_PI
/
sqrt
(
3.0
);
D
=
radius
+
2.0
*
M_PI
/
sqrt
(
3.0
);
radius
=
R
/
(
1.0
-
R
)
*
2.0
*
m_pi
/
sqrt
(
3.0
);
D
=
radius
+
2.0
*
m_pi
/
sqrt
(
3.0
);
center
.
set
(
0.0
);
Initfile
::
get
(
"user parameter->colloids position[0]"
,
center
,
1
);
...
...
@@ -189,8 +189,8 @@ class StokesFlow_robin : public AbstractFunction<double, WorldVector<double> >
Initfile
::
get
(
"user parameter->colloidal radius"
,
R
,
1
);
Initfile
::
get
(
"pfc-parameter->density"
,
density
,
1
);
Initfile
::
get
(
"pfc-parameter->r"
,
r
,
1
);
radius
=
R
/
(
1.0
-
R
)
*
2.0
*
M_PI
/
sqrt
(
3.0
);
D
=
radius
+
2.0
*
M_PI
/
sqrt
(
3.0
);
radius
=
R
/
(
1.0
-
R
)
*
2.0
*
m_pi
/
sqrt
(
3.0
);
D
=
radius
+
2.0
*
m_pi
/
sqrt
(
3.0
);
center
.
set
(
0.0
);
Initfile
::
get
(
"user parameter->colloids position[0]"
,
center
,
1
);
...
...
extensions/Helpers.h
View file @
3d5c3720
...
...
@@ -9,15 +9,22 @@
#include
"parallel/StdMpi.h"
#endif
#ifdef _WIN32
#include
<io.h>
#else
#include
<unistd.h>
#endif
#include
<ios>
#include
<iostream>
#include
<fstream>
#include
<string>
#include
<boost/numeric/mtl/mtl.hpp>
#include
<boost/numeric/itl/itl.hpp>
#include
"boost/lexical_cast.hpp"
#include
"boost/date_time/posix_time/posix_time.hpp"
#include
<boost/math/special_functions/fpclassify.hpp>
#include
<time.h>
#include
<stdarg.h>
...
...
@@ -53,11 +60,21 @@ namespace Helpers {
inline
int
signum
(
int
val
)
{
return
val
>
0
?
1
:
(
val
<
0
?
-
1
:
0
);
}
inline
int
signum
(
bool
val
)
{
return
val
?
1
:
-
1
;
}
inline
int
toInt
(
bool
val
)
{
return
val
?
1
:
0
;
}
inline
bool
isNumber
(
double
val
)
{
return
!
isnan
(
val
)
&&
!
isinf
(
val
);
}
inline
bool
isNumber
(
double
val
)
{
return
!
boost
::
math
::
isnan
(
val
)
&&
!
boost
::
math
::
isinf
(
val
);
}
inline
bool
toBool
(
double
val
,
double
tol
=
DBL_TOL
)
{
return
val
>
tol
||
val
<
-
tol
?
true
:
false
;
}
inline
bool
isPositiv
(
double
val
,
double
tol
=
DBL_TOL
)
{
return
val
>
-
tol
;
}
inline
bool
isStrictPositiv
(
double
val
,
double
tol
=
DBL_TOL
)
{
return
val
>
tol
;
}
template
<
typename
T
>
T
atanh
(
T
x
)
{
#ifndef _WIN32
return
atanh
(
x
);
#else
return
0.5
*
log
((
1.0
+
x
)
/
(
1.0
-
x
));
#endif
}
// routines for conversion to string
// =================================
...
...
@@ -302,13 +319,6 @@ namespace Helpers {
// =============
void
plot
(
std
::
vector
<
double
>
&
values
,
int
numRows
=
7
,
int
numCols
=
20
,
std
::
string
symbol
=
"*"
);
// process_mem_usage(double &, double &) - takes two doubles by reference,
// attempts to read the system-dependent data for a process' virtual memory
// size and resident set size, and return the results in KB.
//
// On failure, returns 0.0, 0.0
void
process_mem_usage
(
double
&
vm_usage
,
double
&
resident_set
);
inline
long
getMicroTimestamp
()
{
using
namespace
boost
::
posix_time
;
...
...
extensions/MetaTools.h
View file @
3d5c3720
...
...
@@ -208,6 +208,7 @@ namespace tools {
/// \brief
/// template to compute the Nth root of a via iteration
///
#ifndef _WIN32
template
<
int
a
,
int
N
,
int
I
=
1
>
struct
Root
{
// instantiate next step or result type as branch
...
...
@@ -230,7 +231,7 @@ namespace tools {
BOOST_STATIC_CONSTANT
(
int
,
value
=
0
);
};
/**@}*/
#endif
// ______________________________________________________________________________________________________
// monomials and polynomials
...
...
@@ -340,7 +341,7 @@ namespace tools {
// ______________________________________________________________________________________________________
// Bezier-Polynomial
#ifndef _WIN32
namespace
details
{
// sum_{I=0}^N B_I^N(x)*c_I
...
...
@@ -426,7 +427,7 @@ namespace tools {
private:
Coefficients
&
coefficients
;
// p in points is element of result_type
};
#endif
// ______________________________________________________________________________________________________
// for loops: for<i, n [,{incr,decr}]>, for<mpl::range_c>, for<mpl::vector_c>
...
...
extensions/PhaseFieldConvert.h
View file @
3d5c3720
...
...
@@ -3,6 +3,8 @@
#ifndef PHASE_FIELD_CONVERT_H
#define PHASE_FIELD_CONVERT_H
#include
"Helpers.h"
using
namespace
AMDiS
;
/// \brief
...
...
@@ -180,7 +182,7 @@ struct PhaseFieldToSignedDist : AbstractFunction<double, double>
double
operator
()(
const
double
&
phi
)
const
{
double
z
=
std
::
max
(
-
1.0
+
1.e-12
,
std
::
min
(
1.0
-
1.e-12
,
-
phi
));
return
(
epsilon
/
scalingFactor
)
*
atanh
(
z
);
return
(
epsilon
/
scalingFactor
)
*
Helpers
::
atanh
(
z
);
}
private:
...
...
extensions/SignedDistFunctors.h
View file @
3d5c3720
...
...
@@ -50,7 +50,7 @@ static double signedDist2D(const WorldVector<double> x, const WorldVector<double
if
(
x_trans
[
0
]
>=
0.0
)
{
alpha
=
acos
(
x_trans
[
0
]
/
norm_xy
);
}
else
{
alpha
=
2.0
*
M_PI
-
acos
(
x_trans
[
0
]
/
norm_xy
);
alpha
=
2.0
*
m_pi
-
acos
(
x_trans
[
0
]
/
norm_xy
);
}
return
(
norm_xy
-
(
*
radius
)(
alpha
));
...
...
@@ -79,9 +79,9 @@ static double signedDist3D(const WorldVector<double> x, const WorldVector<double
if
(
x_trans
[
1
]
>=
0
)
{
alpha
=
acos
(
x_trans
[
0
]
/
norm_xy
);
}
else
{
alpha
=
2.0
*
M_PI
-
acos
(
x_trans
[
0
]
/
norm_xy
);
alpha
=
2.0
*
m_pi
-
acos
(
x_trans
[
0
]
/
norm_xy
);
}
beta
=
0.5
*
M_PI
-
atan
(
x_trans
[
2
]
/
norm_xy
);
beta
=
0.5
*
m_pi
-
atan
(
x_trans
[
2
]
/
norm_xy
);
return
(
norm_xyz
-
(
*
radius
)(
alpha
,
beta
));
};
...
...
extensions/VectorOperations.h
View file @
3d5c3720
...
...
@@ -10,7 +10,6 @@
#include
"parallel/StdMpi.h"
#endif
#include
<unistd.h>
#include
<ios>
#include
<iostream>
#include
<fstream>
...
...
@@ -192,7 +191,8 @@ namespace vector_operations {
{
typedef
void
matrix_void_type
;
void
operator
()(
WorldMatrix
<
Value
>&
v
,
size_t
r
,
size_t
c
)
{
TEST_EXIT
(
Global
::
getGeo
(
WORLD
)
==
r
&&
Global
::
getGeo
(
WORLD
)
==
c
)
size_t
dow
=
static_cast
<
size_t
>
(
Global
::
getGeo
(
WORLD
));
TEST_EXIT
(
dow
==
r
&&
dow
==
c
)
(
"WorldMatrices can not be resized!
\n
"
);
}
};
...
...
@@ -589,14 +589,14 @@ namespace vector_operations {
std
::
vector
<
pair
<
T1
,
T2
>
>
order
(
vec1
.
size
());
// create vector of pairs
for
(
in
t
i
=
0
;
i
<
vec1
.
size
();
++
i
)
for
(
size_
t
i
=
0
;
i
<
vec1
.
size
();
++
i
)
order
[
i
]
=
make_pair
(
vec1
[
i
],
vec2
[
i
]);
// sort vector of pairs
sort
(
order
.
begin
(),
order
.
end
(),
comp
);
// copy sorted pairs back to vectors
for
(
in
t
i
=
0
;
i
<
vec1
.
size
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
vec1
.
size
();
++
i
)
{
vec1
[
i
]
=
order
[
i
].
first
;
vec2
[
i
]
=
order
[
i
].
second
;
}
...
...
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