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