foamVtkPatchWriter.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) 2016-2019 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 
28 #include "foamVtkPatchWriter.H"
29 #include "foamVtkOutput.H"
30 #include "globalIndex.H"
31 
32 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
33 
34 void Foam::vtk::patchWriter::beginPiece()
35 {
36  // Basic sizes
37  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
38 
39  nLocalPoints_ = nLocalFaces_ = nLocalVerts_ = 0;
40 
41  for (const label patchId : patchIDs_)
42  {
43  const polyPatch& pp = patches[patchId];
44 
45  nLocalPoints_ += pp.nPoints();
46  nLocalFaces_ += pp.size();
47 
48  for (const face& f : pp)
49  {
50  nLocalVerts_ += f.size();
51  }
52  }
53 
54  numberOfPoints_ = nLocalPoints_;
55  numberOfCells_ = nLocalFaces_;
56 
57  if (parallel_)
58  {
59  reduce(numberOfPoints_, sumOp<label>());
60  reduce(numberOfCells_, sumOp<label>());
61  }
62 
63 
64  // Nothing else to do for legacy
65  if (legacy()) return;
66 
67 
68  if (format_)
69  {
70  format()
71  .tag
72  (
74  vtk::fileAttr::NUMBER_OF_POINTS, numberOfPoints_,
75  vtk::fileAttr::NUMBER_OF_POLYS, numberOfCells_
76  );
77  }
78 }
79 
80 
81 void Foam::vtk::patchWriter::writePoints()
82 {
83  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
84 
85  if (format_)
86  {
87  if (legacy())
88  {
89  legacy::beginPoints(os_, numberOfPoints_);
90  }
91  else
92  {
93  const uint64_t payLoad =
94  vtk::sizeofData<float, 3>(numberOfPoints_);
95 
96  format()
98  .beginDataArray<float, 3>(vtk::dataArrayAttr::POINTS);
99 
100  format().writeSize(payLoad);
101  }
102  }
103 
104 
105  if (parallel_ ? Pstream::master() : true)
106  {
107  for (const label patchId : patchIDs_)
108  {
109  const polyPatch& pp = patches[patchId];
110 
111  vtk::writeList(format(), pp.localPoints());
112  }
113  }
114 
115 
116  if (parallel_)
117  {
118  // Patch Ids are identical across all processes
119  const label nPatches = patchIDs_.size();
120 
121  if (Pstream::master())
122  {
123  pointField recv;
124 
125  // Receive each point field and write
126  for
127  (
128  int slave=Pstream::firstSlave();
129  slave<=Pstream::lastSlave();
130  ++slave
131  )
132  {
133  IPstream fromSlave(Pstream::commsTypes::blocking, slave);
134 
135  for (label i=0; i < nPatches; ++i)
136  {
137  fromSlave >> recv;
138 
139  vtk::writeList(format(), recv);
140  }
141  }
142  }
143  else
144  {
145  // Send each point field to master
146  OPstream toMaster
147  (
150  );
151 
152  for (const label patchId : patchIDs_)
153  {
154  const polyPatch& pp = patches[patchId];
155 
156  toMaster << pp.localPoints();
157  }
158  }
159  }
160 
161 
162  if (format_)
163  {
164  format().flush();
165  format().endDataArray();
166 
167  if (!legacy())
168  {
169  format()
170  .endTag(vtk::fileTag::POINTS);
171  }
172  }
173 }
174 
175 
176 void Foam::vtk::patchWriter::writePolysLegacy(const label pointOffset)
177 {
178  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
179 
180  // Connectivity count without additional storage (done internally)
181 
182  label nFaces = nLocalFaces_;
183  label nVerts = nLocalVerts_;
184 
185  if (parallel_)
186  {
187  reduce(nFaces, sumOp<label>());
188  reduce(nVerts, sumOp<label>());
189  }
190 
191  if (nFaces != numberOfCells_)
192  {
194  << "Expecting " << numberOfCells_
195  << " faces, but found " << nFaces
196  << exit(FatalError);
197  }
198 
199  legacy::beginPolys(os_, nFaces, nVerts);
200 
201  labelList vertLabels(nLocalFaces_ + nLocalVerts_);
202 
203  {
204  // Legacy: size + connectivity together
205  // [nPts, id1, id2, ..., nPts, id1, id2, ...]
206 
207  auto iter = vertLabels.begin();
208 
209  label off = pointOffset;
210 
211  for (const label patchId : patchIDs_)
212  {
213  const polyPatch& pp = patches[patchId];
214 
215  for (const face& f : pp.localFaces())
216  {
217  *iter = f.size(); // The size prefix
218  ++iter;
219 
220  for (const label pfi : f)
221  {
222  *iter = pfi + off; // Face vertex label
223  ++iter;
224  }
225  }
226  off += pp.nPoints();
227  }
228  }
229 
230 
231  if (parallel_)
232  {
233  vtk::writeListParallel(format_.ref(), vertLabels);
234  }
235  else
236  {
237  vtk::writeList(format(), vertLabels);
238  }
239 
240  if (format_)
241  {
242  format().flush();
243  }
244 }
245 
246 
247 void Foam::vtk::patchWriter::writePolys(const label pointOffset)
248 {
249  if (format_)
250  {
252  }
253 
254  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
255 
256  //
257  // 'connectivity'
258  //
259  {
260  labelList vertLabels(nLocalVerts_);
261 
262  label nVerts = nLocalVerts_;
263 
264  if (parallel_)
265  {
266  reduce(nVerts, sumOp<label>());
267  }
268 
269  if (format_)
270  {
271  const uint64_t payLoad =
272  vtk::sizeofData<label>(nVerts);
273 
274  format().beginDataArray<label>(vtk::dataArrayAttr::CONNECTIVITY);
275  format().writeSize(payLoad);
276  }
277 
278  {
279  // XML: connectivity only
280  // [id1, id2, ..., id1, id2, ...]
281 
282  auto iter = vertLabels.begin();
283 
284  label off = pointOffset;
285 
286  for (const label patchId : patchIDs_)
287  {
288  const polyPatch& pp = patches[patchId];
289 
290  for (const face& f : pp.localFaces())
291  {
292  for (const label pfi : f)
293  {
294  *iter = pfi + off; // Face vertex label
295  ++iter;
296  }
297  }
298  off += pp.nPoints();
299  }
300  }
301 
302 
303  if (parallel_)
304  {
305  vtk::writeListParallel(format_.ref(), vertLabels);
306  }
307  else
308  {
309  vtk::writeList(format(), vertLabels);
310  }
311 
312  if (format_)
313  {
314  format().flush();
315  format().endDataArray();
316  }
317  }
318 
319 
320  //
321  // 'offsets' (connectivity offsets)
322  //
323  {
324  labelList vertOffsets(nLocalFaces_);
325  label nOffs = vertOffsets.size();
326 
327  if (parallel_)
328  {
329  reduce(nOffs, sumOp<label>());
330  }
331 
332  if (format_)
333  {
334  const uint64_t payLoad =
335  vtk::sizeofData<label>(nOffs);
336 
337  format().beginDataArray<label>(vtk::dataArrayAttr::OFFSETS);
338  format().writeSize(payLoad);
339  }
340 
341 
342  // processor-local connectivity offsets
343  label off =
344  (
345  parallel_ ? globalIndex(nLocalVerts_).localStart() : 0
346  );
347 
348 
349  auto iter = vertOffsets.begin();
350 
351  for (const label patchId : patchIDs_)
352  {
353  const polyPatch& pp = patches[patchId];
354 
355  for (const face& f : pp)
356  {
357  off += f.size(); // End offset
358  *iter = off;
359  ++iter;
360  }
361  }
362 
363 
364  if (parallel_)
365  {
366  vtk::writeListParallel(format_.ref(), vertOffsets);
367  }
368  else
369  {
370  vtk::writeList(format_.ref(), vertOffsets);
371  }
372 
373 
374  if (format_)
375  {
376  format().flush();
377  format().endDataArray();
378  }
379  }
380 
381  if (format_)
382  {
383  format().endTag(vtk::fileTag::POLYS);
384  }
385 }
386 
387 
388 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
389 
390 Foam::vtk::patchWriter::patchWriter
391 (
392  const fvMesh& mesh,
393  const labelList& patchIDs,
394  const vtk::outputOptions opts,
395  const bool useNearCellValue
396 )
397 :
399  mesh_(mesh),
400  patchIDs_(patchIDs),
401  useNearCellValue_(useNearCellValue),
402  numberOfPoints_(0),
403  numberOfCells_(0),
404  nLocalPoints_(0),
405  nLocalFaces_(0),
406  nLocalVerts_(0)
407 {
408  // We do not currently support append mode
409  opts_.append(false);
410 }
411 
412 
413 Foam::vtk::patchWriter::patchWriter
414 (
415  const fvMesh& mesh,
416  const labelList& patchIDs,
417  const fileName& file,
418  bool parallel
419 )
420 :
421  patchWriter(mesh, patchIDs)
422 {
423  open(file, parallel);
424 }
425 
426 
427 Foam::vtk::patchWriter::patchWriter
428 (
429  const fvMesh& mesh,
430  const labelList& patchIDs,
431  const vtk::outputOptions opts,
432  const fileName& file,
433  bool parallel
434 )
435 :
436  patchWriter(mesh, patchIDs, opts)
437 {
438  open(file, parallel);
439 }
440 
441 
442 Foam::vtk::patchWriter::patchWriter
443 (
444  const fvMesh& mesh,
445  const labelList& patchIDs,
446  const vtk::outputOptions opts,
447  const bool useNearCellValue,
448  const fileName& file,
449  bool parallel
450 )
451 :
452  patchWriter(mesh, patchIDs, opts, useNearCellValue)
453 {
454  open(file, parallel);
455 }
456 
457 
458 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
459 
460 bool Foam::vtk::patchWriter::beginFile(std::string title)
461 {
462  if (title.size())
463  {
464  return vtk::fileWriter::beginFile(title);
465  }
466 
467  // Provide default title
468 
469  if (legacy())
470  {
471  title =
472  (
473  patchIDs_.size() == 1
474  ? mesh_.boundaryMesh()[patchIDs_.first()].name()
475  : "patches"
476  );
477 
478  return vtk::fileWriter::beginFile(title);
479  }
480 
481 
482  // XML (inline)
483 
484  if (patchIDs_.size() == 1)
485  {
486  title =
487  (
488  "patch='" + mesh_.boundaryMesh()[patchIDs_.first()].name() + "'"
489  );
490  }
491  else
492  {
493  title =
494  (
495  "npatches='" + Foam::name(patchIDs_.size()) + "'"
496  );
497  }
498 
499  title +=
500  (
501  " time='" + mesh_.time().timeName()
502  + "' index='" + Foam::name(mesh_.time().timeIndex())
503  + "'"
504  );
505 
506  return vtk::fileWriter::beginFile(title);
507 }
508 
509 
511 {
512  enter_Piece();
513 
514  beginPiece();
515 
516  writePoints();
517 
518  const label pointOffset =
519  (
520  parallel_ ? globalIndex(nLocalPoints_).localStart() : 0
521  );
522 
523  if (legacy())
524  {
525  writePolysLegacy(pointOffset);
526  }
527  else
528  {
529  writePolys(pointOffset);
530  }
531 
532  return true;
533 }
534 
535 
537 {
538  return enter_CellData(numberOfCells_, nFields);
539 }
540 
541 
543 {
544  return enter_PointData(numberOfPoints_, nFields);
545 }
546 
547 
549 {
550  if (isState(outputState::CELL_DATA))
551  {
552  ++nCellData_;
553  }
554  else
555  {
557  << "Bad writer state (" << stateNames[state_]
558  << ") - should be (" << stateNames[outputState::CELL_DATA]
559  << ") for patchID field" << nl << endl
560  << exit(FatalError);
561  }
562 
563  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
564 
565  label nFaces = nLocalFaces_;
566 
567  if (parallel_)
568  {
569  reduce(nFaces, sumOp<label>());
570  }
571 
572  if (format_)
573  {
574  if (legacy())
575  {
576  legacy::intField<1>(format(), "patchID", nFaces); // 1 component
577  }
578  else
579  {
580  const uint64_t payLoad =
581  vtk::sizeofData<label>(nFaces);
582 
583  format().beginDataArray<label>("patchID");
584  format().writeSize(payLoad);
585  }
586  }
587 
588  if (parallel_ ? Pstream::master() : true)
589  {
590  for (const label patchId : patchIDs_)
591  {
592  vtk::write(format(), patchId, patches[patchId].size());
593  }
594  }
595 
596  if (parallel_)
597  {
598  if (Pstream::master())
599  {
600  labelList recv;
601 
602  // Receive each pair
603  for
604  (
605  int slave=Pstream::firstSlave();
606  slave<=Pstream::lastSlave();
607  ++slave
608  )
609  {
610  IPstream fromSlave(Pstream::commsTypes::blocking, slave);
611 
612  fromSlave >> recv;
613 
614  // Receive as [size, id] pairs
615  for (label i=0; i < recv.size(); i += 2)
616  {
617  const label len = recv[i];
618  const label val = recv[i+1];
619 
620  vtk::write(format(), val, len);
621  }
622  }
623  }
624  else
625  {
626  // Send to master
627  OPstream toMaster
628  (
631  );
632 
633 
634  labelList send(2*patchIDs_.size());
635 
636  // Encode as [size, id] pairs
637  label i = 0;
638  for (const label patchId : patchIDs_)
639  {
640  send[i] = patches[patchId].size();
641  send[i+1] = patchId;
642 
643  i += 2;
644  }
645 
646  toMaster << send;
647  }
648  }
649 
650 
651  if (format_)
652  {
653  format().flush();
654  format().endDataArray();
655  }
656 }
657 
658 
660 {
661  // This is different than for internalWriter.
662  // Here we allow procIDs whenever running in parallel, even if the
663  // output is serial. This allow diagnosis of processor patches.
664 
665  if (!Pstream::parRun())
666  {
667  // Skip in non-parallel
668  return false;
669  }
670 
671  if (isState(outputState::CELL_DATA))
672  {
673  ++nCellData_;
674  }
675  else
676  {
678  << "Bad writer state (" << stateNames[state_]
679  << ") - should be (" << stateNames[outputState::CELL_DATA]
680  << ") for patchID field" << nl << endl
681  << exit(FatalError);
682  }
683 
684  label nFaces = nLocalFaces_;
685 
686  if (parallel_)
687  {
688  reduce(nFaces, sumOp<label>());
689  }
690 
691  if (format_)
692  {
693  if (legacy())
694  {
695  legacy::intField<1>(format(), "procID", nFaces); // 1 component
696  }
697  else
698  {
699  const uint64_t payLoad =
700  vtk::sizeofData<label>(nFaces);
701 
702  format().beginDataArray<label>("procID");
703  format().writeSize(payLoad);
704  }
705  }
706 
707  bool good = false;
708 
709  if (parallel_)
710  {
711  globalIndex procSizes(nLocalFaces_);
712 
713  if (Pstream::master())
714  {
715  // Per-processor ids
716  for (label proci=0; proci < Pstream::nProcs(); ++proci)
717  {
718  vtk::write(format(), proci, procSizes.localSize(proci));
719  }
720 
721  good = true;
722  }
723  }
724  else
725  {
726  vtk::write(format(), label(Pstream::myProcNo()), nLocalFaces_);
727 
728  good = true;
729  }
730 
731 
732  if (format_)
733  {
734  format().flush();
735  format().endDataArray();
736  }
737 
738  // MPI barrier
739  return parallel_ ? returnReduce(good, orOp<bool>()) : good;
740 }
741 
742 
744 {
745  if (!Pstream::parRun())
746  {
747  // Skip in non-parallel
748  return false;
749  }
750 
751  if (isState(outputState::CELL_DATA))
752  {
753  ++nCellData_;
754  }
755  else
756  {
758  << "Bad writer state (" << stateNames[state_]
759  << ") - should be (" << stateNames[outputState::CELL_DATA]
760  << ") for patchID field" << nl << endl
761  << exit(FatalError);
762  }
763 
764  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
765 
766  label nFaces = nLocalFaces_;
767 
768  if (parallel_)
769  {
770  reduce(nFaces, sumOp<label>());
771  }
772 
773  if (format_)
774  {
775  if (legacy())
776  {
777  legacy::intField<1>(format(), "neighID", nFaces); // 1 component
778  }
779  else
780  {
781  const uint64_t payLoad =
782  vtk::sizeofData<label>(nFaces);
783 
784  format().beginDataArray<label>("neighID");
785  format().writeSize(payLoad);
786  }
787  }
788 
789  bool good = false;
790 
791  if (parallel_ ? Pstream::master() : true)
792  {
793  for (const label patchId : patchIDs_)
794  {
795  const auto* pp = isA<processorPolyPatch>(patches[patchId]);
796 
797  const label val = (pp ? pp->neighbProcNo() : -1);
798 
799  vtk::write(format(), val, patches[patchId].size());
800  }
801 
802  good = true;
803  }
804 
805  if (parallel_)
806  {
807  if (Pstream::master())
808  {
809  labelList recv;
810 
811  // Receive each pair
812  for
813  (
814  int slave=Pstream::firstSlave();
815  slave<=Pstream::lastSlave();
816  ++slave
817  )
818  {
819  IPstream fromSlave(Pstream::commsTypes::blocking, slave);
820 
821  fromSlave >> recv;
822 
823  // Receive as [size, id] pairs
824  for (label i=0; i < recv.size(); i += 2)
825  {
826  const label len = recv[i];
827  const label val = recv[i+1];
828 
829  vtk::write(format(), val, len);
830  }
831  }
832  }
833  else
834  {
835  // Send to master
836  OPstream toMaster
837  (
840  );
841 
842  labelList send(2*patchIDs_.size());
843 
844  // Encode as [size, id] pairs
845  label i = 0;
846  for (const label patchId : patchIDs_)
847  {
848  const auto* pp = isA<processorPolyPatch>(patches[patchId]);
849 
850  send[i] = patches[patchId].size();
851  send[i+1] = (pp ? pp->neighbProcNo() : -1);
852 
853  i += 2;
854  }
855 
856  toMaster << send;
857  }
858  }
859 
860  if (format_)
861  {
862  format().flush();
863  format().endDataArray();
864  }
865 
866  // MPI barrier
867  return parallel_ ? returnReduce(good, orOp<bool>()) : good;
868 }
869 
870 
871 // ************************************************************************* //
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:74
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
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::UPstream::commsTypes::blocking
foamVtkOutput.H
Foam::val
label ListType::const_reference val
Definition: ListOps.H:407
Foam::vtk::fileWriter
Base class for VTK output writers that handle geometry and fields (eg, vtp, vtu data)....
Definition: foamVtkFileWriter.H:66
Foam::UPstream::masterNo
static constexpr int masterNo() noexcept
Process index of the master.
Definition: UPstream.H:432
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::polyBoundaryMesh
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
Definition: polyBoundaryMesh.H:62
nPatches
label nPatches
Definition: readKivaGrid.H:396
Foam::globalIndex::localStart
label localStart() const
My local start.
Definition: globalIndexI.H:112
Foam::OPstream
Output inter-processor communications stream.
Definition: OPstream.H:52
Foam::vtk::dataArrayAttr::OFFSETS
"offsets"
globalIndex.H
Foam::UPstream::nProcs
static label nProcs(const label communicator=0)
Number of processes in parallel run.
Definition: UPstream.H:426
Foam::vtk::fileTag::POLY_DATA
"PolyData"
Foam::UPstream::parRun
static bool & parRun()
Is this a parallel run?
Definition: UPstream.H:414
Foam::vtk::legacy::beginPolys
void beginPolys(std::ostream &os, label nPolys, label nConnectivity)
Emit header for POLYGONS (with trailing newline).
Definition: foamVtkOutputI.H:121
Foam::globalIndex::localSize
label localSize() const
My local size.
Definition: globalIndexI.H:124
Foam::vtk::patchWriter::beginPointData
virtual bool beginPointData(label nFields=0)
Begin PointData for specified number of fields.
Definition: foamVtkPatchWriter.C:542
Foam::vtk::fileWriter::beginFile
virtual bool beginFile(std::string title="")
Write file header (non-collective)
Definition: foamVtkFileWriter.C:317
Foam::polyMesh::boundaryMesh
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:435
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:337
Foam::vtk::fileTag::POLYS
"Polys"
Foam::vtk::fileWriter::format_
autoPtr< vtk::formatter > format_
The VTK formatter in use (master process)
Definition: foamVtkFileWriter.H:110
Foam::sumOp
Definition: ops.H:213
Foam::vtk::patchWriter::writeGeometry
virtual bool writeGeometry()
Write patch topology.
Definition: foamVtkPatchWriter.C:510
format
word format(conversionProperties.get< word >("format"))
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::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
Foam::UPstream::lastSlave
static int lastSlave(const label communicator=0)
Process index of last slave.
Definition: UPstream.H:467
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::patchWriter::writeNeighIDs
bool writeNeighIDs()
Write processor neighbour ids as CellData. This is no-op in serial.
Definition: foamVtkPatchWriter.C:743
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::legacy::beginPoints
void beginPoints(std::ostream &os, label nPoints)
Emit header for POINTS (with trailing newline).
Definition: foamVtkOutputI.H:113
Foam::vtk::fileWriter::parallel_
bool parallel_
Writing in parallel (via master)
Definition: foamVtkFileWriter.H:95
Foam::FatalError
error FatalError
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::vtk::fileTag::POINTS
"Points"
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
Foam::globalIndex
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Definition: globalIndex.H:68
foamVtkPatchWriter.H
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::vtk::patchWriter
Write OpenFOAM patches and patch fields in VTP or legacy vtk format.
Definition: foamVtkPatchWriter.H:66
Foam::UPstream::myProcNo
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Definition: UPstream.H:444
Foam::UPstream::master
static bool master(const label communicator=0)
Am I the master process.
Definition: UPstream.H:438
Foam::UPstream::firstSlave
static constexpr int firstSlave() noexcept
Process index of first slave.
Definition: UPstream.H:461
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:355
Foam::nl
constexpr char nl
Definition: Ostream.H:372
f
labelList f(nPoints)
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::patchWriter::beginCellData
virtual bool beginCellData(label nFields=0)
Begin CellData output section for specified number of fields.
Definition: foamVtkPatchWriter.C:536
Foam::vtk::patchWriter::writePatchIDs
void writePatchIDs()
Write patch ids as CellData.
Definition: foamVtkPatchWriter.C:548
patches
const polyBoundaryMesh & patches
Definition: convertProcessorPatches.H:65
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"
Foam::vtk::fileTag::PIECE
"Piece"
Foam::IPstream
Input inter-processor communications stream.
Definition: IPstream.H:52
Foam::vtk::fileWriter::format
vtk::formatter & format()
The VTK formatter in use.
Definition: foamVtkFileWriterI.H:36
patchId
label patchId(-1)
Foam::vtk::patchWriter::writeProcIDs
bool writeProcIDs()
Write processor ids as CellData. This is no-op in serial.
Definition: foamVtkPatchWriter.C:659
Foam::orOp
Definition: ops.H:234
Foam::vtk::fileAttr::NUMBER_OF_POLYS
"NumberOfPolys"
Foam::vtk::patchWriter::beginFile
virtual bool beginFile(std::string title="")
Write file header (non-collective)
Definition: foamVtkPatchWriter.C:460