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>
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 {
68 struct IsLocalFunction
74 template <
class Gr
idView>
75 class VTKSequenceWriterBase;
76 template <
class Gr
idView>
77 class VTKSequenceWriter;
87 template<
class Gr
idView >
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 )
160 virtual void bind(
const Entity& e) = 0;
169 virtual void write(
const Coordinate& pos,
Writer& w, std::size_t count)
const = 0;
181 using Function =
typename std::decay<F>::type;
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
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>
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))))
276 vtkFunctionPtr->
name(),
277 vtkFunctionPtr->ncomps() > 1 ? VTK::FieldInfo::Type::vector : VTK::FieldInfo::Type::scalar,
278 vtkFunctionPtr->ncomps()
295 void bind(
const Entity& e)
const
312 std::shared_ptr<FunctionWrapperBase> _f;
317 typedef typename std::list<VTKLocalFunction>::const_iterator FunctionIterator;
338 CellIterator cellBegin()
const
340 return gridView_.template begin< 0, VTK_Partition >();
343 CellIterator cellEnd()
const
345 return gridView_.template end< 0, VTK_Partition >();
366 GridCellIterator git;
367 GridCellIterator gend;
373 std::vector<bool> visited;
381 void basicIncrement ()
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,
402 git(x), gend(end), datamode(dm), cornerIndexDune(0),
403 vertexmapper(vm), visited(vm.
size(),
false),
406 if (datamode == VTK::conforming && git != gend)
407 visited[vertexmapper.
subIndex(*git,cornerIndexDune,n)] =
true;
413 case VTK::conforming :
414 while(visited[vertexmapper.
subIndex(*git,cornerIndexDune,n)])
417 if (git == gend)
return;
419 visited[vertexmapper.
subIndex(*git,cornerIndexDune,n)] =
true;
421 case VTK::nonconforming :
428 return git == cit.git
429 && cornerIndexDune == cit.cornerIndexDune
430 && datamode == cit.datamode;
432 EntityReference dereference()
const
439 return cornerIndexDune;
444 return referenceElement<DT,n>(git->type())
445 .position(cornerIndexDune,n);
449 VertexIterator vertexBegin ()
const
451 return VertexIterator( gridView_.template begin< 0, VTK_Partition >(),
452 gridView_.template end< 0, VTK_Partition >(),
453 datamode, *vertexmapper );
456 VertexIterator vertexEnd ()
const
458 return VertexIterator( gridView_.template end< 0, VTK_Partition >(),
459 gridView_.template end< 0, VTK_Partition >(),
460 datamode, *vertexmapper );
481 GridCellIterator git;
482 GridCellIterator gend;
491 const std::vector<int> & number;
500 const GridCellIterator & end,
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;
529 EntityReference dereference()
const
542 case VTK::conforming :
544 number[vertexmapper.
subIndex(*git,VTK::renumber(*git,cornerIndexVTK),
546 case VTK::nonconforming :
547 return offset + VTK::renumber(*git,cornerIndexVTK);
554 CornerIterator cornerBegin ()
const
556 return CornerIterator( gridView_.template begin< 0, VTK_Partition >(),
557 gridView_.template end< 0, VTK_Partition >(),
558 datamode, *vertexmapper, number );
561 CornerIterator cornerEnd ()
const
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 <<
"]";
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 <<
"]";
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 =
840 std::string
write (
const std::string &name,
848 return pwrite(name,
"",
"", type, commRank, commSize);
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())
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);
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())
930 gridView_.
comm().barrier();
936 file.open(fullname.c_str());
937 if (! file.is_open())
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)
969 (n == 1) ? VTK::polyData : VTK::unstructuredGrid;
977 std::string scalars, vectors;
978 std::tie(scalars,vectors) = getDataNames(vertexdata);
979 writer.beginPointData(scalars, vectors);
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);
990 writer.endPointData();
994 std::string scalars, vectors;
995 std::tie(scalars,vectors) = getDataNames(celldata);
996 writer.beginCellData(scalars, vectors);
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);
1007 writer.endCellData();
1010 writer.beginPoints();
1011 writer.addArray<
float>(
"Coordinates", 3);
1015 for(
int i = 0; i < commSize; ++i )
1020 writer.addPiece(fullname);
1027 void writeDataFile (std::ostream& s)
1029 VTK::FileType fileType =
1030 (n == 1) ? VTK::polyData : VTK::unstructuredGrid;
1032 VTK::VTUWriter writer(s, outputtype, fileType);
1036 if (datamode == VTK::conforming)
1038 number.resize(vertexmapper->
size());
1039 for (std::vector<int>::size_type i=0; i<number.size(); i++) number[i] = -1;
1043 writer.beginMain(ncells, nvertices);
1044 writeAllData(writer);
1048 if(writer.beginAppended())
1049 writeAllData(writer);
1050 writer.endAppended();
1052 delete vertexmapper; number.clear();
1055 void writeAllData(VTK::VTUWriter& writer) {
1070 std::string getFormatString()
const
1072 if (outputtype==VTK::ascii)
1074 if (outputtype==VTK::base64)
1076 if (outputtype==VTK::appendedraw)
1078 if (outputtype==VTK::appendedbase64)
1080 DUNE_THROW(IOError,
"VTKWriter: unsupported OutputType" << outputtype);
1083 std::string getTypeString()
const
1088 return "UnstructuredGrid";
1102 const int subEntities = it->subEntities(n);
1103 for (
int i=0; i<subEntities; ++i)
1106 if (datamode == VTK::conforming)
1108 int alpha = vertexmapper->
subIndex(*it,i,n);
1109 if (number[alpha]<0)
1110 number[alpha] = nvertices++;
1120 template<
typename T>
1121 std::tuple<std::string,std::string> getDataNames(
const T& data)
const
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>
1148 void writeData(VTK::VTUWriter& writer,
const Data& data,
const Iterator begin,
const Iterator end,
int nentries)
1150 for (
auto it = data.begin(),
1155 const auto& f = *it;
1156 VTK::FieldInfo fieldInfo = f.fieldInfo();
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
1173 (writer.makeArrayWriter<
float>(f.name(), writecomps, nentries));
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())
1280 int vtktype = VTK::geometryType(it->type());
1288 if( polyhedralCellsPresent_ )
1298 bool checkForPolyhedralCells()
const
1301 for(
const auto& geomType : gridView_.
indexSet().types( 0 ) )
1303 if( VTK::geometryType( geomType ) == VTK::polyhedron )
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>
1351 inline void fillFaceVertices( CornerIterator it,
1352 const CornerIterator end,
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>
1392 static void fillFacesForElement(
const Entity& element,
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 );
1441 std::list<VTKLocalFunction> celldata;
1442 std::list<VTKLocalFunction> vertexdata;
1452 VertexMapper* vertexmapper;
1455 std::vector<int> number;
1456 VTK::DataMode datamode;
1459 const bool polyhedralCellsPresent_;
1462 std::shared_ptr< std::pair< std::vector<int>, std::vector<int> > > faceVertices_;
1465 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:29
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:200
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
size_type size() const
Return total number of entities in the entity set managed by the mapper.
Definition: mcmgmapper.hh:287
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:326
CellIterator(const GridCellIterator &x)
construct a CellIterator from the gridview's Iterator.
Definition: vtkwriter.hh:329
const FieldVector< DT, n > position() const
Definition: vtkwriter.hh:332
Iterate over the elements' corners.
Definition: vtkwriter.hh:480
int id() const
Process-local consecutive zero-starting vertex id.
Definition: vtkwriter.hh:538
Type erasure wrapper for VTK data sets.
Definition: vtkwriter.hh:149
void unbind() const
Unbind the data set from the currently bound entity.
Definition: vtkwriter.hh:301
VTKLocalFunction(F &&f, VTK::FieldInfo fieldInfo)
Construct a VTKLocalFunction for a dune-functions style LocalFunction.
Definition: vtkwriter.hh:258
std::string name() const
Returns the name of the data set.
Definition: vtkwriter.hh:283
const VTK::FieldInfo & fieldInfo() const
Returns the VTK::FieldInfo for the data set.
Definition: vtkwriter.hh:289
void bind(const Entity &e) const
Bind the data set to grid entity e.
Definition: vtkwriter.hh:295
VTKLocalFunction(const std::shared_ptr< const VTKFunction > &vtkFunctionPtr)
Construct a VTKLocalFunction for a legacy VTKFunction.
Definition: vtkwriter.hh:273
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
Iterate over the grid's vertices.
Definition: vtkwriter.hh:365
FieldVector< DT, n > position() const
position of vertex inside the entity
Definition: vtkwriter.hh:442
int localindex() const
index of vertex within the entity, in Dune-numbering
Definition: vtkwriter.hh:437
Writer for the ouput of grid functions in the vtk format.
Definition: vtkwriter.hh:88
void clear()
clear list of registered functions
Definition: vtkwriter.hh:679
std::string write(const std::string &name, VTK::OutputType type=VTK::ascii)
write output (interface might change later)
Definition: vtkwriter.hh:702
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
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
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
std::string getSerialPieceName(const std::string &name, const std::string &path) const
return name of a serial piece file
Definition: vtkwriter.hh:816
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
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
virtual void writeCellData(VTK::VTUWriter &writer)
write cell data
Definition: vtkwriter.hh:1190
VTKWriter(const GridView &gridView, VTK::DataMode dm=VTK::conforming)
Construct a VTKWriter working on a specific GridView.
Definition: vtkwriter.hh:576
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
virtual void countEntities(int &nvertices, int &ncells, int &ncorners)
count the vertices, cells and corners
Definition: vtkwriter.hh:1092
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
virtual void writeGridCells(VTK::VTUWriter &writer)
write the connectivity array
Definition: vtkwriter.hh:1242
virtual void writeCellFaces(VTK::VTUWriter &writer)
write the connectivity array
Definition: vtkwriter.hh:1312
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
virtual void writeGridPoints(VTK::VTUWriter &writer)
write the positions of vertices
Definition: vtkwriter.hh:1218
virtual void writeVertexData(VTK::VTUWriter &writer)
write vertex data
Definition: vtkwriter.hh:1204
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
virtual ~VTKWriter()
destructor
Definition: vtkwriter.hh:686
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
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
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
Data array writers for the VTKWriter.
A few common exception classes.
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
Functions for VTK output.
typename Impl::voider< Types... >::type void_t
Is void for all valid input types (see N3911). The workhorse for C++11 SFINAE-techniques.
Definition: typetraits.hh:39
Impl::MakeUniqueHelper< T >::NonArrayUniquePtr make_unique(Args &&... args)
Implementation of std::make_unique to be introduced in C++14.
Definition: memory.hh:66
#define DUNE_THROW(E, m)
Definition: exceptions.hh:216
const IndexSet & indexSet() const
obtain the index set
Definition: gridview.hh:172
Traits::Grid Grid
type of the grid
Definition: gridview.hh:77
const CollectiveCommunication & comm() const
obtain collective communication object
Definition: gridview.hh:246
Traits::IndexSet IndexSet
type of the index set
Definition: gridview.hh:80
Grid::ctype ctype
type used for coordinates in grid
Definition: gridview.hh:124
@ dimensionworld
The dimension of the world the grid lives in.
Definition: gridview.hh:131
@ dimension
The dimension of the grid.
Definition: gridview.hh:127
MCMGLayout mcmgVertexLayout()
layout for vertices (dim-0 entities)
Definition: mcmgmapper.hh:160
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: alignedallocator.hh:10
Utilities for handling filesystem paths.
Static tag representing a codimension.
Definition: dimension.hh:22
static const ReferenceElement & general(const GeometryType &type)
get general reference elements
Definition: referenceelements.hh:196
Base class for polymorphic container of underlying data set.
Definition: vtkwriter.hh:157
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:180
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
virtual void unbind()
Unbind data set from current grid entity - mostly here for performance and symmetry reasons.
Definition: vtkwriter.hh:193
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
Type erasure implementation for legacy VTKFunctions.
Definition: vtkwriter.hh:227
virtual void unbind()
Unbind data set from current grid entity - mostly here for performance and symmetry reasons.
Definition: vtkwriter.hh:238
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
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
Type trait to determine whether an instance of T has an operator[](I), i.e. whether it can be indexed...
Definition: typetraits.hh:222
Traits for type conversions and type information.