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
Backofen, Rainer
amdis
Commits
02638872
Commit
02638872
authored
Nov 08, 2011
by
Thomas Witkowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some new small functions for MeshDistributor
parent
90f28a27
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
31 deletions
+54
-31
AMDiS/src/parallel/MeshDistributor.cc
AMDiS/src/parallel/MeshDistributor.cc
+20
-29
AMDiS/src/parallel/MeshDistributor.h
AMDiS/src/parallel/MeshDistributor.h
+34
-2
No files found.
AMDiS/src/parallel/MeshDistributor.cc
View file @
02638872
...
@@ -496,35 +496,6 @@ namespace AMDiS {
...
@@ -496,35 +496,6 @@ namespace AMDiS {
}
}
void
MeshDistributor
::
synchVector
(
DOFVector
<
double
>
&
vec
)
{
StdMpi
<
vector
<
double
>
>
stdMpi
(
mpiComm
);
for
(
RankToDofContainer
::
iterator
sendIt
=
sendDofs
.
begin
();
sendIt
!=
sendDofs
.
end
();
++
sendIt
)
{
vector
<
double
>
dofs
;
int
nSendDofs
=
sendIt
->
second
.
size
();
dofs
.
reserve
(
nSendDofs
);
for
(
int
i
=
0
;
i
<
nSendDofs
;
i
++
)
dofs
.
push_back
(
vec
[
*
((
sendIt
->
second
)[
i
])]);
stdMpi
.
send
(
sendIt
->
first
,
dofs
);
}
for
(
RankToDofContainer
::
iterator
recvIt
=
recvDofs
.
begin
();
recvIt
!=
recvDofs
.
end
();
++
recvIt
)
stdMpi
.
recv
(
recvIt
->
first
,
recvIt
->
second
.
size
());
stdMpi
.
startCommunication
();
for
(
RankToDofContainer
::
iterator
recvIt
=
recvDofs
.
begin
();
recvIt
!=
recvDofs
.
end
();
++
recvIt
)
for
(
unsigned
int
i
=
0
;
i
<
recvIt
->
second
.
size
();
i
++
)
vec
[
*
(
recvIt
->
second
)[
i
]]
=
stdMpi
.
getRecvData
(
recvIt
->
first
)[
i
];
}
void
MeshDistributor
::
synchVector
(
SystemVector
&
vec
)
void
MeshDistributor
::
synchVector
(
SystemVector
&
vec
)
{
{
int
nComponents
=
vec
.
getSize
();
int
nComponents
=
vec
.
getSize
();
...
@@ -958,6 +929,26 @@ namespace AMDiS {
...
@@ -958,6 +929,26 @@ namespace AMDiS {
}
}
void
MeshDistributor
::
createBoundaryDofs
(
std
::
set
<
DegreeOfFreedom
>
&
boundaryDofs
)
{
FUNCNAME
(
"MeshDistributor::createBoundaryDofs()"
);
boundaryDofs
.
clear
();
for
(
RankToDofContainer
::
iterator
it
=
sendDofs
.
begin
();
it
!=
sendDofs
.
end
();
++
it
)
for
(
DofContainer
::
iterator
dofIt
=
it
->
second
.
begin
();
dofIt
!=
it
->
second
.
end
();
++
dofIt
)
boundaryDofs
.
insert
(
**
dofIt
);
for
(
RankToDofContainer
::
iterator
it
=
recvDofs
.
begin
();
it
!=
recvDofs
.
end
();
++
it
)
for
(
DofContainer
::
iterator
dofIt
=
it
->
second
.
begin
();
dofIt
!=
it
->
second
.
end
();
++
dofIt
)
boundaryDofs
.
insert
(
**
dofIt
);
}
void
MeshDistributor
::
serialize
(
ostream
&
out
,
DofContainer
&
data
)
void
MeshDistributor
::
serialize
(
ostream
&
out
,
DofContainer
&
data
)
{
{
int
vecSize
=
data
.
size
();
int
vecSize
=
data
.
size
();
...
...
AMDiS/src/parallel/MeshDistributor.h
View file @
02638872
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#include "parallel/ParallelTypes.h"
#include "parallel/ParallelTypes.h"
#include "parallel/MeshPartitioner.h"
#include "parallel/MeshPartitioner.h"
#include "parallel/InteriorBoundary.h"
#include "parallel/InteriorBoundary.h"
#include "parallel/StdMpi.h"
#include "AMDiS_fwd.h"
#include "AMDiS_fwd.h"
#include "Global.h"
#include "Global.h"
#include "ProblemTimeInterface.h"
#include "ProblemTimeInterface.h"
...
@@ -239,6 +240,10 @@ namespace AMDiS {
...
@@ -239,6 +240,10 @@ namespace AMDiS {
return
recvDofs
;
return
recvDofs
;
}
}
/// Creates a set of all DOFs that are on interior boundaries of rank's
/// domain. Thus, it creates the union of \ref sendDofs and \ref recvDofs.
void
createBoundaryDofs
(
std
::
set
<
DegreeOfFreedom
>
&
boundaryDofs
);
// Writes all data of this object to an output stream.
// Writes all data of this object to an output stream.
void
serialize
(
ostream
&
out
);
void
serialize
(
ostream
&
out
);
...
@@ -255,7 +260,34 @@ namespace AMDiS {
...
@@ -255,7 +260,34 @@ namespace AMDiS {
* after the DOFVector is set by some user defined functions, e.g., initial
* after the DOFVector is set by some user defined functions, e.g., initial
* solution functions.
* solution functions.
*/
*/
void
synchVector
(
DOFVector
<
double
>
&
vec
);
template
<
typename
T
>
void
synchVector
(
DOFVector
<
T
>
&
vec
)
{
StdMpi
<
vector
<
T
>
>
stdMpi
(
mpiComm
);
for
(
RankToDofContainer
::
iterator
sendIt
=
sendDofs
.
begin
();
sendIt
!=
sendDofs
.
end
();
++
sendIt
)
{
vector
<
T
>
dofs
;
int
nSendDofs
=
sendIt
->
second
.
size
();
dofs
.
reserve
(
nSendDofs
);
for
(
int
i
=
0
;
i
<
nSendDofs
;
i
++
)
dofs
.
push_back
(
vec
[
*
((
sendIt
->
second
)[
i
])]);
stdMpi
.
send
(
sendIt
->
first
,
dofs
);
}
for
(
RankToDofContainer
::
iterator
recvIt
=
recvDofs
.
begin
();
recvIt
!=
recvDofs
.
end
();
++
recvIt
)
stdMpi
.
recv
(
recvIt
->
first
,
recvIt
->
second
.
size
());
stdMpi
.
startCommunication
();
for
(
RankToDofContainer
::
iterator
recvIt
=
recvDofs
.
begin
();
recvIt
!=
recvDofs
.
end
();
++
recvIt
)
for
(
unsigned
int
i
=
0
;
i
<
recvIt
->
second
.
size
();
i
++
)
vec
[
*
(
recvIt
->
second
)[
i
]]
=
stdMpi
.
getRecvData
(
recvIt
->
first
)[
i
];
}
/** \brief
/** \brief
* Works in the same way as the function above defined for DOFVectors. Due to
* Works in the same way as the function above defined for DOFVectors. Due to
...
...
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