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>
56 template<
class F,
class E,
class =
void >
61 template<
class F,
class E >
62 struct IsBindable< F, E,
std::void_t< decltype( std::declval< F & >().bind( std::declval< const E & >() ) ),
63 decltype( std::declval< F & >().unbind() ) > >
68 template<
class F,
class =
void >
69 struct HasLocalFunction
74 struct HasLocalFunction< F,
std::void_t< decltype( localFunction( std::declval< F& >() ) ) > >
81 template <
class Gr
idView>
83 template <
class Gr
idView>
94 template<
class Gr
idView >
119 ::template Partition< VTK_Partition >::Iterator
122 ::template Partition< VTK_Partition >::Iterator
125 typedef typename GridCellIterator::Reference EntityReference;
128 ::Entity::Geometry::LocalCoordinate Coordinate;
135 switch( VTK_Partition )
140 default: DUNE_THROW(NotImplemented,
"Add check for this partition type");
167 virtual void bind(
const Entity& e) = 0;
176 virtual void write(
const Coordinate& pos,
Writer& w, std::size_t count)
const = 0;
191 template<
typename F_>
193 : _f(
std::forward<F_>(f))
196 virtual void bind(
const Entity& e)
206 virtual void write(
const Coordinate& pos,
Writer& w, std::size_t count)
const
210 do_write(w,r,count,IsIndexable<
decltype(r)>());
216 void do_write(
Writer& w,
const R& r, std::size_t count, std::true_type)
const
218 for (std::size_t i = 0; i < count; ++i)
223 void do_write(Writer& w,
const R& r, std::size_t count, std::false_type)
const
239 template<
typename F_>
241 : _f(
std::forward<F_>(f))
245 virtual void bind(
const Entity& e)
255 virtual void write(
const Coordinate& pos,
Writer& w, std::size_t count)
const
257 auto globalPos = element_->geometry().global(pos);
258 auto r = _f(globalPos);
259 if constexpr (IsIndexable<decltype(r)>()) {
260 for (std::size_t i = 0; i < count; ++i)
270 const Entity* element_;
282 virtual void bind(
const Entity& e)
292 virtual void write(
const Coordinate& pos,
Writer& w, std::size_t count)
const
294 for (std::size_t i = 0; i < count; ++i)
295 w.
write(_f->evaluate(i,*_entity,pos));
300 std::shared_ptr< const VTKFunction > _f;
301 const Entity* _entity;
306 template<typename F, std::enable_if_t<Impl::IsBindable<F, Entity>::value,
int> = 0>
314 template<typename F, std::enable_if_t<not Impl::IsBindable<F, Entity>::value && Impl::HasLocalFunction<F>::value,
int> = 0>
317 typename
std::decay<decltype(localFunction(
std::forward<F>(f)))>::type
318 > >(localFunction(
std::forward<F>(f))))
324 template<typename F, std::enable_if_t<not Impl::IsBindable<F, Entity>::value && not Impl::HasLocalFunction<F>::value,
int> = 0>
334 vtkFunctionPtr->
name(),
335 (vtkFunctionPtr->ncomps() == 2 || vtkFunctionPtr->ncomps() == 3) ? VTK::FieldInfo::Type::vector : VTK::FieldInfo::Type::scalar,
336 vtkFunctionPtr->ncomps(),
337 vtkFunctionPtr->precision()
354 void bind(
const Entity& e)
const
371 std::shared_ptr<FunctionWrapperBase>
_f;
393 return ReferenceElements<DT,n>::general((*this)->type()).position(0,0);
399 return gridView_.template begin< 0, VTK_Partition >();
404 return gridView_.template end< 0, VTK_Partition >();
423 public ForwardIteratorFacade<VertexIterator, const Entity, EntityReference, int>
425 GridCellIterator git;
426 GridCellIterator gend;
432 std::vector<bool> visited;
445 const int numCorners = git->subEntities(n);
446 if( cornerIndexDune == numCorners )
448 offset += numCorners;
452 while( (git != gend) && skipEntity( git->partitionType() ) )
458 const GridCellIterator & end,
461 git(x), gend(end), datamode(dm), cornerIndexDune(0),
462 vertexmapper(vm), visited(vm.size(), false),
466 visited[vertexmapper.
subIndex(*git,cornerIndexDune,n)] =
true;
473 while(visited[vertexmapper.
subIndex(*git,cornerIndexDune,n)])
476 if (git == gend)
return;
478 visited[vertexmapper.
subIndex(*git,cornerIndexDune,n)] =
true;
487 return git == cit.git
488 && cornerIndexDune == cit.cornerIndexDune
489 && datamode == cit.datamode;
498 return cornerIndexDune;
503 return referenceElement<DT,n>(git->type())
504 .position(cornerIndexDune,n);
511 gridView_.template end< 0, VTK_Partition >(),
512 datamode, *vertexmapper );
518 gridView_.template end< 0, VTK_Partition >(),
519 datamode, *vertexmapper );
538 public ForwardIteratorFacade<CornerIterator, const Entity, EntityReference, int>
540 GridCellIterator git;
541 GridCellIterator gend;
550 const std::vector<int> & number;
559 const GridCellIterator & end,
562 const std::vector<int> & num) :
563 git(x), gend(end), datamode(dm), cornerIndexVTK(0),
565 number(num), offset(0) {}
571 const int numCorners = git->subEntities(n);
572 if( cornerIndexVTK == numCorners )
574 offset += numCorners;
578 while( (git != gend) && skipEntity( git->partitionType() ) )
584 return git == cit.git
585 && cornerIndexVTK == cit.cornerIndexVTK
586 && datamode == cit.datamode;
608 DUNE_THROW(IOError,
"VTKWriter: unsupported DataMode" << datamode);
616 gridView_.template end< 0, VTK_Partition >(),
617 datamode, *vertexmapper, number );
623 gridView_.template end< 0, VTK_Partition >(),
624 datamode, *vertexmapper, number );
694 template<
class Container>
695 void addCellData (
const Container& v,
const std::string &name,
int ncomps = 1,
699 for (
int c=0; c<ncomps; ++c) {
700 std::stringstream compName;
703 compName <<
"[" << c <<
"]";
705 addCellData(std::shared_ptr< const VTKFunction >(p));
759 template<
class Container>
760 void addVertexData (
const Container& v,
const std::string &name,
int ncomps=1,
764 for (
int c=0; c<ncomps; ++c) {
765 std::stringstream compName;
768 compName <<
"[" << c <<
"]";
783 {
return coordPrec; }
803 std::string
write (
const std::string &name,
835 std::string
pwrite (
const std::string & name,
const std::string & path,
const std::string & extendpath,
856 const std::string& path,
857 int commRank,
int commSize)
const
859 std::ostringstream s;
864 if(path[path.size()-1] !=
'/')
868 std::string fileprefix;
871 auto pos = name.rfind(
'/');
872 if( pos != std::string::npos )
875 fileprefix = name.substr( pos+1 );
878 std::string newpath = name.substr(0, pos);
880 if(newpath[name.size()-1] !=
'/')
889 s <<
's' << std::setw(4) << std::setfill(
'0') << commSize <<
'-';
890 const bool writeHeader = commRank < 0;
893 s <<
'p' << std::setw(4) << std::setfill(
'0') << commRank <<
'-';
896 s << fileprefix <<
".";
921 const std::string& path,
941 const std::string& path)
const
943 static const std::string extension =
946 return concatPaths(path, name+extension);
965 std::string
write (
const std::string &name,
974 std::string filename = name;
975 std::string path = std::string(
"");
979 auto pos = name.rfind(
'/');
980 if( pos != std::string::npos )
983 filename = name.substr( pos+1 );
987 path = name.substr(0, pos);
990 return pwrite(filename, path,
"", type, commRank, commSize);
1001 file.exceptions(std::ios_base::badbit | std::ios_base::failbit |
1002 std::ios_base::eofbit);
1005 file.open( pieceName.c_str(), std::ios::binary );
1008 std::cerr <<
"Filename: " << pieceName <<
" could not be opened" << std::endl;
1011 if (! file.is_open())
1012 DUNE_THROW(IOError,
"Could not write to piece file " << pieceName);
1013 writeDataFile( file );
1043 std::string
pwrite(
const std::string& name,
const std::string& path,
1044 const std::string& extendpath,
1046 const int commSize )
1053 file.exceptions(std::ios_base::badbit | std::ios_base::failbit |
1054 std::ios_base::eofbit);
1055 std::string piecepath = concatPaths(path, extendpath);
1056 std::string relpiecepath = relativePath(path, piecepath);
1063 file.open(fullname.c_str(),std::ios::binary);
1066 std::cerr <<
"Filename: " << fullname <<
" could not be opened" << std::endl;
1069 if (! file.is_open())
1070 DUNE_THROW(IOError,
"Could not write to piecefile file " << fullname);
1071 writeDataFile(file);
1079 file.open(fullname.c_str());
1080 if (! file.is_open())
1081 DUNE_THROW(IOError,
"Could not write to parallel file " << fullname);
1082 writeParallelHeader(file,name,relpiecepath, commSize );
1108 void writeParallelHeader(std::ostream& s,
const std::string& piecename,
1109 const std::string& piecepath,
const int commSize)
1120 std::string scalars, vectors;
1122 writer.beginPointData(scalars, vectors);
1129 unsigned writecomps = it->fieldInfo().size();
1130 if(writecomps == 2) writecomps = 3;
1131 writer.addArray(it->name(), writecomps, it->fieldInfo().precision());
1133 writer.endPointData();
1137 std::string scalars, vectors;
1139 writer.beginCellData(scalars, vectors);
1146 unsigned writecomps = it->fieldInfo().size();
1147 if(writecomps == 2) writecomps = 3;
1148 writer.addArray(it->name(), writecomps, it->fieldInfo().precision());
1150 writer.endCellData();
1153 writer.beginPoints();
1154 writer.addArray(
"Coordinates", 3, coordPrec);
1158 for(
int i = 0; i < commSize; ++i )
1163 writer.addPiece(fullname);
1170 void writeDataFile (std::ostream& s)
1175 VTK::VTUWriter writer(s,
outputtype, fileType);
1181 number.resize(vertexmapper->
size());
1182 for (std::vector<int>::size_type i=0; i<number.size(); i++) number[i] = -1;
1187 writeAllData(writer);
1191 if(writer.beginAppended())
1192 writeAllData(writer);
1193 writer.endAppended();
1195 delete vertexmapper; number.clear();
1198 void writeAllData(VTK::VTUWriter& writer) {
1223 DUNE_THROW(IOError,
"VTKWriter: unsupported OutputType" <<
outputtype);
1231 return "UnstructuredGrid";
1245 const int subEntities = it->subEntities(n);
1246 for (
int i=0; i<subEntities; ++i)
1251 int alpha = vertexmapper->
subIndex(*it,i,n);
1252 if (number[alpha]<0)
1253 number[alpha] = nvertices_++;
1263 template<
typename T>
1266 std::string scalars =
"";
1267 for (
auto it = data.begin(),
1273 scalars = it->name();
1277 std::string vectors =
"";
1278 for (
auto it = data.begin(),
1284 vectors = it->name();
1287 return std::make_tuple(scalars,vectors);
1290 template<
typename Data,
typename Iterator>
1293 for (
auto it = data.begin(),
1298 const auto& f = *it;
1300 std::size_t writecomps = fieldInfo.
size();
1301 switch (fieldInfo.
type())
1309 DUNE_THROW(IOError,
"Cannot write VTK vectors with more than 3 components (components was " << writecomps <<
")");
1313 DUNE_THROW(NotImplemented,
"VTK output for tensors not implemented yet");
1315 std::shared_ptr<VTK::DataArrayWriter> p
1317 if(!p->writeIsNoop())
1318 for (Iterator eit = begin; eit!=end; ++eit)
1320 const Entity & e = *eit;
1322 f.write(eit.position(),*p);
1326 for (std::size_t j=fieldInfo.
size(); j < writecomps; ++j)
1338 std::string scalars, vectors;
1352 std::string scalars, vectors;
1365 std::shared_ptr<VTK::DataArrayWriter> p
1367 if(!p->writeIsNoop()) {
1372 for (
int j=0; j<std::min(dimw,3); j++)
1373 p->write((*vit).geometry().corner(vit.localindex())[j]);
1374 for (
int j=std::min(dimw,3); j<3; j++)
1391 std::shared_ptr<VTK::DataArrayWriter> p1
1393 if(!p1->writeIsNoop())
1400 std::shared_ptr<VTK::DataArrayWriter> p2
1402 if(!p2->writeIsNoop()) {
1406 offset += it->subEntities(n);
1416 std::shared_ptr<VTK::DataArrayWriter> p3
1419 if(!p3->writeIsNoop())
1431 if( polyhedralCellsPresent_ )
1457 if( ! faceVertices_ )
1459 faceVertices_.reset(
new std::pair< std::vector<int>, std::vector<int> > () );
1462 faceVertices_->first, faceVertices_->second );
1465 std::vector< int >& faces = faceVertices_->first;
1466 std::vector< int >& faceOffsets = faceVertices_->second;
1467 assert(
int(faceOffsets.size()) ==
ncells );
1470 std::shared_ptr<VTK::DataArrayWriter> p4
1472 if(!p4->writeIsNoop())
1474 for(
const auto& face : faces )
1480 std::shared_ptr<VTK::DataArrayWriter> p5
1482 if(!p5->writeIsNoop())
1484 for(
const auto& offset : faceOffsets )
1485 p5->write( offset );
1488 faceVertices_.reset();
1493 template <
class CornerIterator,
class IndexSet,
class T>
1496 const IndexSet& indexSet,
1497 std::vector<T>& faces,
1498 std::vector<T>& faceOffsets )
1500 if( n == 3 && it != end )
1504 faces.reserve( 15 *
ncells );
1505 faceOffsets.clear();
1506 faceOffsets.reserve(
ncells );
1511 int elIndex = indexSet.index( element );
1512 std::vector< T > vertices;
1513 vertices.reserve( 30 );
1514 for( ; it != end; ++it )
1516 const Cell& cell = *it ;
1517 const int cellIndex = indexSet.index( cell ) ;
1518 if( elIndex != cellIndex )
1524 elIndex = cellIndex ;
1526 vertices.push_back( it.
id() );
1534 template <
class Entity,
class IndexSet,
class T>
1536 const IndexSet& indexSet,
1537 const std::vector<T>& vertices,
1539 std::vector<T>& faces,
1540 std::vector<T>& faceOffsets )
1544 std::map< T, T > vxMap;
1547 const int nVertices = element.subEntities( dim );
1548 for(
int vx = 0; vx < nVertices; ++ vx )
1550 const int vxIdx = indexSet.subIndex( element, vx, dim );
1551 vxMap[ vxIdx ] = vertices[ vx ];
1555 const int nFaces = element.subEntities( 1 );
1557 faces.push_back( nFaces );
1560 for(
int fce = 0; fce < nFaces; ++ fce )
1563 const auto face = element.template subEntity< 1 > ( fce );
1566 const int nVxFace = face.subEntities( dim );
1567 faces.push_back( nVxFace );
1569 for(
int i=0; i<nVxFace; ++i )
1571 const T vxIndex = indexSet.subIndex( face, i, dim );
1572 assert( vxMap.find( vxIndex ) != vxMap.end() );
1573 faces.push_back( vxMap[ vxIndex ] );
1579 faceOffsets.push_back( offset );
1598 std::vector<int> number;
1603 const bool polyhedralCellsPresent_;
1606 std::shared_ptr< std::pair< std::vector<int>, std::vector<int> > > faceVertices_;
Mapper for multiple codim and multiple geometry types.
Common stuff for the VTKWriter.
Data array writers for the VTKWriter.
Functions for VTK output.
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
const IndexSet & indexSet() const
obtain the index set
Definition common/gridview.hh:191
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
const Communication & comm() const
obtain communication object
Definition common/gridview.hh:280
static constexpr int dimension
The dimension of the grid.
Definition common/gridview.hh:148
Grid::ctype ctype
type used for coordinates in grid
Definition common/gridview.hh:145
static constexpr int dimensionworld
The dimension of the world the grid lives in.
Definition common/gridview.hh:151
MCMGLayout mcmgVertexLayout()
layout for vertices (dim-0 entities)
Definition mcmgmapper.hh:107
Include standard header files.
Definition agrid.hh:60
Precision
which precision to use when writing out data to vtk files
Definition common.hh:271
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
Grid view abstract base class.
Definition common/gridview.hh:66
A struct that collects all associated types of one implementation from the Traits class.
Definition common/gridview.hh:118
Implementation class for a multiple codim and multiple geometry type mapper.
Definition mcmgmapper.hh:129
size_type size() const
Return total number of entities in the entity set managed by the mapper.
Definition mcmgmapper.hh:204
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:185
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)
@ vector
vector-valued field (always 3D, will be padded if necessary)
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 ouput 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
Writer for the ouput of grid functions in the vtk format.
Definition vtkwriter.hh:95
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:695
CornerIterator cornerEnd() const
Definition vtkwriter.hh:620
void clear()
clear list of registered functions
Definition vtkwriter.hh:775
std::string write(const std::string &name, VTK::OutputType type=VTK::ascii)
write output (interface might change later)
Definition vtkwriter.hh:803
VertexIterator vertexBegin() const
Definition vtkwriter.hh:508
std::string getTypeString() const
Definition vtkwriter.hh:1226
std::string getParallelHeaderName(const std::string &name, const std::string &path, int commSize) const
return name of a parallel header file
Definition vtkwriter.hh:920
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:713
Dune::VTKFunction< GridView > VTKFunction
Definition vtkwriter.hh:147
CellIterator cellEnd() const
Definition vtkwriter.hh:402
std::list< VTKLocalFunction > vertexdata
Definition vtkwriter.hh:1585
CornerIterator cornerBegin() const
Definition vtkwriter.hh:613
std::string getSerialPieceName(const std::string &name, const std::string &path) const
return name of a serial piece file
Definition vtkwriter.hh:940
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:649
std::string getFormatString() const
Definition vtkwriter.hh:1213
bool checkForPolyhedralCells() const
Definition vtkwriter.hh:1441
void addVertexData(F &&f, VTK::FieldInfo vtkFieldInfo)
Add a function by sampling it on the grid vertices.
Definition vtkwriter.hh:738
virtual void writeCellData(VTK::VTUWriter &writer)
write cell data
Definition vtkwriter.hh:1333
virtual void countEntities(int &nvertices_, int &ncells_, int &ncorners_)
count the vertices, cells and corners
Definition vtkwriter.hh:1235
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:855
CellIterator cellBegin() const
Definition vtkwriter.hh:397
VTK::OutputType outputtype
Definition vtkwriter.hh:1609
virtual void writeGridCells(VTK::VTUWriter &writer)
write the connectivity array
Definition vtkwriter.hh:1385
GridView gridView_
Definition vtkwriter.hh:1588
virtual void writeCellFaces(VTK::VTUWriter &writer)
write the connectivity array
Definition vtkwriter.hh:1455
void fillFaceVertices(CornerIterator it, const CornerIterator end, const IndexSet &indexSet, std::vector< T > &faces, std::vector< T > &faceOffsets)
Definition vtkwriter.hh:1494
std::list< VTKLocalFunction > celldata
Definition vtkwriter.hh:1584
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:965
VTK::Precision coordPrecision() const
get the precision with which coordinates are written out
Definition vtkwriter.hh:782
std::list< VTKLocalFunction >::const_iterator FunctionIterator
Definition vtkwriter.hh:376
std::tuple< std::string, std::string > getDataNames(const T &data) const
Definition vtkwriter.hh:1264
virtual void writeGridPoints(VTK::VTUWriter &writer)
write the positions of vertices
Definition vtkwriter.hh:1361
virtual void writeVertexData(VTK::VTUWriter &writer)
write vertex data
Definition vtkwriter.hh:1347
int nvertices
Definition vtkwriter.hh:1592
void addCellData(F &&f, VTK::FieldInfo vtkFieldInfo)
Add a function by sampling it on the element centers.
Definition vtkwriter.hh:674
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:760
virtual ~VTKWriter()
destructor
Definition vtkwriter.hh:786
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:1535
void writeData(VTK::VTUWriter &writer, const Data &data, const Iterator begin, const Iterator end, int nentries)
Definition vtkwriter.hh:1291
int ncells
Definition vtkwriter.hh:1591
VertexIterator vertexEnd() const
Definition vtkwriter.hh:515
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:636
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:1043
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:835
int ncorners
Definition vtkwriter.hh:1593
Type erasure wrapper for VTK data sets.
Definition vtkwriter.hh:156
void unbind() const
Unbind the data set from the currently bound entity.
Definition vtkwriter.hh:360
VTKLocalFunction(F &&f, VTK::FieldInfo fieldInfo)
Construct a VTKLocalFunction for a dune-functions style LocalFunction.
Definition vtkwriter.hh:307
std::string name() const
Returns the name of the data set.
Definition vtkwriter.hh:342
VTK::FieldInfo _fieldInfo
Definition vtkwriter.hh:372
VTK::DataArrayWriter Writer
Definition vtkwriter.hh:160
const VTK::FieldInfo & fieldInfo() const
Returns the VTK::FieldInfo for the data set.
Definition vtkwriter.hh:348
void bind(const Entity &e) const
Bind the data set to grid entity e.
Definition vtkwriter.hh:354
VTKLocalFunction(const std::shared_ptr< const VTKFunction > &vtkFunctionPtr)
Construct a VTKLocalFunction for a legacy VTKFunction.
Definition vtkwriter.hh:331
std::shared_ptr< FunctionWrapperBase > _f
Definition vtkwriter.hh:371
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:366
Base class for polymorphic container of underlying data set.
Definition vtkwriter.hh:164
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:178
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:188
typename std::decay< F >::type Function
Definition vtkwriter.hh:189
FunctionWrapper(F_ &&f)
Definition vtkwriter.hh:192
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:206
virtual void unbind()
Unbind data set from current grid entity - mostly here for performance and symmetry reasons.
Definition vtkwriter.hh:201
virtual void bind(const Entity &e)
Bind data set to grid entity - must be called before evaluating (i.e. calling write())
Definition vtkwriter.hh:196
Type erasure implementation for C++ functions, i.e., functions that can be evaluated in global coordi...
Definition vtkwriter.hh:236
GlobalFunctionWrapper(F_ &&f)
Definition vtkwriter.hh:240
virtual void unbind()
Unbind data set from current grid entity - mostly here for performance and symmetry reasons.
Definition vtkwriter.hh:250
typename std::decay< F >::type Function
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:255
virtual void bind(const Entity &e)
Bind data set to grid entity - must be called before evaluating (i.e. calling write())
Definition vtkwriter.hh:245
Type erasure implementation for legacy VTKFunctions.
Definition vtkwriter.hh:276
virtual void unbind()
Unbind data set from current grid entity - mostly here for performance and symmetry reasons.
Definition vtkwriter.hh:287
VTKFunctionWrapper(const std::shared_ptr< const VTKFunction > &f)
Definition vtkwriter.hh:277
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:292
virtual void bind(const Entity &e)
Bind data set to grid entity - must be called before evaluating (i.e. calling write())
Definition vtkwriter.hh:282
Iterator over the grids elements.
Definition vtkwriter.hh:385
CellIterator(const GridCellIterator &x)
construct a CellIterator from the gridview's Iterator.
Definition vtkwriter.hh:388
const FieldVector< DT, n > position() const
Definition vtkwriter.hh:391
Iterate over the grid's vertices.
Definition vtkwriter.hh:424
VertexIterator(const GridCellIterator &x, const GridCellIterator &end, const VTK::DataMode &dm, const VertexMapper &vm)
Definition vtkwriter.hh:457
void basicIncrement()
Definition vtkwriter.hh:440
void increment()
Definition vtkwriter.hh:468
EntityReference dereference() const
Definition vtkwriter.hh:491
bool equals(const VertexIterator &cit) const
Definition vtkwriter.hh:485
FieldVector< DT, n > position() const
position of vertex inside the entity
Definition vtkwriter.hh:501
int localindex() const
index of vertex within the entity, in Dune-numbering
Definition vtkwriter.hh:496
Iterate over the elements' corners.
Definition vtkwriter.hh:539
void increment()
Definition vtkwriter.hh:566
CornerIterator(const GridCellIterator &x, const GridCellIterator &end, const VTK::DataMode &dm, const VertexMapper &vm, const std::vector< int > &num)
Definition vtkwriter.hh:558
int id() const
Process-local consecutive zero-starting vertex id.
Definition vtkwriter.hh:597
EntityReference dereference() const
Definition vtkwriter.hh:588
bool equals(const CornerIterator &cit) const
Definition vtkwriter.hh:582
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:380
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