Go to the documentation of this file.
4 #ifndef DUNE_VTKWRITER_HH
5 #define DUNE_VTKWRITER_HH
19 #include <dune/common/typetraits.hh>
20 #include <dune/common/exceptions.hh>
21 #include <dune/common/indent.hh>
22 #include <dune/common/iteratorfacades.hh>
23 #include <dune/common/path.hh>
24 #include <dune/geometry/referenceelements.hh>
53 template<
class F,
class E,
class =
void >
58 template<
class F,
class E >
59 struct IsBindable< F, E, void_t< decltype( std::declval< F & >().bind( std::declval< const E & >() ) ), decltype( std::declval< F & >().unbind() ) > >
64 template<
class F,
class =
void >
65 struct HasLocalFunction
70 struct HasLocalFunction< F, void_t< decltype( localFunction( std::declval< F& >() ) ) > >
77 template <
class Gr
idView>
78 class VTKSequenceWriterBase;
79 template <
class Gr
idView>
80 class VTKSequenceWriter;
90 template<
class Gr
idView >
105 typedef typename GridView::template Codim< 0 >::Entity Cell;
106 typedef typename GridView::template Codim< n >::Entity Vertex;
114 typedef typename GridView::template Codim< 0 >
115 ::template Partition< VTK_Partition >::Iterator
117 typedef typename GridView::template Codim< n >
118 ::template Partition< VTK_Partition >::Iterator
121 typedef typename GridCellIterator::Reference EntityReference;
123 typedef typename GridView::template Codim< 0 >
124 ::Entity::Geometry::LocalCoordinate Coordinate;
126 typedef MultipleCodimMultipleGeomTypeMapper< GridView > VertexMapper;
131 switch( VTK_Partition )
136 default: DUNE_THROW(NotImplemented,
"Add check for this partition type");
163 virtual void bind(
const Entity& e) = 0;
166 virtual void unbind() = 0;
172 virtual void write(
const Coordinate& pos,
Writer& w, std::size_t count)
const = 0;
186 template<
typename F_>
188 : _f(std::forward<F_>(f))
191 virtual void bind(
const Entity& e)
201 virtual void write(
const Coordinate& pos,
Writer& w, std::size_t count)
const
205 do_write(w,r,count,IsIndexable<decltype(r)>());
211 void do_write(
Writer& w,
const R& r, std::size_t count, std::true_type)
const
213 for (std::size_t i = 0; i < count; ++i)
218 void do_write(
Writer& w,
const R& r, std::size_t count, std::false_type)
const
234 template<
typename F_>
236 : _f(std::forward<F_>(f))
240 virtual void bind(
const Entity& e)
250 virtual void write(
const Coordinate& pos,
Writer& w, std::size_t count)
const
252 auto globalPos = element_->geometry().global(pos);
253 auto r = _f(globalPos);
254 Hybrid::ifElse(IsIndexable<decltype(r)>(),
256 for (std::size_t i = 0; i < count; ++i)
266 const Entity* element_;
278 virtual void bind(
const Entity& e)
288 virtual void write(
const Coordinate& pos,
Writer& w, std::size_t count)
const
290 for (std::size_t i = 0; i < count; ++i)
291 w.
write(_f->evaluate(i,*_entity,pos));
296 std::shared_ptr< const VTKFunction > _f;
297 const Entity* _entity;
302 template<typename F, std::enable_if_t<Impl::IsBindable<F, Entity>::value,
int> = 0>
310 template<typename F, std::enable_if_t<not Impl::IsBindable<F, Entity>::value && Impl::HasLocalFunction<F>::value,
int> = 0>
313 typename std::decay<decltype(localFunction(std::forward<F>(f)))>::type
314 > >(localFunction(std::forward<F>(f))))
320 template<typename F, std::enable_if_t<not Impl::IsBindable<F, Entity>::value && not Impl::HasLocalFunction<F>::value,
int> = 0>
330 vtkFunctionPtr->
name(),
331 vtkFunctionPtr->ncomps() > 1 ? VTK::FieldInfo::Type::vector : VTK::FieldInfo::Type::scalar,
332 vtkFunctionPtr->ncomps(),
333 vtkFunctionPtr->precision()
350 void bind(
const Entity& e)
const
367 std::shared_ptr<FunctionWrapperBase>
_f;
389 return ReferenceElements<DT,n>::general((*this)->type()).position(0,0);
395 return gridView_.template begin< 0, VTK_Partition >();
400 return gridView_.template end< 0, VTK_Partition >();
419 public ForwardIteratorFacade<VertexIterator, const Entity, EntityReference, int>
421 GridCellIterator git;
422 GridCellIterator gend;
428 std::vector<bool> visited;
441 const int numCorners = git->subEntities(n);
442 if( cornerIndexDune == numCorners )
444 offset += numCorners;
448 while( (git != gend) && skipEntity( git->partitionType() ) )
454 const GridCellIterator & end,
457 git(x), gend(end), datamode(dm), cornerIndexDune(0),
458 vertexmapper(vm), visited(vm.size(), false),
462 visited[vertexmapper.
subIndex(*git,cornerIndexDune,n)] =
true;
469 while(visited[vertexmapper.
subIndex(*git,cornerIndexDune,n)])
472 if (git == gend)
return;
474 visited[vertexmapper.
subIndex(*git,cornerIndexDune,n)] =
true;
483 return git == cit.git
484 && cornerIndexDune == cit.cornerIndexDune
485 && datamode == cit.datamode;
494 return cornerIndexDune;
499 return referenceElement<DT,n>(git->type())
500 .position(cornerIndexDune,n);
506 return VertexIterator(
gridView_.template begin< 0, VTK_Partition >(),
507 gridView_.template end< 0, VTK_Partition >(),
508 datamode, *vertexmapper );
513 return VertexIterator(
gridView_.template end< 0, VTK_Partition >(),
514 gridView_.template end< 0, VTK_Partition >(),
515 datamode, *vertexmapper );
534 public ForwardIteratorFacade<CornerIterator, const Entity, EntityReference, int>
536 GridCellIterator git;
537 GridCellIterator gend;
546 const std::vector<int> & number;
555 const GridCellIterator & end,
558 const std::vector<int> & num) :
559 git(x), gend(end), datamode(dm), cornerIndexVTK(0),
561 number(num), offset(0) {}
567 const int numCorners = git->subEntities(n);
568 if( cornerIndexVTK == numCorners )
570 offset += numCorners;
574 while( (git != gend) && skipEntity( git->partitionType() ) )
580 return git == cit.git
581 && cornerIndexVTK == cit.cornerIndexVTK
582 && datamode == cit.datamode;
604 DUNE_THROW(IOError,
"VTKWriter: unsupported DataMode" << datamode);
611 return CornerIterator(
gridView_.template begin< 0, VTK_Partition >(),
612 gridView_.template end< 0, VTK_Partition >(),
613 datamode, *vertexmapper, number );
618 return CornerIterator(
gridView_.template end< 0, VTK_Partition >(),
619 gridView_.template end< 0, VTK_Partition >(),
620 datamode, *vertexmapper, number );
647 celldata.push_back(VTKLocalFunction(p));
672 celldata.push_back(VTKLocalFunction(std::forward<F>(f),vtkFieldInfo));
690 template<
class Container>
691 void addCellData (
const Container& v,
const std::string &name,
int ncomps = 1,
695 for (
int c=0; c<ncomps; ++c) {
696 std::stringstream compName;
699 compName <<
"[" << c <<
"]";
701 addCellData(std::shared_ptr< const VTKFunction >(p));
736 vertexdata.push_back(VTKLocalFunction(std::forward<F>(f),vtkFieldInfo));
755 template<
class Container>
756 void addVertexData (
const Container& v,
const std::string &name,
int ncomps=1,
760 for (
int c=0; c<ncomps; ++c) {
761 std::stringstream compName;
764 compName <<
"[" << c <<
"]";
779 {
return coordPrec; }
798 std::string
write (
const std::string &name,
830 std::string
pwrite (
const std::string & name,
const std::string & path,
const std::string & extendpath,
850 const std::string& path,
851 int commRank,
int commSize)
const
853 std::ostringstream s;
854 if(path.size() > 0) {
856 if(path[path.size()-1] !=
'/')
859 s <<
's' << std::setw(4) << std::setfill(
'0') << commSize <<
'-';
860 s <<
'p' << std::setw(4) << std::setfill(
'0') << commRank <<
'-';
881 const std::string& path,
884 std::ostringstream s;
885 if(path.size() > 0) {
887 if(path[path.size()-1] !=
'/')
890 s <<
's' << std::setw(4) << std::setfill(
'0') << commSize <<
'-';
913 const std::string& path)
const
915 static const std::string extension =
918 return concatPaths(path, name+extension);
936 std::string
write (
const std::string &name,
944 return pwrite(name,
"",
"", type, commRank, commSize);
954 file.exceptions(std::ios_base::badbit | std::ios_base::failbit |
955 std::ios_base::eofbit);
958 file.open( pieceName.c_str(), std::ios::binary );
961 std::cerr <<
"Filename: " << pieceName <<
" could not be opened" << std::endl;
964 if (! file.is_open())
965 DUNE_THROW(IOError,
"Could not write to piece file " << pieceName);
966 writeDataFile( file );
996 std::string
pwrite(
const std::string& name,
const std::string& path,
997 const std::string& extendpath,
1006 file.exceptions(std::ios_base::badbit | std::ios_base::failbit |
1007 std::ios_base::eofbit);
1008 std::string piecepath = concatPaths(path, extendpath);
1009 std::string relpiecepath = relativePath(path, piecepath);
1016 file.open(fullname.c_str(),std::ios::binary);
1019 std::cerr <<
"Filename: " << fullname <<
" could not be opened" << std::endl;
1022 if (! file.is_open())
1023 DUNE_THROW(IOError,
"Could not write to piecefile file " << fullname);
1024 writeDataFile(file);
1032 file.open(fullname.c_str());
1033 if (! file.is_open())
1034 DUNE_THROW(IOError,
"Could not write to parallel file " << fullname);
1035 writeParallelHeader(file,name,relpiecepath, commSize );
1061 void writeParallelHeader(std::ostream& s,
const std::string& piecename,
1062 const std::string& piecepath,
const int commSize)
1073 std::string scalars, vectors;
1075 writer.beginPointData(scalars, vectors);
1082 unsigned writecomps = it->fieldInfo().size();
1083 if(writecomps == 2) writecomps = 3;
1084 writer.addArray(it->name(), writecomps, it->fieldInfo().precision());
1086 writer.endPointData();
1090 std::string scalars, vectors;
1092 writer.beginCellData(scalars, vectors);
1099 unsigned writecomps = it->fieldInfo().size();
1100 if(writecomps == 2) writecomps = 3;
1101 writer.addArray(it->name(), writecomps, it->fieldInfo().precision());
1103 writer.endCellData();
1106 writer.beginPoints();
1107 writer.addArray(
"Coordinates", 3, coordPrec);
1111 for(
int i = 0; i < commSize; ++i )
1116 writer.addPiece(fullname);
1123 void writeDataFile (std::ostream& s)
1128 VTK::VTUWriter writer(s,
outputtype, fileType);
1134 number.resize(vertexmapper->
size());
1135 for (std::vector<int>::size_type i=0; i<number.size(); i++) number[i] = -1;
1140 writeAllData(writer);
1144 if(writer.beginAppended())
1145 writeAllData(writer);
1146 writer.endAppended();
1148 delete vertexmapper; number.clear();
1151 void writeAllData(VTK::VTUWriter& writer) {
1176 DUNE_THROW(IOError,
"VTKWriter: unsupported OutputType" <<
outputtype);
1184 return "UnstructuredGrid";
1198 const int subEntities = it->subEntities(n);
1199 for (
int i=0; i<subEntities; ++i)
1204 int alpha = vertexmapper->
subIndex(*it,i,n);
1205 if (number[alpha]<0)
1216 template<
typename T>
1219 std::string scalars =
"";
1220 for (
auto it = data.begin(),
1226 scalars = it->name();
1230 std::string vectors =
"";
1231 for (
auto it = data.begin(),
1237 vectors = it->name();
1240 return std::make_tuple(scalars,vectors);
1243 template<
typename Data,
typename Iterator>
1246 for (
auto it = data.begin(),
1251 const auto& f = *it;
1253 std::size_t writecomps = fieldInfo.
size();
1254 switch (fieldInfo.
type())
1262 DUNE_THROW(IOError,
"Cannot write VTK vectors with more than 3 components (components was " << writecomps <<
")");
1266 DUNE_THROW(NotImplemented,
"VTK output for tensors not implemented yet");
1268 std::shared_ptr<VTK::DataArrayWriter> p
1270 if(!p->writeIsNoop())
1271 for (Iterator eit = begin; eit!=end; ++eit)
1273 const Entity & e = *eit;
1275 f.write(eit.position(),*p);
1279 for (std::size_t j=fieldInfo.
size(); j < writecomps; ++j)
1291 std::string scalars, vectors;
1305 std::string scalars, vectors;
1318 std::shared_ptr<VTK::DataArrayWriter> p
1320 if(!p->writeIsNoop()) {
1322 for (VertexIterator vit=
vertexBegin(); vit!=vEnd; ++vit)
1325 for (
int j=0; j<std::min(dimw,3); j++)
1326 p->write((*vit).geometry().corner(vit.localindex())[j]);
1327 for (
int j=std::min(dimw,3); j<3; j++)
1344 std::shared_ptr<VTK::DataArrayWriter> p1
1346 if(!p1->writeIsNoop())
1353 std::shared_ptr<VTK::DataArrayWriter> p2
1355 if(!p2->writeIsNoop()) {
1359 offset += it->subEntities(n);
1369 std::shared_ptr<VTK::DataArrayWriter> p3
1372 if(!p3->writeIsNoop())
1384 if( polyhedralCellsPresent_ )
1410 if( ! faceVertices_ )
1412 faceVertices_.reset(
new std::pair< std::vector<int>, std::vector<int> > () );
1415 faceVertices_->first, faceVertices_->second );
1418 std::vector< int >& faces = faceVertices_->first;
1419 std::vector< int >& faceOffsets = faceVertices_->second;
1420 assert(
int(faceOffsets.size()) ==
ncells );
1423 std::shared_ptr<VTK::DataArrayWriter> p4
1425 if(!p4->writeIsNoop())
1427 for(
const auto& face : faces )
1433 std::shared_ptr<VTK::DataArrayWriter> p5
1435 if(!p5->writeIsNoop())
1437 for(
const auto& offset : faceOffsets )
1438 p5->write( offset );
1441 faceVertices_.reset();
1446 template <
class CornerIterator,
class IndexSet,
class T>
1448 const CornerIterator end,
1449 const IndexSet& indexSet,
1450 std::vector<T>& faces,
1451 std::vector<T>& faceOffsets )
1453 if( n == 3 && it != end )
1457 faces.reserve( 15 *
ncells );
1458 faceOffsets.clear();
1459 faceOffsets.reserve(
ncells );
1464 int elIndex = indexSet.index( element );
1465 std::vector< T > vertices;
1466 vertices.reserve( 30 );
1467 for( ; it != end; ++it )
1469 const Cell& cell = *it ;
1470 const int cellIndex = indexSet.index( cell ) ;
1471 if( elIndex != cellIndex )
1477 elIndex = cellIndex ;
1479 vertices.push_back( it.id() );
1487 template <
class Entity,
class IndexSet,
class T>
1489 const IndexSet& indexSet,
1490 const std::vector<T>& vertices,
1492 std::vector<T>& faces,
1493 std::vector<T>& faceOffsets )
1497 std::map< T, T > vxMap;
1500 const int nVertices = element.subEntities( dim );
1501 for(
int vx = 0; vx < nVertices; ++ vx )
1503 const int vxIdx = indexSet.subIndex( element, vx, dim );
1504 vxMap[ vxIdx ] = vertices[ vx ];
1508 const int nFaces = element.subEntities( 1 );
1510 faces.push_back( nFaces );
1513 for(
int fce = 0; fce < nFaces; ++ fce )
1516 const auto face = element.template subEntity< 1 > ( fce );
1519 const int nVxFace = face.subEntities( dim );
1520 faces.push_back( nVxFace );
1522 for(
int i=0; i<nVxFace; ++i )
1524 const T vxIndex = indexSet.subIndex( face, i, dim );
1525 assert( vxMap.find( vxIndex ) != vxMap.end() );
1526 faces.push_back( vxMap[ vxIndex ] );
1532 faceOffsets.push_back( offset );
1551 std::vector<int> number;
1556 const bool polyhedralCellsPresent_;
1559 std::shared_ptr< std::pair< std::vector<int>, std::vector<int> > > faceVertices_;
void beginCellData(const std::string &scalars="", const std::string &vectors="")
start CellData section
Definition: vtuwriter.hh:203
Iterate over the grid's vertices.
Definition: vtkwriter.hh:418
void addCellData(const Container &v, const std::string &name, int ncomps=1, VTK::Precision prec=VTK::Precision::float32)
Add a grid function (represented by container) that lives on the cells of the grid to the visualizati...
Definition: vtkwriter.hh:691
@ appendedraw
Output is to the file is appended raw binary.
Definition: common.hh:48
std::list< VTKLocalFunction > celldata
Definition: vtkwriter.hh:1537
VTK::FieldInfo _fieldInfo
Definition: vtkwriter.hh:368
FileType
which type of VTK file to write
Definition: common.hh:300
virtual void countEntities(int &nvertices, int &ncells, int &ncorners)
count the vertices, cells and corners
Definition: vtkwriter.hh:1188
CornerIterator cornerEnd() const
Definition: vtkwriter.hh:616
virtual void write(const Coordinate &pos, Writer &w, std::size_t count) const
Evaluate data set at local position pos inside the current entity and write result to w.
Definition: vtkwriter.hh:288
void writeData(VTK::VTUWriter &writer, const Data &data, const Iterator begin, const Iterator end, int nentries)
Definition: vtkwriter.hh:1244
EntityReference dereference() const
Definition: vtkwriter.hh:584
Traits ::IndexSet IndexSet
type of the index set
Definition: common/gridview.hh:80
@ InteriorBorder_Partition
interior and border entities
Definition: gridenums.hh:136
Base class for polymorphic container of underlying data set.
Definition: vtkwriter.hh:159
void endPoints()
finish section for the point coordinates
Definition: vtuwriter.hh:247
VertexIterator(const GridCellIterator &x, const GridCellIterator &end, const VTK::DataMode &dm, const VertexMapper &vm)
Definition: vtkwriter.hh:453
void addCellData(F &&f, VTK::FieldInfo vtkFieldInfo)
Add a function by sampling it on the element centers.
Definition: vtkwriter.hh:670
Dump a .vtu/.vtp files contents to a stream.
Definition: vtuwriter.hh:96
@ conforming
Output conforming data.
Definition: common.hh:72
virtual void unbind()
Unbind data set from current grid entity - mostly here for performance and symmetry reasons.
Definition: vtkwriter.hh:245
Dump a .vtu/.vtp files contents to a stream.
Definition: pvtuwriter.hh:60
int localindex() const
index of vertex within the entity, in Dune-numbering
Definition: vtkwriter.hh:492
CellIterator cellBegin() const
Definition: vtkwriter.hh:393
int nvertices
Definition: vtkwriter.hh:1545
DataArrayWriter * makeArrayWriter(const std::string &name, unsigned ncomps, unsigned nitems, Precision prec)
acquire a DataArrayWriter
Definition: vtuwriter.hh:378
VTK::DataArrayWriter Writer
Definition: vtkwriter.hh:156
A base class for grid functions with any return type and dimension.
Definition: function.hh:39
@ vector
vector-valued field (always 3D, will be padded if necessary)
std::string getTypeString() const
Definition: vtkwriter.hh:1179
Iterator over the grids elements.
Definition: vtkwriter.hh:380
Grid::ctype ctype
type used for coordinates in grid
Definition: common/gridview.hh:124
Base class to write pvd-files which contains a list of all collected vtk-files.
Definition: vtksequencewriterbase.hh:31
void fillFaceVertices(CornerIterator it, const CornerIterator end, const IndexSet &indexSet, std::vector< T > &faces, std::vector< T > &faceOffsets)
Definition: vtkwriter.hh:1447
virtual void bind(const Entity &e)
Bind data set to grid entity - must be called before evaluating (i.e. calling write())
Definition: vtkwriter.hh:191
std::string name() const
The name of the data field.
Definition: common.hh:400
MCMGLayout mcmgVertexLayout()
layout for vertices (dim-0 entities)
Definition: mcmgmapper.hh:160
std::string name() const
Returns the name of the data set.
Definition: vtkwriter.hh:338
int ncells
Definition: vtkwriter.hh:1544
VTKLocalFunction(const std::shared_ptr< const VTKFunction > &vtkFunctionPtr)
Construct a VTKLocalFunction for a legacy VTKFunction.
Definition: vtkwriter.hh:327
CellIterator cellEnd() const
Definition: vtkwriter.hh:398
VTKLocalFunction(F &&f, VTK::FieldInfo fieldInfo)
Construct a VTKLocalFunction for a dune-functions style LocalFunction.
Definition: vtkwriter.hh:303
std::string pwrite(const std::string &name, const std::string &path, const std::string &extendpath, VTK::OutputType ot, const int commRank, const int commSize)
write output; interface might change later
Definition: vtkwriter.hh:996
void addVertexData(F &&f, VTK::FieldInfo vtkFieldInfo)
Add a function by sampling it on the grid vertices.
Definition: vtkwriter.hh:734
FieldVector< DT, n > position() const
position of vertex inside the entity
Definition: vtkwriter.hh:497
Type erasure implementation for C++ functions, i.e., functions that can be evaluated in global coordi...
Definition: vtkwriter.hh:229
VTKFunctionWrapper(const std::shared_ptr< const VTKFunction > &f)
Definition: vtkwriter.hh:273
void beginPointData(const std::string &scalars="", const std::string &vectors="")
start PointData section
Definition: vtuwriter.hh:165
std::list< VTKLocalFunction > vertexdata
Definition: vtkwriter.hh:1538
Type erasure wrapper for VTK data sets.
Definition: vtkwriter.hh:151
bool checkForPolyhedralCells() const
Definition: vtkwriter.hh:1394
VTKWriter(const GridView &gridView, VTK::DataMode dm=VTK::conforming, VTK::Precision coordPrecision=VTK::Precision::float32)
Construct a VTKWriter working on a specific GridView.
Definition: vtkwriter.hh:632
base class for data array writers
Definition: dataarraywriter.hh:53
void write(T data)
write one element of data
Definition: dataarraywriter.hh:67
void beginPoints()
start section for the point coordinates
Definition: vtuwriter.hh:236
virtual void write(const Coordinate &pos, Writer &w, std::size_t count) const =0
Evaluate data set at local position pos inside the current entity and write result to w.
void bind(const Entity &e) const
Bind the data set to grid entity e.
Definition: vtkwriter.hh:350
std::string getParallelPieceName(const std::string &name, const std::string &path, int commRank, int commSize) const
return name of a parallel piece file
Definition: vtkwriter.hh:849
FunctionWrapper(F_ &&f)
Definition: vtkwriter.hh:187
Traits ::Grid Grid
type of the grid
Definition: common/gridview.hh:77
void endCellData()
finish CellData section
Definition: vtuwriter.hh:218
const VTK::FieldInfo & fieldInfo() const
Returns the VTK::FieldInfo for the data set.
Definition: vtkwriter.hh:344
void increment()
Definition: vtkwriter.hh:562
void increment()
Definition: vtkwriter.hh:464
@ nonconforming
Output non-conforming data.
Definition: common.hh:80
CornerIterator cornerBegin() const
Definition: vtkwriter.hh:609
@ polyData
for .vtp files (PolyData)
Definition: common.hh:302
std::string getParallelHeaderName(const std::string &name, const std::string &path, int commSize) const
return name of a parallel header file
Definition: vtkwriter.hh:880
virtual void bind(const Entity &e)
Bind data set to grid entity - must be called before evaluating (i.e. calling write())
Definition: vtkwriter.hh:278
int ncorners
Definition: vtkwriter.hh:1546
typename std::decay< F >::type Function
Definition: vtkwriter.hh:232
std::string write(const std::string &name, VTK::OutputType type, const int commRank, const int commSize)
write output (interface might change later)
Definition: vtkwriter.hh:936
virtual void writeVertexData(VTK::VTUWriter &writer)
write vertex data
Definition: vtkwriter.hh:1300
@ All_Partition
all entities
Definition: gridenums.hh:139
@ dimension
The dimension of the grid.
Definition: common/gridview.hh:127
std::list< VTKLocalFunction >::const_iterator FunctionIterator
Definition: vtkwriter.hh:372
std::size_t size() const
The number of components in the data field.
Definition: common.hh:412
@ ascii
Output to the file is in ascii.
Definition: common.hh:44
void unbind() const
Unbind the data set from the currently bound entity.
Definition: vtkwriter.hh:356
CornerIterator(const GridCellIterator &x, const GridCellIterator &end, const VTK::DataMode &dm, const VertexMapper &vm, const std::vector< int > &num)
Definition: vtkwriter.hh:554
Precision precision() const
The precision used for the output of the data field.
Definition: common.hh:418
OutputType
How the bulk data should be stored in the file.
Definition: common.hh:42
@ polyhedron
Definition: common.hh:190
size_type size() const
Return total number of entities in the entity set managed by the mapper.
Definition: mcmgmapper.hh:287
virtual void write(const Coordinate &pos, Writer &w, std::size_t count) const
Evaluate data set at local position pos inside the current entity and write result to w.
Definition: vtkwriter.hh:201
Common stuff for the VTKWriter.
VertexIterator vertexEnd() const
Definition: vtkwriter.hh:511
virtual void writeCellData(VTK::VTUWriter &writer)
write cell data
Definition: vtkwriter.hh:1286
virtual void write(const Coordinate &pos, Writer &w, std::size_t count) const
Evaluate data set at local position pos inside the current entity and write result to w.
Definition: vtkwriter.hh:250
void endCells()
start section for the grid cells/PolyData lines
Definition: vtuwriter.hh:283
Take a vector and interpret it as cell data for the VTKWriter.
Definition: function.hh:93
static void fillFacesForElement(const Entity &element, const IndexSet &indexSet, const std::vector< T > &vertices, T &offset, std::vector< T > &faces, std::vector< T > &faceOffsets)
Definition: vtkwriter.hh:1488
GeometryType geometryType(const Dune::GeometryType &t)
mapping from GeometryType to VTKGeometryType
Definition: common.hh:199
std::tuple< std::string, std::string > getDataNames(const T &data) const
Definition: vtkwriter.hh:1217
Type type() const
The type of the data field.
Definition: common.hh:406
EntityReference dereference() const
Definition: vtkwriter.hh:487
std::string write(const std::string &name, VTK::OutputType type=VTK::ascii)
write output (interface might change later)
Definition: vtkwriter.hh:798
GlobalFunctionWrapper(F_ &&f)
Definition: vtkwriter.hh:235
virtual void unbind()
Unbind data set from current grid entity - mostly here for performance and symmetry reasons.
Definition: vtkwriter.hh:196
Data array writers for the VTKWriter.
virtual void bind(const Entity &e)
Bind data set to grid entity - must be called before evaluating (i.e. calling write())
Definition: vtkwriter.hh:240
virtual void unbind()=0
Unbind data set from current grid entity - mostly here for performance and symmetry reasons.
Writer for the ouput of grid functions in the vtk format.
Definition: vtksequencewriter.hh:26
virtual void writeGridCells(VTK::VTUWriter &writer)
write the connectivity array
Definition: vtkwriter.hh:1338
Index subIndex(const typename GV::template Codim< 0 >::Entity &e, int i, unsigned int codim) const
Map subentity of codim 0 entity to starting index in array for dof block.
Definition: mcmgmapper.hh:268
@ appendedbase64
Output is to the file is appended base64 binary.
Definition: common.hh:50
void endPointData()
finish PointData section
Definition: vtuwriter.hh:180
virtual ~VTKWriter()
destructor
Definition: vtkwriter.hh:782
Dune::VTKFunction< GridView > VTKFunction
Definition: vtkwriter.hh:143
VTK::OutputType outputtype
Definition: vtkwriter.hh:1562
std::string getFormatString() const
Definition: vtkwriter.hh:1166
@ dimensionworld
The dimension of the world the grid lives in.
Definition: common/gridview.hh:131
VertexIterator vertexBegin() const
Definition: vtkwriter.hh:504
@ unstructuredGrid
for .vtu files (UnstructuredGrid)
Definition: common.hh:304
void basicIncrement()
Definition: vtkwriter.hh:436
std::shared_ptr< FunctionWrapperBase > _f
Definition: vtkwriter.hh:367
Iterate over the elements' corners.
Definition: vtkwriter.hh:533
void write(const Coordinate &pos, Writer &w) const
Write the value of the data set at local coordinate pos to the writer w.
Definition: vtkwriter.hh:362
virtual void writeGridPoints(VTK::VTUWriter &writer)
write the positions of vertices
Definition: vtkwriter.hh:1314
const IndexSet & indexSet() const
obtain the index set
Definition: common/gridview.hh:172
Grid view abstract base class.
Definition: common/gridview.hh:59
Type erasure implementation for legacy VTKFunctions.
Definition: vtkwriter.hh:270
void addVertexData(const std::shared_ptr< const VTKFunction > &p)
Add a grid function that lives on the vertices of the grid to the visualization.
Definition: vtkwriter.hh:709
const CollectiveCommunication & comm() const
obtain collective communication object
Definition: common/gridview.hh:246
Mapper for multiple codim and multiple geometry types.
GridView gridView_
Definition: vtkwriter.hh:1541
@ tensor
tensor field (always 3x3)
bool equals(const CornerIterator &cit) const
Definition: vtkwriter.hh:578
std::string getSerialPieceName(const std::string &name, const std::string &path) const
return name of a serial piece file
Definition: vtkwriter.hh:912
void clear()
clear list of registered functions
Definition: vtkwriter.hh:771
Type erasure implementation for functions conforming to the dune-functions LocalFunction interface.
Definition: vtkwriter.hh:181
virtual void writeCellFaces(VTK::VTUWriter &writer)
write the connectivity array
Definition: vtkwriter.hh:1408
typename std::decay< F >::type Function
Definition: vtkwriter.hh:184
Functions for VTK output.
const FieldVector< DT, n > position() const
Definition: vtkwriter.hh:387
Writer for the ouput of grid functions in the vtk format.
Definition: vtkwriter.hh:91
virtual void unbind()
Unbind data set from current grid entity - mostly here for performance and symmetry reasons.
Definition: vtkwriter.hh:283
Take a vector and interpret it as point data for the VTKWriter.
Definition: function.hh:201
int id() const
Process-local consecutive zero-starting vertex id.
Definition: vtkwriter.hh:593
Precision
which precision to use when writing out data to vtk files
Definition: common.hh:319
PartitionType
Attributes used in the generic overlap model.
Definition: gridenums.hh:28
std::string pwrite(const std::string &name, const std::string &path, const std::string &extendpath, VTK::OutputType type=VTK::ascii)
write output (interface might change later)
Definition: vtkwriter.hh:830
PartitionIteratorType
Parameter to be used for the parallel level- and leaf iterators.
Definition: gridenums.hh:134
virtual void bind(const Entity &e)=0
Bind data set to grid entity - must be called before evaluating (i.e. calling write())
int renumber(const Dune::GeometryType &t, int i)
renumber VTK <-> Dune
Definition: common.hh:234
DataMode
Whether to produce conforming or non-conforming output.
Definition: common.hh:66
Implementation class for a multiple codim and multiple geometry type mapper.
Definition: mcmgmapper.hh:198
void addCellData(const std::shared_ptr< const VTKFunction > &p)
Add a grid function that lives on the cells of the grid to the visualization.
Definition: vtkwriter.hh:645
Descriptor struct for VTK fields.
Definition: common.hh:375
bool equals(const VertexIterator &cit) const
Definition: vtkwriter.hh:481
CellIterator(const GridCellIterator &x)
construct a CellIterator from the gridview's Iterator.
Definition: vtkwriter.hh:384
void beginCells()
start section for the grid cells/PolyData lines
Definition: vtuwriter.hh:272
void addVertexData(const Container &v, const std::string &name, int ncomps=1, VTK::Precision prec=VTK::Precision::float32)
Add a grid function (represented by container) that lives on the vertices of the grid to the visualiz...
Definition: vtkwriter.hh:756
Include standard header files.
Definition: agrid.hh:58
@ base64
Output to the file is inline base64 binary.
Definition: common.hh:46
virtual ~FunctionWrapperBase()
Definition: vtkwriter.hh:174
@ InteriorEntity
all interior entities
Definition: gridenums.hh:29
VTK::Precision coordPrecision() const
get the precision with which coordinates are written out
Definition: vtkwriter.hh:778