6 #ifndef DUNE_VTKWRITER_HH 7 #define DUNE_VTKWRITER_HH 16 #include <type_traits> 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>
83 class VTKSequenceWriterBase;
84 template <
class Gr
idView>
85 class VTKSequenceWriter;
95 template<
class Gr
idView >
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;
171 virtual void unbind() = 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;
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,
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;
504 return referenceElement<DT,n>(git->type())
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;
551 const std::vector<int> & number;
560 const GridCellIterator & end,
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;
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";
1252 const int subEntities = it->subEntities(n);
1253 for (
int i=0; i<subEntities; ++i)
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_ )
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 );
1521 std::vector< T > vertices;
1522 vertices.reserve( 30 );
1523 for( ; it != end; ++it )
1525 const Cell& cell = *it ;
1526 const int cellIndex = indexSet.index( cell ) ;
1527 if( elIndex != cellIndex )
1533 elIndex = cellIndex ;
1535 vertices.push_back( it.
id() );
1543 template <
class Entity,
class IndexSet,
class T>
1545 const IndexSet& indexSet,
1546 const std::vector<T>& vertices,
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 );
1560 vxMap[ vxIdx ] = vertices[ vx ];
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 );
1611 std::vector<int> number;
1616 const bool polyhedralCellsPresent_;
1619 std::shared_ptr< std::pair< std::vector<int>, std::vector<int> > > faceVertices_;
void increment()
Definition: vtkwriter.hh:469
void clear()
clear list of registered functions
Definition: vtkwriter.hh:778
Descriptor struct for VTK fields.
Definition: common.hh:327
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
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
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
PartitionType
Attributes used in the generic overlap model.
Definition: gridenums.hh:30
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
concept Entity
Model of a grid entity.
Definition: concepts/entity.hh:119
Iterate over the elements' corners.
Definition: vtkwriter.hh:538
Dump a .vtu/.vtp files contents to a stream.
Definition: pvtuwriter.hh:62
for .vtu files (UnstructuredGrid)
Definition: common.hh:256
void write(T data)
write one element of data
Definition: dataarraywriter.hh:69
Type erasure implementation for legacy VTKFunctions.
Definition: vtkwriter.hh:275
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
for .vtp files (PolyData)
Definition: common.hh:254
void unbind() const
Unbind the data set from the currently bound entity.
Definition: vtkwriter.hh:361
std::string name() const
Returns the name of the data set.
Definition: vtkwriter.hh:343
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 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
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
Mapper for multiple codim and multiple geometry types.
void beginCellData(const std::string &scalars="", const std::string &vectors="")
start CellData section
Definition: vtuwriter.hh:205
std::size_t size() const
The number of components in the data field.
Definition: common.hh:364
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 endPoints()
finish section for the point coordinates
Definition: vtuwriter.hh:249
const VTK::FieldInfo & fieldInfo() const
Returns the VTK::FieldInfo for the data set.
Definition: vtkwriter.hh:349
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
void endCells()
start section for the grid cells/PolyData lines
Definition: vtuwriter.hh:285
GeometryType geometryType(const Dune::GeometryType &t)
mapping from GeometryType to VTKGeometryType
Definition: common.hh:151
void addVertexData(F &&f, VTK::FieldInfo vtkFieldInfo)
Add a function by sampling it on the grid vertices.
Definition: vtkwriter.hh:740
void beginPoints()
start section for the point coordinates
Definition: vtuwriter.hh:238
std::string write(const std::string &name, VTK::OutputType type=VTK::ascii)
write output (interface might change later)
Definition: vtkwriter.hh:806
std::string name() const
The name of the data field.
Definition: common.hh:352
Precision precision() const
The precision used for the output of the data field.
Definition: common.hh:370
Data array writers for the VTKWriter.
std::string getFormatString() const
Definition: vtkwriter.hh:1220
VTKFunctionWrapper(const std::shared_ptr< const VTKFunction > &f)
Definition: vtkwriter.hh:278
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
FunctionWrapper(F_ &&f)
Definition: vtkwriter.hh:193
VTK::DataArrayWriter Writer
Definition: vtkwriter.hh:161
DataMode
Whether to produce conforming or non-conforming output.
Definition: common.hh:67
VTKLocalFunction(const std::shared_ptr< const VTKFunction > &vtkFunctionPtr)
Construct a VTKLocalFunction for a legacy VTKFunction.
Definition: vtkwriter.hh:332
std::tuple< std::string, std::string > getDataNames(const T &data) const
Definition: vtkwriter.hh:1271
VTKLocalFunction(F &&f, VTK::FieldInfo fieldInfo)
Construct a VTKLocalFunction for a dune-functions style LocalFunction.
Definition: vtkwriter.hh:308
Output is to the file is appended raw binary.
Definition: common.hh:49
size_type size() const
Return total number of entities in the entity set managed by the mapper.
Definition: mcmgmapper.hh:204
virtual void writeGridPoints(VTK::VTUWriter &writer)
write the positions of vertices
Definition: vtkwriter.hh:1368
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
Dune::VTKFunction< GridView > VTKFunction
Definition: vtkwriter.hh:148
Specialize with 'true' for all codims that a grid implements entities for. (default=false) ...
Definition: common/capabilities.hh:57
std::list< VTKLocalFunction > vertexdata
Definition: vtkwriter.hh:1598
Grid::ctype ctype
type used for coordinates in grid
Definition: common/gridview.hh:131
CellIterator cellBegin() const
Definition: vtkwriter.hh:398
all entities
Definition: gridenums.hh:141
VertexIterator vertexBegin() const
Definition: vtkwriter.hh:509
const IndexSet & indexSet() const
obtain the index set
Definition: common/gridview.hh:177
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
std::shared_ptr< FunctionWrapperBase > _f
Definition: vtkwriter.hh:372
int localindex() const
index of vertex within the entity, in Dune-numbering
Definition: vtkwriter.hh:497
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
virtual ~FunctionWrapperBase()
Definition: vtkwriter.hh:179
virtual void unbind()
Unbind data set from current grid entity - mostly here for performance and symmetry reasons...
Definition: vtkwriter.hh:288
void basicIncrement()
Definition: vtkwriter.hh:441
all interior entities
Definition: gridenums.hh:31
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
VTK::OutputType outputtype
Definition: vtkwriter.hh:1622
VTK::Precision coordPrecision() const
get the precision with which coordinates are written out
Definition: vtkwriter.hh:785
Output to the file is inline base64 binary.
Definition: common.hh:47
CornerIterator cornerEnd() const
Definition: vtkwriter.hh:621
A base class for grid functions with any return type and dimension.
Definition: function.hh:41
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
void beginPointData(const std::string &scalars="", const std::string &vectors="")
start PointData section
Definition: vtuwriter.hh:167
std::list< VTKLocalFunction > celldata
Definition: vtkwriter.hh:1597
VTK::FieldInfo _fieldInfo
Definition: vtkwriter.hh:373
FileType
which type of VTK file to write
Definition: common.hh:252
static constexpr int dimensionworld
The dimension of the world the grid lives in.
Definition: common/gridview.hh:137
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 beginCells()
start section for the grid cells/PolyData lines
Definition: vtuwriter.hh:274
int nvertices
Definition: vtkwriter.hh:1605
VertexIterator vertexEnd() const
Definition: vtkwriter.hh:516
Grid view abstract base class.
Definition: common/gridview.hh:65
int renumber(const Dune::GeometryType &t, int i)
renumber VTK <-> Dune
Definition: common.hh:186
base class for data array writers
Definition: dataarraywriter.hh:55
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...
Output to the file is in ascii.
Definition: common.hh:45
GlobalFunctionWrapper(F_ &&f)
Definition: vtkwriter.hh:241
int ncells
Definition: vtkwriter.hh:1604
void bind(const Entity &e) const
Bind the data set to grid entity e.
Definition: vtkwriter.hh:355
void fillFaceVertices(CornerIterator it, const CornerIterator end, const IndexSet &indexSet, std::vector< T > &faces, std::vector< T > &faceOffsets)
Definition: vtkwriter.hh:1503
const FieldVector< DT, n > position() const
Definition: vtkwriter.hh:392
virtual void writeGridCells(VTK::VTUWriter &writer)
write the connectivity array
Definition: vtkwriter.hh:1392
typename std::decay< F >::type Function
Definition: vtkwriter.hh:190
Writer for the output of grid functions in the vtk format.Writes arbitrary grid functions (living on ...
Definition: vtksequencewriter.hh:27
Output non-conforming data.
Definition: common.hh:81
VertexIterator(const GridCellIterator &x, const GridCellIterator &end, const VTK::DataMode &dm, const VertexMapper &vm)
Definition: vtkwriter.hh:458
Iterate over the grid's vertices.
Definition: vtkwriter.hh:423
virtual void bind(const Entity &e)=0
Bind data set to grid entity - must be called before evaluating (i.e. calling write()) ...
tensor field (always 3x3)
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
GridView gridView_
Definition: vtkwriter.hh:1601
CellIterator cellEnd() const
Definition: vtkwriter.hh:403
Include standard header files.
Definition: agrid.hh:59
FieldVector< DT, n > position() const
position of vertex inside the entity
Definition: vtkwriter.hh:502
bool checkForPolyhedralCells() const
Definition: vtkwriter.hh:1448
CornerIterator(const GridCellIterator &x, const GridCellIterator &end, const VTK::DataMode &dm, const VertexMapper &vm, const std::vector< int > &num)
Definition: vtkwriter.hh:559
PartitionIteratorType
Parameter to be used for the parallel level- and leaf iterators.
Definition: gridenums.hh:136
void increment()
Definition: vtkwriter.hh:567
interior and border entities
Definition: gridenums.hh:138
concept Grid
Requirements for implementations of the Dune::Grid interface.The Grid concept defines interface requi...
Definition: concepts/grid.hh:109
Implementation class for a multiple codim and multiple geometry type mapper.
Definition: mcmgmapper.hh:127
Take a vector and interpret it as point data for the VTKWriter.
Definition: function.hh:203
Output is to the file is appended base64 binary.
Definition: common.hh:51
bool equals(const VertexIterator &cit) const
Definition: vtkwriter.hh:486
Definition: common.hh:142
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
virtual void writeVertexData(VTK::VTUWriter &writer)
write vertex data
Definition: vtkwriter.hh:1354
static constexpr int dimension
The dimension of the grid.
Definition: common/gridview.hh:134
CellIterator(const GridCellIterator &x)
construct a CellIterator from the gridview's Iterator.
Definition: vtkwriter.hh:389
Traits ::IndexSet IndexSet
type of the index set
Definition: common/gridview.hh:86
Traits ::Grid Grid
type of the grid
Definition: common/gridview.hh:83
DataArrayWriter * makeArrayWriter(const std::string &name, unsigned ncomps, unsigned nitems, Precision prec)
acquire a DataArrayWriter
Definition: vtuwriter.hh:381
Type type() const
The type of the data field.
Definition: common.hh:358
Type erasure implementation for C++ functions, i.e., functions that can be evaluated in global coordi...
Definition: vtkwriter.hh:235
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
Type erasure wrapper for VTK data sets.
Definition: vtkwriter.hh:156
MCMGLayout mcmgVertexLayout()
layout for vertices (dim-0 entities)
Definition: mcmgmapper.hh:107
const Communication & comm() const
obtain communication object
Definition: common/gridview.hh:273
virtual ~VTKWriter()
destructor
Definition: vtkwriter.hh:789
virtual void unbind()
Unbind data set from current grid entity - mostly here for performance and symmetry reasons...
Definition: vtkwriter.hh:251
Take a vector and interpret it as cell data for the VTKWriter.
Definition: function.hh:95
virtual void unbind()
Unbind data set from current grid entity - mostly here for performance and symmetry reasons...
Definition: vtkwriter.hh:202
Base class to write pvd-files which contains a list of all collected vtk-files.
Definition: vtksequencewriterbase.hh:33
Functions for VTK output.
EntityReference dereference() const
Definition: vtkwriter.hh:492
virtual void writeCellFaces(VTK::VTUWriter &writer)
write the connectivity array
Definition: vtkwriter.hh:1464
typename std::decay< F >::type Function
Definition: vtkwriter.hh:238
void writeData(VTK::VTUWriter &writer, const Data &data, const Iterator begin, const Iterator end, int nentries)
Definition: vtkwriter.hh:1298
Common stuff for the VTKWriter.
Dump a .vtu/.vtp files contents to a stream.
Definition: vtuwriter.hh:98
bool equals(const CornerIterator &cit) const
Definition: vtkwriter.hh:583
A set of traits classes to store static information about grid implementation.
Iterator over the grids elements.
Definition: vtkwriter.hh:385
Precision
which precision to use when writing out data to vtk files
Definition: common.hh:271
EntityReference dereference() const
Definition: vtkwriter.hh:589
Type erasure implementation for functions conforming to the dune-functions LocalFunction interface...
Definition: vtkwriter.hh:187
int id() const
Process-local consecutive zero-starting vertex id.
Definition: vtkwriter.hh:598
virtual void unbind()=0
Unbind data set from current grid entity - mostly here for performance and symmetry reasons...
void endPointData()
finish PointData section
Definition: vtuwriter.hh:182
Writer for the output of grid functions in the vtk format.Writes arbitrary grid functions (living on ...
Definition: vtkwriter.hh:96
std::list< VTKLocalFunction >::const_iterator FunctionIterator
Definition: vtkwriter.hh:377
int ncorners
Definition: vtkwriter.hh:1606
int min(const DofVectorPointer< int > &dofVector)
Definition: dofvector.hh:348
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
void addCellData(F &&f, VTK::FieldInfo vtkFieldInfo)
Add a function by sampling it on the element centers.
Definition: vtkwriter.hh:675
OutputType
How the bulk data should be stored in the file.
Definition: common.hh:43
Output conforming data.
Definition: common.hh:73
concept IndexSet
Model of an index set.
Definition: concepts/indexidset.hh:55
vector-valued field (always 3D, will be padded if necessary)
void endCellData()
finish CellData section
Definition: vtuwriter.hh:220
std::string getTypeString() const
Definition: vtkwriter.hh:1233