Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
iwr
dune-vtk
Commits
a2756452
Commit
a2756452
authored
Aug 27, 2018
by
Praetorius, Simon
Browse files
added extents to parallel piece files by communication
parent
d11aca8f
Changes
4
Hide whitespace changes
Inline
Side-by-side
dune/vtk/datacollectors/yaspdatacollector.hh
View file @
a2756452
...
...
@@ -23,7 +23,7 @@ public:
,
wholeExtent_
(
filledArray
<
6
,
int
>
(
0
))
,
origin_
(
0.0
)
,
spacing_
(
0.0
)
,
level_
(
gridView
.
template
begin
<
0
,
Interior
_Partition
>()
->
level
())
,
level_
(
gridView
.
template
begin
<
0
,
All
_Partition
>()
->
level
())
{}
std
::
array
<
int
,
6
>
const
&
wholeExtentImpl
()
const
...
...
@@ -44,6 +44,7 @@ public:
void
updateImpl
()
{
Super
::
updateImpl
();
localPieceCalled_
=
false
;
for
(
int
i
=
0
;
i
<
dim
;
++
i
)
{
wholeExtent_
[
2
*
i
]
=
0
;
...
...
@@ -52,6 +53,20 @@ public:
auto
it
=
gridView_
.
grid
().
begin
(
level_
);
initGeometry
(
it
->
coords
);
#if HAVE_MPI
int
rank
=
-
1
;
int
num_ranks
=
-
1
;
MPI_Comm_rank
(
gridView_
.
comm
(),
&
rank
);
MPI_Comm_size
(
gridView_
.
comm
(),
&
num_ranks
);
if
(
rank
==
0
)
{
extents_
.
resize
(
num_ranks
);
requests_
.
resize
(
num_ranks
);
for
(
int
i
=
1
;
i
<
num_ranks
;
++
i
)
MPI_Irecv
(
extents_
[
i
].
data
(),
extents_
[
i
].
size
(),
MPI_INT
,
i
,
/*tag=*/
6
,
gridView_
.
comm
(),
&
requests_
[
i
]);
}
#endif
}
template
<
class
Coords
>
...
...
@@ -92,25 +107,38 @@ public:
extent
[
2
*
i
]
=
gc
.
min
(
i
);
extent
[
2
*
i
+
1
]
=
gc
.
max
(
i
)
+
1
;
}
#if HAVE_MPI
if
(
!
localPieceCalled_
)
{
int
rank
=
-
1
;
MPI_Comm_rank
(
gridView_
.
comm
(),
&
rank
);
if
(
rank
!=
0
)
{
MPI_Isend
(
extent
.
data
(),
extent
.
size
(),
MPI_INT
,
0
,
/*tag=*/
6
,
gridView_
.
comm
(),
&
sendRequest_
);
}
else
{
extents_
[
0
]
=
extent
;
}
localPieceCalled_
=
true
;
}
#endif
writer
(
extent
);
}
template
<
class
Writer
>
void
writePiecesImpl
(
Writer
const
&
writer
)
const
{
auto
extent
=
filledArray
<
6
,
int
>
(
0
);
// for (auto const& part : gridView_.gridLevel().template partition<InteriorEntity>())
// {
// for (int i = 0; i < dim; ++i) {
// extent[2*i] = part.begin()[i];
// extent[2*i+1] = part.end()[i]-1;
// }
assert
(
localPieceCalled_
);
#if HAVE_MPI
int
num_ranks
=
-
1
;
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
num_ranks
);
MPI_Comm_size
(
gridView_
.
comm
(),
&
num_ranks
);
std
::
vector
<
MPI_Status
>
status
(
num_ranks
-
1
);
MPI_Waitall
(
num_ranks
-
1
,
requests_
.
data
()
+
1
,
status
.
data
());
for
(
int
p
=
0
;
p
<
num_ranks
;
++
p
)
{
writer
(
p
,
extent
,
fals
e
);
writer
(
p
,
extent
s_
[
p
],
tru
e
);
}
#endif
}
template
<
class
T
>
...
...
@@ -142,6 +170,11 @@ private:
FieldVector
<
ctype
,
3
>
origin_
;
std
::
vector
<
std
::
size_t
>
indexMap_
;
int
level_
;
mutable
std
::
vector
<
std
::
array
<
int
,
6
>>
extents_
;
mutable
std
::
vector
<
MPI_Request
>
requests_
;
mutable
MPI_Request
sendRequest_
;
mutable
bool
localPieceCalled_
=
false
;
};
namespace
Impl
...
...
dune/vtk/writers/vtkwriterinterface.impl.hh
View file @
a2756452
...
...
@@ -51,12 +51,14 @@ void VtkWriterInterface<GV,DC>
if
(
num_ranks
>
1
)
{
filename
=
p
.
string
()
+
"_p"
+
std
::
to_string
(
rank
)
+
"."
+
fileExtension
();
writeSerialFile
(
filename
);
if
(
rank
==
0
)
{
writeParallelFile
(
p
.
string
(),
num_ranks
);
}
}
else
{
writeSerialFile
(
filename
);
}
#endif
writeSerialFile
(
filename
);
}
...
...
src/test/mixed_element_test.cc
View file @
a2756452
...
...
@@ -18,7 +18,7 @@
#include <dune/grid/utility/structuredgridfactory.hh>
#include <dune/vtk/vtkreader.hh>
#include <dune/vtk/vtkunstructuredgridwriter.hh>
#include <dune/vtk/
writers/
vtkunstructuredgridwriter.hh>
using
namespace
Dune
;
using
namespace
Dune
::
experimental
;
...
...
src/test/reader_writer_test.cc
View file @
a2756452
...
...
@@ -18,7 +18,7 @@
#include <dune/grid/utility/structuredgridfactory.hh>
#include <dune/vtk/vtkreader.hh>
#include <dune/vtk/vtkunstructuredgridwriter.hh>
#include <dune/vtk/
writers/
vtkunstructuredgridwriter.hh>
using
namespace
Dune
;
using
namespace
Dune
::
experimental
;
...
...
Write
Preview
Supports
Markdown
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