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
6b0d1620
Commit
6b0d1620
authored
Aug 11, 2020
by
Stenger, Florian
Browse files
namespace Vtk engulfs all
parent
c66bd4cd
Changes
76
Show whitespace changes
Inline
Side-by-side
dune/vtk/CMakeLists.txt
View file @
6b0d1620
dune_add_library
(
"vtktypes"
OBJECT
vtk
types.cc
)
types.cc
)
#install headers
install
(
FILES
...
...
@@ -8,20 +8,22 @@ install(FILES
defaultvtkfunction.hh
filereader.hh
filewriter.hh
forward.hh
gridcreatorinterface.hh
legacyvtkfunction.hh
pvdwriter.hh
pvdwriter.impl.hh
vtk
function.hh
vtk
localfunction.hh
vtk
localfunctioninterface.hh
vtk
reader.hh
vtk
reader.impl.hh
vtk
timeserieswriter.hh
vtk
timeserieswriter.impl.hh
vtk
types.hh
vtk
writer.hh
vtk
writerinterface.hh
vtk
writerinterface.impl.hh
function.hh
localfunction.hh
localfunctioninterface.hh
reader.hh
reader.impl.hh
timeserieswriter.hh
timeserieswriter.impl.hh
types.hh
writer.hh
writerinterface.hh
writerinterface.impl.hh
DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
/dune/vtkwriter
)
add_subdirectory
(
datacollectors
)
...
...
dune/vtk/datacollectorinterface.hh
View file @
6b0d1620
...
...
@@ -5,6 +5,10 @@
namespace
Dune
{
namespace
Vtk
{
/// Base class for data collectors in a CRTP style.
/**
* \tparam GridViewType Model of Dune::GridView
...
...
@@ -129,6 +133,7 @@ namespace Dune
GridView
gridView_
;
};
}
// end namespace Vtk
}
// end namespace Dune
#include
"datacollectorinterface.impl.hh"
dune/vtk/datacollectorinterface.impl.hh
View file @
6b0d1620
...
...
@@ -2,13 +2,17 @@
#include
<dune/geometry/referenceelements.hh>
namespace
Dune
{
namespace
Dune
{
namespace
Vtk
{
template
<
class
GV
,
class
D
,
class
P
>
template
<
class
GV
,
class
D
,
class
P
>
template
<
class
T
,
class
VtkFunction
>
std
::
vector
<
T
>
DataCollectorInterface
<
GV
,
D
,
P
>
std
::
vector
<
T
>
DataCollectorInterface
<
GV
,
D
,
P
>
::
cellDataImpl
(
VtkFunction
const
&
fct
)
const
{
{
std
::
vector
<
T
>
data
;
data
.
reserve
(
this
->
numCells
()
*
fct
.
ncomps
());
...
...
@@ -21,6 +25,7 @@ std::vector<T> DataCollectorInterface<GV,D,P>
localFct
.
unbind
();
}
return
data
;
}
}
}
// end namespace Vtk
}
// end namespace Dune
dune/vtk/datacollectors/continuousdatacollector.hh
View file @
6b0d1620
...
...
@@ -7,26 +7,29 @@
#include
<dune/grid/utility/globalindexset.hh>
#include
<dune/vtk/forward.hh>
#include
<dune/vtk/
vtk
types.hh>
#include
<dune/vtk/types.hh>
#include
"unstructureddatacollector.hh"
namespace
Dune
{
/// Implementation of \ref DataCollector for linear cells, with continuous data.
template
<
class
GridView
,
class
Partition
>
class
ContinuousDataCollector
namespace
Vtk
{
/// Implementation of \ref DataCollector for linear cells, with continuous data.
template
<
class
GridView
,
class
Partition
>
class
ContinuousDataCollector
:
public
UnstructuredDataCollectorInterface
<
GridView
,
ContinuousDataCollector
<
GridView
,
Partition
>
,
Partition
>
{
{
using
Self
=
ContinuousDataCollector
;
using
Super
=
UnstructuredDataCollectorInterface
<
GridView
,
Self
,
Partition
>
;
public:
public:
using
Super
::
dim
;
using
Super
::
partition
;
public:
public:
ContinuousDataCollector
(
GridView
const
&
gridView
)
:
Super
(
gridView
)
{}
...
...
@@ -136,11 +139,12 @@ public:
return
data
;
}
protected:
protected:
using
Super
::
gridView_
;
std
::
uint64_t
numPoints_
=
0
;
std
::
uint64_t
numCells_
=
0
;
std
::
vector
<
std
::
int64_t
>
indexMap_
;
};
};
}
// end namespace Vtk
}
// end namespace Dune
dune/vtk/datacollectors/discontinuousdatacollector.hh
View file @
6b0d1620
...
...
@@ -3,26 +3,29 @@
#include
<vector>
#include
<dune/vtk/forward.hh>
#include
<dune/vtk/
vtk
types.hh>
#include
<dune/vtk/types.hh>
#include
"unstructureddatacollector.hh"
namespace
Dune
{
/// Implementation of \ref DataCollector for linear cells, with discontinuous data.
template
<
class
GridView
,
class
Partition
>
class
DiscontinuousDataCollector
namespace
Vtk
{
/// Implementation of \ref DataCollector for linear cells, with discontinuous data.
template
<
class
GridView
,
class
Partition
>
class
DiscontinuousDataCollector
:
public
UnstructuredDataCollectorInterface
<
GridView
,
DiscontinuousDataCollector
<
GridView
,
Partition
>
,
Partition
>
{
{
using
Self
=
DiscontinuousDataCollector
;
using
Super
=
UnstructuredDataCollectorInterface
<
GridView
,
Self
,
Partition
>
;
public:
public:
using
Super
::
dim
;
using
Super
::
partition
;
public:
public:
DiscontinuousDataCollector
(
GridView
const
&
gridView
)
:
Super
(
gridView
)
{}
...
...
@@ -118,11 +121,12 @@ public:
return
data
;
}
protected:
protected:
using
Super
::
gridView_
;
std
::
uint64_t
numCells_
=
0
;
std
::
uint64_t
numPoints_
=
0
;
std
::
vector
<
std
::
int64_t
>
indexMap_
;
};
};
}
// end namespace Vtk
}
// end namespace Dune
dune/vtk/datacollectors/lagrangedatacollector.hh
View file @
6b0d1620
...
...
@@ -8,27 +8,31 @@
#include
<dune/grid/common/partitionset.hh>
#include
<dune/vtk/forward.hh>
#include
<dune/vtk/
vtk
types.hh>
#include
<dune/vtk/types.hh>
#include
<dune/vtk/utility/lagrangepoints.hh>
#include
"unstructureddatacollector.hh"
namespace
Dune
{
namespace
Dune
{
namespace
Vtk
{
/// Implementation of \ref DataCollector for lagrange cells
template
<
class
GridView
,
int
ORDER
=
-
1
>
class
LagrangeDataCollector
/// Implementation of \ref DataCollector for lagrange cells
template
<
class
GridView
,
int
ORDER
=
-
1
>
class
LagrangeDataCollector
:
public
UnstructuredDataCollectorInterface
<
GridView
,
LagrangeDataCollector
<
GridView
,
ORDER
>
,
Partitions
::
All
>
{
{
using
Self
=
LagrangeDataCollector
;
using
Super
=
UnstructuredDataCollectorInterface
<
GridView
,
Self
,
Partitions
::
All
>
;
public:
public:
static_assert
(
ORDER
!=
0
,
"Order 0 not supported"
);
using
Super
::
dim
;
using
Super
::
partition
;
// NOTE: lagrange data-collector currently implemented for the All partition only
public:
public:
LagrangeDataCollector
(
GridView
const
&
gridView
,
int
order
=
(
ORDER
<
0
?
2
:
ORDER
))
:
Super
(
gridView
)
,
order_
(
order
)
...
...
@@ -183,14 +187,15 @@ public:
return
data
;
}
protected:
protected:
using
Super
::
gridView_
;
unsigned
int
order_
;
std
::
uint64_t
numPoints_
=
0
;
using
PointSet
=
Vtk
LagrangePointSet
<
typename
GridView
::
ctype
,
GridView
::
dimension
>
;
using
PointSet
=
LagrangePointSet
<
typename
GridView
::
ctype
,
GridView
::
dimension
>
;
std
::
map
<
GeometryType
,
PointSet
>
pointSets_
;
};
};
}
// end namespace Vtk
}
// end namespace Dune
dune/vtk/datacollectors/quadraticdatacollector.hh
View file @
6b0d1620
...
...
@@ -6,26 +6,29 @@
#include
<dune/grid/common/partitionset.hh>
#include
<dune/vtk/forward.hh>
#include
<dune/vtk/
vtk
types.hh>
#include
<dune/vtk/types.hh>
#include
"unstructureddatacollector.hh"
namespace
Dune
{
/// Implementation of \ref DataCollector for quadratic cells, with continuous data.
template
<
class
GridView
>
class
QuadraticDataCollector
namespace
Vtk
{
/// Implementation of \ref DataCollector for quadratic cells, with continuous data.
template
<
class
GridView
>
class
QuadraticDataCollector
:
public
UnstructuredDataCollectorInterface
<
GridView
,
QuadraticDataCollector
<
GridView
>
,
Partitions
::
All
>
{
{
using
Self
=
QuadraticDataCollector
;
using
Super
=
UnstructuredDataCollectorInterface
<
GridView
,
Self
,
Partitions
::
All
>
;
public:
public:
using
Super
::
dim
;
using
Super
::
partition
;
// NOTE: quadratic data-collector currently implemented for the All partition only
public:
public:
QuadraticDataCollector
(
GridView
const
&
gridView
)
:
Super
(
gridView
)
{}
...
...
@@ -138,8 +141,9 @@ public:
return
data
;
}
protected:
protected:
using
Super
::
gridView_
;
};
};
}
// end namespace Vtk
}
// end namespace Dune
dune/vtk/datacollectors/spdatacollector.hh
View file @
6b0d1620
...
...
@@ -16,22 +16,26 @@
namespace
Dune
{
#if HAVE_DUNE_SPGRID
// Specialization for SPGrid
template
<
class
GridView
>
class
SPDataCollector
namespace
Vtk
{
#if HAVE_DUNE_SPGRID
// Specialization for SPGrid
template
<
class
GridView
>
class
SPDataCollector
:
public
StructuredDataCollectorInterface
<
GridView
,
SPDataCollector
<
GridView
>>
{
{
using
Self
=
SPDataCollector
;
using
Super
=
StructuredDataCollectorInterface
<
GridView
,
Self
>
;
using
ctype
=
typename
GridView
::
ctype
;
public:
public:
using
Super
::
dim
;
using
Super
::
partition
;
public:
public:
SPDataCollector
(
GridView
const
&
gridView
)
:
Super
(
gridView
)
,
wholeExtent_
(
filledArray
<
6
,
int
>
(
0
))
...
...
@@ -79,23 +83,25 @@ public:
}
}
protected:
protected:
using
Super
::
gridView_
;
std
::
array
<
int
,
6
>
wholeExtent_
;
std
::
array
<
int
,
6
>
extent_
;
FieldVector
<
ctype
,
3
>
origin_
;
FieldVector
<
ctype
,
3
>
spacing_
;
std
::
vector
<
std
::
size_t
>
indexMap_
;
};
};
namespace
Impl
{
namespace
Impl
{
template
<
class
GridView
,
class
ct
,
int
dim
,
template
<
int
>
class
Ref
,
class
Comm
>
struct
StructuredDataCollectorImpl
<
GridView
,
SPGrid
<
ct
,
dim
,
Ref
,
Comm
>>
{
using
type
=
SPDataCollector
<
GridView
>
;
};
}
}
#endif // HAVE_DUNE_SPGRID
#endif // HAVE_DUNE_SPGRID
}
// end namespace Vtk
}
// end namespace Dune
dune/vtk/datacollectors/structureddatacollector.hh
View file @
6b0d1620
...
...
@@ -12,21 +12,25 @@
namespace
Dune
{
/// The Interface for structured data-collectors
template
<
class
GridView
,
class
Derived
>
class
StructuredDataCollectorInterface
namespace
Vtk
{
/// The Interface for structured data-collectors
template
<
class
GridView
,
class
Derived
>
class
StructuredDataCollectorInterface
:
public
DataCollectorInterface
<
GridView
,
Derived
>
{
protected:
{
protected:
using
Super
=
DataCollectorInterface
<
GridView
,
Derived
>
;
using
SubDataCollector
=
ContinuousDataCollector
<
GridView
>
;
using
ctype
=
typename
GridView
::
ctype
;
public:
public:
using
Super
::
dim
;
using
Super
::
partition
;
public:
public:
StructuredDataCollectorInterface
(
GridView
const
&
gridView
)
:
Super
(
gridView
)
,
subDataCollector_
(
gridView
)
...
...
@@ -88,14 +92,14 @@ public:
/// @}
public:
// default implementation:
public:
// default implementation:
/// \copyref DefaultDataCollector::update.
void
updateImpl
()
{
subDataCollector_
.
update
();
#if HAVE_MPI
#if HAVE_MPI
int
rank
=
gridView_
.
comm
().
rank
();
int
numRanks
=
gridView_
.
comm
().
size
();
...
...
@@ -107,7 +111,7 @@ public: // default implementation:
}
sendRequest_
=
MPI_REQUEST_NULL
;
#endif
#endif
}
/// Return number of grid cells
...
...
@@ -146,7 +150,7 @@ public: // default implementation:
{
auto
&&
extent
=
this
->
extent
();
#if HAVE_MPI
#if HAVE_MPI
int
sendFlag
=
0
;
MPI_Status
sendStatus
;
MPI_Test
(
&
sendRequest_
,
&
sendFlag
,
&
sendStatus
);
...
...
@@ -159,7 +163,7 @@ public: // default implementation:
extents_
[
0
]
=
extent
;
}
}
#endif
#endif
writer
(
extent
);
}
...
...
@@ -168,7 +172,7 @@ public: // default implementation:
template
<
class
Writer
>
void
writePiecesImpl
(
Writer
const
&
writer
)
const
{
#if HAVE_MPI
#if HAVE_MPI
writer
(
0
,
extents_
[
0
],
true
);
int
numRanks
=
gridView_
.
comm
().
size
();
...
...
@@ -181,9 +185,9 @@ public: // default implementation:
writer
(
idx
,
extents_
[
idx
],
true
);
}
}
#else
#else
writer
(
0
,
this
->
extent
(),
true
);
#endif
#endif
}
// Origin (0,0,0)
...
...
@@ -222,15 +226,16 @@ public: // default implementation:
return
ordinates
;
}
protected:
protected:
using
Super
::
gridView_
;
SubDataCollector
subDataCollector_
;
#if HAVE_MPI
#if HAVE_MPI
mutable
std
::
vector
<
std
::
array
<
int
,
6
>>
extents_
;
mutable
std
::
vector
<
MPI_Request
>
requests_
;
mutable
MPI_Request
sendRequest_
=
MPI_REQUEST_NULL
;
#endif
};
#endif
};
}
// end namespace Vtk
}
// end namespace Dune
dune/vtk/datacollectors/test/test-lagrangedatacollector.cc
View file @
6b0d1620
...
...
@@ -71,14 +71,14 @@ void testGridView (std::string prefix, Dune::TestSuite& testSuite, GridView cons
{
// 1. test linear order lagrange data-collector
{
Dune
::
ContinuousDataCollector
<
GridView
>
linearDataCollector
(
gridView
);
Dune
::
Vtk
::
ContinuousDataCollector
<
GridView
>
linearDataCollector
(
gridView
);
// data collector with template order
Dune
::
LagrangeDataCollector
<
GridView
,
1
>
lagrangeDataCollector1a
(
gridView
);
Dune
::
Vtk
::
LagrangeDataCollector
<
GridView
,
1
>
lagrangeDataCollector1a
(
gridView
);
testDataCollector
(
prefix
+
"_linear_template"
,
testSuite
,
lagrangeDataCollector1a
,
linearDataCollector
);
// data collector with runtime order
Dune
::
LagrangeDataCollector
<
GridView
>
lagrangeDataCollector1b
(
gridView
,
1
);
Dune
::
Vtk
::
LagrangeDataCollector
<
GridView
>
lagrangeDataCollector1b
(
gridView
,
1
);
testDataCollector
(
prefix
+
"_linear_runtime"
,
testSuite
,
lagrangeDataCollector1b
,
linearDataCollector
);
}
}
...
...
dune/vtk/datacollectors/unstructureddatacollector.hh
View file @
6b0d1620
...
...
@@ -6,26 +6,30 @@
#include
<dune/vtk/forward.hh>
#include
<dune/vtk/datacollectorinterface.hh>
namespace
Dune
{
struct
Cells
namespace
Dune
{
namespace
Vtk
{
struct
Cells
{
std
::
vector
<
std
::
uint8_t
>
types
;
std
::
vector
<
std
::
int64_t
>
offsets
;
std
::
vector
<
std
::
int64_t
>
connectivity
;
};
};
template
<
class
GridView
,
class
Derived
,
class
Partition
>
class
UnstructuredDataCollectorInterface
template
<
class
GridView
,
class
Derived
,
class
Partition
>
class
UnstructuredDataCollectorInterface
:
public
DataCollectorInterface
<
GridView
,
Derived
,
Partition
>
{
{
using
Super
=
DataCollectorInterface
<
GridView
,
Derived
,
Partition
>
;
public:
public:
using
Super
::
dim
;
using
Super
::
partition
;
public:
public:
UnstructuredDataCollectorInterface
(
GridView
const
&
gridView
)
:
Super
(
gridView
)
{}
...
...
@@ -41,15 +45,16 @@ public:
return
this
->
asDerived
().
pointIdsImpl
();
}
protected:
protected:
// default implementation
std
::
vector
<
std
::
uint64_t
>
pointIdsImpl
()
const
{
return
{};
}
protected:
protected:
using
Super
::
gridView_
;
};
};
}
// end namespace Vtk
}
// end namespace Dune
dune/vtk/datacollectors/yaspdatacollector.hh
View file @
6b0d1620
...
...
@@ -17,20 +17,24 @@
namespace
Dune
{
// Specialization for YaspGrid
template
<
class
GridView
>
class
YaspDataCollector
namespace
Vtk
{
// Specialization for YaspGrid
template
<
class
GridView
>
class
YaspDataCollector
:
public
StructuredDataCollectorInterface
<
GridView
,
YaspDataCollector
<
GridView
>>
{
{
using
Self
=
YaspDataCollector
;
using
Super
=
StructuredDataCollectorInterface
<
GridView
,
Self
>
;
using
ctype
=
typename
GridView
::
ctype
;
public:
public:
using
Super
::
dim
;
using
Super
::
partition
;
public:
public:
YaspDataCollector
(
GridView
const
&
gridView
)
:
Super
(
gridView
)
,
wholeExtent_
(
filledArray
<
6
,
int
>
(
0
))
...
...
@@ -129,7 +133,7 @@ public:
}
private:
private:
template
<
class
G
>
using
HostGrid
=
decltype
(
std
::
declval
<
G
>
().
hostGrid
());
...
...
@@ -148,22 +152,23 @@ private:
return
grid
(
g
.
hostGrid
());
}
protected:
protected:
using
Super
::
gridView_
;
std
::
array
<
int
,
6
>
wholeExtent_
;
std
::
array
<
int
,
6
>
extent_
;
FieldVector
<
ctype
,
3
>
origin_
;
FieldVector
<
ctype
,
3
>
spacing_
;
int
level_
;
};
};
namespace
Impl
{