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 (const int slave : Pstream::subProcs())
129  {
130  IPstream fromSlave(Pstream::commsTypes::blocking, slave);
131 
132  for (label i=0; i < nPatches; ++i)
133  {
134  fromSlave >> recv;
135 
136  vtk::writeList(format(), recv);
137  }
138  }
139  }
140  else
141  {
142  // Send each point field to master
143  OPstream toMaster
144  (
147  );
148 
149  for (const label patchId : patchIDs_)
150  {
151  const polyPatch& pp = patches[patchId];
152 
153  toMaster << pp.localPoints();
154  }
155  }
156  }
157 
158 
159  if (format_)
160  {
161  format().flush();
162  format().endDataArray();
163 
164  if (!legacy())
165  {
166  format()
167  .endTag(vtk::fileTag::POINTS);
168  }
169  }
170 }
171 
172 
173 void Foam::vtk::patchMeshWriter::writePolysLegacy(const label pointOffset)
174 {
175  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
176 
177  // Connectivity count without additional storage (done internally)
178 
179  label nFaces = nLocalFaces_;
180  label nVerts = nLocalVerts_;
181 
182  if (parallel_)
183  {
184  reduce(nFaces, sumOp<label>());
185  reduce(nVerts, sumOp<label>());
186  }
187 
188  if (nFaces != numberOfCells_)
189  {
191  << "Expecting " << numberOfCells_
192  << " faces, but found " << nFaces
193  << exit(FatalError);
194  }
195 
196  legacy::beginPolys(os_, nFaces, nVerts);
197 
198  labelList vertLabels(nLocalFaces_ + nLocalVerts_);
199 
200  {
201  // Legacy: size + connectivity together
202  // [nPts, id1, id2, ..., nPts, id1, id2, ...]
203 
204  auto iter = vertLabels.begin();
205 
206  label off = pointOffset;
207 
208  for (const label patchId : patchIDs_)
209  {
210  const polyPatch& pp = patches[patchId];
211 
212  for (const face& f : pp.localFaces())
213  {
214  *iter = f.size(); // The size prefix
215  ++iter;
216 
217  for (const label pfi : f)
218  {
219  *iter = pfi + off; // Face vertex label
220  ++iter;
221  }
222  }
223  off += pp.nPoints();
224  }
225  }
226 
227 
228  if (parallel_)
229  {
230  vtk::writeListParallel(format_.ref(), vertLabels);
231  }
232  else
233  {
234  vtk::writeList(format(), vertLabels);
235  }
236 
237  if (format_)
238  {
239  format().flush();
240  }
241 }
242 
243 
244 void Foam::vtk::patchMeshWriter::writePolys(const label pointOffset)
245 {
246  if (format_)
247  {
249  }
250 
251  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
252 
253  //
254  // 'connectivity'
255  //
256  {
257  labelList vertLabels(nLocalVerts_);
258 
259  label nVerts = nLocalVerts_;
260 
261  if (parallel_)
262  {
263  reduce(nVerts, sumOp<label>());
264  }
265 
266  if (format_)
267  {
268  const uint64_t payLoad =
269  vtk::sizeofData<label>(nVerts);
270 
271  format().beginDataArray<label>(vtk::dataArrayAttr::CONNECTIVITY);
272  format().writeSize(payLoad);
273  }
274 
275  {
276  // XML: connectivity only
277  // [id1, id2, ..., id1, id2, ...]
278 
279  auto iter = vertLabels.begin();
280 
281  label off = pointOffset;
282 
283  for (const label patchId : patchIDs_)
284  {
285  const polyPatch& pp = patches[patchId];
286 
287  for (const face& f : pp.localFaces())
288  {
289  for (const label pfi : f)
290  {
291  *iter = pfi + off; // Face vertex label
292  ++iter;
293  }
294  }
295  off += pp.nPoints();
296  }
297  }
298 
299 
300  if (parallel_)
301  {
302  vtk::writeListParallel(format_.ref(), vertLabels);
303  }
304  else
305  {
306  vtk::writeList(format(), vertLabels);
307  }
308 
309  if (format_)
310  {
311  format().flush();
312  format().endDataArray();
313  }
314  }
315 
316 
317  //
318  // 'offsets' (connectivity offsets)
319  //
320  {
321  labelList vertOffsets(nLocalFaces_);
322  label nOffs = vertOffsets.size();
323 
324  if (parallel_)
325  {
326  reduce(nOffs, sumOp<label>());
327  }
328 
329  if (format_)
330  {
331  const uint64_t payLoad =
332  vtk::sizeofData<label>(nOffs);
333 
334  format().beginDataArray<label>(vtk::dataArrayAttr::OFFSETS);
335  format().writeSize(payLoad);
336  }
337 
338 
339  // processor-local connectivity offsets
340  label off =
341  (
342  parallel_ ? globalIndex(nLocalVerts_).localStart() : 0
343  );
344 
345 
346  auto iter = vertOffsets.begin();
347 
348  for (const label patchId : patchIDs_)
349  {
350  const polyPatch& pp = patches[patchId];
351 
352  for (const face& f : pp)
353  {
354  off += f.size(); // End offset
355  *iter = off;
356  ++iter;
357  }
358  }
359 
360 
361  if (parallel_)
362  {
363  vtk::writeListParallel(format_.ref(), vertOffsets);
364  }
365  else
366  {
367  vtk::writeList(format_.ref(), vertOffsets);
368  }
369 
370 
371  if (format_)
372  {
373  format().flush();
374  format().endDataArray();
375  }
376  }
377 
378  if (format_)
379  {
380  format().endTag(vtk::fileTag::POLYS);
381  }
382 }
383 
384 
385 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
386 
388 (
389  const polyMesh& mesh,
390  const labelList& patchIDs,
391  const vtk::outputOptions opts
392 )
393 :
395  mesh_(mesh),
396  patchIDs_(patchIDs),
397  numberOfPoints_(0),
398  numberOfCells_(0),
399  nLocalPoints_(0),
400  nLocalFaces_(0),
401  nLocalVerts_(0)
402 {
403  // We do not currently support append mode
404  opts_.append(false);
405 }
406 
407 
409 (
410  const polyMesh& mesh,
411  const labelList& patchIDs,
412  const fileName& file,
413  bool parallel
414 )
415 :
416  patchMeshWriter(mesh, patchIDs)
417 {
418  open(file, parallel);
419 }
420 
421 
423 (
424  const polyMesh& mesh,
425  const labelList& patchIDs,
426  const vtk::outputOptions opts,
427  const fileName& file,
428  bool parallel
429 )
430 :
431  patchMeshWriter(mesh, patchIDs, opts)
432 {
433  open(file, parallel);
434 }
435 
436 
437 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
438 
440 {
441  if (title.size())
442  {
443  return vtk::fileWriter::beginFile(title);
444  }
445 
446  // Provide default title
447 
448  if (legacy())
449  {
450  title =
451  (
452  patchIDs_.size() == 1
453  ? mesh_.boundaryMesh()[patchIDs_.first()].name()
454  : "patches"
455  );
456 
457  return vtk::fileWriter::beginFile(title);
458  }
459 
460 
461  // XML (inline)
462 
463  if (patchIDs_.size() == 1)
464  {
465  title =
466  (
467  "patch='" + mesh_.boundaryMesh()[patchIDs_.first()].name() + "'"
468  );
469  }
470  else
471  {
472  title =
473  (
474  "npatches='" + Foam::name(patchIDs_.size()) + "'"
475  );
476  }
477 
478  title +=
479  (
480  " time='" + mesh_.time().timeName()
481  + "' index='" + Foam::name(mesh_.time().timeIndex())
482  + "'"
483  );
484 
485  return vtk::fileWriter::beginFile(title);
486 }
487 
488 
490 {
491  enter_Piece();
492 
493  beginPiece();
494 
495  writePoints();
496 
497  const label pointOffset =
498  (
499  parallel_ ? globalIndex(nLocalPoints_).localStart() : 0
500  );
501 
502  if (legacy())
503  {
504  writePolysLegacy(pointOffset);
505  }
506  else
507  {
508  writePolys(pointOffset);
509  }
510 
511  return true;
512 }
513 
514 
516 {
517  return enter_CellData(numberOfCells_, nFields);
518 }
519 
520 
522 {
523  return enter_PointData(numberOfPoints_, nFields);
524 }
525 
526 
528 {
529  if (isState(outputState::CELL_DATA))
530  {
531  ++nCellData_;
532  }
533  else
534  {
536  << "Bad writer state (" << stateNames[state_]
537  << ") - should be (" << stateNames[outputState::CELL_DATA]
538  << ") for patchID field" << nl << endl
539  << exit(FatalError);
540  }
541 
542  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
543 
544  label nFaces = nLocalFaces_;
545 
546  if (parallel_)
547  {
548  reduce(nFaces, sumOp<label>());
549  }
550 
551  if (format_)
552  {
553  if (legacy())
554  {
555  legacy::intField<1>(format(), "patchID", nFaces); // 1 component
556  }
557  else
558  {
559  const uint64_t payLoad =
560  vtk::sizeofData<label>(nFaces);
561 
562  format().beginDataArray<label>("patchID");
563  format().writeSize(payLoad);
564  }
565  }
566 
567  if (parallel_ ? Pstream::master() : true)
568  {
569  for (const label patchId : patchIDs_)
570  {
571  vtk::write(format(), patchId, patches[patchId].size());
572  }
573  }
574 
575  if (parallel_)
576  {
577  if (Pstream::master())
578  {
579  labelList recv;
580 
581  // Receive each pair
582  for (const int slave : Pstream::subProcs())
583  {
584  IPstream fromSlave(Pstream::commsTypes::blocking, slave);
585 
586  fromSlave >> recv;
587 
588  // Receive as [size, id] pairs
589  for (label i=0; i < recv.size(); i += 2)
590  {
591  const label len = recv[i];
592  const label val = recv[i+1];
593 
594  vtk::write(format(), val, len);
595  }
596  }
597  }
598  else
599  {
600  // Send to master
601  OPstream toMaster
602  (
605  );
606 
607 
608  labelList send(2*patchIDs_.size());
609 
610  // Encode as [size, id] pairs
611  label i = 0;
612  for (const label patchId : patchIDs_)
613  {
614  send[i] = patches[patchId].size();
615  send[i+1] = patchId;
616 
617  i += 2;
618  }
619 
620  toMaster << send;
621  }
622  }
623 
624 
625  if (format_)
626  {
627  format().flush();
628  format().endDataArray();
629  }
630 }
631 
632 
634 {
635  // This is different than for internalWriter.
636  // Here we allow procIDs whenever running in parallel, even if the
637  // output is serial. This allow diagnosis of processor patches.
638 
639  if (!Pstream::parRun())
640  {
641  // Skip in non-parallel
642  return false;
643  }
644 
645  if (isState(outputState::CELL_DATA))
646  {
647  ++nCellData_;
648  }
649  else
650  {
652  << "Bad writer state (" << stateNames[state_]
653  << ") - should be (" << stateNames[outputState::CELL_DATA]
654  << ") for patchID field" << nl << endl
655  << exit(FatalError);
656  }
657 
658  label nFaces = nLocalFaces_;
659 
660  if (parallel_)
661  {
662  reduce(nFaces, sumOp<label>());
663  }
664 
665  if (format_)
666  {
667  if (legacy())
668  {
669  legacy::intField<1>(format(), "procID", nFaces); // 1 component
670  }
671  else
672  {
673  const uint64_t payLoad =
674  vtk::sizeofData<label>(nFaces);
675 
676  format().beginDataArray<label>("procID");
677  format().writeSize(payLoad);
678  }
679  }
680 
681  bool good = false;
682 
683  if (parallel_)
684  {
685  globalIndex procSizes(nLocalFaces_);
686 
687  if (Pstream::master())
688  {
689  // Per-processor ids
690  for (const int proci : Pstream::allProcs())
691  {
692  vtk::write(format(), label(proci), procSizes.localSize(proci));
693  }
694 
695  good = true;
696  }
697  }
698  else
699  {
700  vtk::write(format(), label(Pstream::myProcNo()), nLocalFaces_);
701 
702  good = true;
703  }
704 
705 
706  if (format_)
707  {
708  format().flush();
709  format().endDataArray();
710  }
711 
712  // MPI barrier
713  return parallel_ ? returnReduce(good, orOp<bool>()) : good;
714 }
715 
716 
718 {
719  if (!Pstream::parRun())
720  {
721  // Skip in non-parallel
722  return false;
723  }
724 
725  if (isState(outputState::CELL_DATA))
726  {
727  ++nCellData_;
728  }
729  else
730  {
732  << "Bad writer state (" << stateNames[state_]
733  << ") - should be (" << stateNames[outputState::CELL_DATA]
734  << ") for patchID field" << nl << endl
735  << exit(FatalError);
736  }
737 
738  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
739 
740  label nFaces = nLocalFaces_;
741 
742  if (parallel_)
743  {
744  reduce(nFaces, sumOp<label>());
745  }
746 
747  if (format_)
748  {
749  if (legacy())
750  {
751  legacy::intField<1>(format(), "neighID", nFaces); // 1 component
752  }
753  else
754  {
755  const uint64_t payLoad =
756  vtk::sizeofData<label>(nFaces);
757 
758  format().beginDataArray<label>("neighID");
759  format().writeSize(payLoad);
760  }
761  }
762 
763  bool good = false;
764 
765  if (parallel_ ? Pstream::master() : true)
766  {
767  for (const label patchId : patchIDs_)
768  {
769  const auto* pp = isA<processorPolyPatch>(patches[patchId]);
770 
771  const label val = (pp ? pp->neighbProcNo() : -1);
772 
773  vtk::write(format(), val, patches[patchId].size());
774  }
775 
776  good = true;
777  }
778 
779  if (parallel_)
780  {
781  if (Pstream::master())
782  {
783  labelList recv;
784 
785  // Receive each pair
786  for (const int slave : Pstream::subProcs())
787  {
788  IPstream fromSlave(Pstream::commsTypes::blocking, slave);
789 
790  fromSlave >> recv;
791 
792  // Receive as [size, id] pairs
793  for (label i=0; i < recv.size(); i += 2)
794  {
795  const label len = recv[i];
796  const label val = recv[i+1];
797 
798  vtk::write(format(), val, len);
799  }
800  }
801  }
802  else
803  {
804  // Send to master
805  OPstream toMaster
806  (
809  );
810 
811  labelList send(2*patchIDs_.size());
812 
813  // Encode as [size, id] pairs
814  label i = 0;
815  for (const label patchId : patchIDs_)
816  {
817  const auto* pp = isA<processorPolyPatch>(patches[patchId]);
818 
819  send[i] = patches[patchId].size();
820  send[i+1] = (pp ? pp->neighbProcNo() : -1);
821 
822  i += 2;
823  }
824 
825  toMaster << send;
826  }
827  }
828 
829  if (format_)
830  {
831  format().flush();
832  format().endDataArray();
833  }
834 
835  // MPI barrier
836  return parallel_ ? returnReduce(good, orOp<bool>()) : good;
837 }
838 
839 
840 // ************************************************************************* //
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:521
foamVtkOutput.H
Foam::vtk::patchMeshWriter::writePolysLegacy
void writePolysLegacy(const label pointOffset)
Write patch faces, legacy format.
Definition: foamVtkPatchMeshWriter.C:173
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 (always 0)
Definition: UPstream.H:452
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:633
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::vtk::fileTag::POLY_DATA
"PolyData"
Foam::UPstream::parRun
static bool & parRun()
Test if this a parallel run, or allow modify access.
Definition: UPstream.H:434
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::UPstream::master
static bool master(const label communicator=worldComm)
Am I the master process.
Definition: UPstream.H:458
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:444
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:717
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::UPstream::subProcs
static rangeType subProcs(const label communicator=worldComm)
Range of process indices for sub-processes.
Definition: UPstream.H:516
Foam::Field< vector >
Foam::vtk::patchMeshWriter::nLocalVerts_
label nLocalVerts_
Local face vertices (connectivity) count. Sum of face sizes.
Definition: foamVtkPatchMeshWriter.H:94
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
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:439
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:515
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::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:381
Foam::UPstream::allProcs
static rangeType allProcs(const label communicator=worldComm)
Range of process indices for all processes.
Definition: UPstream.H:509
Foam::UPstream::myProcNo
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
Definition: UPstream.H:464
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:489
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:527
Foam::vtk::patchMeshWriter::writePolys
void writePolys(const label pointOffset)
Write patch faces.
Definition: foamVtkPatchMeshWriter.C:244
Foam::orOp
Definition: ops.H:234
Foam::vtk::patchMeshWriter::beginPiece
void beginPiece()
Definition: foamVtkPatchMeshWriter.C:36
Foam::vtk::fileAttr::NUMBER_OF_POLYS
"NumberOfPolys"