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
613caf74
Commit
613caf74
authored
Nov 30, 2010
by
Thomas Witkowski
Browse files
Transfer of DOFVectors in mesh repartitioning.
parent
30c3b864
Changes
8
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/MeshStructure.cc
View file @
613caf74
...
...
@@ -6,6 +6,7 @@
#include
"ElInfo.h"
#include
"RefinementManager.h"
#include
"Debug.h"
#include
"DOFVector.h"
namespace
AMDiS
{
...
...
@@ -356,4 +357,64 @@ namespace AMDiS {
{
return
(
other
.
getCode
()
==
code
);
}
void
MeshStructure
::
getMeshStructureValues
(
Mesh
*
mesh
,
int
macroElIndex
,
const
DOFVector
<
double
>*
vec
,
std
::
vector
<
double
>&
values
)
{
FUNCNAME
(
"MeshStructure::getMeshStructureValues()"
);
values
.
clear
();
TraverseStack
stack
;
ElInfo
*
elInfo
=
stack
.
traverseFirstOneMacro
(
mesh
,
macroElIndex
,
-
1
,
Mesh
::
CALL_EVERY_EL_PREORDER
);
while
(
elInfo
)
{
if
(
elInfo
->
getLevel
()
==
0
)
{
for
(
int
i
=
0
;
i
<
mesh
->
getGeo
(
VERTEX
);
i
++
)
values
.
push_back
((
*
vec
)[
elInfo
->
getElement
()
->
getDof
(
i
,
0
)]);
}
else
{
if
(
!
elInfo
->
getElement
()
->
isLeaf
())
values
.
push_back
((
*
vec
)[
elInfo
->
getElement
()
->
getChild
(
0
)
->
getDof
(
mesh
->
getDim
(),
0
)]);
}
elInfo
=
stack
.
traverseNext
(
elInfo
);
}
}
void
MeshStructure
::
setMeshStructureValues
(
Mesh
*
mesh
,
int
macroElIndex
,
DOFVector
<
double
>*
vec
,
const
std
::
vector
<
double
>&
values
)
{
FUNCNAME
(
"MeshStructure::setMeshStructureValues()"
);
TEST_EXIT_DBG
(
values
.
size
()
>=
mesh
->
getGeo
(
VERTEX
))(
"Should not happen!
\n
"
);
unsigned
int
counter
=
0
;
TraverseStack
stack
;
ElInfo
*
elInfo
=
stack
.
traverseFirstOneMacro
(
mesh
,
macroElIndex
,
-
1
,
Mesh
::
CALL_EVERY_EL_PREORDER
);
while
(
elInfo
)
{
if
(
elInfo
->
getLevel
()
==
0
)
{
for
(
int
i
=
0
;
i
<
mesh
->
getGeo
(
VERTEX
);
i
++
)
(
*
vec
)[
elInfo
->
getElement
()
->
getDof
(
i
,
0
)]
=
values
[
counter
++
];
}
else
{
if
(
!
elInfo
->
getElement
()
->
isLeaf
())
{
TEST_EXIT_DBG
(
counter
<
values
.
size
())(
"Should not happen!
\n
"
);
(
*
vec
)[
elInfo
->
getElement
()
->
getChild
(
0
)
->
getDof
(
mesh
->
getDim
(),
0
)]
=
values
[
counter
++
];
}
}
elInfo
=
stack
.
traverseNext
(
elInfo
);
}
}
}
AMDiS/src/MeshStructure.h
View file @
613caf74
...
...
@@ -150,6 +150,17 @@ namespace AMDiS {
/// Returns true, if the given mesh structure code is equal to this one.
bool
compare
(
MeshStructure
&
other
);
void
getMeshStructureValues
(
Mesh
*
mesh
,
int
macroElIndex
,
const
DOFVector
<
double
>*
vec
,
std
::
vector
<
double
>&
values
);
void
setMeshStructureValues
(
Mesh
*
mesh
,
int
macroElIndex
,
DOFVector
<
double
>*
vec
,
const
std
::
vector
<
double
>&
values
);
protected:
/// Insert a new element to the structure code. Is used by the init function.
void
insertElement
(
bool
isLeaf
);
...
...
AMDiS/src/io/ArhReader.cc
View file @
613caf74
...
...
@@ -107,7 +107,7 @@ namespace AMDiS {
while
(
elInfo
)
{
if
(
!
macroElement
)
{
Element
*
mEl
=
elInfo
->
getMacroElement
()
->
getElement
();
for
(
int
i
=
0
;
i
<
=
mesh
->
get
Dim
(
);
i
++
)
for
(
int
i
=
0
;
i
<
mesh
->
get
Geo
(
VERTEX
);
i
++
)
(
*
vec
)[
mEl
->
getDof
(
i
,
0
)]
=
values
[
valuePos
++
];
macroElement
=
true
;
}
...
...
AMDiS/src/io/ArhWriter.cc
View file @
613caf74
...
...
@@ -73,7 +73,7 @@ namespace AMDiS {
for
(
unsigned
int
i
=
0
;
i
<
vecs
.
size
();
i
++
)
{
values
[
i
].
clear
();
for
(
int
j
=
0
;
j
<
=
mesh
->
get
Dim
(
);
j
++
)
for
(
int
j
=
0
;
j
<
mesh
->
get
Geo
(
VERTEX
);
j
++
)
values
[
i
].
push_back
((
*
vecs
[
i
])[
elInfo
->
getElement
()
->
getDof
(
j
,
0
)]);
}
}
...
...
AMDiS/src/parallel/MeshDistributor.cc
View file @
613caf74
...
...
@@ -995,7 +995,7 @@ namespace AMDiS {
elIndexMap
[(
*
it
)
->
getIndex
()]
=
*
it
;
// === Cr
a
ete set of all new macro elements this rank will receive from ===
// === Cre
a
te set of all new macro elements this rank will receive from ===
// === other ranks. ===
std
::
set
<
MacroElement
*>
newMacroEl
;
...
...
@@ -1033,6 +1033,8 @@ namespace AMDiS {
// === Send and receive mesh structure codes. ===
std
::
map
<
int
,
MeshCodeVec
>
sendCodes
;
std
::
map
<
int
,
std
::
vector
<
std
::
vector
<
double
>
>
>
sendValues
;
for
(
std
::
map
<
int
,
std
::
vector
<
int
>
>::
iterator
it
=
partitioner
->
getSendElements
().
begin
();
it
!=
partitioner
->
getSendElements
().
end
();
++
it
)
{
for
(
std
::
vector
<
int
>::
iterator
elIt
=
it
->
second
.
begin
();
...
...
@@ -1040,6 +1042,10 @@ namespace AMDiS {
MeshStructure
elCode
;
elCode
.
init
(
mesh
,
*
elIt
);
sendCodes
[
it
->
first
].
push_back
(
elCode
);
std
::
vector
<
double
>
valVec
;
elCode
.
getMeshStructureValues
(
mesh
,
*
elIt
,
testVec
,
valVec
);
sendValues
[
it
->
first
].
push_back
(
valVec
);
}
}
...
...
@@ -1136,9 +1142,6 @@ namespace AMDiS {
MSG
(
"Debug mode tests finished!
\n
"
);
#endif
MSG
(
"DONE
\n
"
);
}
...
...
AMDiS/src/parallel/MeshDistributor.h
View file @
613caf74
...
...
@@ -402,6 +402,9 @@ namespace AMDiS {
data
[
dofMap
[
v1
]]
=
v2
;
}
}
public:
DOFVector
<
double
>*
testVec
;
protected:
///
...
...
AMDiS/src/parallel/StdMpi.cc
View file @
613caf74
...
...
@@ -61,6 +61,16 @@ namespace AMDiS {
return
data
.
size
();
}
int
intSizeOf
(
std
::
vector
<
std
::
vector
<
double
>
>
&
data
)
{
int
size
=
1
;
for
(
unsigned
int
i
=
0
;
i
<
data
.
size
();
i
++
)
size
+=
data
[
i
].
size
()
+
1
;
return
size
;
}
void
makeBuf
(
int
&
data
,
int
*
buf
)
{
buf
[
0
]
=
data
;
...
...
@@ -269,4 +279,29 @@ namespace AMDiS {
}
}
void
makeBuf
(
std
::
vector
<
std
::
vector
<
double
>
>
&
data
,
double
*
buf
)
{
buf
[
0
]
=
data
.
size
();
int
counter
=
1
;
for
(
unsigned
int
i
=
0
;
i
<
data
.
size
();
i
++
)
{
buf
[
counter
++
]
=
data
[
i
].
size
();
for
(
unsigned
int
j
=
0
;
j
<
data
[
i
].
size
();
j
++
)
buf
[
counter
++
]
=
data
[
i
][
j
];
}
}
void
makeFromBuf
(
std
::
vector
<
std
::
vector
<
double
>
>
&
data
,
double
*
buf
,
int
bufSize
)
{
data
.
resize
(
buf
[
0
]);
int
counter
=
1
;
for
(
unsigned
int
i
=
0
;
i
<
data
.
size
();
i
++
)
{
data
[
i
].
resize
(
buf
[
counter
++
]);
for
(
unsigned
int
j
=
0
;
j
<
data
[
i
].
size
();
j
++
)
data
[
i
][
j
]
=
buf
[
counter
++
];
}
}
}
AMDiS/src/parallel/StdMpi.h
View file @
613caf74
...
...
@@ -52,6 +52,8 @@ namespace AMDiS {
int
intSizeOf
(
std
::
vector
<
const
DegreeOfFreedom
*>
&
data
);
int
intSizeOf
(
std
::
vector
<
std
::
vector
<
double
>
>
&
data
);
void
makeBuf
(
int
&
data
,
int
*
buf
);
void
makeFromBuf
(
int
&
data
,
int
*
buf
,
int
bufSize
);
...
...
@@ -92,6 +94,10 @@ namespace AMDiS {
void
makeFromBuf
(
std
::
vector
<
BoundaryObject
>
&
data
,
int
*
buf
,
int
bufSize
);
void
makeBuf
(
std
::
vector
<
std
::
vector
<
double
>
>
&
data
,
double
*
buf
);
void
makeFromBuf
(
std
::
vector
<
std
::
vector
<
double
>
>
&
data
,
double
*
buf
,
int
bufSize
);
template
<
typename
SendT
,
typename
RecvT
=
SendT
>
...
...
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