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/std/memory.hh> 22 #include <dune/common/indent.hh> 23 #include <dune/common/iteratorfacades.hh> 24 #include <dune/common/path.hh> 25 #include <dune/geometry/referenceelements.hh> 54 template<
class F,
class E,
class =
void >
59 template<
class F,
class E >
60 struct IsBindable< F, E, void_t< decltype(
std::declval< F & >().bind( std::declval< const E & >() ) ), decltype( std::declval< F & >().unbind() ) > >
66 namespace VTKWriteTypeTraits {
74 template <
class Gr
idView>
76 template <
class Gr
idView>
87 template<
class Gr
idView >
102 typedef typename GridView::template Codim< 0 >::Entity Cell;
103 typedef typename GridView::template Codim< n >::Entity Vertex;
111 typedef typename GridView::template Codim< 0 >
112 ::template Partition< VTK_Partition >::Iterator
114 typedef typename GridView::template Codim< n >
115 ::template Partition< VTK_Partition >::Iterator
118 typedef typename GridCellIterator::Reference EntityReference;
120 typedef typename GridView::template Codim< 0 >
121 ::Entity::Geometry::LocalCoordinate Coordinate;
128 switch( VTK_Partition )
133 default: DUNE_THROW(NotImplemented,
"Add check for this partition type");
160 virtual void bind(
const Entity& e) = 0;
163 virtual void unbind() = 0;
169 virtual void write(
const Coordinate& pos, Writer& w, std::size_t count)
const = 0;
183 template<
typename F_>
185 : _f(
std::forward<F_>(f))
188 virtual void bind(
const Entity& e)
198 virtual void write(
const Coordinate& pos, Writer& w, std::size_t count)
const 202 do_write(w,r,count,is_indexable<decltype(r)>());
208 void do_write(Writer& w,
const R& r, std::size_t count, std::true_type)
const 210 for (std::size_t i = 0; i < count; ++i)
215 void do_write(Writer& w,
const R& r, std::size_t count, std::false_type)
const 233 virtual void bind(
const Entity& e)
243 virtual void write(
const Coordinate& pos, Writer& w, std::size_t count)
const 245 for (std::size_t i = 0; i < count; ++i)
246 w.
write(_f->evaluate(i,*_entity,pos));
251 std::shared_ptr< const VTKFunction > _f;
252 const Entity* _entity;
257 template<typename F, std::enable_if_t<Impl::IsBindable<F, Entity>::value,
int> = 0>
260 , _fieldInfo(fieldInfo)
264 template<typename F, std::enable_if_t<not Impl::IsBindable<F, Entity>::value,
int> = 0>
267 typename
std::decay<decltype(localFunction(
std::forward<F>(f)))>::type
268 > >(localFunction(
std::forward<F>(f))))
269 , _fieldInfo(fieldInfo)
276 vtkFunctionPtr->name(),
277 vtkFunctionPtr->ncomps() > 1 ? VTK::FieldInfo::Type::vector : VTK::FieldInfo::Type::scalar,
278 vtkFunctionPtr->ncomps()
285 return fieldInfo().name();
295 void bind(
const Entity& e)
const 307 void write(
const Coordinate& pos, Writer& w)
const 309 _f->write(pos,w,fieldInfo().size());
312 std::shared_ptr<FunctionWrapperBase>
_f;
334 return ReferenceElements<DT,n>::general((*this)->type()).position(0,0);
340 return gridView_.template begin< 0, VTK_Partition >();
345 return gridView_.template end< 0, VTK_Partition >();
364 public ForwardIteratorFacade<VertexIterator, const Entity, EntityReference, int>
366 GridCellIterator git;
367 GridCellIterator gend;
372 const VertexMapper & vertexmapper;
373 std::vector<bool> visited;
386 const int numCorners = git->subEntities(n);
387 if( cornerIndexDune == numCorners )
389 offset += numCorners;
393 while( (git != gend) && skipEntity( git->partitionType() ) )
399 const GridCellIterator & end,
401 const VertexMapper & vm) :
402 git(x), gend(end), datamode(dm), cornerIndexDune(0),
403 vertexmapper(vm), visited(vm.size(), false),
407 visited[vertexmapper.
subIndex(*git,cornerIndexDune,n)] =
true;
414 while(visited[vertexmapper.
subIndex(*git,cornerIndexDune,n)])
417 if (git == gend)
return;
419 visited[vertexmapper.
subIndex(*git,cornerIndexDune,n)] =
true;
428 return git == cit.git
429 && cornerIndexDune == cit.cornerIndexDune
430 && datamode == cit.datamode;
439 return cornerIndexDune;
444 return referenceElement<DT,n>(git->type())
445 .position(cornerIndexDune,n);
451 return VertexIterator( gridView_.template begin< 0, VTK_Partition >(),
452 gridView_.template end< 0, VTK_Partition >(),
453 datamode, *vertexmapper );
458 return VertexIterator( gridView_.template end< 0, VTK_Partition >(),
459 gridView_.template end< 0, VTK_Partition >(),
460 datamode, *vertexmapper );
479 public ForwardIteratorFacade<CornerIterator, const Entity, EntityReference, int>
481 GridCellIterator git;
482 GridCellIterator gend;
487 const VertexMapper & vertexmapper;
491 const std::vector<int> & number;
500 const GridCellIterator & end,
502 const VertexMapper & vm,
503 const std::vector<int> & num) :
504 git(x), gend(end), datamode(dm), cornerIndexVTK(0),
506 number(num), offset(0) {}
512 const int numCorners = git->subEntities(n);
513 if( cornerIndexVTK == numCorners )
515 offset += numCorners;
519 while( (git != gend) && skipEntity( git->partitionType() ) )
525 return git == cit.git
526 && cornerIndexVTK == cit.cornerIndexVTK
527 && datamode == cit.datamode;
549 DUNE_THROW(IOError,
"VTKWriter: unsupported DataMode" << datamode);
556 return CornerIterator( gridView_.template begin< 0, VTK_Partition >(),
557 gridView_.template end< 0, VTK_Partition >(),
558 datamode, *vertexmapper, number );
563 return CornerIterator( gridView_.template end< 0, VTK_Partition >(),
564 gridView_.template end< 0, VTK_Partition >(),
565 datamode, *vertexmapper, number );
578 : gridView_( gridView ),
580 polyhedralCellsPresent_( checkForPolyhedralCells() )
616 template<
class Container>
617 void addCellData (
const Container& v,
const std::string &name,
int ncomps = 1)
620 for (
int c=0; c<ncomps; ++c) {
621 std::stringstream compName;
624 compName <<
"[" << c <<
"]";
625 VTKFunction* p =
new Function(gridView_, v, compName.str(), ncomps, c);
626 addCellData(std::shared_ptr< const VTKFunction >(p));
664 template<
class Container>
665 void addVertexData (
const Container& v,
const std::string &name,
int ncomps=1)
668 for (
int c=0; c<ncomps; ++c) {
669 std::stringstream compName;
672 compName <<
"[" << c <<
"]";
673 VTKFunction* p =
new Function(gridView_, v, compName.str(), ncomps, c);
674 addVertexData(std::shared_ptr< const VTKFunction >(p));
702 std::string
write (
const std::string &name,
705 return write( name, type, gridView_.comm().rank(), gridView_.comm().size() );
734 std::string
pwrite (
const std::string & name,
const std::string & path,
const std::string & extendpath,
737 return pwrite( name, path, extendpath, type, gridView_.comm().rank(), gridView_.comm().size() );
754 const std::string& path,
755 int commRank,
int commSize)
const 757 std::ostringstream s;
758 if(path.size() > 0) {
760 if(path[path.size()-1] !=
'/')
763 s <<
's' << std::setw(4) << std::setfill(
'0') << commSize <<
'-';
764 s <<
'p' << std::setw(4) << std::setfill(
'0') << commRank <<
'-';
785 const std::string& path,
788 std::ostringstream s;
789 if(path.size() > 0) {
791 if(path[path.size()-1] !=
'/')
794 s <<
's' << std::setw(4) << std::setfill(
'0') << commSize <<
'-';
817 const std::string& path)
const 819 static const std::string extension =
822 return concatPaths(path, name+extension);
840 std::string
write (
const std::string &name,
848 return pwrite(name,
"",
"", type, commRank, commSize);
854 std::string pieceName = getSerialPieceName(name,
"");
858 file.exceptions(std::ios_base::badbit | std::ios_base::failbit |
859 std::ios_base::eofbit);
862 file.open( pieceName.c_str(), std::ios::binary );
865 std::cerr <<
"Filename: " << pieceName <<
" could not be opened" << std::endl;
868 if (! file.is_open())
869 DUNE_THROW(IOError,
"Could not write to piece file " << pieceName);
870 writeDataFile( file );
900 std::string
pwrite(
const std::string& name,
const std::string& path,
901 const std::string& extendpath,
910 file.exceptions(std::ios_base::badbit | std::ios_base::failbit |
911 std::ios_base::eofbit);
912 std::string piecepath = concatPaths(path, extendpath);
913 std::string relpiecepath = relativePath(path, piecepath);
916 std::string fullname = getParallelPieceName(name, piecepath, commRank,
920 file.open(fullname.c_str(),std::ios::binary);
923 std::cerr <<
"Filename: " << fullname <<
" could not be opened" << std::endl;
926 if (! file.is_open())
927 DUNE_THROW(IOError,
"Could not write to piecefile file " << fullname);
930 gridView_.comm().barrier();
933 fullname = getParallelHeaderName(name, path, commSize);
936 file.open(fullname.c_str());
937 if (! file.is_open())
938 DUNE_THROW(IOError,
"Could not write to parallel file " << fullname);
939 writeParallelHeader(file,name,relpiecepath, commSize );
942 gridView_.comm().barrier();
965 void writeParallelHeader(std::ostream& s,
const std::string& piecename,
966 const std::string& piecepath,
const int commSize)
977 std::string scalars, vectors;
978 std::tie(scalars,vectors) = getDataNames(vertexdata);
981 for (
auto it = vertexdata.begin(),
982 end = vertexdata.end();
986 unsigned writecomps = it->fieldInfo().size();
987 if(writecomps == 2) writecomps = 3;
988 writer.
addArray<
float>(it->name(), writecomps);
994 std::string scalars, vectors;
995 std::tie(scalars,vectors) = getDataNames(celldata);
998 for (
auto it = celldata.begin(),
999 end = celldata.end();
1003 unsigned writecomps = it->fieldInfo().size();
1004 if(writecomps == 2) writecomps = 3;
1005 writer.
addArray<
float>(it->name(), writecomps);
1011 writer.
addArray<
float>(
"Coordinates", 3);
1015 for(
int i = 0; i < commSize; ++i )
1017 const std::string& fullname = getParallelPieceName(piecename,
1027 void writeDataFile (std::ostream& s)
1038 number.resize(vertexmapper->size());
1039 for (std::vector<int>::size_type i=0; i<number.size(); i++) number[i] = -1;
1041 countEntities(nvertices, ncells, ncorners);
1044 writeAllData(writer);
1049 writeAllData(writer);
1052 delete vertexmapper; number.clear();
1057 writeVertexData(writer);
1060 writeCellData(writer);
1063 writeGridPoints(writer);
1066 writeGridCells(writer);
1080 DUNE_THROW(IOError,
"VTKWriter: unsupported OutputType" << outputtype);
1088 return "UnstructuredGrid";
1102 const int subEntities = it->subEntities(n);
1103 for (
int i=0; i<subEntities; ++i)
1108 int alpha = vertexmapper->subIndex(*it,i,n);
1109 if (number[alpha]<0)
1110 number[alpha] = nvertices++;
1120 template<
typename T>
1123 std::string scalars =
"";
1124 for (
auto it = data.begin(),
1130 scalars = it->name();
1134 std::string vectors =
"";
1135 for (
auto it = data.begin(),
1141 vectors = it->name();
1144 return std::make_tuple(scalars,vectors);
1147 template<
typename Data,
typename Iterator>
1150 for (
auto it = data.begin(),
1155 const auto& f = *it;
1157 std::size_t writecomps = fieldInfo.
size();
1158 switch (fieldInfo.
type())
1166 DUNE_THROW(IOError,
"Cannot write VTK vectors with more than 3 components (components was " << writecomps <<
")");
1170 DUNE_THROW(NotImplemented,
"VTK output for tensors not implemented yet");
1172 std::shared_ptr<VTK::DataArrayWriter<float> > p
1174 if(!p->writeIsNoop())
1175 for (Iterator eit = begin; eit!=end; ++eit)
1177 const Entity & e = *eit;
1179 f.write(eit.position(),*p);
1183 for (std::size_t j=fieldInfo.
size(); j < writecomps; ++j)
1192 if(celldata.size() == 0)
1195 std::string scalars, vectors;
1196 std::tie(scalars,vectors) = getDataNames(celldata);
1199 writeData(writer,celldata,cellBegin(),cellEnd(),ncells);
1206 if(vertexdata.size() == 0)
1209 std::string scalars, vectors;
1210 std::tie(scalars,vectors) = getDataNames(vertexdata);
1213 writeData(writer,vertexdata,vertexBegin(),vertexEnd(),nvertices);
1222 std::shared_ptr<VTK::DataArrayWriter<float> > p
1224 if(!p->writeIsNoop()) {
1229 for (
int j=0; j<
std::min(dimw,3); j++)
1230 p->write((*vit).geometry().corner(vit.localindex())[j]);
1231 for (
int j=std::min(dimw,3); j<3; j++)
1248 std::shared_ptr<VTK::DataArrayWriter<int> > p1
1250 if(!p1->writeIsNoop())
1257 std::shared_ptr<VTK::DataArrayWriter<int> > p2
1259 if(!p2->writeIsNoop()) {
1263 offset += it->subEntities(n);
1273 std::shared_ptr<VTK::DataArrayWriter<unsigned char> > p3
1276 if(!p3->writeIsNoop())
1288 if( polyhedralCellsPresent_ )
1290 writeCellFaces( writer );
1301 for(
const auto& geomType : gridView_.indexSet().types( 0 ) )
1314 if( ! faceVertices_ )
1316 faceVertices_.reset(
new std::pair< std::vector<int>, std::vector<int> > () );
1318 fillFaceVertices( cornerBegin(), cornerEnd(), gridView_.indexSet(),
1319 faceVertices_->first, faceVertices_->second );
1322 std::vector< int >& faces = faceVertices_->first;
1323 std::vector< int >& faceOffsets = faceVertices_->second;
1324 assert(
int(faceOffsets.size()) == ncells );
1327 std::shared_ptr<VTK::DataArrayWriter< int > > p4
1329 if(!p4->writeIsNoop())
1331 for(
const auto& face : faces )
1337 std::shared_ptr<VTK::DataArrayWriter< int > > p5
1339 if(!p5->writeIsNoop())
1341 for(
const auto& offset : faceOffsets )
1342 p5->write( offset );
1345 faceVertices_.reset();
1350 template <
class CornerIterator,
class IndexSet,
class T>
1353 const IndexSet& indexSet,
1354 std::vector<T>& faces,
1355 std::vector<T>& faceOffsets )
1357 if( n == 3 && it != end )
1361 faces.reserve( 15 * ncells );
1362 faceOffsets.clear();
1363 faceOffsets.reserve( ncells );
1368 int elIndex = indexSet.index( element );
1369 std::vector< T > vertices;
1370 vertices.reserve( 30 );
1371 for( ; it != end; ++it )
1373 const Cell& cell = *it ;
1374 const int cellIndex = indexSet.index( cell ) ;
1375 if( elIndex != cellIndex )
1377 fillFacesForElement( element, indexSet, vertices, offset, faces, faceOffsets );
1381 elIndex = cellIndex ;
1383 vertices.push_back( it.
id() );
1387 fillFacesForElement( element, indexSet, vertices, offset, faces, faceOffsets );
1391 template <
class Entity,
class IndexSet,
class T>
1393 const IndexSet& indexSet,
1394 const std::vector<T>& vertices,
1396 std::vector<T>& faces,
1397 std::vector<T>& faceOffsets )
1401 std::map< T, T > vxMap;
1404 const int nVertices = element.subEntities( dim );
1405 for(
int vx = 0; vx < nVertices; ++ vx )
1407 const int vxIdx = indexSet.subIndex( element, vx, dim );
1408 vxMap[ vxIdx ] = vertices[ vx ];
1412 const int nFaces = element.subEntities( 1 );
1414 faces.push_back( nFaces );
1417 for(
int fce = 0; fce < nFaces; ++ fce )
1420 const auto face = element.template subEntity< 1 > ( fce );
1423 const int nVxFace = face.subEntities( dim );
1424 faces.push_back( nVxFace );
1426 for(
int i=0; i<nVxFace; ++i )
1428 const T vxIndex = indexSet.subIndex( face, i, dim );
1429 assert( vxMap.find( vxIndex ) != vxMap.end() );
1430 faces.push_back( vxMap[ vxIndex ] );
1436 faceOffsets.push_back( offset );
1452 VertexMapper* vertexmapper;
1455 std::vector<int> number;
1459 const bool polyhedralCellsPresent_;
1462 std::shared_ptr< std::pair< std::vector<int>, std::vector<int> > > faceVertices_;
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:900
Include standard header files.
Definition: agrid.hh:58
OutputType
How the bulk data should be stored in the file.
Definition: common.hh:40
void endAppended()
finish the appended data section
Definition: vtuwriter.hh:357
Output is to the file is appended base64 binary.
Definition: common.hh:48
void endCellData()
finish CellData section
Definition: pvtuwriter.hh:153
void endMain()
finish the main PolyData/UnstructuredGrid section
Definition: pvtuwriter.hh:193
FunctionWrapper(F_ &&f)
Definition: vtkwriter.hh:184
Writer for the ouput of grid functions in the vtk format.Writes arbitrary grid functions (living on c...
Definition: vtkwriter.hh:88
bool beginAppended()
start the appended data section
Definition: vtuwriter.hh:343
Mapper for multiple codim and multiple geometry types.
bool equals(const VertexIterator &cit) const
Definition: vtkwriter.hh:426
for .vtp files (PolyData)
Definition: common.hh:300
A base class for grid functions with any return type and dimension.
Definition: function.hh:38
EntityReference dereference() const
Definition: vtkwriter.hh:529
PartitionIteratorType
Parameter to be used for the parallel level- and leaf iterators.
Definition: gridenums.hh:134
VertexIterator(const GridCellIterator &x, const GridCellIterator &end, const VTK::DataMode &dm, const VertexMapper &vm)
Definition: vtkwriter.hh:398
Traits ::Grid Grid
type of the grid
Definition: common/gridview.hh:77
virtual void countEntities(int &nvertices, int &ncells, int &ncorners)
count the vertices, cells and corners
Definition: vtkwriter.hh:1092
void beginMain(unsigned ncells, unsigned npoints)
start the main PolyData/UnstructuredGrid section
Definition: vtuwriter.hh:308
interior and border entities
Definition: gridenums.hh:136
Grid view abstract base class.
Definition: common/gridview.hh:59
void endCellData()
finish CellData section
Definition: vtuwriter.hh:218
FieldVector< DT, n > position() const
position of vertex inside the entity
Definition: vtkwriter.hh:442
void addCellData(F &&f, VTK::FieldInfo vtkFieldInfo)
Add a grid function that lives on the cells of the grid to the visualization.
Definition: vtkwriter.hh:596
int ncells
Definition: vtkwriter.hh:1448
Iterator over the grids elements.
Definition: vtkwriter.hh:325
for .vtu files (UnstructuredGrid)
Definition: common.hh:302
all interior entities
Definition: gridenums.hh:29
Common stuff for the VTKWriter.
Base class for polymorphic container of underlying data set.
Definition: vtkwriter.hh:156
void beginMain(unsigned ghostLevel=0)
start the main PPolyData/PUnstructuredGrid section
Definition: pvtuwriter.hh:187
CellIterator cellEnd() const
Definition: vtkwriter.hh:343
int nvertices
Definition: vtkwriter.hh:1449
virtual void writeGridCells(VTK::VTUWriter &writer)
write the connectivity array
Definition: vtkwriter.hh:1242
Definition: vtkwriter.hh:68
std::string getTypeString() const
Definition: vtkwriter.hh:1083
Take a vector and interpret it as point data for the VTKWriter.
Definition: function.hh:186
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:840
Traits ::IndexSet IndexSet
type of the index set
Definition: common/gridview.hh:80
void clear()
clear list of registered functions
Definition: vtkwriter.hh:679
typename std::decay< F >::type Function
Definition: vtkwriter.hh:181
Base class to write pvd-files which contains a list of all collected vtk-files.
Definition: vtksequencewriterbase.hh:31
std::string getFormatString() const
Definition: vtkwriter.hh:1070
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:634
std::string name() const
Returns the name of the data set.
Definition: vtkwriter.hh:283
void endPointData()
finish PointData section
Definition: vtuwriter.hh:180
Output to the file is in ascii.
Definition: common.hh:42
void beginPoints()
start section for the point coordinates
Definition: pvtuwriter.hh:164
std::size_t size() const
The number of components in the data field.
Definition: common.hh:350
void addCellData(const Container &v, const std::string &name, int ncomps=1)
Add a grid function (represented by container) that lives on the cells of the grid to the visualizati...
Definition: vtkwriter.hh:617
CornerIterator cornerEnd() const
Definition: vtkwriter.hh:561
virtual void writeCellData(VTK::VTUWriter &writer)
write cell data
Definition: vtkwriter.hh:1190
Iterate over the elements' corners.
Definition: vtkwriter.hh:478
Implementation class for a multiple codim and multiple geometry type mapper.
Definition: mcmgmapper.hh:198
int id() const
Process-local consecutive zero-starting vertex id.
Definition: vtkwriter.hh:538
Type erasure implementation for legacy VTKFunctions.
Definition: vtkwriter.hh:225
void increment()
Definition: vtkwriter.hh:409
Type erasure wrapper for VTK data sets.
Definition: vtkwriter.hh:148
std::shared_ptr< FunctionWrapperBase > _f
Definition: vtkwriter.hh:312
CornerIterator cornerBegin() const
Definition: vtkwriter.hh:554
Dune::VTKFunction< GridView > VTKFunction
Definition: vtkwriter.hh:140
std::string getSerialPieceName(const std::string &name, const std::string &path) const
return name of a serial piece file
Definition: vtkwriter.hh:816
void addArray(const std::string &name, unsigned ncomps)
Add an array to the output file.
Definition: pvtuwriter.hh:205
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:734
void beginCells()
start section for the grid cells/PolyData lines
Definition: vtuwriter.hh:272
VertexIterator vertexEnd() const
Definition: vtkwriter.hh:456
void basicIncrement()
Definition: vtkwriter.hh:381
virtual void unbind()
Unbind data set from current grid entity - mostly here for performance and symmetry reasons...
Definition: vtkwriter.hh:193
Grid::ctype ctype
type used for coordinates in grid
Definition: common/gridview.hh:124
void beginPointData(const std::string &scalars="", const std::string &vectors="")
start PointData section
Definition: pvtuwriter.hh:118
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:587
virtual void writeGridPoints(VTK::VTUWriter &writer)
write the positions of vertices
Definition: vtkwriter.hh:1218
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:243
void beginPoints()
start section for the point coordinates
Definition: vtuwriter.hh:236
VTKWriter(const GridView &gridView, VTK::DataMode dm=VTK::conforming)
Construct a VTKWriter working on a specific GridView.
Definition: vtkwriter.hh:576
Output to the file is inline base64 binary.
Definition: common.hh:44
void endPoints()
finish section for the point coordinates
Definition: vtuwriter.hh:247
Iterate over the grid's vertices.
Definition: vtkwriter.hh:363
void addVertexData(const Container &v, const std::string &name, int ncomps=1)
Add a grid function (represented by container) that lives on the vertices of the grid to the visualiz...
Definition: vtkwriter.hh:665
GeometryType geometryType(const Dune::GeometryType &t)
mapping from GeometryType to VTKGeometryType
Definition: common.hh:197
int min(const DofVectorPointer< int > &dofVector)
Definition: dofvector.hh:346
CornerIterator(const GridCellIterator &x, const GridCellIterator &end, const VTK::DataMode &dm, const VertexMapper &vm, const std::vector< int > &num)
Definition: vtkwriter.hh:499
VTKFunctionWrapper(const std::shared_ptr< const VTKFunction > &f)
Definition: vtkwriter.hh:228
bool checkForPolyhedralCells() const
Definition: vtkwriter.hh:1298
Type type() const
The type of the data field.
Definition: common.hh:344
std::tuple< std::string, std::string > getDataNames(const T &data) const
Definition: vtkwriter.hh:1121
void writeData(VTK::VTUWriter &writer, const Data &data, const Iterator begin, const Iterator end, int nentries)
Definition: vtkwriter.hh:1148
virtual void bind(const Entity &e)
Bind data set to grid entity - must be called before evaluating (i.e. calling write()) ...
Definition: vtkwriter.hh:233
base class for data array writers
Definition: dataarraywriter.hh:53
Descriptor struct for VTK fields.
Definition: common.hh:314
Output non-conforming data.
Definition: common.hh:78
VTK::FieldInfo _fieldInfo
Definition: vtkwriter.hh:313
void beginCellData(const std::string &scalars="", const std::string &vectors="")
start CellData section
Definition: vtuwriter.hh:203
virtual void bind(const Entity &e)
Bind data set to grid entity - must be called before evaluating (i.e. calling write()) ...
Definition: vtkwriter.hh:188
Functions for VTK output.
void unbind() const
Unbind the data set from the currently bound entity.
Definition: vtkwriter.hh:301
const FieldVector< DT, n > position() const
Definition: vtkwriter.hh:332
virtual ~FunctionWrapperBase()
Definition: vtkwriter.hh:171
PartitionType
Attributes used in the generic overlap model.
Definition: gridenums.hh:28
VertexIterator vertexBegin() const
Definition: vtkwriter.hh:449
std::string write(const std::string &name, VTK::OutputType type=VTK::ascii)
write output (interface might change later)
Definition: vtkwriter.hh:702
std::list< VTKLocalFunction >::const_iterator FunctionIterator
Definition: vtkwriter.hh:317
void endCells()
start section for the grid cells/PolyData lines
Definition: vtuwriter.hh:283
VTK::DataArrayWriter< float > Writer
Definition: vtkwriter.hh:153
GridView gridView_
Definition: vtkwriter.hh:1445
Writer for the ouput of grid functions in the vtk format.Writes arbitrary grid functions (living on c...
Definition: vtksequencewriter.hh:26
bool equals(const CornerIterator &cit) const
Definition: vtkwriter.hh:523
virtual void write(T data)=0
write one data element
std::list< VTKLocalFunction > celldata
Definition: vtkwriter.hh:1441
VTKLocalFunction(const std::shared_ptr< const VTKFunction > &vtkFunctionPtr)
Construct a VTKLocalFunction for a legacy VTKFunction.
Definition: vtkwriter.hh:273
int ncorners
Definition: vtkwriter.hh:1450
DataArrayWriter< T > * makeArrayWriter(const std::string &name, unsigned ncomps, unsigned nitems)
acquire a DataArrayWriter
Definition: vtuwriter.hh:379
Output is to the file is appended raw binary.
Definition: common.hh:46
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
tensor field (always 3x3)
CellIterator(const GridCellIterator &x)
construct a CellIterator from the gridview's Iterator.
Definition: vtkwriter.hh:329
void addVertexData(F &&f, VTK::FieldInfo vtkFieldInfo)
Add a grid function that lives on the vertices of the grid to the visualization.
Definition: vtkwriter.hh:643
EntityReference dereference() const
Definition: vtkwriter.hh:432
CellIterator cellBegin() const
Definition: vtkwriter.hh:338
std::string getParallelHeaderName(const std::string &name, const std::string &path, int commSize) const
return name of a parallel header file
Definition: vtkwriter.hh:784
Definition: common.hh:188
void endPointData()
finish PointData section
Definition: pvtuwriter.hh:127
VTKLocalFunction(F &&f, VTK::FieldInfo fieldInfo)
Construct a VTKLocalFunction for a dune-functions style LocalFunction.
Definition: vtkwriter.hh:258
void beginPointData(const std::string &scalars="", const std::string &vectors="")
start PointData section
Definition: vtuwriter.hh:165
DataMode
Whether to produce conforming or non-conforming output.
Definition: common.hh:64
void beginCellData(const std::string &scalars="", const std::string &vectors="")
start CellData section
Definition: pvtuwriter.hh:144
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:753
void fillFaceVertices(CornerIterator it, const CornerIterator end, const IndexSet &indexSet, std::vector< T > &faces, std::vector< T > &faceOffsets)
Definition: vtkwriter.hh:1351
int localindex() const
index of vertex within the entity, in Dune-numbering
Definition: vtkwriter.hh:437
Take a vector and interpret it as cell data for the VTKWriter.
Definition: function.hh:88
virtual void writeVertexData(VTK::VTUWriter &writer)
write vertex data
Definition: vtkwriter.hh:1204
virtual void writeCellFaces(VTK::VTUWriter &writer)
write the connectivity array
Definition: vtkwriter.hh:1312
The dimension of the grid.
Definition: common/gridview.hh:127
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:307
void bind(const Entity &e) const
Bind the data set to grid entity e.
Definition: vtkwriter.hh:295
all entities
Definition: gridenums.hh:139
std::list< VTKLocalFunction > vertexdata
Definition: vtkwriter.hh:1442
int renumber(const Dune::GeometryType &t, int i)
renumber VTK <-> Dune
Definition: common.hh:232
VTK::OutputType outputtype
Definition: vtkwriter.hh:1465
vector-valued field (always 3D, will be padded if necessary)
void addPiece(const std::string &filename)
Add a serial piece to the output file.
Definition: pvtuwriter.hh:214
void endPoints()
finish section for the point coordinates
Definition: pvtuwriter.hh:169
Output conforming data.
Definition: common.hh:70
virtual ~VTKWriter()
destructor
Definition: vtkwriter.hh:686
const VTK::FieldInfo & fieldInfo() const
Returns the VTK::FieldInfo for the data set.
Definition: vtkwriter.hh:289
Type erasure implementation for functions conforming to the dune-functions LocalFunction interface...
Definition: vtkwriter.hh:178
The dimension of the world the grid lives in.
Definition: common/gridview.hh:131
Data array writers for the VTKWriter.
virtual void unbind()
Unbind data set from current grid entity - mostly here for performance and symmetry reasons...
Definition: vtkwriter.hh:238
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:1392
void endMain()
finish the main PolyData/UnstructuredGrid section
Definition: vtuwriter.hh:318
MCMGLayout mcmgVertexLayout()
layout for vertices (dim-0 entities)
Definition: mcmgmapper.hh:160
void increment()
Definition: vtkwriter.hh:507
Dump a .vtu/.vtp files contents to a stream.
Definition: vtuwriter.hh:96
Dump a .vtu/.vtp files contents to a stream.
Definition: pvtuwriter.hh:60
FileType
which type of VTK file to write
Definition: common.hh:298
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:198