4#ifndef DUNE_VTKWRITER_HH
5#define DUNE_VTKWRITER_HH
21#include <dune/common/std/memory.hh>
25#include <dune/geometry/referenceelements.hh>
27#include <dune/grid/common/gridenums.hh>
31#include <dune/grid/io/file/vtk/pvtuwriter.hh>
32#include <dune/grid/io/file/vtk/streams.hh>
33#include <dune/grid/io/file/vtk/vtuwriter.hh>
53 template<
typename F,
typename =
int>
54 struct _has_local_context
55 :
public std::false_type
59 struct _has_local_context<T,typename
std::enable_if<(sizeof(std::declval<T>().localContext()) > 0),int>::type>
60 :
public std::true_type
65 namespace VTKWriteTypeTraits {
67 struct IsLocalFunction
73 template <
class Gr
idView>
74 class VTKSequenceWriterBase;
75 template <
class Gr
idView>
76 class VTKSequenceWriter;
86 template<
class Gr
idView >
110 typedef typename GridView::template
Codim< 0 >
111 ::template Partition< VTK_Partition >::Iterator
113 typedef typename GridView::template
Codim< n >
114 ::template Partition< VTK_Partition >::Iterator
117 typedef typename GridCellIterator::Reference EntityReference;
119 typedef typename GridView::template
Codim< 0 >
120 ::Entity::Geometry::LocalCoordinate Coordinate;
127 switch( VTK_Partition )
159 virtual void bind(
const Entity& e) = 0;
168 virtual void write(
const Coordinate& pos,
Writer& w, std::size_t count)
const = 0;
180 using Function =
typename std::decay<F>::type;
182 template<
typename F_>
184 : _f(std::forward<F_>(f))
187 virtual void bind(
const Entity& e)
197 virtual void write(
const Coordinate& pos,
Writer& w, std::size_t count)
const
207 void do_write(
Writer& w,
const R& r, std::size_t count, std::true_type)
const
209 for (std::size_t i = 0; i < count; ++i)
214 void do_write(Writer& w,
const R& r, std::size_t count, std::false_type)
const
232 virtual void bind(
const Entity& e)
242 virtual void write(
const Coordinate& pos,
Writer& w, std::size_t count)
const
244 for (std::size_t i = 0; i < count; ++i)
245 w.
write(_f->evaluate(i,*_entity,pos));
250 std::shared_ptr< const VTKFunction > _f;
251 const Entity* _entity;
258 typename std::enable_if<detail::_has_local_context<F>::value,
int>::type dummy = 0)
266 typename std::enable_if<not detail::_has_local_context<F>::value,
int>::type dummy = 0)
268 typename
std::decay<decltype(localFunction(
std::forward<F>(f)))>::type
269 > >(localFunction(
std::forward<F>(f))))
277 vtkFunctionPtr->
name(),
278 vtkFunctionPtr->ncomps() > 1 ? VTK::FieldInfo::Type::vector : VTK::FieldInfo::Type::scalar,
279 vtkFunctionPtr->ncomps()
296 void bind(
const Entity& e)
const
313 std::shared_ptr<FunctionWrapperBase> _f;
318 typedef typename std::list<VTKLocalFunction>::const_iterator FunctionIterator;
339 CellIterator cellBegin()
const
341 return gridView_.template begin< 0, VTK_Partition >();
344 CellIterator cellEnd()
const
346 return gridView_.template end< 0, VTK_Partition >();
367 GridCellIterator git;
368 GridCellIterator gend;
374 std::vector<bool> visited;
382 void basicIncrement ()
387 const int numCorners = git->subEntities(n);
388 if( cornerIndexDune == numCorners )
390 offset += numCorners;
394 while( (git != gend) && skipEntity( git->partitionType() ) )
400 const GridCellIterator & end,
403 git(x), gend(end), datamode(dm), cornerIndexDune(0),
404 vertexmapper(vm), visited(vm.
size(),
false),
407 if (datamode == VTK::conforming && git != gend)
408 visited[vertexmapper.
subIndex(*git,cornerIndexDune,n)] =
true;
414 case VTK::conforming :
415 while(visited[vertexmapper.
subIndex(*git,cornerIndexDune,n)])
418 if (git == gend)
return;
420 visited[vertexmapper.
subIndex(*git,cornerIndexDune,n)] =
true;
422 case VTK::nonconforming :
429 return git == cit.git
430 && cornerIndexDune == cit.cornerIndexDune
431 && datamode == cit.datamode;
433 EntityReference dereference()
const
440 return cornerIndexDune;
446 .position(cornerIndexDune,n);
450 VertexIterator vertexBegin ()
const
452 return VertexIterator( gridView_.template begin< 0, VTK_Partition >(),
453 gridView_.template end< 0, VTK_Partition >(),
454 datamode, *vertexmapper );
457 VertexIterator vertexEnd ()
const
459 return VertexIterator( gridView_.template end< 0, VTK_Partition >(),
460 gridView_.template end< 0, VTK_Partition >(),
461 datamode, *vertexmapper );
482 GridCellIterator git;
483 GridCellIterator gend;
492 const std::vector<int> & number;
501 const GridCellIterator & end,
504 const std::vector<int> & num) :
505 git(x), gend(end), datamode(dm), cornerIndexVTK(0),
507 number(num), offset(0) {}
513 const int numCorners = git->subEntities(n);
514 if( cornerIndexVTK == numCorners )
516 offset += numCorners;
520 while( (git != gend) && skipEntity( git->partitionType() ) )
526 return git == cit.git
527 && cornerIndexVTK == cit.cornerIndexVTK
528 && datamode == cit.datamode;
530 EntityReference dereference()
const
543 case VTK::conforming :
545 number[vertexmapper.
subIndex(*git,VTK::renumber(*git,cornerIndexVTK),
547 case VTK::nonconforming :
548 return offset + VTK::renumber(*git,cornerIndexVTK);
555 CornerIterator cornerBegin ()
const
557 return CornerIterator( gridView_.template begin< 0, VTK_Partition >(),
558 gridView_.template end< 0, VTK_Partition >(),
559 datamode, *vertexmapper, number );
562 CornerIterator cornerEnd ()
const
564 return CornerIterator( gridView_.template end< 0, VTK_Partition >(),
565 gridView_.template end< 0, VTK_Partition >(),
566 datamode, *vertexmapper, number );
579 : gridView_( gridView ),
581 polyhedralCellsPresent_( checkForPolyhedralCells() )
596 celldata.push_back(VTKLocalFunction(std::forward<F>(f),vtkFieldInfo));
614 template<
class Container>
615 void addCellData (
const Container& v,
const std::string &name,
int ncomps = 1)
618 for (
int c=0; c<ncomps; ++c) {
619 std::stringstream compName;
622 compName <<
"[" << c <<
"]";
624 addCellData(std::shared_ptr< const VTKFunction >(p));
640 vertexdata.push_back(VTKLocalFunction(std::forward<F>(f),vtkFieldInfo));
659 template<
class Container>
660 void addVertexData (
const Container& v,
const std::string &name,
int ncomps=1)
663 for (
int c=0; c<ncomps; ++c) {
664 std::stringstream compName;
667 compName <<
"[" << c <<
"]";
697 std::string
write (
const std::string &name,
700 return write( name, type, gridView_.
comm().rank(), gridView_.
comm().size() );
729 std::string
pwrite (
const std::string & name,
const std::string & path,
const std::string & extendpath,
732 return pwrite( name, path, extendpath, type, gridView_.
comm().rank(), gridView_.
comm().size() );
749 const std::string& path,
750 int commRank,
int commSize)
const
752 std::ostringstream s;
753 if(path.size() > 0) {
755 if(path[path.size()-1] !=
'/')
758 s <<
's' << std::setw(4) << std::setfill(
'0') << commSize <<
'-';
759 s <<
'p' << std::setw(4) << std::setfill(
'0') << commRank <<
'-';
780 const std::string& path,
783 std::ostringstream s;
784 if(path.size() > 0) {
786 if(path[path.size()-1] !=
'/')
789 s <<
's' << std::setw(4) << std::setfill(
'0') << commSize <<
'-';
812 const std::string& path)
const
814 static const std::string extension =
835 std::string
write (
const std::string &name,
843 return pwrite(name,
"",
"", type, commRank, commSize);
853 file.exceptions(std::ios_base::badbit | std::ios_base::failbit |
854 std::ios_base::eofbit);
857 file.open( pieceName.c_str(), std::ios::binary );
860 std::cerr <<
"Filename: " << pieceName <<
" could not be opened" << std::endl;
863 if (! file.is_open())
865 writeDataFile( file );
895 std::string
pwrite(
const std::string& name,
const std::string& path,
896 const std::string& extendpath,
905 file.exceptions(std::ios_base::badbit | std::ios_base::failbit |
906 std::ios_base::eofbit);
907 std::string piecepath =
concatPaths(path, extendpath);
908 std::string relpiecepath =
relativePath(path, piecepath);
915 file.open(fullname.c_str(),std::ios::binary);
918 std::cerr <<
"Filename: " << fullname <<
" could not be opened" << std::endl;
921 if (! file.is_open())
925 gridView_.
comm().barrier();
931 file.open(fullname.c_str());
932 if (! file.is_open())
934 writeParallelHeader(file,name,relpiecepath, commSize );
937 gridView_.
comm().barrier();
960 void writeParallelHeader(std::ostream& s,
const std::string& piecename,
961 const std::string& piecepath,
const int commSize)
964 (n == 1) ? VTK::polyData : VTK::unstructuredGrid;
972 std::string scalars, vectors;
973 std::tie(scalars,vectors) = getDataNames(vertexdata);
974 writer.beginPointData(scalars, vectors);
976 for (
auto it = vertexdata.begin(),
977 end = vertexdata.end();
981 unsigned writecomps = it->fieldInfo().size();
982 if(writecomps == 2) writecomps = 3;
983 writer.addArray<
float>(it->name(), writecomps);
985 writer.endPointData();
989 std::string scalars, vectors;
990 std::tie(scalars,vectors) = getDataNames(celldata);
991 writer.beginCellData(scalars, vectors);
993 for (
auto it = celldata.begin(),
994 end = celldata.end();
998 unsigned writecomps = it->fieldInfo().size();
999 if(writecomps == 2) writecomps = 3;
1000 writer.addArray<
float>(it->name(), writecomps);
1002 writer.endCellData();
1005 writer.beginPoints();
1006 writer.addArray<
float>(
"Coordinates", 3);
1010 for(
int i = 0; i < commSize; ++i )
1015 writer.addPiece(fullname);
1022 void writeDataFile (std::ostream& s)
1024 VTK::FileType fileType =
1025 (n == 1) ? VTK::polyData : VTK::unstructuredGrid;
1027 VTK::VTUWriter writer(s, outputtype, fileType);
1030 vertexmapper =
new VertexMapper( gridView_ );
1031 if (datamode == VTK::conforming)
1033 number.resize(vertexmapper->
size());
1034 for (std::vector<int>::size_type i=0; i<number.size(); i++) number[i] = -1;
1038 writer.beginMain(ncells, nvertices);
1039 writeAllData(writer);
1043 if(writer.beginAppended())
1044 writeAllData(writer);
1045 writer.endAppended();
1047 delete vertexmapper; number.clear();
1050 void writeAllData(VTK::VTUWriter& writer) {
1065 std::string getFormatString()
const
1067 if (outputtype==VTK::ascii)
1069 if (outputtype==VTK::base64)
1071 if (outputtype==VTK::appendedraw)
1073 if (outputtype==VTK::appendedbase64)
1075 DUNE_THROW(IOError,
"VTKWriter: unsupported OutputType" << outputtype);
1078 std::string getTypeString()
const
1083 return "UnstructuredGrid";
1097 const int subEntities = it->subEntities(n);
1098 for (
int i=0; i<subEntities; ++i)
1101 if (datamode == VTK::conforming)
1103 int alpha = vertexmapper->
subIndex(*it,i,n);
1104 if (number[alpha]<0)
1105 number[alpha] = nvertices++;
1115 template<
typename T>
1116 std::tuple<std::string,std::string> getDataNames(
const T& data)
const
1118 std::string scalars =
"";
1119 for (
auto it = data.begin(),
1125 scalars = it->name();
1129 std::string vectors =
"";
1130 for (
auto it = data.begin(),
1136 vectors = it->name();
1139 return std::make_tuple(scalars,vectors);
1142 template<
typename Data,
typename Iterator>
1143 void writeData(VTK::VTUWriter& writer,
const Data& data,
const Iterator begin,
const Iterator end,
int nentries)
1145 for (
auto it = data.begin(),
1150 const auto& f = *it;
1151 VTK::FieldInfo fieldInfo = f.fieldInfo();
1152 std::size_t writecomps = fieldInfo.size();
1153 switch (fieldInfo.type())
1161 DUNE_THROW(IOError,
"Cannot write VTK vectors with more than 3 components (components was " << writecomps <<
")");
1165 DUNE_THROW(NotImplemented,
"VTK output for tensors not implemented yet");
1167 std::shared_ptr<VTK::DataArrayWriter<float> > p
1168 (writer.makeArrayWriter<
float>(f.name(), writecomps, nentries));
1169 if(!p->writeIsNoop())
1170 for (Iterator eit = begin; eit!=end; ++eit)
1172 const Entity & e = *eit;
1174 f.write(eit.position(),*p);
1178 for (std::size_t j=fieldInfo.size(); j < writecomps; ++j)
1187 if(celldata.size() == 0)
1190 std::string scalars, vectors;
1191 std::tie(scalars,vectors) = getDataNames(celldata);
1194 writeData(writer,celldata,cellBegin(),cellEnd(),ncells);
1201 if(vertexdata.size() == 0)
1204 std::string scalars, vectors;
1205 std::tie(scalars,vectors) = getDataNames(vertexdata);
1208 writeData(writer,vertexdata,vertexBegin(),vertexEnd(),nvertices);
1217 std::shared_ptr<VTK::DataArrayWriter<float> > p
1219 if(!p->writeIsNoop()) {
1224 for (
int j=0; j<std::min(dimw,3); j++)
1225 p->write((*vit).geometry().corner(vit.localindex())[j]);
1226 for (
int j=std::min(dimw,3); j<3; j++)
1243 std::shared_ptr<VTK::DataArrayWriter<int> > p1
1245 if(!p1->writeIsNoop())
1252 std::shared_ptr<VTK::DataArrayWriter<int> > p2
1254 if(!p2->writeIsNoop()) {
1258 offset += it->subEntities(n);
1268 std::shared_ptr<VTK::DataArrayWriter<unsigned char> > p3
1271 if(!p3->writeIsNoop())
1275 int vtktype = VTK::geometryType(it->type());
1283 if( polyhedralCellsPresent_ )
1293 bool checkForPolyhedralCells()
const
1296 for(
const auto& geomType : gridView_.
indexSet().types( 0 ) )
1298 if( VTK::geometryType( geomType ) == VTK::polyhedron )
1309 if( ! faceVertices_ )
1311 faceVertices_.reset(
new std::pair< std::vector<int>, std::vector<int> > () );
1313 fillFaceVertices( cornerBegin(), cornerEnd(), gridView_.
indexSet(),
1314 faceVertices_->first, faceVertices_->second );
1317 std::vector< int >& faces = faceVertices_->first;
1318 std::vector< int >& faceOffsets = faceVertices_->second;
1319 assert(
int(faceOffsets.size()) == ncells );
1322 std::shared_ptr<VTK::DataArrayWriter< int > > p4
1324 if(!p4->writeIsNoop())
1326 for(
const auto& face : faces )
1332 std::shared_ptr<VTK::DataArrayWriter< int > > p5
1334 if(!p5->writeIsNoop())
1336 for(
const auto& offset : faceOffsets )
1337 p5->write( offset );
1340 faceVertices_.reset();
1345 template <
class CornerIterator,
class IndexSet,
class T>
1346 inline void fillFaceVertices( CornerIterator it,
1347 const CornerIterator end,
1349 std::vector<T>& faces,
1350 std::vector<T>& faceOffsets )
1352 if( n == 3 && it != end )
1356 faces.reserve( 15 * ncells );
1357 faceOffsets.clear();
1358 faceOffsets.reserve( ncells );
1363 int elIndex = indexSet.
index( element );
1364 std::vector< T > vertices;
1365 vertices.reserve( 30 );
1366 for( ; it != end; ++it )
1368 const Cell& cell = *it ;
1369 const int cellIndex = indexSet.
index( cell ) ;
1370 if( elIndex != cellIndex )
1372 fillFacesForElement( element, indexSet, vertices, offset, faces, faceOffsets );
1376 elIndex = cellIndex ;
1378 vertices.push_back( it.id() );
1382 fillFacesForElement( element, indexSet, vertices, offset, faces, faceOffsets );
1386 template <
class Entity,
class IndexSet,
class T>
1387 static void fillFacesForElement(
const Entity& element,
1388 const IndexSet& indexSet,
1389 const std::vector<T>& vertices,
1391 std::vector<T>& faces,
1392 std::vector<T>& faceOffsets )
1396 std::map< T, T > vxMap;
1399 const int nVertices = element.subEntities( dim );
1400 for(
int vx = 0; vx < nVertices; ++ vx )
1402 const int vxIdx = indexSet.subIndex( element, vx, dim );
1403 vxMap[ vxIdx ] = vertices[ vx ];
1407 const int nFaces = element.subEntities( 1 );
1409 faces.push_back( nFaces );
1412 for(
int fce = 0; fce < nFaces; ++ fce )
1415 const auto face = element.template subEntity< 1 > ( fce );
1418 const int nVxFace = face.subEntities( dim );
1419 faces.push_back( nVxFace );
1421 for(
int i=0; i<nVxFace; ++i )
1423 const T vxIndex = indexSet.subIndex( face, i, dim );
1424 assert( vxMap.find( vxIndex ) != vxMap.end() );
1425 faces.push_back( vxMap[ vxIndex ] );
1431 faceOffsets.push_back( offset );
1436 std::list<VTKLocalFunction> celldata;
1437 std::list<VTKLocalFunction> vertexdata;
1447 VertexMapper* vertexmapper;
1450 std::vector<int> number;
1451 VTK::DataMode datamode;
1454 const bool polyhedralCellsPresent_;
1457 std::shared_ptr< std::pair< std::vector<int>, std::vector<int> > > faceVertices_;
1460 VTK::OutputType outputtype;
vector space out of a tensor product of fields.
Definition: fvector.hh:93
Base class for stl conformant forward iterators.
Definition: iteratorfacades.hh:144
Base class template for function classes.
Definition: function.hh:28
Grid view abstract base class.
Definition: gridview.hh:60
Default exception class for I/O errors.
Definition: exceptions.hh:229
Index Set Interface base class.
Definition: indexidset.hh:76
IndexType index(const typename Traits::template Codim< cc >::Entity &e) const
Map entity to index. The result of calling this method with an entity that is not in the index set is...
Definition: indexidset.hh:111
Implementation class for a multiple codim and multiple geometry type mapper.
Definition: mcmgmapper.hh:103
Index subIndex(const typename GV::template Codim< 0 >::Entity &e, int i, unsigned int codim) const
Map subentity of codim 0 entity to array index.
Definition: mcmgmapper.hh:160
int size() const
Return total number of entities in the entity set managed by the mapper.
Definition: mcmgmapper.hh:179
Default exception for dummy implementations.
Definition: exceptions.hh:261
Take a vector and interpret it as cell data for the VTKWriter.
Definition: function.hh:90
Take a vector and interpret it as point data for the VTKWriter.
Definition: function.hh:188
A base class for grid functions with any return type and dimension.
Definition: function.hh:39
Base class to write pvd-files which contains a list of all collected vtk-files.
Definition: vtksequencewriterbase.hh:32
Writer for the ouput of grid functions in the vtk format.
Definition: vtksequencewriter.hh:28
Iterator over the grids elements.
Definition: vtkwriter.hh:327
CellIterator(const GridCellIterator &x)
construct a CellIterator from the gridview's Iterator.
Definition: vtkwriter.hh:330
const FieldVector< DT, n > position() const
Definition: vtkwriter.hh:333
Iterate over the elements' corners.
Definition: vtkwriter.hh:481
int id() const
Process-local consecutive zero-starting vertex id.
Definition: vtkwriter.hh:539
Type erasure wrapper for VTK data sets.
Definition: vtkwriter.hh:148
void unbind() const
Unbind the data set from the currently bound entity.
Definition: vtkwriter.hh:302
std::string name() const
Returns the name of the data set.
Definition: vtkwriter.hh:284
const VTK::FieldInfo & fieldInfo() const
Returns the VTK::FieldInfo for the data set.
Definition: vtkwriter.hh:290
void bind(const Entity &e) const
Bind the data set to grid entity e.
Definition: vtkwriter.hh:296
VTKLocalFunction(const std::shared_ptr< const VTKFunction > &vtkFunctionPtr)
Construct a VTKLocalFunction for a legacy VTKFunction.
Definition: vtkwriter.hh:274
VTKLocalFunction(F &&f, VTK::FieldInfo fieldInfo, typename std::enable_if< detail::_has_local_context< F >::value, int >::type dummy=0)
Construct a VTKLocalFunction for a dune-functions style LocalFunction.
Definition: vtkwriter.hh:257
VTKLocalFunction(F &&f, VTK::FieldInfo fieldInfo, typename std::enable_if< not detail::_has_local_context< F >::value, int >::type dummy=0)
Construct a VTKLocalFunction for a dune-functions style Function.
Definition: vtkwriter.hh:265
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:308
Iterate over the grid's vertices.
Definition: vtkwriter.hh:366
const FieldVector< DT, n > & position() const
position of vertex inside the entity
Definition: vtkwriter.hh:443
int localindex() const
index of vertex within the entity, in Dune-numbering
Definition: vtkwriter.hh:438
Writer for the ouput of grid functions in the vtk format.
Definition: vtkwriter.hh:87
void clear()
clear list of registered functions
Definition: vtkwriter.hh:674
std::string write(const std::string &name, VTK::OutputType type=VTK::ascii)
write output (interface might change later)
Definition: vtkwriter.hh:697
std::string getParallelHeaderName(const std::string &name, const std::string &path, int commSize) const
return name of a parallel header file
Definition: vtkwriter.hh:779
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:632
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:660
std::string getSerialPieceName(const std::string &name, const std::string &path) const
return name of a serial piece file
Definition: vtkwriter.hh:811
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:588
virtual void writeCellData(VTK::VTUWriter &writer)
write cell data
Definition: vtkwriter.hh:1185
VTKWriter(const GridView &gridView, VTK::DataMode dm=VTK::conforming)
Construct a VTKWriter working on a specific GridView.
Definition: vtkwriter.hh:577
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:748
virtual void countEntities(int &nvertices, int &ncells, int &ncorners)
count the vertices, cells and corners
Definition: vtkwriter.hh:1087
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:615
virtual void writeGridCells(VTK::VTUWriter &writer)
write the connectivity array
Definition: vtkwriter.hh:1237
virtual void writeCellFaces(VTK::VTUWriter &writer)
write the connectivity array
Definition: vtkwriter.hh:1307
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:835
virtual void writeGridPoints(VTK::VTUWriter &writer)
write the positions of vertices
Definition: vtkwriter.hh:1213
virtual void writeVertexData(VTK::VTUWriter &writer)
write vertex data
Definition: vtkwriter.hh:1199
virtual ~VTKWriter()
destructor
Definition: vtkwriter.hh:681
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:895
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:729
virtual void write(T data)=0
write one data element
Descriptor struct for VTK fields.
Definition: common.hh:315
@ tensor
tensor field (always 3x3)
@ vector
vector-valued field (always 3D, will be padded if necessary)
std::string name() const
The name of the data field.
Definition: common.hh:338
Dump a .vtu/.vtp files contents to a stream.
Definition: pvtuwriter.hh:60
Dump a .vtu/.vtp files contents to a stream.
Definition: vtuwriter.hh:96
void endCellData()
finish CellData section
Definition: vtuwriter.hh:218
void beginCells()
start section for the grid cells/PolyData lines
Definition: vtuwriter.hh:272
DataArrayWriter< T > * makeArrayWriter(const std::string &name, unsigned ncomps, unsigned nitems)
acquire a DataArrayWriter
Definition: vtuwriter.hh:379
void endPointData()
finish PointData section
Definition: vtuwriter.hh:180
void beginCellData(const std::string &scalars="", const std::string &vectors="")
start CellData section
Definition: vtuwriter.hh:203
void beginPointData(const std::string &scalars="", const std::string &vectors="")
start PointData section
Definition: vtuwriter.hh:165
void endPoints()
finish section for the point coordinates
Definition: vtuwriter.hh:247
void endCells()
start section for the grid cells/PolyData lines
Definition: vtuwriter.hh:283
void beginPoints()
start section for the point coordinates
Definition: vtuwriter.hh:236
Common stuff for the VTKWriter.
OutputType
How the bulk data should be stored in the file.
Definition: common.hh:40
FileType
which type of VTK file to write
Definition: common.hh:298
DataMode
Whether to produce conforming or non-conforming output.
Definition: common.hh:64
Data array writers for the VTKWriter.
A few common exception classes.
Functions for VTK output.
#define DUNE_THROW(E, m)
Definition: exceptions.hh:216
const IndexSet & indexSet() const
obtain the index set
Definition: gridview.hh:173
Traits::Grid Grid
type of the grid
Definition: gridview.hh:78
const CollectiveCommunication & comm() const
obtain collective communication object
Definition: gridview.hh:247
Traits::IndexSet IndexSet
type of the index set
Definition: gridview.hh:81
Grid::ctype ctype
type used for coordinates in grid
Definition: gridview.hh:125
@ dimensionworld
The dimension of the world the grid lives in.
Definition: gridview.hh:132
@ dimension
The dimension of the grid.
Definition: gridview.hh:128
std::string relativePath(const std::string &newbase, const std::string &p)
compute a relative path between two paths
Definition: path.cc:151
std::string concatPaths(const std::string &base, const std::string &p)
concatenate two paths
Definition: path.cc:30
Utility class for handling nested indentation in output.
This file implements iterator facade classes for writing stl conformant iterators.
Mapper for multiple codim and multiple geometry types.
Dune namespace.
Definition: alignment.hh:11
Utilities for handling filesystem paths.
Static tag representing a codimension.
Definition: dimension.hh:22
static const ReferenceElement< ctype, dim > & general(const GeometryType &type)
get general reference elements
Definition: referenceelements.hh:757
Base class for polymorphic container of underlying data set.
Definition: vtkwriter.hh:156
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.
virtual void unbind()=0
Unbind data set from current grid entity - mostly here for performance and symmetry reasons.
virtual void bind(const Entity &e)=0
Bind data set to grid entity - must be called before evaluating (i.e. calling write())
Type erasure implementation for functions conforming to the dune-functions LocalFunction interface.
Definition: vtkwriter.hh:179
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:197
virtual void unbind()
Unbind data set from current grid entity - mostly here for performance and symmetry reasons.
Definition: vtkwriter.hh:192
virtual void bind(const Entity &e)
Bind data set to grid entity - must be called before evaluating (i.e. calling write())
Definition: vtkwriter.hh:187
Type erasure implementation for legacy VTKFunctions.
Definition: vtkwriter.hh:226
virtual void unbind()
Unbind data set from current grid entity - mostly here for performance and symmetry reasons.
Definition: vtkwriter.hh:237
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:242
virtual void bind(const Entity &e)
Bind data set to grid entity - must be called before evaluating (i.e. calling write())
Definition: vtkwriter.hh:232
Definition: typetraits.hh:344
Traits for type conversions and type information.