4 #ifndef DUNE_VTKWRITER_HH 5 #define DUNE_VTKWRITER_HH 19 #include <dune/common/typetraits.hh> 20 #include <dune/common/exceptions.hh> 21 #include <dune/common/std/memory.hh> 22 #include <dune/common/indent.hh> 23 #include <dune/common/iteratorfacades.hh> 24 #include <dune/common/path.hh> 25 #include <dune/geometry/referenceelements.hh> 53 template<
typename F,
typename =
int>
55 :
public std::false_type
60 :
public std::true_type
65 namespace VTKWriteTypeTraits {
73 template <
class Gr
idView>
75 template <
class Gr
idView>
86 template<
class Gr
idView >
101 typedef typename GridView::template Codim< 0 >::Entity Cell;
102 typedef typename GridView::template Codim< n >::Entity Vertex;
110 typedef typename GridView::template Codim< 0 >
111 ::template Partition< VTK_Partition >::Iterator
113 typedef typename GridView::template Codim< n >
114 ::template Partition< VTK_Partition >::Iterator
117 typedef typename GridCellIterator::Reference EntityReference;
119 typedef typename GridView::template Codim< 0 >
120 ::Entity::Geometry::LocalCoordinate Coordinate;
127 switch( VTK_Partition )
132 default: DUNE_THROW(NotImplemented,
"Add check for this partition type");
159 virtual void bind(
const Entity& e) = 0;
162 virtual void unbind() = 0;
168 virtual void write(
const Coordinate& pos, Writer& w, std::size_t count)
const = 0;
182 template<
typename F_>
184 : _f(
std::forward<F_>(f))
187 virtual void bind(
const Entity& e)
197 virtual void write(
const Coordinate& pos, Writer& w, std::size_t count)
const 201 do_write(w,r,count,is_indexable<decltype(r)>());
207 void do_write(Writer& w,
const R& r, std::size_t count, std::true_type)
const 209 for (std::size_t i = 0; i < count; ++i)
214 void do_write(Writer& w,
const R& r, std::size_t count, std::false_type)
const 232 virtual void bind(
const Entity& e)
242 virtual void write(
const Coordinate& pos, Writer& w, std::size_t count)
const 244 for (std::size_t i = 0; i < count; ++i)
245 w.
write(_f->evaluate(i,*_entity,pos));
250 std::shared_ptr< const VTKFunction > _f;
251 const Entity* _entity;
260 , _fieldInfo(fieldInfo)
268 typename
std::decay<decltype(localFunction(
std::forward<F>(f)))>::type
269 > >(localFunction(
std::forward<F>(f))))
270 , _fieldInfo(fieldInfo)
277 vtkFunctionPtr->name(),
278 vtkFunctionPtr->ncomps() > 1 ? VTK::FieldInfo::Type::vector : VTK::FieldInfo::Type::scalar,
279 vtkFunctionPtr->ncomps()
286 return fieldInfo().name();
296 void bind(
const Entity& e)
const 308 void write(
const Coordinate& pos, Writer& w)
const 310 _f->write(pos,w,fieldInfo().size());
313 std::shared_ptr<FunctionWrapperBase>
_f;
335 return ReferenceElements<DT,n>::general((*this)->type()).position(0,0);
341 return gridView_.template begin< 0, VTK_Partition >();
346 return gridView_.template end< 0, VTK_Partition >();
365 public ForwardIteratorFacade<VertexIterator, const Entity, EntityReference, int>
367 GridCellIterator git;
368 GridCellIterator gend;
373 const VertexMapper & vertexmapper;
374 std::vector<bool> visited;
387 const int numCorners = git->subEntities(n);
388 if( cornerIndexDune == numCorners )
390 offset += numCorners;
394 while( (git != gend) && skipEntity( git->partitionType() ) )
400 const GridCellIterator & end,
402 const VertexMapper & vm) :
403 git(x), gend(end), datamode(dm), cornerIndexDune(0),
404 vertexmapper(vm), visited(vm.size(), false),
408 visited[vertexmapper.
subIndex(*git,cornerIndexDune,n)] =
true;
415 while(visited[vertexmapper.
subIndex(*git,cornerIndexDune,n)])
418 if (git == gend)
return;
420 visited[vertexmapper.
subIndex(*git,cornerIndexDune,n)] =
true;
429 return git == cit.git
430 && cornerIndexDune == cit.cornerIndexDune
431 && datamode == cit.datamode;
440 return cornerIndexDune;
445 return ReferenceElements<DT,n>::general(git->type())
446 .position(cornerIndexDune,n);
452 return VertexIterator( gridView_.template begin< 0, VTK_Partition >(),
453 gridView_.template end< 0, VTK_Partition >(),
454 datamode, *vertexmapper );
459 return VertexIterator( gridView_.template end< 0, VTK_Partition >(),
460 gridView_.template end< 0, VTK_Partition >(),
461 datamode, *vertexmapper );
480 public ForwardIteratorFacade<CornerIterator, const Entity, EntityReference, int>
482 GridCellIterator git;
483 GridCellIterator gend;
488 const VertexMapper & vertexmapper;
492 const std::vector<int> & number;
501 const GridCellIterator & end,
503 const VertexMapper & vm,
504 const std::vector<int> & num) :
505 git(x), gend(end), datamode(dm), cornerIndexVTK(0),
507 number(num), offset(0) {}
513 const int numCorners = git->subEntities(n);
514 if( cornerIndexVTK == numCorners )
516 offset += numCorners;
520 while( (git != gend) && skipEntity( git->partitionType() ) )
526 return git == cit.git
527 && cornerIndexVTK == cit.cornerIndexVTK
528 && datamode == cit.datamode;
550 DUNE_THROW(IOError,
"VTKWriter: unsupported DataMode" << datamode);
557 return CornerIterator( gridView_.template begin< 0, VTK_Partition >(),
558 gridView_.template end< 0, VTK_Partition >(),
559 datamode, *vertexmapper, number );
564 return CornerIterator( gridView_.template end< 0, VTK_Partition >(),
565 gridView_.template end< 0, VTK_Partition >(),
566 datamode, *vertexmapper, number );
579 : gridView_( gridView ),
581 polyhedralCellsPresent_( checkForPolyhedralCells() )
614 template<
class Container>
615 void addCellData (
const Container& v,
const std::string &name,
int ncomps = 1)
618 for (
int c=0; c<ncomps; ++c) {
619 std::stringstream compName;
622 compName <<
"[" << c <<
"]";
623 VTKFunction* p =
new Function(gridView_, v, compName.str(), ncomps, c);
624 addCellData(std::shared_ptr< const VTKFunction >(p));
659 template<
class Container>
660 void addVertexData (
const Container& v,
const std::string &name,
int ncomps=1)
663 for (
int c=0; c<ncomps; ++c) {
664 std::stringstream compName;
667 compName <<
"[" << c <<
"]";
668 VTKFunction* p =
new Function(gridView_, v, compName.str(), ncomps, c);
669 addVertexData(std::shared_ptr< const VTKFunction >(p));
697 std::string
write (
const std::string &name,
700 return write( name, type, gridView_.comm().rank(), gridView_.comm().size() );
729 std::string
pwrite (
const std::string & name,
const std::string & path,
const std::string & extendpath,
732 return pwrite( name, path, extendpath, type, gridView_.comm().rank(), gridView_.comm().size() );
749 const std::string& path,
750 int commRank,
int commSize)
const 752 std::ostringstream s;
753 if(path.size() > 0) {
755 if(path[path.size()-1] !=
'/')
758 s <<
's' << std::setw(4) << std::setfill(
'0') << commSize <<
'-';
759 s <<
'p' << std::setw(4) << std::setfill(
'0') << commRank <<
'-';
780 const std::string& path,
783 std::ostringstream s;
784 if(path.size() > 0) {
786 if(path[path.size()-1] !=
'/')
789 s <<
's' << std::setw(4) << std::setfill(
'0') << commSize <<
'-';
812 const std::string& path)
const 814 static const std::string extension =
817 return concatPaths(path, name+extension);
835 std::string
write (
const std::string &name,
843 return pwrite(name,
"",
"", type, commRank, commSize);
849 std::string pieceName = getSerialPieceName(name,
"");
853 file.exceptions(std::ios_base::badbit | std::ios_base::failbit |
854 std::ios_base::eofbit);
857 file.open( pieceName.c_str(), std::ios::binary );
860 std::cerr <<
"Filename: " << pieceName <<
" could not be opened" << std::endl;
863 if (! file.is_open())
864 DUNE_THROW(IOError,
"Could not write to piece file " << pieceName);
865 writeDataFile( file );
895 std::string
pwrite(
const std::string& name,
const std::string& path,
896 const std::string& extendpath,
905 file.exceptions(std::ios_base::badbit | std::ios_base::failbit |
906 std::ios_base::eofbit);
907 std::string piecepath = concatPaths(path, extendpath);
908 std::string relpiecepath = relativePath(path, piecepath);
911 std::string fullname = getParallelPieceName(name, piecepath, commRank,
915 file.open(fullname.c_str(),std::ios::binary);
918 std::cerr <<
"Filename: " << fullname <<
" could not be opened" << std::endl;
921 if (! file.is_open())
922 DUNE_THROW(IOError,
"Could not write to piecefile file " << fullname);
925 gridView_.comm().barrier();
928 fullname = getParallelHeaderName(name, path, commSize);
931 file.open(fullname.c_str());
932 if (! file.is_open())
933 DUNE_THROW(IOError,
"Could not write to parallel file " << fullname);
934 writeParallelHeader(file,name,relpiecepath, commSize );
937 gridView_.comm().barrier();
960 void writeParallelHeader(std::ostream& s,
const std::string& piecename,
961 const std::string& piecepath,
const int commSize)
972 std::string scalars, vectors;
973 std::tie(scalars,vectors) = getDataNames(vertexdata);
976 for (
auto it = vertexdata.begin(),
977 end = vertexdata.end();
981 unsigned writecomps = it->fieldInfo().size();
982 if(writecomps == 2) writecomps = 3;
983 writer.
addArray<
float>(it->name(), writecomps);
989 std::string scalars, vectors;
990 std::tie(scalars,vectors) = getDataNames(celldata);
993 for (
auto it = celldata.begin(),
994 end = celldata.end();
998 unsigned writecomps = it->fieldInfo().size();
999 if(writecomps == 2) writecomps = 3;
1000 writer.
addArray<
float>(it->name(), writecomps);
1006 writer.
addArray<
float>(
"Coordinates", 3);
1010 for(
int i = 0; i < commSize; ++i )
1012 const std::string& fullname = getParallelPieceName(piecename,
1022 void writeDataFile (std::ostream& s)
1030 vertexmapper =
new VertexMapper( gridView_ );
1033 number.resize(vertexmapper->size());
1034 for (std::vector<int>::size_type i=0; i<number.size(); i++) number[i] = -1;
1036 countEntities(nvertices, ncells, ncorners);
1039 writeAllData(writer);
1044 writeAllData(writer);
1047 delete vertexmapper; number.clear();
1052 writeVertexData(writer);
1055 writeCellData(writer);
1058 writeGridPoints(writer);
1061 writeGridCells(writer);
1075 DUNE_THROW(IOError,
"VTKWriter: unsupported OutputType" << outputtype);
1083 return "UnstructuredGrid";
1097 const int subEntities = it->subEntities(n);
1098 for (
int i=0; i<subEntities; ++i)
1103 int alpha = vertexmapper->subIndex(*it,i,n);
1104 if (number[alpha]<0)
1105 number[alpha] = nvertices++;
1115 template<
typename T>
1118 std::string scalars =
"";
1119 for (
auto it = data.begin(),
1125 scalars = it->name();
1129 std::string vectors =
"";
1130 for (
auto it = data.begin(),
1136 vectors = it->name();
1139 return std::make_tuple(scalars,vectors);
1142 template<
typename Data,
typename Iterator>
1145 for (
auto it = data.begin(),
1150 const auto& f = *it;
1152 std::size_t writecomps = fieldInfo.
size();
1153 switch (fieldInfo.
type())
1161 DUNE_THROW(IOError,
"Cannot write VTK vectors with more than 3 components (components was " << writecomps <<
")");
1165 DUNE_THROW(NotImplemented,
"VTK output for tensors not implemented yet");
1167 std::shared_ptr<VTK::DataArrayWriter<float> > p
1169 if(!p->writeIsNoop())
1170 for (Iterator eit = begin; eit!=end; ++eit)
1172 const Entity & e = *eit;
1174 f.write(eit.position(),*p);
1178 for (std::size_t j=fieldInfo.
size(); j < writecomps; ++j)
1187 if(celldata.size() == 0)
1190 std::string scalars, vectors;
1191 std::tie(scalars,vectors) = getDataNames(celldata);
1194 writeData(writer,celldata,cellBegin(),cellEnd(),ncells);
1201 if(vertexdata.size() == 0)
1204 std::string scalars, vectors;
1205 std::tie(scalars,vectors) = getDataNames(vertexdata);
1208 writeData(writer,vertexdata,vertexBegin(),vertexEnd(),nvertices);
1217 std::shared_ptr<VTK::DataArrayWriter<float> > p
1219 if(!p->writeIsNoop()) {
1224 for (
int j=0; j<
std::min(dimw,3); j++)
1225 p->write((*vit).geometry().corner(vit.localindex())[j]);
1226 for (
int j=std::min(dimw,3); j<3; j++)
1243 std::shared_ptr<VTK::DataArrayWriter<int> > p1
1245 if(!p1->writeIsNoop())
1252 std::shared_ptr<VTK::DataArrayWriter<int> > p2
1254 if(!p2->writeIsNoop()) {
1258 offset += it->subEntities(n);
1268 std::shared_ptr<VTK::DataArrayWriter<unsigned char> > p3
1271 if(!p3->writeIsNoop())
1283 if( polyhedralCellsPresent_ )
1285 writeCellFaces( writer );
1296 for(
const auto& geomType : gridView_.indexSet().types( 0 ) )
1309 if( ! faceVertices_ )
1311 faceVertices_.reset(
new std::pair< std::vector<int>, std::vector<int> > () );
1313 fillFaceVertices( cornerBegin(), cornerEnd(), gridView_.indexSet(),
1314 faceVertices_->first, faceVertices_->second );
1317 std::vector< int >& faces = faceVertices_->first;
1318 std::vector< int >& faceOffsets = faceVertices_->second;
1319 assert(
int(faceOffsets.size()) == ncells );
1322 std::shared_ptr<VTK::DataArrayWriter< int > > p4
1324 if(!p4->writeIsNoop())
1326 for(
const auto& face : faces )
1332 std::shared_ptr<VTK::DataArrayWriter< int > > p5
1334 if(!p5->writeIsNoop())
1336 for(
const auto& offset : faceOffsets )
1337 p5->write( offset );
1340 faceVertices_.reset();
1345 template <
class CornerIterator,
class IndexSet,
class T>
1348 const IndexSet& indexSet,
1349 std::vector<T>& faces,
1350 std::vector<T>& faceOffsets )
1352 if( n == 3 && it != end )
1356 faces.reserve( 15 * ncells );
1357 faceOffsets.clear();
1358 faceOffsets.reserve( ncells );
1363 int elIndex = indexSet.index( element );
1364 std::vector< T > vertices;
1365 vertices.reserve( 30 );
1366 for( ; it != end; ++it )
1368 const Cell& cell = *it ;
1369 const int cellIndex = indexSet.index( cell ) ;
1370 if( elIndex != cellIndex )
1372 fillFacesForElement( element, indexSet, vertices, offset, faces, faceOffsets );
1376 elIndex = cellIndex ;
1378 vertices.push_back( it.
id() );
1382 fillFacesForElement( element, indexSet, vertices, offset, faces, faceOffsets );
1386 template <
class Entity,
class IndexSet,
class T>
1388 const IndexSet& indexSet,
1389 const std::vector<T>& vertices,
1391 std::vector<T>& faces,
1392 std::vector<T>& faceOffsets )
1396 std::map< T, T > vxMap;
1399 const int nVertices = element.subEntities( dim );
1400 for(
int vx = 0; vx < nVertices; ++ vx )
1402 const int vxIdx = indexSet.subIndex( element, vx, dim );
1403 vxMap[ vxIdx ] = vertices[ vx ];
1407 const int nFaces = element.subEntities( 1 );
1409 faces.push_back( nFaces );
1412 for(
int fce = 0; fce < nFaces; ++ fce )
1415 const auto face = element.template subEntity< 1 > ( fce );
1418 const int nVxFace = face.subEntities( dim );
1419 faces.push_back( nVxFace );
1421 for(
int i=0; i<nVxFace; ++i )
1423 const T vxIndex = indexSet.subIndex( face, i, dim );
1424 assert( vxMap.find( vxIndex ) != vxMap.end() );
1425 faces.push_back( vxMap[ vxIndex ] );
1431 faceOffsets.push_back( offset );
1447 VertexMapper* vertexmapper;
1450 std::vector<int> number;
1454 const bool polyhedralCellsPresent_;
1457 std::shared_ptr< std::pair< std::vector<int>, std::vector<int> > > faceVertices_;
std::string getFormatString() const
Definition: vtkwriter.hh:1065
EntityReference dereference() const
Definition: vtkwriter.hh:530
Writer for the ouput of grid functions in the vtk format.Writes arbitrary grid functions (living on c...
Definition: vtkwriter.hh:87
VTKLocalFunction(F &&f, VTK::FieldInfo fieldInfo, typename std::enable_if< detail::_has_local_context< F >::value, int >::type dummy=0)
Construct a VTKLocalFunction for a dune-functions style LocalFunction.
Definition: vtkwriter.hh:257
VTK::DataArrayWriter< float > Writer
Definition: vtkwriter.hh:152
CellIterator(const GridCellIterator &x)
construct a CellIterator from the gridview's Iterator.
Definition: vtkwriter.hh:330
A base class for grid functions with any return type and dimension.
Definition: function.hh:38
Output non-conforming data.
Definition: common.hh:78
Definition: vtkwriter.hh:54
VTK::FieldInfo _fieldInfo
Definition: vtkwriter.hh:314
Writer for the ouput of grid functions in the vtk format.Writes arbitrary grid functions (living on c...
Definition: vtksequencewriter.hh:26
virtual void writeGridPoints(VTK::VTUWriter &writer)
write the positions of vertices
Definition: vtkwriter.hh:1213
typename std::decay< F >::type Function
Definition: vtkwriter.hh:180
Output is to the file is appended raw binary.
Definition: common.hh:46
VTKWriter(const GridView &gridView, VTK::DataMode dm=VTK::conforming)
Construct a VTKWriter working on a specific GridView.
Definition: vtkwriter.hh:577
CornerIterator cornerBegin() const
Definition: vtkwriter.hh:555
std::string getSerialPieceName(const std::string &name, const std::string &path) const
return name of a serial piece file
Definition: vtkwriter.hh:811
CellIterator cellEnd() const
Definition: vtkwriter.hh:344
VTKFunctionWrapper(const std::shared_ptr< const VTKFunction > &f)
Definition: vtkwriter.hh:227
Data array writers for the VTKWriter.
std::list< VTKLocalFunction > vertexdata
Definition: vtkwriter.hh:1437
virtual void unbind()
Unbind data set from current grid entity - mostly here for performance and symmetry reasons...
Definition: vtkwriter.hh:192
void addVertexData(const Container &v, const std::string &name, int ncomps=1)
Add a grid function (represented by container) that lives on the vertices of the grid to the visualiz...
Definition: vtkwriter.hh:660
Take a vector and interpret it as point data for the VTKWriter.
Definition: function.hh:186
std::string name() const
Returns the name of the data set.
Definition: vtkwriter.hh:284
EntityReference dereference() const
Definition: vtkwriter.hh:433
GridView gridView_
Definition: vtkwriter.hh:1440
tensor field (always 3x3)
Definition: vtkwriter.hh:67
void beginPoints()
start section for the point coordinates
Definition: vtuwriter.hh:236
bool checkForPolyhedralCells() const
Definition: vtkwriter.hh:1293
Definition: common.hh:188
virtual ~FunctionWrapperBase()
Definition: vtkwriter.hh:170
void beginCellData(const std::string &scalars="", const std::string &vectors="")
start CellData section
Definition: vtuwriter.hh:203
void bind(const Entity &e) const
Bind the data set to grid entity e.
Definition: vtkwriter.hh:296
std::tuple< std::string, std::string > getDataNames(const T &data) const
Definition: vtkwriter.hh:1116
virtual void countEntities(int &nvertices, int &ncells, int &ncorners)
count the vertices, cells and corners
Definition: vtkwriter.hh:1087
VTK::OutputType outputtype
Definition: vtkwriter.hh:1460
virtual void write(const Coordinate &pos, Writer &w, std::size_t count) const
Evaluate data set at local position pos inside the current entity and write result to w...
Definition: vtkwriter.hh:197
PartitionType
Attributes used in the generic overlap model.
Definition: gridenums.hh:28
PartitionIteratorType
Parameter to be used for the parallel level- and leaf iterators.
Definition: gridenums.hh:134
void endPointData()
finish PointData section
Definition: vtuwriter.hh:180
void addVertexData(const std::shared_ptr< const VTKFunction > &p)
Add a grid function that lives on the vertices of the grid to the visualization.
Definition: vtkwriter.hh:632
Type erasure wrapper for VTK data sets.
Definition: vtkwriter.hh:147
void writeData(VTK::VTUWriter &writer, const Data &data, const Iterator begin, const Iterator end, int nentries)
Definition: vtkwriter.hh:1143
void endPoints()
finish section for the point coordinates
Definition: vtuwriter.hh:247
OutputType
How the bulk data should be stored in the file.
Definition: common.hh:40
std::string write(const std::string &name, VTK::OutputType type=VTK::ascii)
write output (interface might change later)
Definition: vtkwriter.hh:697
vector-valued field (always 3D, will be padded if necessary)
Functions for VTK output.
Iterate over the grid's vertices.
Definition: vtkwriter.hh:364
void beginPointData(const std::string &scalars="", const std::string &vectors="")
start PointData section
Definition: vtuwriter.hh:165
GeometryType geometryType(const Dune::GeometryType &t)
mapping from GeometryType to VTKGeometryType
Definition: common.hh:197
void endPointData()
finish PointData section
Definition: pvtuwriter.hh:127
int min(const DofVectorPointer< int > &dofVector)
Definition: dofvector.hh:346
Common stuff for the VTKWriter.
void beginCells()
start section for the grid cells/PolyData lines
Definition: vtuwriter.hh:272
virtual void writeCellFaces(VTK::VTUWriter &writer)
write the connectivity array
Definition: vtkwriter.hh:1307
void addCellData(const std::shared_ptr< const VTKFunction > &p)
Add a grid function that lives on the cells of the grid to the visualization.
Definition: vtkwriter.hh:588
Dune::VTKFunction< GridView > VTKFunction
Definition: vtkwriter.hh:139
Output conforming data.
Definition: common.hh:70
void beginMain(unsigned ghostLevel=0)
start the main PPolyData/PUnstructuredGrid section
Definition: pvtuwriter.hh:187
interior and border entities
Definition: gridenums.hh:136
Descriptor struct for VTK fields.
Definition: common.hh:314
void increment()
Definition: vtkwriter.hh:508
int localindex() const
index of vertex within the entity, in Dune-numbering
Definition: vtkwriter.hh:438
void endMain()
finish the main PolyData/UnstructuredGrid section
Definition: vtuwriter.hh:318
void endCells()
start section for the grid cells/PolyData lines
Definition: vtuwriter.hh:283
const FieldVector< DT, n > position() const
Definition: vtkwriter.hh:333
const VTK::FieldInfo & fieldInfo() const
Returns the VTK::FieldInfo for the data set.
Definition: vtkwriter.hh:290
virtual void unbind()
Unbind data set from current grid entity - mostly here for performance and symmetry reasons...
Definition: vtkwriter.hh:237
void addArray(const std::string &name, unsigned ncomps)
Add an array to the output file.
Definition: pvtuwriter.hh:205
DataMode
Whether to produce conforming or non-conforming output.
Definition: common.hh:64
all entities
Definition: gridenums.hh:139
std::list< VTKLocalFunction >::const_iterator FunctionIterator
Definition: vtkwriter.hh:318
void fillFaceVertices(CornerIterator it, const CornerIterator end, const IndexSet &indexSet, std::vector< T > &faces, std::vector< T > &faceOffsets)
Definition: vtkwriter.hh:1346
virtual void writeGridCells(VTK::VTUWriter &writer)
write the connectivity array
Definition: vtkwriter.hh:1237
void addCellData(F &&f, VTK::FieldInfo vtkFieldInfo)
Definition: vtkwriter.hh:594
Type type() const
The type of the data field.
Definition: common.hh:344
std::string pwrite(const std::string &name, const std::string &path, const std::string &extendpath, VTK::OutputType ot, const int commRank, const int commSize)
write output; interface might change later
Definition: vtkwriter.hh:895
Type erasure implementation for functions conforming to the dune-functions LocalFunction interface...
Definition: vtkwriter.hh:177
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:1387
void basicIncrement()
Definition: vtkwriter.hh:382
VertexIterator vertexBegin() const
Definition: vtkwriter.hh:450
std::string write(const std::string &name, VTK::OutputType type, const int commRank, const int commSize)
write output (interface might change later)
Definition: vtkwriter.hh:835
DataArrayWriter< T > * makeArrayWriter(const std::string &name, unsigned ncomps, unsigned nitems)
acquire a DataArrayWriter
Definition: vtuwriter.hh:379
Output is to the file is appended base64 binary.
Definition: common.hh:48
CellIterator cellBegin() const
Definition: vtkwriter.hh:339
virtual ~VTKWriter()
destructor
Definition: vtkwriter.hh:681
const FieldVector< DT, n > & position() const
position of vertex inside the entity
Definition: vtkwriter.hh:443
Dump a .vtu/.vtp files contents to a stream.
Definition: vtuwriter.hh:96
Dump a .vtu/.vtp files contents to a stream.
Definition: pvtuwriter.hh:60
for .vtu files (UnstructuredGrid)
Definition: common.hh:302
virtual void writeCellData(VTK::VTUWriter &writer)
write cell data
Definition: vtkwriter.hh:1185
FunctionWrapper(F_ &&f)
Definition: vtkwriter.hh:183
void endPoints()
finish section for the point coordinates
Definition: pvtuwriter.hh:169
Base class to write pvd-files which contains a list of all collected vtk-files.
Definition: vtksequencewriterbase.hh:31
Iterator over the grids elements.
Definition: vtkwriter.hh:326
for .vtp files (PolyData)
Definition: common.hh:300
Base class for polymorphic container of underlying data set.
Definition: vtkwriter.hh:155
virtual void writeVertexData(VTK::VTUWriter &writer)
write vertex data
Definition: vtkwriter.hh:1199
void beginMain(unsigned ncells, unsigned npoints)
start the main PolyData/UnstructuredGrid section
Definition: vtuwriter.hh:308
Include standard header files.
Definition: agrid.hh:59
int nvertices
Definition: vtkwriter.hh:1444
Implementation class for a multiple codim and multiple geometry type mapper.
Definition: mcmgmapper.hh:101
virtual void write(const Coordinate &pos, Writer &w, std::size_t count) const
Evaluate data set at local position pos inside the current entity and write result to w...
Definition: vtkwriter.hh:242
Output to the file is in ascii.
Definition: common.hh:42
Mapper for multiple codim and multiple geometry types.
void endAppended()
finish the appended data section
Definition: vtuwriter.hh:357
std::list< VTKLocalFunction > celldata
Definition: vtkwriter.hh:1436
int ncorners
Definition: vtkwriter.hh:1445
bool beginAppended()
start the appended data section
Definition: vtuwriter.hh:343
Iterate over the elements' corners.
Definition: vtkwriter.hh:479
void addCellData(const Container &v, const std::string &name, int ncomps=1)
Add a grid function (represented by container) that lives on the cells of the grid to the visualizati...
Definition: vtkwriter.hh:615
Type erasure implementation for legacy VTKFunctions.
Definition: vtkwriter.hh:224
std::string pwrite(const std::string &name, const std::string &path, const std::string &extendpath, VTK::OutputType type=VTK::ascii)
write output (interface might change later)
Definition: vtkwriter.hh:729
The dimension of the grid.
Definition: common/gridview.hh:128
std::string getParallelPieceName(const std::string &name, const std::string &path, int commRank, int commSize) const
return name of a parallel piece file
Definition: vtkwriter.hh:748
void write(const Coordinate &pos, Writer &w) const
Write the value of the data set at local coordinate pos to the writer w.
Definition: vtkwriter.hh:308
void endCellData()
finish CellData section
Definition: pvtuwriter.hh:153
VTKLocalFunction(const std::shared_ptr< const VTKFunction > &vtkFunctionPtr)
Construct a VTKLocalFunction for a legacy VTKFunction.
Definition: vtkwriter.hh:274
std::size_t size() const
The number of components in the data field.
Definition: common.hh:350
Index subIndex(const typename GV::template Codim< 0 >::Entity &e, int i, unsigned int codim) const
Map subentity of codim 0 entity to array index.
Definition: mcmgmapper.hh:160
virtual void bind(const Entity &e)
Bind data set to grid entity - must be called before evaluating (i.e. calling write()) ...
Definition: vtkwriter.hh:187
Traits ::Grid Grid
type of the grid
Definition: common/gridview.hh:78
Output to the file is inline base64 binary.
Definition: common.hh:44
void increment()
Definition: vtkwriter.hh:410
void addPiece(const std::string &filename)
Add a serial piece to the output file.
Definition: pvtuwriter.hh:214
void beginPointData(const std::string &scalars="", const std::string &vectors="")
start PointData section
Definition: pvtuwriter.hh:118
void unbind() const
Unbind the data set from the currently bound entity.
Definition: vtkwriter.hh:302
FileType
which type of VTK file to write
Definition: common.hh:298
std::shared_ptr< FunctionWrapperBase > _f
Definition: vtkwriter.hh:313
Take a vector and interpret it as cell data for the VTKWriter.
Definition: function.hh:88
all interior entities
Definition: gridenums.hh:29
virtual void write(T data)=0
write one data element
std::string getTypeString() const
Definition: vtkwriter.hh:1078
CornerIterator cornerEnd() const
Definition: vtkwriter.hh:562
void endCellData()
finish CellData section
Definition: vtuwriter.hh:218
void beginPoints()
start section for the point coordinates
Definition: pvtuwriter.hh:164
Grid::ctype ctype
type used for coordinates in grid
Definition: common/gridview.hh:125
void clear()
clear list of registered functions
Definition: vtkwriter.hh:674
Traits ::IndexSet IndexSet
type of the index set
Definition: common/gridview.hh:81
std::string getParallelHeaderName(const std::string &name, const std::string &path, int commSize) const
return name of a parallel header file
Definition: vtkwriter.hh:779
void endMain()
finish the main PolyData/UnstructuredGrid section
Definition: pvtuwriter.hh:193
int ncells
Definition: vtkwriter.hh:1443
int renumber(const Dune::GeometryType &t, int i)
renumber VTK <-> Dune
Definition: common.hh:232
void beginCellData(const std::string &scalars="", const std::string &vectors="")
start CellData section
Definition: pvtuwriter.hh:144
base class for data array writers
Definition: dataarraywriter.hh:53
VertexIterator(const GridCellIterator &x, const GridCellIterator &end, const VTK::DataMode &dm, const VertexMapper &vm)
Definition: vtkwriter.hh:399
bool equals(const CornerIterator &cit) const
Definition: vtkwriter.hh:524
VTKLocalFunction(F &&f, VTK::FieldInfo fieldInfo, typename std::enable_if< not detail::_has_local_context< F >::value, int >::type dummy=0)
Construct a VTKLocalFunction for a dune-functions style Function.
Definition: vtkwriter.hh:265
Grid view abstract base class.
Definition: common/gridview.hh:59
void addVertexData(F &&f, VTK::FieldInfo vtkFieldInfo)
Definition: vtkwriter.hh:638
virtual void bind(const Entity &e)
Bind data set to grid entity - must be called before evaluating (i.e. calling write()) ...
Definition: vtkwriter.hh:232
The dimension of the world the grid lives in.
Definition: common/gridview.hh:132
VertexIterator vertexEnd() const
Definition: vtkwriter.hh:457
bool equals(const VertexIterator &cit) const
Definition: vtkwriter.hh:427
CornerIterator(const GridCellIterator &x, const GridCellIterator &end, const VTK::DataMode &dm, const VertexMapper &vm, const std::vector< int > &num)
Definition: vtkwriter.hh:500
int id() const
Process-local consecutive zero-starting vertex id.
Definition: vtkwriter.hh:539