6#ifndef DUNE_VTKWRITER_HH
7#define DUNE_VTKWRITER_HH
21#include <dune/common/visibility.hh>
22#include <dune/common/typetraits.hh>
23#include <dune/common/exceptions.hh>
24#include <dune/common/indent.hh>
25#include <dune/common/iteratorfacades.hh>
26#include <dune/common/path.hh>
27#include <dune/geometry/referenceelements.hh>
57 template<
class F,
class E,
class =
void >
62 template<
class F,
class E >
63 struct IsBindable< F, E,
std::void_t< decltype( std::declval< F & >().bind( std::declval< const E & >() ) ),
64 decltype( std::declval< F & >().unbind() ) > >
69 template<
class F,
class =
void >
70 struct HasLocalFunction
75 struct HasLocalFunction< F,
std::void_t< decltype( localFunction( std::declval< F& >() ) ) > >
82 template <
class Gr
idView>
84 template <
class Gr
idView>
95 template<
class Gr
idView >
110 typedef typename GridView::template Codim< 0 >::Entity Cell;
111 typedef typename GridView::template Codim< n >::Entity Vertex;
119 typedef typename GridView::template Codim< 0 >
120 ::template Partition< VTK_Partition >::Iterator
122 typedef typename GridView::template Codim< n >
123 ::template Partition< VTK_Partition >::Iterator
126 typedef typename GridCellIterator::Reference EntityReference;
128 typedef typename GridView::template Codim< 0 >
129 ::Entity::Geometry::LocalCoordinate Coordinate;
136 switch( VTK_Partition )
141 default: DUNE_THROW(NotImplemented,
"Add check for this partition type");
168 virtual void bind(
const Entity& e) = 0;
177 virtual void write(
const Coordinate& pos,
Writer& w, std::size_t count)
const = 0;
192 template<
typename F_>
194 : _f(
std::forward<F_>(f))
197 virtual void bind(
const Entity& e)
207 virtual void write(
const Coordinate& pos,
Writer& writer, std::size_t count)
const
211 do_write(writer,r,count,IsIndexable<
decltype(r)>());
217 void do_write(
Writer& writer,
const R& r, std::size_t count, std::true_type)
const
219 for (std::size_t i = 0; i < count; ++i)
224 void do_write(Writer& writer,
const R& r, std::size_t count, std::false_type)
const
240 template<
typename F_>
242 : _f(
std::forward<F_>(f))
246 virtual void bind(
const Entity& e)
256 virtual void write(
const Coordinate& pos,
Writer& writer, std::size_t count)
const
258 auto globalPos = element_->geometry().global(pos);
259 auto r =
_f(globalPos);
260 if constexpr (IsIndexable<decltype(r)>()) {
261 for (std::size_t i = 0; i < count; ++i)
271 const Entity* element_;
283 virtual void bind(
const Entity& e)
293 virtual void write(
const Coordinate& pos,
Writer& writer, std::size_t count)
const
295 for (std::size_t i = 0; i < count; ++i)
296 writer.
write(_f->evaluate(i,*_entity,pos));
301 std::shared_ptr< const VTKFunction >
_f;
302 const Entity* _entity;
307 template<typename F, std::enable_if_t<Impl::IsBindable<F, Entity>::value,
int> = 0>
315 template<typename F, std::enable_if_t<not Impl::IsBindable<F, Entity>::value && Impl::HasLocalFunction<F>::value,
int> = 0>
318 typename
std::decay<decltype(localFunction(
std::forward<F>(f)))>::type
319 > >(localFunction(
std::forward<F>(f))))
325 template<typename F, std::enable_if_t<not Impl::IsBindable<F, Entity>::value && not Impl::HasLocalFunction<F>::value,
int> = 0>
335 vtkFunctionPtr->
name(),
336 (vtkFunctionPtr->ncomps() == 2 || vtkFunctionPtr->ncomps() == 3) ?
VTK::FieldInfo::Type::vector :
VTK::FieldInfo::Type::scalar,
337 vtkFunctionPtr->ncomps(),
338 vtkFunctionPtr->precision()
355 void bind(
const Entity& e)
const
372 std::shared_ptr<FunctionWrapperBase>
_f;
394 return ReferenceElements<DT,n>::general((*this)->type()).position(0,0);
400 return gridView_.template begin< 0, VTK_Partition >();
405 return gridView_.template end< 0, VTK_Partition >();
424 public ForwardIteratorFacade<VertexIterator, const Entity, EntityReference, int>
426 GridCellIterator git;
427 GridCellIterator gend;
432 const VertexMapper & vertexmapper;
433 std::vector<bool> visited;
446 const int numCorners = git->subEntities(n);
447 if( cornerIndexDune == numCorners )
449 offset += numCorners;
453 while( (git != gend) && skipEntity( git->partitionType() ) )
459 const GridCellIterator & end,
461 const VertexMapper & vm) :
462 git(x), gend(end), datamode(dm), cornerIndexDune(0),
463 vertexmapper(vm), visited(vm.size(), false),
467 visited[vertexmapper.subIndex(*git,cornerIndexDune,n)] =
true;
474 while(visited[vertexmapper.subIndex(*git,cornerIndexDune,n)])
477 if (git == gend)
return;
479 visited[vertexmapper.subIndex(*git,cornerIndexDune,n)] =
true;
488 return git == cit.git
489 && cornerIndexDune == cit.cornerIndexDune
490 && datamode == cit.datamode;
499 return cornerIndexDune;
505 .position(cornerIndexDune,n);
512 gridView_.template end< 0, VTK_Partition >(),
513 datamode, *vertexmapper );
519 gridView_.template end< 0, VTK_Partition >(),
520 datamode, *vertexmapper );
539 public ForwardIteratorFacade<CornerIterator, const Entity, EntityReference, int>
541 GridCellIterator git;
542 GridCellIterator gend;
547 const VertexMapper & vertexmapper;
551 const std::vector<int> & number;
560 const GridCellIterator & end,
562 const VertexMapper & vm,
563 const std::vector<int> & num) :
564 git(x), gend(end), datamode(dm), cornerIndexVTK(0),
566 number(num), offset(0) {}
572 const int numCorners = git->subEntities(n);
573 if( cornerIndexVTK == numCorners )
575 offset += numCorners;
579 while( (git != gend) && skipEntity( git->partitionType() ) )
585 return git == cit.git
586 && cornerIndexVTK == cit.cornerIndexVTK
587 && datamode == cit.datamode;
604 number[vertexmapper.subIndex(*git,
VTK::renumber(*git,cornerIndexVTK),
609 DUNE_THROW(IOError,
"VTKWriter: unsupported DataMode" << datamode);
617 gridView_.template end< 0, VTK_Partition >(),
618 datamode, *vertexmapper, number );
624 gridView_.template end< 0, VTK_Partition >(),
625 datamode, *vertexmapper, number );
696 template<
class Container>
697 void addCellData (
const Container& v,
const std::string &name,
int ncomps = 1,
701 for (
int c=0; c<ncomps; ++c) {
702 std::stringstream compName;
705 compName <<
"[" << c <<
"]";
707 addCellData(std::shared_ptr< const VTKFunction >(p));
762 template<
class Container>
763 void addVertexData (
const Container& v,
const std::string &name,
int ncomps=1,
767 for (
int c=0; c<ncomps; ++c) {
768 std::stringstream compName;
771 compName <<
"[" << c <<
"]";
786 {
return coordPrec; }
806 std::string
write (
const std::string &name,
838 std::string
pwrite (
const std::string & name,
const std::string & path,
const std::string & extendpath,
859 const std::string& path,
860 int commRank,
int commSize)
const
862 std::ostringstream s;
867 if(path[path.size()-1] !=
'/')
871 std::string fileprefix;
874 auto pos = name.rfind(
'/');
875 if( pos != std::string::npos )
878 fileprefix = name.substr( pos+1 );
881 std::string newpath = name.substr(0, pos);
883 if(newpath[name.size()-1] !=
'/')
892 s <<
's' << std::setw(4) << std::setfill(
'0') << commSize <<
'-';
893 const bool writeHeader = commRank < 0;
896 s <<
'p' << std::setw(4) << std::setfill(
'0') << commRank <<
'-';
899 s << fileprefix <<
".";
924 const std::string& path,
944 const std::string& path)
const
946 static const std::string extension =
949 return concatPaths(path, name+extension);
968 std::string
write (
const std::string &name,
977 std::string filename = name;
978 std::string path = std::string(
"");
982 auto pos = name.rfind(
'/');
983 if( pos != std::string::npos )
986 filename = name.substr( pos+1 );
990 path = name.substr(0, pos);
993 return pwrite(filename, path,
"", type, commRank, commSize);
1004 file.exceptions(std::ios_base::badbit | std::ios_base::failbit |
1005 std::ios_base::eofbit);
1008 file.open( pieceName.c_str(), std::ios::binary );
1011 std::cerr <<
"Filename: " << pieceName <<
" could not be opened" << std::endl;
1014 if (! file.is_open())
1015 DUNE_THROW(IOError,
"Could not write to piece file " << pieceName);
1016 writeDataFile( file );
1046 std::string
pwrite(
const std::string& name,
const std::string& path,
1047 const std::string& extendpath,
1049 const int commSize )
1056 file.exceptions(std::ios_base::badbit | std::ios_base::failbit |
1057 std::ios_base::eofbit);
1058 std::string piecepath = concatPaths(path, extendpath);
1059 std::string relpiecepath = relativePath(path, piecepath);
1066 file.open(fullname.c_str(),std::ios::binary);
1069 std::cerr <<
"Filename: " << fullname <<
" could not be opened" << std::endl;
1072 if (! file.is_open())
1073 DUNE_THROW(IOError,
"Could not write to piecefile file " << fullname);
1074 writeDataFile(file);
1082 file.open(fullname.c_str());
1083 if (! file.is_open())
1084 DUNE_THROW(IOError,
"Could not write to parallel file " << fullname);
1085 writeParallelHeader(file,name,relpiecepath, commSize );
1111 void writeParallelHeader(std::ostream& s,
const std::string& piecename,
1112 const std::string& piecepath,
const int commSize)
1123 std::string scalars, vectors;
1125 writer.beginPointData(scalars, vectors);
1132 unsigned writecomps = it->fieldInfo().size();
1136 writer.addArray(it->name(), writecomps, it->fieldInfo().precision());
1138 writer.endPointData();
1142 std::string scalars, vectors;
1144 writer.beginCellData(scalars, vectors);
1151 unsigned writecomps = it->fieldInfo().size();
1155 writer.addArray(it->name(), writecomps, it->fieldInfo().precision());
1157 writer.endCellData();
1160 writer.beginPoints();
1161 writer.addArray(
"Coordinates", 3, coordPrec);
1165 for(
int i = 0; i < commSize; ++i )
1170 writer.addPiece(fullname);
1177 void writeDataFile (std::ostream& s)
1182 VTK::VTUWriter writer(s,
outputtype, fileType);
1188 number.resize(vertexmapper->size());
1189 for (std::vector<int>::size_type i=0; i<number.size(); i++) number[i] = -1;
1194 writeAllData(writer);
1198 if(writer.beginAppended())
1199 writeAllData(writer);
1200 writer.endAppended();
1202 delete vertexmapper; number.clear();
1205 void writeAllData(VTK::VTUWriter& writer) {
1230 DUNE_THROW(IOError,
"VTKWriter: unsupported OutputType" <<
outputtype);
1238 return "UnstructuredGrid";
1258 int alpha = vertexmapper->subIndex(*it,i,n);
1259 if (number[alpha]<0)
1260 number[alpha] = nvertices_++;
1270 template<
typename T>
1273 std::string scalars =
"";
1274 for (
auto it = data.begin(),
1280 scalars = it->name();
1284 std::string vectors =
"";
1285 for (
auto it = data.begin(),
1291 vectors = it->name();
1294 return std::make_tuple(scalars,vectors);
1297 template<
typename Data,
typename Iterator>
1300 for (
auto it = data.begin(),
1305 const auto& f = *it;
1307 std::size_t writecomps = fieldInfo.
size();
1308 switch (fieldInfo.
type())
1316 DUNE_THROW(IOError,
"Cannot write VTK vectors with more than 3 components (components was " << writecomps <<
")");
1320 DUNE_THROW(NotImplemented,
"VTK output for tensors not implemented yet");
1322 std::shared_ptr<VTK::DataArrayWriter> p
1324 if(!p->writeIsNoop())
1325 for (
Iterator eit = begin; eit!=end; ++eit)
1327 const Entity & e = *eit;
1329 f.write(eit.position(),*p);
1333 for (std::size_t j=fieldInfo.
size(); j < writecomps; ++j)
1345 std::string scalars, vectors;
1359 std::string scalars, vectors;
1372 std::shared_ptr<VTK::DataArrayWriter> p
1374 if(!p->writeIsNoop()) {
1379 for (
int j=0; j<std::min(dimw,3); j++)
1380 p->write((*vit).geometry().corner(vit.localindex())[j]);
1381 for (
int j=std::min(dimw,3); j<3; j++)
1398 std::shared_ptr<VTK::DataArrayWriter> p1
1400 if(!p1->writeIsNoop())
1407 std::shared_ptr<VTK::DataArrayWriter> p2
1409 if(!p2->writeIsNoop()) {
1413 offset += it->subEntities(n);
1423 std::shared_ptr<VTK::DataArrayWriter> p3
1426 if(!p3->writeIsNoop())
1438 if( polyhedralCellsPresent_ )
1451 for(
const auto& geomType :
gridView_.indexSet().types( 0 ) )
1456 DUNE_THROW(IOError,
"VTKWriter: grid must support codim 1 entities to be able to write VTK polyhedral cells");
1466 if( ! faceVertices_ )
1468 faceVertices_.reset(
new std::pair< std::vector<int>, std::vector<int> > () );
1471 faceVertices_->first, faceVertices_->second );
1474 std::vector< int >& faces = faceVertices_->first;
1475 std::vector< int >& faceOffsets = faceVertices_->second;
1476 assert(
int(faceOffsets.size()) ==
ncells );
1479 std::shared_ptr<VTK::DataArrayWriter> p4
1481 if(!p4->writeIsNoop())
1483 for(
const auto& face : faces )
1489 std::shared_ptr<VTK::DataArrayWriter> p5
1491 if(!p5->writeIsNoop())
1493 for(
const auto& offset : faceOffsets )
1494 p5->write( offset );
1497 faceVertices_.reset();
1502 template <
class CornerIterator,
class IndexSet,
class T>
1505 const IndexSet& indexSet,
1506 std::vector<T>& faces,
1507 std::vector<T>& faceOffsets )
1509 if( n == 3 && it != end )
1513 faces.reserve( 15 *
ncells );
1514 faceOffsets.clear();
1515 faceOffsets.reserve(
ncells );
1520 int elIndex = indexSet.index( element );
1523 for( ; it != end; ++it )
1525 const Cell& cell = *it ;
1526 const int cellIndex = indexSet.index( cell ) ;
1527 if( elIndex != cellIndex )
1533 elIndex = cellIndex ;
1543 template <
class Entity,
class IndexSet,
class T>
1545 const IndexSet& indexSet,
1548 std::vector<T>& faces,
1549 std::vector<T>& faceOffsets )
1553 std::map< T, T > vxMap;
1556 const int nVertices = element.subEntities( dim );
1557 for(
int vx = 0; vx < nVertices; ++ vx )
1559 const int vxIdx = indexSet.subIndex( element, vx, dim );
1564 const int nFaces = element.subEntities( 1 );
1566 faces.push_back( nFaces );
1569 for(
int fce = 0; fce < nFaces; ++ fce )
1573 const auto face = element.template subEntity< 1 > ( fce );
1576 const int nVxFace = face.subEntities( dim );
1577 faces.push_back( nVxFace );
1579 for(
int i=0; i<nVxFace; ++i )
1581 const T vxIndex = indexSet.subIndex( face, i, dim );
1582 assert( vxMap.find( vxIndex ) != vxMap.end() );
1583 faces.push_back( vxMap[ vxIndex ] );
1587 DUNE_THROW(IOError,
"VTKWriter: grid must support codim 1 entities to be able to write VTK polyhedral cells");
1592 faceOffsets.push_back( offset );
1608 VertexMapper* vertexmapper;
1611 std::vector<int> number;
1616 const bool polyhedralCellsPresent_;
1619 std::shared_ptr< std::pair< std::vector<int>, std::vector<int> > > faceVertices_;
Mapper for multiple codim and multiple geometry types.
Functions for VTK output.
Data array writers for the VTKWriter.
Common stuff for the VTKWriter.
PartitionIteratorType
Parameter to be used for the parallel level- and leaf iterators.
Definition gridenums.hh:136
PartitionType
Attributes used in the generic overlap model.
Definition gridenums.hh:30
@ All_Partition
all entities
Definition gridenums.hh:141
@ InteriorBorder_Partition
interior and border entities
Definition gridenums.hh:138
@ InteriorEntity
all interior entities
Definition gridenums.hh:31
Traits::Grid Grid
type of the grid
Definition common/gridview.hh:83
Traits::IndexSet IndexSet
type of the index set
Definition common/gridview.hh:86
static constexpr int dimension
The dimension of the grid.
Definition common/gridview.hh:134
Grid::ctype ctype
type used for coordinates in grid
Definition common/gridview.hh:131
static constexpr int dimensionworld
The dimension of the world the grid lives in.
Definition common/gridview.hh:137
IteratorRange<... > vertices(const GV &gv)
Iterates over all vertices (entities with dimension 0) of a GridView.
IteratorRange<... > subEntities(const E &e, Codim< codim > c)
Iterates over all sub-entities of an entity given the codimension of the sub-entities.
MCMGLayout mcmgVertexLayout()
layout for vertices (dim-0 entities)
Definition mcmgmapper.hh:107
Include standard header files.
Definition agrid.hh:60
auto referenceElement(const Geometry< mydim, cdim, GridImp, GeometryImp > &geo) -> decltype(referenceElement(geo, geo.impl()))
Definition common/geometry.hh:558
Definition basicwriter.hh:32
Precision
which precision to use when writing out data to vtk files
Definition common.hh:271
@ int32
Definition common.hh:272
@ uint8
Definition common.hh:273
@ float32
Definition common.hh:275
OutputType
How the bulk data should be stored in the file.
Definition common.hh:43
@ ascii
Output to the file is in ascii.
Definition common.hh:45
@ appendedraw
Output is to the file is appended raw binary.
Definition common.hh:49
@ appendedbase64
Output is to the file is appended base64 binary.
Definition common.hh:51
@ base64
Output to the file is inline base64 binary.
Definition common.hh:47
int renumber(const Dune::GeometryType &t, int i)
renumber VTK <-> Dune
Definition common.hh:186
FileType
which type of VTK file to write
Definition common.hh:252
@ polyData
for .vtp files (PolyData)
Definition common.hh:254
@ unstructuredGrid
for .vtu files (UnstructuredGrid)
Definition common.hh:256
DataMode
Whether to produce conforming or non-conforming output.
Definition common.hh:67
@ conforming
Output conforming data.
Definition common.hh:73
@ nonconforming
Output non-conforming data.
Definition common.hh:81
GeometryType geometryType(const Dune::GeometryType &t)
mapping from GeometryType to VTKGeometryType
Definition common.hh:151
@ polyhedron
Definition common.hh:142
static const bool v
Definition common/capabilities.hh:59
Grid view abstract base class.
Definition common/gridview.hh:66
Descriptor struct for VTK fields.
Definition common.hh:328
std::size_t size() const
The number of components in the data field.
Definition common.hh:364
Precision precision() const
The precision used for the output of the data field.
Definition common.hh:370
@ tensor
tensor field (always 3x3)
Definition common.hh:340
@ vector
vector-valued field (always 3D, will be padded if necessary)
Definition common.hh:338
@ scalar
Definition common.hh:336
Type type() const
The type of the data field.
Definition common.hh:358
std::string name() const
The name of the data field.
Definition common.hh:352
base class for data array writers
Definition dataarraywriter.hh:56
void write(T data)
write one element of data
Definition dataarraywriter.hh:69
A base class for grid functions with any return type and dimension.
Definition function.hh:42
Take a vector and interpret it as cell data for the VTKWriter.
Definition function.hh:97
Take a vector and interpret it as point data for the VTKWriter.
Definition function.hh:205
Dump a .vtu/.vtp files contents to a stream.
Definition pvtuwriter.hh:62
Writer for the output of grid functions in the vtk format.
Definition vtksequencewriter.hh:29
Base class to write pvd-files which contains a list of all collected vtk-files.
Definition vtksequencewriterbase.hh:34
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:697
CornerIterator cornerEnd() const
Definition vtkwriter.hh:621
void clear()
clear list of registered functions
Definition vtkwriter.hh:778
std::string write(const std::string &name, VTK::OutputType type=VTK::ascii)
write output (interface might change later)
Definition vtkwriter.hh:806
VertexIterator vertexBegin() const
Definition vtkwriter.hh:509
std::string getTypeString() const
Definition vtkwriter.hh:1233
std::string getParallelHeaderName(const std::string &name, const std::string &path, int commSize) const
return name of a parallel header file
Definition vtkwriter.hh:923
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:715
Dune::VTKFunction< GridView > VTKFunction
Definition vtkwriter.hh:148
CellIterator cellEnd() const
Definition vtkwriter.hh:403
std::list< VTKLocalFunction > vertexdata
Definition vtkwriter.hh:1598
CornerIterator cornerBegin() const
Definition vtkwriter.hh:614
std::string getSerialPieceName(const std::string &name, const std::string &path) const
return name of a serial piece file
Definition vtkwriter.hh:943
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:650
std::string getFormatString() const
Definition vtkwriter.hh:1220
bool checkForPolyhedralCells() const
Definition vtkwriter.hh:1448
void addVertexData(F &&f, VTK::FieldInfo vtkFieldInfo)
Add a function by sampling it on the grid vertices.
Definition vtkwriter.hh:740
virtual void writeCellData(VTK::VTUWriter &writer)
write cell data
Definition vtkwriter.hh:1340
virtual void countEntities(int &nvertices_, int &ncells_, int &ncorners_)
count the vertices, cells and corners
Definition vtkwriter.hh:1242
std::string getParallelPieceName(const std::string &name, const std::string &path, int commRank, int commSize) const
return name of a parallel piece file (or header name)
Definition vtkwriter.hh:858
CellIterator cellBegin() const
Definition vtkwriter.hh:398
VTK::OutputType outputtype
Definition vtkwriter.hh:1622
virtual void writeGridCells(VTK::VTUWriter &writer)
write the connectivity array
Definition vtkwriter.hh:1392
GridView gridView_
Definition vtkwriter.hh:1601
virtual void writeCellFaces(VTK::VTUWriter &writer)
write the connectivity array
Definition vtkwriter.hh:1464
void fillFaceVertices(CornerIterator it, const CornerIterator end, const IndexSet &indexSet, std::vector< T > &faces, std::vector< T > &faceOffsets)
Definition vtkwriter.hh:1503
std::list< VTKLocalFunction > celldata
Definition vtkwriter.hh:1597
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:968
VTK::Precision coordPrecision() const
get the precision with which coordinates are written out
Definition vtkwriter.hh:785
std::list< VTKLocalFunction >::const_iterator FunctionIterator
Definition vtkwriter.hh:377
std::tuple< std::string, std::string > getDataNames(const T &data) const
Definition vtkwriter.hh:1271
virtual void writeGridPoints(VTK::VTUWriter &writer)
write the positions of vertices
Definition vtkwriter.hh:1368
virtual void writeVertexData(VTK::VTUWriter &writer)
write vertex data
Definition vtkwriter.hh:1354
int nvertices
Definition vtkwriter.hh:1605
void addCellData(F &&f, VTK::FieldInfo vtkFieldInfo)
Add a function by sampling it on the element centers.
Definition vtkwriter.hh:675
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:763
virtual ~VTKWriter()
destructor
Definition vtkwriter.hh:789
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:1544
void writeData(VTK::VTUWriter &writer, const Data &data, const Iterator begin, const Iterator end, int nentries)
Definition vtkwriter.hh:1298
int ncells
Definition vtkwriter.hh:1604
VertexIterator vertexEnd() const
Definition vtkwriter.hh:516
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:637
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:1046
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:838
int ncorners
Definition vtkwriter.hh:1606
Type erasure wrapper for VTK data sets.
Definition vtkwriter.hh:157
void write(const Coordinate &pos, Writer &writer) const
Write the value of the data set at local coordinate pos to the writer.
Definition vtkwriter.hh:367
void unbind() const
Unbind the data set from the currently bound entity.
Definition vtkwriter.hh:361
VTKLocalFunction(F &&f, VTK::FieldInfo fieldInfo)
Construct a VTKLocalFunction for a dune-functions style LocalFunction.
Definition vtkwriter.hh:308
std::string name() const
Returns the name of the data set.
Definition vtkwriter.hh:343
VTK::FieldInfo _fieldInfo
Definition vtkwriter.hh:373
VTK::DataArrayWriter Writer
Definition vtkwriter.hh:161
const VTK::FieldInfo & fieldInfo() const
Returns the VTK::FieldInfo for the data set.
Definition vtkwriter.hh:349
void bind(const Entity &e) const
Bind the data set to grid entity e.
Definition vtkwriter.hh:355
VTKLocalFunction(const std::shared_ptr< const VTKFunction > &vtkFunctionPtr)
Construct a VTKLocalFunction for a legacy VTKFunction.
Definition vtkwriter.hh:332
std::shared_ptr< FunctionWrapperBase > _f
Definition vtkwriter.hh:372
Base class for polymorphic container of underlying data set.
Definition vtkwriter.hh:165
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 ~FunctionWrapperBase()
Definition vtkwriter.hh:179
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:189
typename std::decay< F >::type Function
Definition vtkwriter.hh:190
FunctionWrapper(F_ &&f)
Definition vtkwriter.hh:193
virtual void unbind()
Unbind data set from current grid entity - mostly here for performance and symmetry reasons.
Definition vtkwriter.hh:202
virtual void write(const Coordinate &pos, Writer &writer, std::size_t count) const
Evaluate data set at local position pos inside the current entity and write result to w.
Definition vtkwriter.hh:207
virtual void bind(const Entity &e)
Bind data set to grid entity - must be called before evaluating (i.e. calling write()).
Definition vtkwriter.hh:197
Type erasure implementation for C++ functions, i.e., functions that can be evaluated in global coordi...
Definition vtkwriter.hh:237
GlobalFunctionWrapper(F_ &&f)
Definition vtkwriter.hh:241
virtual void unbind()
Unbind data set from current grid entity - mostly here for performance and symmetry reasons.
Definition vtkwriter.hh:251
virtual void write(const Coordinate &pos, Writer &writer, std::size_t count) const
Evaluate data set at local position pos inside the current entity and write result to w.
Definition vtkwriter.hh:256
typename std::decay< F >::type Function
Definition vtkwriter.hh:238
virtual void bind(const Entity &e)
Bind data set to grid entity - must be called before evaluating (i.e. calling write()).
Definition vtkwriter.hh:246
Type erasure implementation for legacy VTKFunctions.
Definition vtkwriter.hh:277
virtual void write(const Coordinate &pos, Writer &writer, std::size_t count) const
Evaluate data set at local position pos inside the current entity and write result to w.
Definition vtkwriter.hh:293
virtual void unbind()
Unbind data set from current grid entity - mostly here for performance and symmetry reasons.
Definition vtkwriter.hh:288
VTKFunctionWrapper(const std::shared_ptr< const VTKFunction > &f)
Definition vtkwriter.hh:278
virtual void bind(const Entity &e)
Bind data set to grid entity - must be called before evaluating (i.e. calling write()).
Definition vtkwriter.hh:283
Iterator over the grids elements.
Definition vtkwriter.hh:386
CellIterator(const GridCellIterator &x)
construct a CellIterator from the gridview's Iterator.
Definition vtkwriter.hh:389
const FieldVector< DT, n > position() const
Definition vtkwriter.hh:392
Iterate over the grid's vertices.
Definition vtkwriter.hh:425
VertexIterator(const GridCellIterator &x, const GridCellIterator &end, const VTK::DataMode &dm, const VertexMapper &vm)
Definition vtkwriter.hh:458
void basicIncrement()
Definition vtkwriter.hh:441
void increment()
Definition vtkwriter.hh:469
EntityReference dereference() const
Definition vtkwriter.hh:492
bool equals(const VertexIterator &cit) const
Definition vtkwriter.hh:486
FieldVector< DT, n > position() const
position of vertex inside the entity
Definition vtkwriter.hh:502
int localindex() const
index of vertex within the entity, in Dune-numbering
Definition vtkwriter.hh:497
Iterate over the elements' corners.
Definition vtkwriter.hh:540
void increment()
Definition vtkwriter.hh:567
CornerIterator(const GridCellIterator &x, const GridCellIterator &end, const VTK::DataMode &dm, const VertexMapper &vm, const std::vector< int > &num)
Definition vtkwriter.hh:559
int id() const
Process-local consecutive zero-starting vertex id.
Definition vtkwriter.hh:598
EntityReference dereference() const
Definition vtkwriter.hh:589
bool equals(const CornerIterator &cit) const
Definition vtkwriter.hh:583
Dump a .vtu/.vtp files contents to a stream.
Definition vtuwriter.hh:98
DataArrayWriter * makeArrayWriter(const std::string &name, unsigned ncomps, unsigned nitems, Precision prec)
acquire a DataArrayWriter
Definition vtuwriter.hh:381
void endCellData()
finish CellData section
Definition vtuwriter.hh:220
void beginCells()
start section for the grid cells/PolyData lines
Definition vtuwriter.hh:274
void endPointData()
finish PointData section
Definition vtuwriter.hh:182
void beginCellData(const std::string &scalars="", const std::string &vectors="")
start CellData section
Definition vtuwriter.hh:205
void beginPointData(const std::string &scalars="", const std::string &vectors="")
start PointData section
Definition vtuwriter.hh:167
void endPoints()
finish section for the point coordinates
Definition vtuwriter.hh:249
void endCells()
start section for the grid cells/PolyData lines
Definition vtuwriter.hh:285
void beginPoints()
start section for the point coordinates
Definition vtuwriter.hh:238
A set of traits classes to store static information about grid implementation.