Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
amdis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Aland, Sebastian
amdis
Commits
98614912
Commit
98614912
authored
9 years ago
by
Sebastian Aland
Browse files
Options
Downloads
Patches
Plain Diff
added synchMultiVector function to get correct sync after coarsening operations
parent
f7b6e563
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
AMDiS/src/parallel/MeshDistributor.h
+68
-0
68 additions, 0 deletions
AMDiS/src/parallel/MeshDistributor.h
with
68 additions
and
0 deletions
AMDiS/src/parallel/MeshDistributor.h
+
68
−
0
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment