Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
iwr
amdis
Commits
98614912
Commit
98614912
authored
Feb 19, 2016
by
Sebastian Aland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added synchMultiVector function to get correct sync after coarsening operations
parent
f7b6e563
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
0 deletions
+68
-0
AMDiS/src/parallel/MeshDistributor.h
AMDiS/src/parallel/MeshDistributor.h
+68
-0
No files found.
AMDiS/src/parallel/MeshDistributor.h
View file @
98614912
...
...
@@ -282,6 +282,74 @@ namespace AMDiS { namespace Parallel {
synchVector
(
vec
);
}
/** \brief
* Synchronize \p vec using indicator vector \p additionalVecs, e.g. let
* additionalVecs[0] be 1 on all dofs the value should be taken from
my rank
* and 0 elsewhere.
*/
// op(std::vector<T>& out, std::vector<T> const& in)
template
<
typename
T
,
typename
Operator
>
void
synchMultiVector
(
DOFVector
<
T
>
&
vec
,
std
::
vector
<
DOFVector
<
T
>*>
additionalVecs
,
Operator
op
)
{
// get FE space and check equal FE space
const
FiniteElemSpace
*
fe
=
vec
.
getFeSpace
();
MultiLevelDofComm
&
dofComm
=
dofComms
[
fe
->
getMesh
()];
typedef
typename
std
::
vector
<
DOFVector
<
T
>*>::
iterator
Iterator
;
int
nLevels
=
levelData
.
getNumberOfLevels
();
for
(
int
level
=
nLevels
-
1
;
level
>=
0
;
level
--
)
{
StdMpi
<
std
::
vector
<
std
::
vector
<
T
>
>
>
stdMpi
(
levelData
.
getMpiComm
(
level
));
for
(
DofComm
::
Iterator
it
(
dofComm
[
level
].
getRecvDofs
(),
fe
);
!
it
.
end
();
it
.
nextRank
())
{
std
::
vector
<
std
::
vector
<
T
>
>
dofs
;
dofs
.
reserve
(
it
.
getDofs
().
size
());
for
(;
!
it
.
endDofIter
();
it
.
nextDof
())
{
std
::
vector
<
T
>
values
;
values
.
reserve
(
additionalVecs
.
size
()
+
1
);
values
.
push_back
(
vec
[
it
.
getDofIndex
()]
);
for
(
Iterator
vecIt
=
additionalVecs
.
begin
();
vecIt
!=
additionalVecs
.
end
();
++
vecIt
)
values
.
push_back
(
(
**
vecIt
)[
it
.
getDofIndex
()]
);
dofs
.
push_back
(
values
);
}
stdMpi
.
send
(
it
.
getRank
(),
dofs
);
}
for
(
DofComm
::
Iterator
it
(
dofComm
[
level
].
getSendDofs
(),
fe
);
!
it
.
end
();
it
.
nextRank
())
stdMpi
.
recv
(
it
.
getRank
());
stdMpi
.
startCommunication
();
for
(
DofComm
::
Iterator
it
(
dofComm
[
level
].
getSendDofs
(),
fe
);
!
it
.
end
();
it
.
nextRank
())
{
for
(;
!
it
.
endDofIter
();
it
.
nextDof
())
{
std
::
vector
<
T
>
values
;
values
.
reserve
(
additionalVecs
.
size
()
+
1
);
values
.
push_back
(
vec
[
it
.
getDofIndex
()]
);
for
(
Iterator
vecIt
=
additionalVecs
.
begin
();
vecIt
!=
additionalVecs
.
end
();
++
vecIt
)
values
.
push_back
(
(
**
vecIt
)[
it
.
getDofIndex
()]
);
op
(
values
,
stdMpi
.
getRecvData
(
it
.
getRank
())[
it
.
getDofCounter
()]);
}
}
}
synchVector
(
vec
);
}
/** \brief
* This function must be used if the values of a set of DOFVectors must be
* synchronized over all ranks. That means, that each rank sends the
...
...
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