foamVtkInternalMeshWriter.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2017-2020 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
29 #include "globalIndex.H"
30 #include "Time.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
35 
36 
37 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
38 
39 void Foam::vtk::internalMeshWriter::beginPiece()
40 {
41  // Basic sizes
42 
43  numberOfPoints_ = vtuCells_.nFieldPoints(); // With addPointCellLabels
44  numberOfCells_ = vtuCells_.nFieldCells(); // With decomposed cells
45 
46  if (parallel_)
47  {
48  reduce(numberOfPoints_, sumOp<label>());
49  reduce(numberOfCells_, sumOp<label>());
50  }
51 
52  // Nothing else to do for legacy
53  if (legacy()) return;
54 
56  << "nPoints=" << numberOfPoints_ << " nCells=" << numberOfCells_ << nl;
57 
58  if (format_)
59  {
60  format()
61  .tag
62  (
66  );
67  }
68 }
69 
70 
71 void Foam::vtk::internalMeshWriter::writePoints()
72 {
73  if (format_)
74  {
75  if (legacy())
76  {
77  legacy::beginPoints(os_, numberOfPoints_);
78  }
79  else
80  {
81  const uint64_t payLoad =
82  vtk::sizeofData<float,3>(numberOfPoints_);
83 
84  format()
86  .beginDataArray<float,3>(vtk::dataArrayAttr::POINTS);
87 
88  format().writeSize(payLoad);
89  }
90  }
91 
92 
93  if (parallel_)
94  {
96  (
97  format_.ref(),
98  mesh_.points(),
99  mesh_.cellCentres(),
100  vtuCells_.addPointCellLabels()
101  );
102  }
103  else
104  {
106  (
107  format(),
108  mesh_.points(),
109  mesh_.cellCentres(),
110  vtuCells_.addPointCellLabels()
111  );
112  }
113 
114 
115  if (format_)
116  {
117  format().flush();
118  format().endDataArray();
119 
120  if (!legacy())
121  {
122  format()
123  .endTag(vtk::fileTag::POINTS);
124  }
125  }
126 }
127 
128 
129 void Foam::vtk::internalMeshWriter::writeCellsLegacy(const label pointOffset)
130 {
131  const List<uint8_t>& cellTypes = vtuCells_.cellTypes();
132  const labelList& vertLabels = vtuCells_.vertLabels();
133 
134  label nCells = cellTypes.size();
135  label nVerts = vertLabels.size();
136 
137  if (parallel_)
138  {
139  reduce(nCells, sumOp<label>());
140  reduce(nVerts, sumOp<label>());
141  }
142 
143  if (nCells != numberOfCells_)
144  {
146  << "Expecting " << numberOfCells_
147  << " cells, but found " << nCells
148  << exit(FatalError);
149  }
150 
151 
152  // CELLS
153  {
154  if (format_)
155  {
156  os_ << nl
157  << "CELLS " << nCells << ' ' << nVerts << nl;
158  }
159 
160  if (parallel_)
161  {
163  (
164  format_.ref(),
166  (
167  vertLabels,
168  pointOffset
169  )
170  );
171  }
172  else
173  {
174  vtk::writeList(format(), vertLabels);
175  }
176 
177  if (format_)
178  {
179  format().flush();
180  }
181  }
182 
183 
184  // CELL_TYPES
185  {
186  if (format_)
187  {
188  os_ << nl
189  << "CELL_TYPES " << nCells << nl;
190  }
191 
192  if (parallel_)
193  {
194  vtk::writeListParallel(format_.ref(), cellTypes);
195  }
196  else
197  {
199  }
200 
201  if (format_)
202  {
203  format().flush();
204  }
205  }
206 }
207 
208 
209 void Foam::vtk::internalMeshWriter::writeCellsConnectivity(const label pointOffset)
210 {
211  //
212  // 'connectivity'
213  //
214  {
215  const labelList& vertLabels = vtuCells_.vertLabels();
216  label nVerts = vertLabels.size();
217 
218  if (parallel_)
219  {
220  reduce(nVerts, sumOp<label>());
221  }
222 
223  if (format_)
224  {
225  const uint64_t payLoad = vtk::sizeofData<label>(nVerts);
226 
227  format().beginDataArray<label>(vtk::dataArrayAttr::CONNECTIVITY);
228  format().writeSize(payLoad);
229  }
230 
231  if (parallel_)
232  {
234  (
235  format_.ref(),
237  (
238  vertLabels,
239  pointOffset
240  )
241  );
242  }
243  else
244  {
245  vtk::writeList(format(), vertLabels);
246  }
247 
248  if (format_)
249  {
250  format().flush();
251  format().endDataArray();
252  }
253  }
254 
255 
256  //
257  // 'offsets' (connectivity offsets)
258  //
259  {
260  const labelList& vertOffsets = vtuCells_.vertOffsets();
261  label nOffs = vertOffsets.size();
262 
263  if (parallel_)
264  {
265  reduce(nOffs, sumOp<label>());
266  }
267 
268  if (format_)
269  {
270  const uint64_t payLoad =
271  vtk::sizeofData<label>(nOffs);
272 
273  format().beginDataArray<label>(vtk::dataArrayAttr::OFFSETS);
274  format().writeSize(payLoad);
275  }
276 
277  if (parallel_)
278  {
279  // processor-local connectivity offsets
280  const globalIndex procOffset
281  (
282  vertOffsets.empty() ? 0 : vertOffsets.last()
283  );
284 
285  vtk::writeListParallel(format_.ref(), vertOffsets, procOffset);
286  }
287  else
288  {
289  vtk::writeList(format(), vertOffsets);
290  }
291 
292  if (format_)
293  {
294  format().flush();
295  format().endDataArray();
296  }
297  }
298 
299 
300  //
301  // 'types' (cell types)
302  //
303  {
304  const List<uint8_t>& cellTypes = vtuCells_.cellTypes();
305  label nCells = cellTypes.size();
306 
307  if (parallel_)
308  {
309  reduce(nCells, sumOp<label>());
310  }
311 
312  if (nCells != numberOfCells_)
313  {
315  << "Expecting " << numberOfCells_
316  << " cells, but found " << nCells
317  << exit(FatalError);
318  }
319 
320  if (format_)
321  {
322  const uint64_t payLoad =
323  vtk::sizeofData<uint8_t>(nCells);
324 
325  format().beginDataArray<uint8_t>(vtk::dataArrayAttr::TYPES);
326  format().writeSize(payLoad);
327  }
328 
329  if (parallel_)
330  {
331  vtk::writeListParallel(format_.ref(), cellTypes);
332  }
333  else
334  {
336  }
337 
338  if (format_)
339  {
340  format().flush();
341  format().endDataArray();
342  }
343  }
344 }
345 
346 
347 void Foam::vtk::internalMeshWriter::writeCellsFaces(const label pointOffset)
348 {
349  label nFaceLabels = vtuCells_.faceLabels().size();
350 
351  if (parallel_)
352  {
353  reduce(nFaceLabels, sumOp<label>());
354  }
355 
356  // Can quit now if there are NO face streams
357  if (!nFaceLabels)
358  {
359  return;
360  }
361 
362  // --------------------------------------------------
363 
364  //
365  // 'faces' (face streams)
366  //
367  const labelList& faceLabels = vtuCells_.faceLabels();
368 
369  {
370  // Already have nFaceLabels (above)
371 
372  if (format_)
373  {
374  const uint64_t payLoad =
375  vtk::sizeofData<label>(nFaceLabels);
376 
377  format().beginDataArray<label>(vtk::dataArrayAttr::FACES);
378  format().writeSize(payLoad);
379  }
380 
381 
382  if (parallel_)
383  {
385  (
386  format_.ref(),
388  (
389  faceLabels,
390  pointOffset
391  )
392  );
393  }
394  else
395  {
396  vtk::writeList(format(), faceLabels);
397  }
398 
399 
400  if (format_)
401  {
402  format().flush();
403  format().endDataArray();
404  }
405  }
406 
407  // 'faceoffsets' (face stream offsets)
408  // -1 to indicate that the cell is a primitive type that does not
409  // have a face stream
410 
411  // If the processor-local mesh has any polyhedrals, we have a list with
412  // the faceoffsets and we just need to renumber.
413  // If the processor-local mesh has NO polyhedrals (but others do), we
414  // need to generate a list of -1 for that processor.
415  //
416  // Result: A face offset value for each cell.
417  {
418  const labelList& faceOffsets = vtuCells_.faceOffsets();
419  const label nLocalCells = vtuCells_.cellTypes().size();
420 
421  label nCells = nLocalCells;
422 
423  if (parallel_)
424  {
425  reduce(nCells, sumOp<label>());
426  }
427 
428  if (format_)
429  {
430  const uint64_t payLoad =
431  vtk::sizeofData<label>(nCells);
432 
433  format().beginDataArray<label>(vtk::dataArrayAttr::FACEOFFSETS);
434  format().writeSize(payLoad);
435  }
436 
437 
438  if (parallel_)
439  {
440  const List<uint8_t>& cellTypes = vtuCells_.cellTypes();
441  const label nLocalCells = cellTypes.size();
442 
443  const globalIndex procOffset(faceLabels.size());
444 
445  labelList faceOffsetsRenumber;
446 
447  if (faceOffsets.size()) // Or check procOffset.localSize()
448  {
449  faceOffsetsRenumber =
451  (
452  faceOffsets,
453  procOffset.localStart()
454  );
455  }
456  else
457  {
458  faceOffsetsRenumber.resize(nLocalCells, -1);
459  }
460 
461  vtk::writeListParallel(format_.ref(), faceOffsetsRenumber);
462  }
463  else
464  {
465  vtk::writeList(format(), faceOffsets);
466  }
467 
468 
469  if (format_)
470  {
471  format().flush();
472  format().endDataArray();
473  }
474  }
475 }
476 
477 
478 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
479 
480 Foam::vtk::internalMeshWriter::internalMeshWriter
481 (
482  const polyMesh& mesh,
483  const vtk::vtuCells& cells,
484  const vtk::outputOptions opts
485 )
486 :
488  mesh_(mesh),
489  vtuCells_(cells),
490  numberOfPoints_(0),
491  numberOfCells_(0)
492 {
493  // We do not currently support append mode
494  opts_.append(false);
495 }
496 
497 
498 Foam::vtk::internalMeshWriter::internalMeshWriter
499 (
500  const polyMesh& mesh,
501  const vtk::vtuCells& cells,
502  const fileName& file,
503  bool parallel
504 )
505 :
507 {
508  open(file, parallel);
509 }
510 
511 
512 Foam::vtk::internalMeshWriter::internalMeshWriter
513 (
514  const polyMesh& mesh,
515  const vtk::vtuCells& cells,
516  const vtk::outputOptions opts,
517  const fileName& file,
518  bool parallel
519 )
520 :
522 {
523  open(file, parallel);
524 }
525 
526 
527 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
528 
530 {
531  if (title.size())
532  {
533  return vtk::fileWriter::beginFile(title);
534  }
535 
536  // Provide default title
537 
539  << "case=" << mesh_.time().caseName()
540  << " region=" << mesh_.name()
541  << " time=" << mesh_.time().timeName()
542  << " index=" << mesh_.time().timeIndex() << endl;
543 
544 
545  if (legacy())
546  {
548  (
549  mesh_.time().globalCaseName()
550  );
551  }
552 
553 
554  // XML (inline)
555 
557  (
558  "case='" + mesh_.time().globalCaseName()
559  + "' region='" + mesh_.name()
560  + "' time='" + mesh_.time().timeName()
561  + "' index='" + Foam::name(mesh_.time().timeIndex())
562  + "'"
563  );
564 }
565 
566 
568 {
569  enter_Piece();
570 
571  beginPiece();
572 
573  writePoints();
574 
575  // Include addPointCellLabels for the point offsets
576  const label pointOffset =
577  (
578  parallel_ ? globalIndex(vtuCells_.nFieldPoints()).localStart() : 0
579  );
580 
581  if (legacy())
582  {
583  writeCellsLegacy(pointOffset);
584  return true;
585  }
586 
587  if (format_)
588  {
590  }
591 
592  writeCellsConnectivity(pointOffset);
593  writeCellsFaces(pointOffset);
594 
595  if (format_)
596  {
597  format().endTag(vtk::fileTag::CELLS);
598  }
599 
600  return true;
601 }
602 
603 
605 {
606  return enter_CellData(numberOfCells_, nFields);
607 }
608 
609 
611 {
612  return enter_PointData(numberOfPoints_, nFields);
613 }
614 
615 
617 {
618  if (isState(outputState::CELL_DATA))
619  {
620  ++nCellData_;
621  }
622  else
623  {
625  << "Bad writer state (" << stateNames[state_]
626  << ") - should be (" << stateNames[outputState::CELL_DATA]
627  << ") for cellID field" << nl << endl
628  << exit(FatalError);
629  }
630 
631  const labelList& cellMap = vtuCells_.cellMap();
632 
633  if (format_)
634  {
635  if (legacy())
636  {
637  vtk::legacy::intField<1>(format(), "cellID", numberOfCells_);
638  }
639  else
640  {
641  const uint64_t payLoad = vtk::sizeofData<label>(numberOfCells_);
642 
643  format().beginDataArray<label>("cellID");
644  format().writeSize(payLoad);
645  }
646  }
647 
648 
649  if (parallel_)
650  {
651  // With decomposed cells for the cell offsets
652  const globalIndex globalCellOffset(vtuCells_.nFieldCells());
653 
654  vtk::writeListParallel(format_.ref(), cellMap, globalCellOffset);
655  }
656  else
657  {
658  vtk::writeList(format(), cellMap);
659  }
660 
661  if (format_)
662  {
663  format().flush();
664  format().endDataArray();
665  }
666 }
667 
668 
670 {
671  if (!parallel_)
672  {
673  // Disabled in serial output (meaningless)
674  return false;
675  }
676 
677  if (isState(outputState::CELL_DATA))
678  {
679  ++nCellData_;
680  }
681  else
682  {
684  << "Bad writer state (" << stateNames[state_]
685  << ") - should be (" << stateNames[outputState::CELL_DATA]
686  << ") for procID field" << nl << endl
687  << exit(FatalError);
688  }
689 
690  const globalIndex procMaps(vtuCells_.nFieldCells());
691 
692  bool good = false;
693 
694  if (Pstream::master())
695  {
696  const label nCells = procMaps.size();
697 
698  if (format_)
699  {
700  if (legacy())
701  {
702  vtk::legacy::intField<1>(format(), "procID", nCells);
703  }
704  else
705  {
706  const uint64_t payLoad =
707  vtk::sizeofData<label>(nCells);
708 
709  format().beginDataArray<label>("procID");
710  format().writeSize(payLoad);
711  }
712  }
713 
714  // Per-processor ids
715  for (const int proci : Pstream::allProcs())
716  {
717  vtk::write(format(), label(proci), procMaps.localSize(proci));
718  }
719 
720  format().flush();
721  format().endDataArray();
722 
723  good = true;
724  }
725 
726  // MPI barrier
727  return returnReduce(good, orOp<bool>());
728 }
729 
730 
732 {
733  if (isState(outputState::POINT_DATA))
734  {
735  ++nPointData_;
736  }
737  else
738  {
740  << "Bad writer state (" << stateNames[state_]
741  << ") - should be (" << stateNames[outputState::POINT_DATA]
742  << ") for pointID field" << nl << endl
743  << exit(FatalError);
744  }
745 
746  if (format_)
747  {
748  if (legacy())
749  {
750  vtk::legacy::intField<1>(format(), "pointID", numberOfPoints_);
751  }
752  else
753  {
754  const uint64_t payLoad = vtk::sizeofData<label>(numberOfPoints_);
755 
756  format().beginDataArray<label>("pointID");
757  format().writeSize(payLoad);
758  }
759  }
760 
761 
762  // Point offset for regular mesh points (without decomposed)
763  const label pointOffset =
764  (
765  parallel_ ? globalIndex(vtuCells_.nPoints()).localStart() : 0
766  );
767 
768  // Cell offset for *regular* mesh cells (without decomposed)
769  const label cellOffset =
770  (
771  parallel_ ? globalIndex(vtuCells_.nCells()).localStart() : 0
772  );
773 
774 
775  labelList pointIds = identity(vtuCells_.nFieldPoints(), pointOffset);
776 
777  // The pointID for added points is the cellID, tag as a negative number
778  label pointi = vtuCells_.nPoints();
779  for (const label celli : vtuCells_.addPointCellLabels())
780  {
781  pointIds[pointi] = (-1 - celli - cellOffset);
782  ++pointi;
783  }
784 
785  if (parallel_)
786  {
787  vtk::writeListParallel(format_.ref(), pointIds);
788  }
789  else
790  {
791  vtk::writeList(format(), pointIds);
792  }
793 
794  if (format_)
795  {
796  format().flush();
797  format().endDataArray();
798  }
799 }
800 
801 
802 // ************************************************************************* //
Foam::vtk::outputOptions
Encapsulated combinations of output format options. This is primarily useful when defining the output...
Definition: foamVtkOutputOptions.H:59
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:71
Foam::vtk::writeListParallel
void writeListParallel(vtk::formatter &fmt, const UList< uint8_t > &values)
Write a list of uint8_t values.
Definition: foamVtkOutput.C:126
Foam::vtk::fileWriter
Base class for VTK output writers that handle geometry and fields (eg, vtp, vtu data)....
Definition: foamVtkFileWriter.H:66
Foam::vtk::fileWriter::legacy
bool legacy() const
Commonly used query.
Definition: foamVtkFileWriterI.H:74
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::returnReduce
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Definition: PstreamReduceOps.H:94
Foam::vtk::internalMeshWriter::writeCellIDs
void writeCellIDs()
Write cell ids as CellData.
Definition: foamVtkInternalMeshWriter.C:616
Foam::vtk::dataArrayAttr::OFFSETS
"offsets"
globalIndex.H
Foam::UPstream::master
static bool master(const label communicator=worldComm)
Am I the master process.
Definition: UPstream.H:458
Foam::vtk::fileWriter::beginFile
virtual bool beginFile(std::string title="")
Write file header (non-collective)
Definition: foamVtkFileWriter.C:317
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
Foam::vtk::writeListsParallel
void writeListsParallel(vtk::formatter &fmt, const UList< Type > &values1, const UList< Type > &values2)
Write a list of values and another list of values.
Definition: foamVtkOutputTemplates.C:240
Foam::vtk::dataArrayAttr::FACES
"faces"
Foam::vtk::fileWriter::format_
autoPtr< vtk::formatter > format_
The VTK formatter in use (master process)
Definition: foamVtkFileWriter.H:110
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::vtk::internalMeshWriter::writeProcIDs
bool writeProcIDs()
Write processor ids as CellData. This is no-op in serial.
Definition: foamVtkInternalMeshWriter.C:669
Foam::vtk::vtuSizing::copyVertLabelsLegacy
static labelList copyVertLabelsLegacy(const labelUList &connectivity, const label globalPointOffset)
Copy vertex labels with a global point offset - legacy format.
Definition: foamVtuSizing.C:443
Foam::vtk::fileTag::CELLS
"Cells"
format
word format(conversionProperties.get< word >("format"))
Foam::vtk::vtuSizing::nFieldCells
label nFieldCells() const
Number of field cells = nCells + nAddCells.
Definition: foamVtuSizingI.H:92
Foam::reduce
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
Definition: PstreamReduceOps.H:51
Foam::vtk::internalMeshWriter::beginPointData
virtual bool beginPointData(label nFields=0)
Begin PointData for specified number of fields.
Definition: foamVtkInternalMeshWriter.C:610
Foam::vtk::internalMeshWriter::vtuCells_
const vtuCells & vtuCells_
The volume cells (internalMesh)
Definition: foamVtkInternalMeshWriter.H:81
DebugInFunction
#define DebugInFunction
Report an information message using Foam::Info.
Definition: messageStream.H:365
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::vtk::fileAttr::NUMBER_OF_POINTS
"NumberOfPoints"
Foam::vtk::writeList
void writeList(vtk::formatter &fmt, const UList< uint8_t > &values)
Write a list of uint8_t values.
Definition: foamVtkOutput.C:112
Foam::vtk::writeLists
void writeLists(vtk::formatter &fmt, const UList< Type > &values1, const UList< Type > &values2, const labelUList &addressing)
Write a list of values and a list of values via indirect addressing.
Definition: foamVtkOutputTemplates.C:113
Foam::vtk::legacy::beginPoints
void beginPoints(std::ostream &os, label nPoints)
Emit header for POINTS (with trailing newline).
Definition: foamVtkOutputI.H:113
Foam::List::resize
void resize(const label newSize)
Adjust allocated size of list.
Definition: ListI.H:139
Foam::vtk::fileAttr::NUMBER_OF_CELLS
"NumberOfCells"
Foam::vtk::fileWriter::parallel_
bool parallel_
Writing in parallel (via master)
Definition: foamVtkFileWriter.H:95
Foam::vtk::vtuSizing::nFieldPoints
label nFieldPoints() const
Number of field points = nPoints + nAddPoints.
Definition: foamVtuSizingI.H:98
Foam::FatalError
error FatalError
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::vtk::fileTag::POINTS
"Points"
Foam::globalIndex
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Definition: globalIndex.H:68
Foam::vtk::fileTag::POINT_DATA
"PointData"
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::vtk::dataArrayAttr::TYPES
"types"
Foam::vtk::fileTag::UNSTRUCTURED_GRID
"UnstructuredGrid"
Foam::vtk::internalMeshWriter::debug
static int debug
Debug information.
Definition: foamVtkInternalMeshWriter.H:123
Time.H
Foam::vtk::internalMeshWriter::beginFile
virtual bool beginFile(std::string title="")
Write file header (non-collective)
Definition: foamVtkInternalMeshWriter.C:529
Foam::vtk::vtuSizing::copyVertLabelsXml
static labelList copyVertLabelsXml(const labelUList &connectivity, const label globalPointOffset)
Copy vertex labels with a global point offset - XML format.
Definition: foamVtuSizing.C:526
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:381
Foam::UPstream::allProcs
static rangeType allProcs(const label communicator=worldComm)
Range of process indices for all processes.
Definition: UPstream.H:509
cellTypes
const labelList & cellTypes
Definition: setCellMask.H:33
Foam::nl
constexpr char nl
Definition: Ostream.H:385
Foam::vtk::vtuSizing::copyFaceOffsetsXml
static labelList copyFaceOffsetsXml(const labelUList &faceOffsets, const label prevOffset)
Copy face offsets with an offset from previous - XML format.
Definition: foamVtuSizing.C:620
Foam::vtk::dataArrayAttr::FACEOFFSETS
"faceoffsets"
Foam::globalIndex::size
label size() const
Global sum of localSizes.
Definition: globalIndexI.H:88
Foam::vtk::formatter::tag
formatter & tag(const word &t, Args &&... args)
Write XML tag without any attributes. Combines openTag/closeTag.
Foam::List< label >
Foam::vtk::vtuSizing::copyFaceLabelsXml
static labelList copyFaceLabelsXml(const labelUList &faceLabels, const label globalPointOffset)
Copy faces stream labels with a global point offset - XML format.
Definition: foamVtuSizing.C:565
Foam::vtk::vtuCells
A deep-copy description of an OpenFOAM volume mesh in data structures suitable for VTK UnstructuredGr...
Definition: foamVtuCells.H:73
Foam::identity
labelList identity(const label len, label start=0)
Create identity map of the given length with (map[i] == i)
Definition: labelList.C:38
Foam::vtk::internalMeshWriter::beginCellData
virtual bool beginCellData(label nFields=0)
Begin CellData output section for specified number of fields.
Definition: foamVtkInternalMeshWriter.C:604
Foam::vtk::internalMeshWriter::numberOfPoints_
label numberOfPoints_
The number of field points for the current Piece.
Definition: foamVtkInternalMeshWriter.H:84
Foam::vtk::write
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
Definition: foamVtkOutputTemplates.C:35
Foam::vtk::dataArrayAttr::CONNECTIVITY
"connectivity"
Foam::vtk::fileTag::CELL_DATA
"CellData"
foamVtkInternalMeshWriter.H
Foam::vtk::internalMeshWriter::numberOfCells_
label numberOfCells_
The number of field cells for the current Piece.
Definition: foamVtkInternalMeshWriter.H:87
Foam::vtk::fileTag::PIECE
"Piece"
Foam::vtk::fileWriter::format
vtk::formatter & format()
The VTK formatter in use.
Definition: foamVtkFileWriterI.H:36
cells
const cellShapeList & cells
Definition: gmvOutputHeader.H:3
Foam::vtk::internalMeshWriter::writePointIDs
void writePointIDs()
Write point ids as PointData.
Definition: foamVtkInternalMeshWriter.C:731
Foam::vtk::internalMeshWriter
Write an OpenFOAM volume (internal) geometry and internal fields as a vtu file or a legacy vtk file.
Definition: foamVtkInternalMeshWriter.H:69
Foam::vtk::dataArrayAttr::POINTS
"Points"
Foam::orOp
Definition: ops.H:234
Foam::vtk::internalMeshWriter::writeGeometry
virtual bool writeGeometry()
Write mesh topology.
Definition: foamVtkInternalMeshWriter.C:567