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
iwr
amdis
Commits
1f9daa76
Commit
1f9daa76
authored
Jan 12, 2011
by
Thomas Witkowski
Browse files
Added some parallel debuging test for periodic boundary conditions.
parent
d5e4c931
Changes
31
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/AdaptInfo.h
View file @
1f9daa76
...
...
@@ -367,7 +367,7 @@ namespace AMDiS {
/// Sets \ref timestepNumber.
inline
void
setTimestepNumber
(
int
num
)
{
timestepNumber
=
AMDiS
::
min
(
nTimesteps
,
num
);
timestepNumber
=
std
::
min
(
nTimesteps
,
num
);
}
/// Returns \ref nTimesteps.
...
...
@@ -379,7 +379,7 @@ namespace AMDiS {
/// Sets \ref nTimesteps.
inline
void
setNumberOfTimesteps
(
int
num
)
{
nTimesteps
=
AMDiS
::
max
(
0
,
num
);
nTimesteps
=
std
::
max
(
0
,
num
);
}
/// Increments \ref timestepNumber by 1;
...
...
AMDiS/src/Boundary.h
View file @
1f9daa76
...
...
@@ -43,4 +43,4 @@ namespace AMDiS {
}
#endif
// _Boundary_H_
#endif
AMDiS/src/CoarseningManager.cc
View file @
1f9daa76
...
...
@@ -45,7 +45,7 @@ namespace AMDiS {
if
(
el
->
getChild
(
0
))
{
// interior node of the tree
int
mark
=
max
(
el
->
getChild
(
0
)
->
getMark
(),
el
->
getChild
(
1
)
->
getMark
());
int
mark
=
std
::
max
(
el
->
getChild
(
0
)
->
getMark
(),
el
->
getChild
(
1
)
->
getMark
());
el
->
setMark
(
std
::
min
(
mark
+
1
,
0
));
}
else
{
// leaf node of the tree
...
...
@@ -63,7 +63,7 @@ namespace AMDiS {
ElInfo
*
elInfo
=
stack
.
traverseFirst
(
mesh
,
-
1
,
Mesh
::
CALL_LEAF_EL
);
while
(
elInfo
)
{
Element
*
el
=
elInfo
->
getElement
();
el
->
setMark
(
max
(
el
->
getMark
(),
0
));
el
->
setMark
(
std
::
max
(
el
->
getMark
(),
0
));
elInfo
=
stack
.
traverseNext
(
elInfo
);
}
}
...
...
AMDiS/src/CoarseningManager1d.cc
View file @
1f9daa76
...
...
@@ -57,7 +57,7 @@ namespace AMDiS {
int
mark0
=
coarsenRecursive
(
dynamic_cast
<
Line
*>
(
const_cast
<
Element
*>
(
parent
->
getChild
(
0
))));
int
mark1
=
coarsenRecursive
(
dynamic_cast
<
Line
*>
(
const_cast
<
Element
*>
(
parent
->
getChild
(
1
))));
mark
=
max
(
mark0
,
mark1
);
mark
=
std
::
max
(
mark0
,
mark1
);
child
[
0
]
=
dynamic_cast
<
Line
*>
(
const_cast
<
Element
*>
(
parent
->
getChild
(
0
)));
child
[
1
]
=
dynamic_cast
<
Line
*>
(
const_cast
<
Element
*>
(
parent
->
getChild
(
1
)));
...
...
AMDiS/src/DOFAdmin.cc
View file @
1f9daa76
...
...
@@ -167,7 +167,7 @@ namespace AMDiS {
usedCount
++
;
if
(
holeCount
>
0
)
holeCount
--
;
sizeUsed
=
max
(
sizeUsed
,
dof
+
1
);
sizeUsed
=
std
::
max
(
sizeUsed
,
dof
+
1
);
return
dof
;
}
...
...
@@ -182,7 +182,7 @@ namespace AMDiS {
if
(
old
>
minsize
)
return
;
int
newval
=
max
(
minsize
,
static_cast
<
int
>
((
dofFree
.
size
()
+
sizeIncrement
)));
int
newval
=
std
::
max
(
minsize
,
static_cast
<
int
>
((
dofFree
.
size
()
+
sizeIncrement
)));
size
=
newval
;
...
...
@@ -324,7 +324,7 @@ namespace AMDiS {
for
(
std
::
list
<
DOFContainer
*>::
iterator
dc
=
dofContainerList
.
begin
();
dc
!=
dofContainerList
.
end
();
++
dc
)
(
*
dc
)
->
compressDofContainer
(
n
,
newDofIndex
);
(
*
dc
)
->
compressDofContainer
(
n
,
newDofIndex
);
}
...
...
AMDiS/src/DOFIterator.h
View file @
1f9daa76
...
...
@@ -173,7 +173,7 @@ namespace AMDiS {
}
/// Dereferntiation of the \ref dofFreeIterator
virtual
bool
isD
OF
Free
()
virtual
bool
isD
of
Free
()
{
return
*
dofFreeIterator
;
}
...
...
AMDiS/src/Error.hh
View file @
1f9daa76
...
...
@@ -77,7 +77,7 @@ namespace AMDiS {
for
(
int
i
=
0
;
i
<
nPoints
;
i
++
)
{
err
=
u_vec
[
i
]
>
uh_vec
[
i
]
?
u_vec
[
i
]
-
uh_vec
[
i
]
:
uh_vec
[
i
]
-
u_vec
[
i
];
maxErr
=
max
(
maxErr
,
err
);
maxErr
=
std
::
max
(
maxErr
,
err
);
}
elInfo
=
stack
.
traverseNext
(
elInfo
);
...
...
AMDiS/src/Global.h
View file @
1f9daa76
...
...
@@ -117,17 +117,6 @@ namespace AMDiS {
// ===== some simple template functions ======================================
/// template<typename T> T max(T a,T b ) {return ((a) > (b) ? (a) : (b));}
template
<
typename
T
,
typename
S
>
inline
T
max
(
T
a
,
S
b
)
{
return
((
a
)
>
(
b
)
?
(
a
)
:
(
b
));
}
template
<
typename
T
>
inline
T
min
(
T
a
,
T
b
)
{
return
((
a
)
<
(
b
))
?
(
a
)
:
(
b
);
}
template
<
typename
T
>
inline
T
abs
(
T
a
)
{
return
((
a
)
>=
0
?
(
a
)
:
-
(
a
));
...
...
AMDiS/src/MathFunctions.h
View file @
1f9daa76
...
...
@@ -42,15 +42,17 @@ namespace AMDiS {
return
0
;
}
inline
double
Phi1ToR
(
double
p1
,
double
eps
)
{
double
x
=
max
(
-
1.0
+
numeric_limits
<
double
>::
epsilon
(),
min
(
1.0
-
numeric_limits
<
double
>::
epsilon
(),
p1
));
inline
double
Phi1ToR
(
double
p1
,
double
eps
)
{
double
x
=
std
::
max
(
-
1.0
+
numeric_limits
<
double
>::
epsilon
(),
std
::
min
(
1.0
-
numeric_limits
<
double
>::
epsilon
(),
p1
));
return
eps
/
3.0
*
log
((
1
+
x
)
/
(
1
-
x
))
*
0.5
;
}
inline
double
Phi2ToR
(
double
p2
,
double
eps
)
{
double
x
=
max
(
-
1.0
+
numeric_limits
<
double
>::
epsilon
(),
min
(
1.0
-
numeric_limits
<
double
>::
epsilon
(),
1
+
2
*
p2
));
inline
double
Phi2ToR
(
double
p2
,
double
eps
)
{
double
x
=
std
::
max
(
-
1.0
+
numeric_limits
<
double
>::
epsilon
(),
std
::
min
(
1.0
-
numeric_limits
<
double
>::
epsilon
(),
1
+
2
*
p2
));
return
eps
/
3.0
*
log
(
(
1
+
x
)
/
(
1
-
x
)
);
}
...
...
AMDiS/src/Mesh.cc
View file @
1f9daa76
...
...
@@ -102,9 +102,12 @@ namespace AMDiS {
changeIndex
(
0
),
final_lambda
(
dimension
,
DEFAULT_VALUE
,
0.0
)
{
FUNCNAME
(
"Mesh::Mesh()"
);
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
nParallelPreRefinements
=
0
;
#endif
// set default element prototype
switch
(
dim
)
{
case
1
:
...
...
@@ -1248,42 +1251,41 @@ namespace AMDiS {
// nMacroElements * 2^gr >= nProcs * 10
// => gr = log_2(nProcs * 10 / nMacroElements)
double
tmp
=
10.0
*
MPI
::
COMM_WORLD
.
Get_size
()
/
nMacroElements
;
int
nrRefine
=
ceil
(
log
(
tmp
)
/
log
(
2
));
if
(
nrRefine
<
0
)
nrRefine
=
0
;
double
scale
=
10.0
*
MPI
::
COMM_WORLD
.
Get_size
()
/
nMacroElements
;
nParallelPreRefinements
=
static_cast
<
int
>
(
std
::
max
(
0.0
,
ceil
(
log
(
scale
)
/
log
(
2
))));
if
(
dim
==
3
)
{
int
newElType
=
(
elType
+
n
r
Refine
)
%
3
;
int
newElType
=
(
elType
+
n
ParallelPre
Refine
ments
)
%
3
;
switch
(
newElType
)
{
case
1
:
if
(
n
r
Refine
>
0
)
n
r
Refine
--
;
if
(
n
ParallelPre
Refine
ments
>
0
)
n
ParallelPre
Refine
ments
--
;
else
n
r
Refine
=
2
;
n
ParallelPre
Refine
ments
=
2
;
break
;
case
2
:
n
r
Refine
++
;
n
ParallelPre
Refine
ments
++
;
break
;
}
TEST_EXIT
((
elType
+
nrRefine
)
%
3
==
0
)(
"This should not happen!
\n
"
);
TEST_EXIT
((
elType
+
nParallelPreRefinements
)
%
3
==
0
)
(
"This should not happen!
\n
"
);
}
// === Check if number of pre refinements is set ini init file. ===
int
nPreRefine
=
0
;
GET_PARAMETER
(
0
,
"parallel->pre refine"
,
"%d"
,
&
nPreRefine
);
if
(
nPreRefine
!=
0
)
{
int
tmp
=
0
;
GET_PARAMETER
(
0
,
"parallel->pre refine"
,
"%d"
,
&
tmp
);
if
(
tmp
!=
0
)
{
MSG
(
"Calculated %d pre refines to be useful, but %d are set in init file!
\n
"
,
n
rRefine
,
nPreRefine
);
n
rRefine
=
nPreRefine
;
n
ParallelPreRefinements
,
tmp
);
n
ParallelPreRefinements
=
tmp
;
}
// === If we do not need to refine the mesh, return back. ===
if
(
n
r
Refine
==
0
)
if
(
n
ParallelPre
Refine
ments
==
0
)
return
;
...
...
@@ -1323,7 +1325,7 @@ namespace AMDiS {
else
refManager
=
new
RefinementManager3d
();
refManager
->
globalRefine
(
&
testMesh
,
n
r
Refine
);
refManager
->
globalRefine
(
&
testMesh
,
n
ParallelPre
Refine
ments
);
delete
refManager
;
Lagrange
*
basFcts
=
Lagrange
::
getLagrange
(
dim
,
1
);
...
...
@@ -1348,21 +1350,20 @@ namespace AMDiS {
int
globalRefinements
=
0
;
GET_PARAMETER
(
0
,
name
+
"->global refinements"
,
"%d"
,
&
globalRefinements
);
if
(
globalRefinements
<
n
r
Refine
)
if
(
globalRefinements
<
n
ParallelPre
Refine
ments
)
globalRefinements
=
0
;
else
globalRefinements
-=
n
r
Refine
;
globalRefinements
-=
n
ParallelPre
Refine
ments
;
std
::
stringstream
oss
;
oss
<<
globalRefinements
;
ADD_PARAMETER
(
0
,
name
+
"->global refinements"
,
oss
.
str
().
c_str
());
// === Print a note to the screen that another mesh file will be used. ===
MSG
(
"The macro mesh file
\"
%s
\"
was refined %d times and stored to file
\"
%s
\"
.
\n
"
,
macroFilename
.
c_str
(),
n
r
Refine
,
newMacroFilename
.
str
().
c_str
());
macroFilename
.
c_str
(),
n
ParallelPre
Refine
ments
,
newMacroFilename
.
str
().
c_str
());
macroFilename
=
newMacroFilename
.
str
();
if
(
periodicFilename
!=
""
)
...
...
AMDiS/src/Mesh.h
View file @
1f9daa76
...
...
@@ -608,6 +608,21 @@ namespace AMDiS {
///
void
deleteMeshStructure
();
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
/// In parallel computations the level of all macro elements is equal to the number
/// of global pre refinements, \ref nParallelPreRefinements.
inline
int
getMacroElementLevel
()
{
return
nParallelPreRefinements
;
}
#else
/// In sequentiel computations the level of all macro elements is always 0.
inline
int
getMacroElementLevel
()
{
return
0
;
}
#endif
public:
///
static
const
Flag
FILL_NOTHING
;
...
...
@@ -702,6 +717,12 @@ namespace AMDiS {
void
checkParallelMacroFile
(
std
::
string
&
macroFilename
,
std
::
string
&
periodicFilename
,
int
check
);
/// Returns \ref nParallelPreRefinements
int
getParallelPreRefinements
()
const
{
return
nParallelPreRefinements
;
}
#endif
protected:
...
...
@@ -855,6 +876,13 @@ namespace AMDiS {
*/
long
changeIndex
;
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
/// In parallel computations the mesh may be globally prerefined to achieve a fine
/// enought starting mesh for the given number of ranks. The value of the variable
/// will be defined in function \ref checkParallelMacroFile.
int
nParallelPreRefinements
;
#endif
protected:
/// for findElement-Fcts
DimVec
<
double
>
final_lambda
;
...
...
AMDiS/src/Operator.cc
View file @
1f9daa76
...
...
@@ -53,7 +53,7 @@ namespace AMDiS {
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
terms
->
size
());
i
++
)
{
OperatorTerm
*
term
=
(
*
terms
)[
i
];
maxTermDegree
=
max
(
maxTermDegree
,
term
->
degree
);
maxTermDegree
=
std
::
max
(
maxTermDegree
,
term
->
degree
);
}
return
psiDegree
+
phiDegree
-
order
+
maxTermDegree
;
...
...
AMDiS/src/Parameters.cc
View file @
1f9daa76
...
...
@@ -50,7 +50,7 @@ namespace AMDiS {
if
(
Parameters
::
singlett
->
paramInfo
)
{
if
(
Parameters
::
singlett
->
paramInfo
>
1
)
info
=
max
(
info
,
Parameters
::
singlett
->
paramInfo
-
1
);
info
=
std
::
max
(
info
,
Parameters
::
singlett
->
paramInfo
-
1
);
}
else
{
info
=
0
;
}
...
...
AMDiS/src/RefinementManager1d.cc
View file @
1f9daa76
...
...
@@ -41,7 +41,7 @@ namespace AMDiS {
child
[
0
]
=
dynamic_cast
<
Line
*>
(
mesh
->
createNewElement
(
el
));
child
[
1
]
=
dynamic_cast
<
Line
*>
(
mesh
->
createNewElement
(
el
));
int
mark
=
max
(
0
,
el
->
getMark
()
-
1
);
int
mark
=
std
::
max
(
0
,
el
->
getMark
()
-
1
);
child
[
0
]
->
setMark
(
mark
);
child
[
1
]
->
setMark
(
mark
);
el
->
setMark
(
0
);
...
...
AMDiS/src/RefinementManager2d.cc
View file @
1f9daa76
...
...
@@ -257,7 +257,7 @@ namespace AMDiS {
child
[
0
]
=
dynamic_cast
<
Triangle
*>
(
mesh
->
createNewElement
(
el
));
child
[
1
]
=
dynamic_cast
<
Triangle
*>
(
mesh
->
createNewElement
(
el
));
int
newMark
=
max
(
0
,
el
->
getMark
()
-
1
);
int
newMark
=
std
::
max
(
0
,
el
->
getMark
()
-
1
);
child
[
0
]
->
setMark
(
newMark
);
child
[
1
]
->
setMark
(
newMark
);
el
->
setMark
(
0
);
...
...
@@ -334,7 +334,7 @@ namespace AMDiS {
int
opp_vertex
=
(
*
elInfo
)
->
getOppVertex
(
2
);
ElInfo
*
neigh_info
=
stack
->
traverseNeighbour2d
(
*
elInfo
,
2
);
neigh_info
->
getElement
()
->
setMark
(
max
(
neigh_info
->
getElement
()
->
getMark
(),
1
));
neigh_info
->
getElement
()
->
setMark
(
std
::
max
(
neigh_info
->
getElement
()
->
getMark
(),
1
));
neigh_info
=
refineFunction
(
neigh_info
);
// === Now go back to the original element and refine the patch. ===
...
...
AMDiS/src/RefinementManager3d.cc
View file @
1f9daa76
...
...
@@ -25,6 +25,7 @@
#include
"DOFVector.h"
#include
"PeriodicBC.h"
#include
"VertexVector.h"
#include
"Debug.h"
namespace
AMDiS
{
...
...
@@ -41,7 +42,7 @@ namespace AMDiS {
child
[
0
]
=
dynamic_cast
<
Tetrahedron
*>
(
mesh
->
createNewElement
(
el
));
child
[
1
]
=
dynamic_cast
<
Tetrahedron
*>
(
mesh
->
createNewElement
(
el
));
int
mark
=
max
(
0
,
el
->
getMark
()
-
1
);
int
mark
=
std
::
max
(
0
,
el
->
getMark
()
-
1
);
child
[
0
]
->
setMark
(
mark
);
child
[
1
]
->
setMark
(
mark
);
el
->
setMark
(
0
);
...
...
@@ -249,6 +250,8 @@ namespace AMDiS {
int
RefinementManager3d
::
newCoordsFct
(
ElInfo
*
el_info
)
{
FUNCNAME
(
"RefinementManager3d::newCoordsFct()"
);
Element
*
el
=
el_info
->
getElement
();
DegreeOfFreedom
*
edge
[
2
];
ElInfo
*
elinfo
=
el_info
;
...
...
@@ -474,7 +477,7 @@ namespace AMDiS {
// Only 0 can be a compatible commen refinement edge. Thus, neigh has not
// a compatible refinement edge. Refine it first.
neigh
->
setMark
(
max
(
neigh
->
getMark
(),
1
));
neigh
->
setMark
(
std
::
max
(
neigh
->
getMark
(),
1
));
neighInfo
=
refineFunction
(
neighInfo
);
...
...
AMDiS/src/ResidualEstimator.cc
View file @
1f9daa76
...
...
@@ -256,7 +256,7 @@ namespace AMDiS {
el
->
setEstimation
(
est_el
,
row
);
el
->
setMark
(
0
);
est_sum
+=
est_el
;
est_max
=
max
(
est_max
,
est_el
);
est_max
=
std
::
max
(
est_max
,
est_el
);
}
...
...
@@ -295,7 +295,7 @@ namespace AMDiS {
}
double
v
=
C3
*
det
*
result
;
est_t_sum
+=
v
;
est_t_max
=
max
(
est_t_max
,
v
);
est_t_max
=
std
::
max
(
est_t_max
,
v
);
}
}
}
...
...
AMDiS/src/Tetrahedron.h
View file @
1f9daa76
...
...
@@ -274,7 +274,7 @@ namespace AMDiS {
DegreeOfFreedom
dof0
=
dof
[
vertexOfEdge
[
localEdgeIndex
][
0
]][
0
];
DegreeOfFreedom
dof1
=
dof
[
vertexOfEdge
[
localEdgeIndex
][
1
]][
0
];
DofEdge
edge
=
std
::
make_pair
(
min
(
dof0
,
dof1
),
max
(
dof0
,
dof1
));
DofEdge
edge
=
std
::
make_pair
(
std
::
min
(
dof0
,
dof1
),
std
::
max
(
dof0
,
dof1
));
return
edge
;
}
...
...
AMDiS/src/Triangle.h
View file @
1f9daa76
...
...
@@ -178,7 +178,7 @@ namespace AMDiS {
DegreeOfFreedom
dof0
=
dof
[
vertexOfEdge
[
localEdgeIndex
][
0
]][
0
];
DegreeOfFreedom
dof1
=
dof
[
vertexOfEdge
[
localEdgeIndex
][
1
]][
0
];
DofEdge
edge
=
std
::
make_pair
(
min
(
dof0
,
dof1
),
max
(
dof0
,
dof1
));
DofEdge
edge
=
std
::
make_pair
(
std
::
min
(
dof0
,
dof1
),
std
::
max
(
dof0
,
dof1
));
return
edge
;
}
...
...
AMDiS/src/VertexVector.cc
View file @
1f9daa76
...
...
@@ -26,29 +26,33 @@ namespace AMDiS {
const_cast
<
DOFAdmin
*>
(
admin
)
->
addDOFContainer
(
this
);
}
VertexVector
::~
VertexVector
()
{
const_cast
<
DOFAdmin
*>
(
admin
)
->
removeDOFIndexed
(
this
);
const_cast
<
DOFAdmin
*>
(
admin
)
->
removeDOFContainer
(
this
);
}
void
VertexVector
::
set
(
DegreeOfFreedom
val
)
{
DOFIteratorBase
it
(
const_cast
<
DOFAdmin
*>
(
admin
),
USED_DOFS
);
for
(
it
.
reset
();
!
it
.
end
();
++
it
)
if
(
!
it
.
isD
OF
Free
())
if
(
!
it
.
isD
of
Free
())
operator
[](
it
.
getDOFIndex
())
=
val
;
}
void
VertexVector
::
print
()
{
DOFIteratorBase
it
(
const_cast
<
DOFAdmin
*>
(
admin
),
USED_DOFS
);
for
(
it
.
reset
();
!
it
.
end
();
++
it
)
if
(
!
it
.
isD
OF
Free
())
if
(
!
it
.
isD
of
Free
())
std
::
cout
<<
"DOF "
<<
it
.
getDOFIndex
()
<<
" -> "
<<
operator
[](
it
.
getDOFIndex
())
<<
"
\n
"
;
}
void
VertexVector
::
changeDofIndices
(
std
::
map
<
int
,
int
>&
dofIndexMap
)
{
FUNCNAME
(
"VertexVector::changedofIndices()"
);
...
...
Prev
1
2
Next
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