polyMesh.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) 2011-2017, 2020 OpenFOAM Foundation
9  Copyright (C) 2016-2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "polyMesh.H"
30 #include "Time.H"
31 #include "cellIOList.H"
32 #include "wedgePolyPatch.H"
33 #include "emptyPolyPatch.H"
34 #include "globalMeshData.H"
35 #include "processorPolyPatch.H"
37 #include "indexedOctree.H"
38 #include "treeDataCell.H"
39 #include "MeshObject.H"
40 #include "pointMesh.H"
41 
42 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46  defineTypeNameAndDebug(polyMesh, 0);
47 
48  word polyMesh::defaultRegion = "region0";
49  word polyMesh::meshSubDir = "polyMesh";
50 }
51 
52 
53 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
54 
55 void Foam::polyMesh::calcDirections() const
56 {
57  for (direction cmpt=0; cmpt<vector::nComponents; cmpt++)
58  {
59  solutionD_[cmpt] = 1;
60  }
61 
62  // Knock out empty and wedge directions. Note:they will be present on all
63  // domains.
64 
65  label nEmptyPatches = 0;
66  label nWedgePatches = 0;
67 
68  vector emptyDirVec = Zero;
69  vector wedgeDirVec = Zero;
70 
71  forAll(boundaryMesh(), patchi)
72  {
73  const polyPatch& pp = boundaryMesh()[patchi];
74  if (isA<emptyPolyPatch>(pp))
75  {
76  // Force calculation of geometric properties, independent of
77  // size. This avoids parallel synchronisation problems.
78  const vectorField::subField fa(pp.faceAreas());
79 
80  if (pp.size())
81  {
82  nEmptyPatches++;
83  emptyDirVec += sum(cmptMag(fa));
84  }
85  }
86  else if (isA<wedgePolyPatch>(pp))
87  {
88  const wedgePolyPatch& wpp = refCast<const wedgePolyPatch>(pp);
89 
90  // Force calculation of geometric properties, independent of
91  // size. This avoids parallel synchronisation problems.
92  (void)wpp.faceNormals();
93 
94  if (pp.size())
95  {
96  nWedgePatches++;
97  wedgeDirVec += cmptMag(wpp.centreNormal());
98  }
99  }
100  }
101 
102  reduce(nEmptyPatches, maxOp<label>());
103  reduce(nWedgePatches, maxOp<label>());
104 
105  if (nEmptyPatches)
106  {
107  reduce(emptyDirVec, sumOp<vector>());
108 
109  emptyDirVec.normalise();
110 
111  for (direction cmpt=0; cmpt<vector::nComponents; cmpt++)
112  {
113  if (emptyDirVec[cmpt] > 1e-6)
114  {
115  solutionD_[cmpt] = -1;
116  }
117  else
118  {
119  solutionD_[cmpt] = 1;
120  }
121  }
122  }
123 
124 
125  // Knock out wedge directions
126 
127  geometricD_ = solutionD_;
128 
129  if (nWedgePatches)
130  {
131  reduce(wedgeDirVec, sumOp<vector>());
132 
133  wedgeDirVec.normalise();
134 
135  for (direction cmpt=0; cmpt<vector::nComponents; cmpt++)
136  {
137  if (wedgeDirVec[cmpt] > 1e-6)
138  {
139  geometricD_[cmpt] = -1;
140  }
141  else
142  {
143  geometricD_[cmpt] = 1;
144  }
145  }
146  }
147 }
148 
149 
150 Foam::autoPtr<Foam::labelIOList> Foam::polyMesh::readTetBasePtIs() const
151 {
152  IOobject io
153  (
154  "tetBasePtIs",
155  instance(),
156  meshSubDir,
157  *this,
160  );
161 
162  if (io.typeHeaderOk<labelIOList>(true))
163  {
164  return autoPtr<labelIOList>::New(io);
165  }
166 
167  return nullptr;
168 }
169 
170 
171 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
172 
173 Foam::polyMesh::polyMesh(const IOobject& io, const bool doInit)
174 :
175  objectRegistry(io),
176  primitiveMesh(),
177  points_
178  (
179  IOobject
180  (
181  "points",
182  time().findInstance(meshDir(), "points"),
183  meshSubDir,
184  *this,
185  IOobject::MUST_READ,
186  IOobject::NO_WRITE
187  )
188  ),
189  faces_
190  (
191  IOobject
192  (
193  "faces",
194  time().findInstance(meshDir(), "faces"),
195  meshSubDir,
196  *this,
197  IOobject::MUST_READ,
198  IOobject::NO_WRITE
199  )
200  ),
201  owner_
202  (
203  IOobject
204  (
205  "owner",
206  faces_.instance(),
207  meshSubDir,
208  *this,
209  IOobject::READ_IF_PRESENT,
210  IOobject::NO_WRITE
211  )
212  ),
213  neighbour_
214  (
215  IOobject
216  (
217  "neighbour",
218  faces_.instance(),
219  meshSubDir,
220  *this,
221  IOobject::READ_IF_PRESENT,
222  IOobject::NO_WRITE
223  )
224  ),
225  clearedPrimitives_(false),
226  boundary_
227  (
228  IOobject
229  (
230  "boundary",
231  time().findInstance // allow 'newer' boundary file
232  (
233  meshDir(),
234  "boundary",
235  IOobject::MUST_READ,
236  faces_.instance()
237  ),
238  meshSubDir,
239  *this,
240  IOobject::MUST_READ,
241  IOobject::NO_WRITE
242  ),
243  *this
244  ),
245  bounds_(points_),
246  comm_(UPstream::worldComm),
247  geometricD_(Zero),
248  solutionD_(Zero),
249  tetBasePtIsPtr_(readTetBasePtIs()),
250  cellTreePtr_(nullptr),
251  pointZones_
252  (
253  IOobject
254  (
255  "pointZones",
256  //time().findInstance
257  //(
258  // meshDir(),
259  // "pointZones",
260  // IOobject::READ_IF_PRESENT
261  //),
262  faces_.instance(),
263  meshSubDir,
264  *this,
265  IOobject::READ_IF_PRESENT,
266  IOobject::NO_WRITE
267  ),
268  *this
269  ),
270  faceZones_
271  (
272  IOobject
273  (
274  "faceZones",
275  //time().findInstance
276  //(
277  // meshDir(),
278  // "faceZones",
279  // IOobject::READ_IF_PRESENT
280  //),
281  faces_.instance(),
282  meshSubDir,
283  *this,
284  IOobject::READ_IF_PRESENT,
285  IOobject::NO_WRITE
286  ),
287  *this
288  ),
289  cellZones_
290  (
291  IOobject
292  (
293  "cellZones",
294  //time().findInstance
295  //(
296  // meshDir(),
297  // "cellZones",
298  // IOobject::READ_IF_PRESENT
299  //),
300  faces_.instance(),
301  meshSubDir,
302  *this,
303  IOobject::READ_IF_PRESENT,
304  IOobject::NO_WRITE
305  ),
306  *this
307  ),
308  globalMeshDataPtr_(nullptr),
309  moving_(false),
310  topoChanging_(false),
311  storeOldCellCentres_(false),
312  curMotionTimeIndex_(time().timeIndex()),
313  oldPointsPtr_(nullptr),
314  oldCellCentresPtr_(nullptr)
315 {
316  if (!owner_.headerClassName().empty())
317  {
318  initMesh();
319  }
320  else
321  {
322  cellCompactIOList cLst
323  (
324  IOobject
325  (
326  "cells",
327  time().findInstance(meshDir(), "cells"),
328  meshSubDir,
329  *this,
332  )
333  );
334 
335  // Set the primitive mesh
336  initMesh(cLst);
337 
338  owner_.write();
339  neighbour_.write();
340  }
341 
342  // Warn if global empty mesh
343  if (returnReduce(boundary_.empty(), orOp<bool>()))
344  {
346  << "mesh missing boundary on one or more domains" << endl;
347 
348  if (returnReduce(nPoints(), sumOp<label>()) == 0)
349  {
351  << "no points in mesh" << endl;
352  }
353  if (returnReduce(nCells(), sumOp<label>()) == 0)
354  {
356  << "no cells in mesh" << endl;
357  }
358  }
359 
360  if (doInit)
361  {
362  polyMesh::init(false); // do not init lower levels
363  }
364 }
365 
366 
367 bool Foam::polyMesh::init(const bool doInit)
368 {
369  if (doInit)
370  {
371  primitiveMesh::init(doInit);
372  }
373 
374  // Calculate topology for the patches (processor-processor comms etc.)
375  boundary_.updateMesh();
376 
377  // Calculate the geometry for the patches (transformation tensors etc.)
378  boundary_.calcGeometry();
379 
380  // Initialise demand-driven data
381  calcDirections();
382 
383  return false;
384 }
385 
386 
387 Foam::polyMesh::polyMesh
388 (
389  const IOobject& io,
390  pointField&& points,
391  faceList&& faces,
392  labelList&& owner,
393  labelList&& neighbour,
394  const bool syncPar
395 )
396 :
397  objectRegistry(io),
398  primitiveMesh(),
399  points_
400  (
401  IOobject
402  (
403  "points",
404  instance(),
405  meshSubDir,
406  *this,
407  IOobject::NO_READ, //io.readOpt(),
408  io.writeOpt()
409  ),
410  std::move(points)
411  ),
412  faces_
413  (
414  IOobject
415  (
416  "faces",
417  instance(),
418  meshSubDir,
419  *this,
420  IOobject::NO_READ, //io.readOpt(),
421  io.writeOpt()
422  ),
423  std::move(faces)
424  ),
425  owner_
426  (
427  IOobject
428  (
429  "owner",
430  instance(),
431  meshSubDir,
432  *this,
433  IOobject::NO_READ, //io.readOpt(),
434  io.writeOpt()
435  ),
436  std::move(owner)
437  ),
438  neighbour_
439  (
440  IOobject
441  (
442  "neighbour",
443  instance(),
444  meshSubDir,
445  *this,
446  IOobject::NO_READ, //io.readOpt(),
447  io.writeOpt()
448  ),
449  std::move(neighbour)
450  ),
451  clearedPrimitives_(false),
452  boundary_
453  (
454  IOobject
455  (
456  "boundary",
457  instance(),
458  meshSubDir,
459  *this,
460  IOobject::NO_READ, // ignore since no alternative can be supplied
461  io.writeOpt()
462  ),
463  *this,
464  polyPatchList()
465  ),
466  bounds_(points_, syncPar),
467  comm_(UPstream::worldComm),
468  geometricD_(Zero),
469  solutionD_(Zero),
470  tetBasePtIsPtr_(nullptr),
471  cellTreePtr_(nullptr),
472  pointZones_
473  (
474  IOobject
475  (
476  "pointZones",
477  instance(),
478  meshSubDir,
479  *this,
480  IOobject::NO_READ, // ignore since no alternative can be supplied
482  ),
483  *this,
485  ),
486  faceZones_
487  (
488  IOobject
489  (
490  "faceZones",
491  instance(),
492  meshSubDir,
493  *this,
494  IOobject::NO_READ,// ignore since no alternative can be supplied
496  ),
497  *this,
499  ),
500  cellZones_
501  (
502  IOobject
503  (
504  "cellZones",
505  instance(),
506  meshSubDir,
507  *this,
508  IOobject::NO_READ, // ignore since no alternative can be supplied
510  ),
511  *this,
513  ),
514  globalMeshDataPtr_(nullptr),
515  moving_(false),
516  topoChanging_(false),
517  storeOldCellCentres_(false),
518  curMotionTimeIndex_(time().timeIndex()),
519  oldPointsPtr_(nullptr),
520  oldCellCentresPtr_(nullptr)
521 {
522  // Check if the faces and cells are valid
523  forAll(faces_, facei)
524  {
525  const face& curFace = faces_[facei];
526 
527  if (min(curFace) < 0 || max(curFace) > points_.size())
528  {
530  << "Face " << facei << "contains vertex labels out of range: "
531  << curFace << " Max point index = " << points_.size()
532  << abort(FatalError);
533  }
534  }
535 
536  // Set the primitive mesh
537  initMesh();
538 }
539 
540 
541 Foam::polyMesh::polyMesh
542 (
543  const IOobject& io,
544  pointField&& points,
545  faceList&& faces,
546  cellList&& cells,
547  const bool syncPar
548 )
549 :
550  objectRegistry(io),
551  primitiveMesh(),
552  points_
553  (
554  IOobject
555  (
556  "points",
557  instance(),
558  meshSubDir,
559  *this,
561  io.writeOpt()
562  ),
563  std::move(points)
564  ),
565  faces_
566  (
567  IOobject
568  (
569  "faces",
570  instance(),
571  meshSubDir,
572  *this,
574  io.writeOpt()
575  ),
576  std::move(faces)
577  ),
578  owner_
579  (
580  IOobject
581  (
582  "owner",
583  instance(),
584  meshSubDir,
585  *this,
587  io.writeOpt()
588  ),
589  0
590  ),
591  neighbour_
592  (
593  IOobject
594  (
595  "neighbour",
596  instance(),
597  meshSubDir,
598  *this,
600  io.writeOpt()
601  ),
602  0
603  ),
604  clearedPrimitives_(false),
605  boundary_
606  (
607  IOobject
608  (
609  "boundary",
610  instance(),
611  meshSubDir,
612  *this,
614  io.writeOpt()
615  ),
616  *this,
617  0
618  ),
619  bounds_(points_, syncPar),
620  comm_(UPstream::worldComm),
621  geometricD_(Zero),
622  solutionD_(Zero),
623  tetBasePtIsPtr_(nullptr),
624  cellTreePtr_(nullptr),
625  pointZones_
626  (
627  IOobject
628  (
629  "pointZones",
630  instance(),
631  meshSubDir,
632  *this,
635  ),
636  *this,
637  0
638  ),
639  faceZones_
640  (
641  IOobject
642  (
643  "faceZones",
644  instance(),
645  meshSubDir,
646  *this,
649  ),
650  *this,
651  0
652  ),
653  cellZones_
654  (
655  IOobject
656  (
657  "cellZones",
658  instance(),
659  meshSubDir,
660  *this,
663  ),
664  *this,
665  0
666  ),
667  globalMeshDataPtr_(nullptr),
668  moving_(false),
669  topoChanging_(false),
670  storeOldCellCentres_(false),
671  curMotionTimeIndex_(time().timeIndex()),
672  oldPointsPtr_(nullptr),
673  oldCellCentresPtr_(nullptr)
674 {
675  // Check if faces are valid
676  forAll(faces_, facei)
677  {
678  const face& curFace = faces_[facei];
679 
680  if (min(curFace) < 0 || max(curFace) > points_.size())
681  {
683  << "Face " << facei << "contains vertex labels out of range: "
684  << curFace << " Max point index = " << points_.size()
685  << abort(FatalError);
686  }
687  }
688 
689  // Transfer in cell list
690  cellList cLst(std::move(cells));
691 
692  // Check if cells are valid
693  forAll(cLst, celli)
694  {
695  const cell& curCell = cLst[celli];
696 
697  if (min(curCell) < 0 || max(curCell) > faces_.size())
698  {
700  << "Cell " << celli << "contains face labels out of range: "
701  << curCell << " Max face index = " << faces_.size()
702  << abort(FatalError);
703  }
704  }
705 
706  // Set the primitive mesh
707  initMesh(cLst);
708 }
709 
710 
711 Foam::polyMesh::polyMesh(const IOobject& io, const zero, const bool syncPar)
712 :
713  polyMesh(io, pointField(), faceList(), labelList(), labelList(), syncPar)
714 {}
715 
716 
718 (
720  autoPtr<faceList>&& faces,
721  autoPtr<labelList>&& owner,
722  autoPtr<labelList>&& neighbour,
723  const labelUList& patchSizes,
724  const labelUList& patchStarts,
725  const bool validBoundary
726 )
727 {
728  // Clear addressing. Keep geometric props and updateable props for mapping.
729  clearAddressing(true);
730 
731  // Take over new primitive data.
732  // Optimized to avoid overwriting data at all
733  if (points)
734  {
735  points_.transfer(*points);
736  bounds_ = boundBox(points_, validBoundary);
737  }
738 
739  if (faces)
740  {
741  faces_.transfer(*faces);
742  }
743 
744  if (owner)
745  {
746  owner_.transfer(*owner);
747  }
748 
749  if (neighbour)
750  {
751  neighbour_.transfer(*neighbour);
752  }
753 
754 
755  // Reset patch sizes and starts
756  forAll(boundary_, patchi)
757  {
758  boundary_[patchi] = polyPatch
759  (
760  boundary_[patchi],
761  boundary_,
762  patchi,
763  patchSizes[patchi],
764  patchStarts[patchi]
765  );
766  }
767 
768 
769  // Flags the mesh files as being changed
770  setInstance(time().timeName());
771 
772  // Check if the faces and cells are valid
773  forAll(faces_, facei)
774  {
775  const face& curFace = faces_[facei];
776 
777  if (min(curFace) < 0 || max(curFace) > points_.size())
778  {
780  << "Face " << facei << " contains vertex labels out of range: "
781  << curFace << " Max point index = " << points_.size()
782  << abort(FatalError);
783  }
784  }
785 
786 
787  // Set the primitive mesh from the owner_, neighbour_.
788  // Works out from patch end where the active faces stop.
789  initMesh();
790 
791 
792  if (validBoundary)
793  {
794  // Note that we assume that all the patches stay the same and are
795  // correct etc. so we can already use the patches to do
796  // processor-processor comms.
797 
798  // Calculate topology for the patches (processor-processor comms etc.)
799  boundary_.updateMesh();
800 
801  // Calculate the geometry for the patches (transformation tensors etc.)
802  boundary_.calcGeometry();
803 
804  // Warn if global empty mesh
805  if
806  (
807  (returnReduce(nPoints(), sumOp<label>()) == 0)
808  || (returnReduce(nCells(), sumOp<label>()) == 0)
809  )
810  {
812  << "no points or no cells in mesh" << endl;
813  }
814  }
815 }
816 
817 
818 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
819 
821 {
822  clearOut();
823  resetMotion();
824 }
825 
826 
827 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
828 
830 {
831  if (objectRegistry::dbDir() == defaultRegion)
832  {
833  return parent().dbDir();
834  }
835 
836  return objectRegistry::dbDir();
837 }
838 
839 
841 {
842  return dbDir()/meshSubDir;
843 }
844 
845 
847 {
848  return points_.instance();
849 }
850 
851 
853 {
854  return faces_.instance();
855 }
856 
857 
859 {
860  if (geometricD_.x() == 0)
861  {
862  calcDirections();
863  }
864 
865  return geometricD_;
866 }
867 
868 
869 Foam::label Foam::polyMesh::nGeometricD() const
870 {
871  return cmptSum(geometricD() + Vector<label>::one)/2;
872 }
873 
874 
876 {
877  if (solutionD_.x() == 0)
878  {
879  calcDirections();
880  }
881 
882  return solutionD_;
883 }
884 
885 
886 Foam::label Foam::polyMesh::nSolutionD() const
887 {
888  return cmptSum(solutionD() + Vector<label>::one)/2;
889 }
890 
891 
893 {
894  if (!tetBasePtIsPtr_)
895  {
896  if (debug)
897  {
899  << "Forcing storage of base points."
900  << endl;
901  }
902 
903  tetBasePtIsPtr_.reset
904  (
905  new labelIOList
906  (
907  IOobject
908  (
909  "tetBasePtIs",
910  instance(),
911  meshSubDir,
912  *this,
915  ),
917  )
918  );
919  }
920 
921  return *tetBasePtIsPtr_;
922 }
923 
924 
927 {
928  if (!cellTreePtr_)
929  {
930  treeBoundBox overallBb(points());
931 
932  Random rndGen(261782);
933 
934  overallBb = overallBb.extend(rndGen, 1e-4);
935  overallBb.min() -= point::uniform(ROOTVSMALL);
936  overallBb.max() += point::uniform(ROOTVSMALL);
937 
938  cellTreePtr_.reset
939  (
941  (
943  (
944  false, // not cache bb
945  *this,
946  CELL_TETS // use tet-decomposition for any inside test
947  ),
948  overallBb,
949  8, // maxLevel
950  10, // leafsize
951  5.0 // duplicity
952  )
953  );
954  }
955 
956  return *cellTreePtr_;
957 }
958 
959 
961 (
962  PtrList<polyPatch>& plist,
963  const bool validBoundary
964 )
965 {
966  if (boundaryMesh().size())
967  {
969  << "boundary already exists"
970  << abort(FatalError);
971  }
972 
973  // Reset valid directions
974  geometricD_ = Zero;
975  solutionD_ = Zero;
976 
977  boundary_.transfer(plist);
978 
979  // parallelData depends on the processorPatch ordering so force
980  // recalculation. Problem: should really be done in removeBoundary but
981  // there is some info in parallelData which might be interesting inbetween
982  // removeBoundary and addPatches.
983  globalMeshDataPtr_.clear();
984 
985  if (validBoundary)
986  {
987  // Calculate topology for the patches (processor-processor comms etc.)
988  boundary_.updateMesh();
989 
990  // Calculate the geometry for the patches (transformation tensors etc.)
991  boundary_.calcGeometry();
992 
993  boundary_.checkDefinition();
994  }
995 }
996 
997 
999 (
1000  const List<pointZone*>& pz,
1001  const List<faceZone*>& fz,
1002  const List<cellZone*>& cz
1003 )
1004 {
1005  if (pointZones().size() || faceZones().size() || cellZones().size())
1006  {
1008  << "point, face or cell zone already exists"
1009  << abort(FatalError);
1010  }
1011 
1012  // Point zones
1013  if (pz.size())
1014  {
1015  pointZones_.setSize(pz.size());
1016 
1017  // Copy the zone pointers
1018  forAll(pz, pI)
1019  {
1020  pointZones_.set(pI, pz[pI]);
1021  }
1022 
1023  pointZones_.writeOpt(IOobject::AUTO_WRITE);
1024  }
1025 
1026  // Face zones
1027  if (fz.size())
1028  {
1029  faceZones_.setSize(fz.size());
1030 
1031  // Copy the zone pointers
1032  forAll(fz, fI)
1033  {
1034  faceZones_.set(fI, fz[fI]);
1035  }
1036 
1037  faceZones_.writeOpt(IOobject::AUTO_WRITE);
1038  }
1039 
1040  // Cell zones
1041  if (cz.size())
1042  {
1043  cellZones_.setSize(cz.size());
1044 
1045  // Copy the zone pointers
1046  forAll(cz, cI)
1047  {
1048  cellZones_.set(cI, cz[cI]);
1049  }
1050 
1051  cellZones_.writeOpt(IOobject::AUTO_WRITE);
1052  }
1053 }
1054 
1055 
1058  const List<polyPatch*>& p,
1059  const bool validBoundary
1060 )
1061 {
1062  // Acquire ownership of the pointers
1063  PtrList<polyPatch> plist(const_cast<List<polyPatch*>&>(p));
1064 
1065  addPatches(plist, validBoundary);
1066 }
1067 
1068 
1070 {
1071  if (clearedPrimitives_)
1072  {
1074  << "points deallocated"
1075  << abort(FatalError);
1076  }
1077 
1078  return points_;
1079 }
1080 
1081 
1083 {
1084  return io.upToDate(points_);
1085 }
1086 
1087 
1089 {
1090  io.eventNo() = points_.eventNo()+1;
1091 }
1092 
1093 
1095 {
1096  if (clearedPrimitives_)
1097  {
1099  << "faces deallocated"
1100  << abort(FatalError);
1101  }
1102 
1103  return faces_;
1104 }
1105 
1106 
1108 {
1109  return owner_;
1110 }
1111 
1112 
1114 {
1115  return neighbour_;
1116 }
1117 
1118 
1120 {
1121  if (!moving_)
1122  {
1123  return points_;
1124  }
1125 
1126  if (!oldPointsPtr_)
1127  {
1128  if (debug)
1129  {
1131  }
1132 
1133  oldPointsPtr_.reset(new pointField(points_));
1134  curMotionTimeIndex_ = time().timeIndex();
1135  }
1136 
1137  return *oldPointsPtr_;
1138 }
1139 
1140 
1142 {
1143  storeOldCellCentres_ = true;
1144 
1145  if (!moving_)
1146  {
1147  return cellCentres();
1148  }
1149 
1150  if (!oldCellCentresPtr_)
1151  {
1152  oldCellCentresPtr_.reset(new pointField(cellCentres()));
1153  }
1154 
1155  return *oldCellCentresPtr_;
1156 }
1157 
1158 
1161  const pointField& newPoints
1162 )
1163 {
1165  << "Moving points for time " << time().value()
1166  << " index " << time().timeIndex() << endl;
1167 
1168  if (newPoints.size() != points_.size())
1169  {
1171  << "Size of newPoints " << newPoints.size()
1172  << " does not correspond to current mesh points size "
1173  << points_.size()
1174  << exit(FatalError);
1175  }
1176 
1177 
1178  moving(true);
1179 
1180  // Pick up old points
1181  if (curMotionTimeIndex_ != time().timeIndex())
1182  {
1183  if (debug)
1184  {
1185  Info<< "tmp<scalarField> polyMesh::movePoints(const pointField&) : "
1186  << " Storing current points for time " << time().value()
1187  << " index " << time().timeIndex() << endl;
1188  }
1189 
1190  if (storeOldCellCentres_)
1191  {
1192  oldCellCentresPtr_.clear();
1193  oldCellCentresPtr_.reset(new pointField(cellCentres()));
1194  }
1195 
1196  // Mesh motion in the new time step
1197  oldPointsPtr_.clear();
1198  oldPointsPtr_.reset(new pointField(points_));
1199  curMotionTimeIndex_ = time().timeIndex();
1200  }
1201 
1202  points_ = newPoints;
1203 
1204  bool moveError = false;
1205  if (debug)
1206  {
1207  // Check mesh motion
1208  if (checkMeshMotion(points_, true))
1209  {
1210  moveError = true;
1211 
1213  << "Moving the mesh with given points will "
1214  << "invalidate the mesh." << nl
1215  << "Mesh motion should not be executed." << endl;
1216  }
1217  }
1218 
1219  points_.writeOpt(IOobject::AUTO_WRITE);
1220  points_.instance() = time().timeName();
1221  points_.eventNo() = getEvent();
1222 
1223  if (tetBasePtIsPtr_)
1224  {
1225  tetBasePtIsPtr_->writeOpt(IOobject::AUTO_WRITE);
1226  tetBasePtIsPtr_->instance() = time().timeName();
1227  tetBasePtIsPtr_->eventNo() = getEvent();
1228  }
1229 
1231  (
1232  points_,
1233  oldPoints()
1234  );
1235 
1236  // Adjust parallel shared points
1237  if (globalMeshDataPtr_)
1238  {
1239  globalMeshDataPtr_->movePoints(points_);
1240  }
1241 
1242  // Force recalculation of all geometric data with new points
1243 
1244  bounds_ = boundBox(points_);
1245  boundary_.movePoints(points_);
1246 
1247  pointZones_.movePoints(points_);
1248  faceZones_.movePoints(points_);
1249  cellZones_.movePoints(points_);
1250 
1251  // Reset cell tree - it gets built from mesh geometry so might have
1252  // wrong boxes. It is correct as long as none of the cells leaves
1253  // the boxes it is in which most likely is almost never the case except
1254  // for tiny displacements. An alternative is to check the displacements
1255  // to see if they are tiny - imagine a big windtunnel with a small rotating
1256  // object. In this case the processors without the rotating object wouldn't
1257  // have to clear any geometry. However your critical path still stays the
1258  // same so no time would be gained (unless the decomposition gets weighted).
1259  // Small benefit for lots of scope for problems so not done.
1260  cellTreePtr_.clear();
1261 
1262  // Reset valid directions (could change with rotation)
1263  geometricD_ = Zero;
1264  solutionD_ = Zero;
1265 
1266  // Note: tet-base decomposition does not get cleared. Ideally your face
1267  // decomposition should not change during mesh motion ...
1268 
1269 
1270  meshObject::movePoints<polyMesh>(*this);
1271  meshObject::movePoints<pointMesh>(*this);
1272 
1273  const_cast<Time&>(time()).functionObjects().movePoints(*this);
1274 
1275 
1276  if (debug && moveError)
1277  {
1278  // Write mesh to ease debugging. Note we want to avoid calling
1279  // e.g. fvMesh::write since meshPhi not yet complete.
1280  polyMesh::write();
1281  }
1282 
1283  return sweptVols;
1284 }
1285 
1286 
1288 {
1289  curMotionTimeIndex_ = 0;
1290  oldPointsPtr_.clear();
1291  oldCellCentresPtr_.clear();
1292 }
1293 
1294 
1296 {
1297  if (!globalMeshDataPtr_)
1298  {
1299  if (debug)
1300  {
1301  Pout<< "polyMesh::globalData() const : "
1302  << "Constructing parallelData from processor topology"
1303  << endl;
1304  }
1305  // Construct globalMeshData using processorPatch information only.
1306  globalMeshDataPtr_.reset(new globalMeshData(*this));
1307  }
1308 
1309  return *globalMeshDataPtr_;
1310 }
1311 
1312 
1313 Foam::label Foam::polyMesh::comm() const noexcept
1314 {
1315  return comm_;
1316 }
1317 
1318 
1319 Foam::label& Foam::polyMesh::comm() noexcept
1320 {
1321  return comm_;
1322 }
1323 
1324 
1325 void Foam::polyMesh::removeFiles(const fileName& instanceDir) const
1326 {
1327  fileName meshFilesPath = thisDb().time().path()/instanceDir/meshDir();
1328 
1329  rm(meshFilesPath/"points");
1330  rm(meshFilesPath/"faces");
1331  rm(meshFilesPath/"owner");
1332  rm(meshFilesPath/"neighbour");
1333  rm(meshFilesPath/"cells");
1334  rm(meshFilesPath/"boundary");
1335  rm(meshFilesPath/"pointZones");
1336  rm(meshFilesPath/"faceZones");
1337  rm(meshFilesPath/"cellZones");
1338  rm(meshFilesPath/"meshModifiers");
1339  rm(meshFilesPath/"parallelData");
1340 
1341  // remove subdirectories
1342  if (isDir(meshFilesPath/"sets"))
1343  {
1344  rmDir(meshFilesPath/"sets");
1345  }
1346 }
1347 
1348 
1350 {
1351  removeFiles(instance());
1352 }
1353 
1354 
1357  const point& p,
1358  label& celli,
1359  label& tetFacei,
1360  label& tetPti
1361 ) const
1362 {
1363  celli = -1;
1364  tetFacei = -1;
1365  tetPti = -1;
1366 
1367  const indexedOctree<treeDataCell>& tree = cellTree();
1368 
1369  // Find point inside cell
1370  celli = tree.findInside(p);
1371 
1372  if (celli != -1)
1373  {
1374  // Check the nearest cell to see if the point is inside.
1375  findTetFacePt(celli, p, tetFacei, tetPti);
1376  }
1377 }
1378 
1379 
1382  const label celli,
1383  const point& p,
1384  label& tetFacei,
1385  label& tetPti
1386 ) const
1387 {
1388  const polyMesh& mesh = *this;
1389 
1391  tetFacei = tet.face();
1392  tetPti = tet.tetPt();
1393 }
1394 
1395 
1398  const point& p,
1399  label celli,
1400  const cellDecomposition decompMode
1401 ) const
1402 {
1403  switch (decompMode)
1404  {
1405  case FACE_PLANES:
1406  {
1407  return primitiveMesh::pointInCell(p, celli);
1408  }
1409  break;
1410 
1411  case FACE_CENTRE_TRIS:
1412  {
1413  // only test that point is on inside of plane defined by cell face
1414  // triangles
1415  const cell& cFaces = cells()[celli];
1416 
1417  forAll(cFaces, cFacei)
1418  {
1419  label facei = cFaces[cFacei];
1420  const face& f = faces_[facei];
1421  const point& fc = faceCentres()[facei];
1422  bool isOwn = (owner_[facei] == celli);
1423 
1424  forAll(f, fp)
1425  {
1426  label pointi;
1427  label nextPointi;
1428 
1429  if (isOwn)
1430  {
1431  pointi = f[fp];
1432  nextPointi = f.nextLabel(fp);
1433  }
1434  else
1435  {
1436  pointi = f.nextLabel(fp);
1437  nextPointi = f[fp];
1438  }
1439 
1440  triPointRef faceTri
1441  (
1442  points()[pointi],
1443  points()[nextPointi],
1444  fc
1445  );
1446 
1447  vector proj = p - faceTri.centre();
1448 
1449  if ((faceTri.areaNormal() & proj) > 0)
1450  {
1451  return false;
1452  }
1453  }
1454  }
1455  return true;
1456  }
1457  break;
1458 
1459  case FACE_DIAG_TRIS:
1460  {
1461  // only test that point is on inside of plane defined by cell face
1462  // triangles
1463  const cell& cFaces = cells()[celli];
1464 
1465  forAll(cFaces, cFacei)
1466  {
1467  label facei = cFaces[cFacei];
1468  const face& f = faces_[facei];
1469 
1470  for (label tetPti = 1; tetPti < f.size() - 1; tetPti++)
1471  {
1472  // Get tetIndices of face triangle
1473  tetIndices faceTetIs(celli, facei, tetPti);
1474 
1475  triPointRef faceTri = faceTetIs.faceTri(*this);
1476 
1477  vector proj = p - faceTri.centre();
1478 
1479  if ((faceTri.areaNormal() & proj) > 0)
1480  {
1481  return false;
1482  }
1483  }
1484  }
1485 
1486  return true;
1487  }
1488  break;
1489 
1490  case CELL_TETS:
1491  {
1492  label tetFacei;
1493  label tetPti;
1494 
1495  findTetFacePt(celli, p, tetFacei, tetPti);
1496 
1497  return tetFacei != -1;
1498  }
1499  break;
1500  }
1501 
1502  return false;
1503 }
1504 
1505 
1506 Foam::label Foam::polyMesh::findCell
1508  const point& p,
1509  const cellDecomposition decompMode
1510 ) const
1511 {
1512  if
1513  (
1514  Pstream::parRun()
1515  && (decompMode == FACE_DIAG_TRIS || decompMode == CELL_TETS)
1516  )
1517  {
1518  // Force construction of face-diagonal decomposition before testing
1519  // for zero cells.
1520  //
1521  // If parallel running a local domain might have zero cells so never
1522  // construct the face-diagonal decomposition which uses parallel
1523  // transfers.
1524  (void)tetBasePtIs();
1525  }
1526 
1527  if (nCells() == 0)
1528  {
1529  return -1;
1530  }
1531 
1532  if (decompMode == CELL_TETS)
1533  {
1534  // Advanced search method utilizing an octree
1535  // and tet-decomposition of the cells
1536 
1537  label celli;
1538  label tetFacei;
1539  label tetPti;
1540 
1541  findCellFacePt(p, celli, tetFacei, tetPti);
1542 
1543  return celli;
1544  }
1545  else
1546  {
1547  // Approximate search avoiding the construction of an octree
1548  // and cell decomposition
1549 
1550  if (Pstream::parRun() && decompMode == FACE_DIAG_TRIS)
1551  {
1552  // Force construction of face-diagonal decomposition before testing
1553  // for zero cells. If parallel running a local domain might have
1554  // zero cells so never construct the face-diagonal decomposition
1555  // (which uses parallel transfers)
1556  (void)tetBasePtIs();
1557  }
1558 
1559  // Find the nearest cell centre to this location
1560  label celli = findNearestCell(p);
1561 
1562  // If point is in the nearest cell return
1563  if (pointInCell(p, celli, decompMode))
1564  {
1565  return celli;
1566  }
1567  else
1568  {
1569  // Point is not in the nearest cell so search all cells
1570 
1571  for (label celli = 0; celli < nCells(); celli++)
1572  {
1573  if (pointInCell(p, celli, decompMode))
1574  {
1575  return celli;
1576  }
1577  }
1578 
1579  return -1;
1580  }
1581  }
1582 }
1583 
1584 
1585 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
Foam::IOobject::NO_WRITE
Definition: IOobject.H:195
Foam::polyMesh::addPatches
void addPatches(PtrList< polyPatch > &plist, const bool validBoundary=true)
Add boundary patches.
Definition: polyMesh.C:961
Foam::autoPtr::New
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
Foam::Random
Random number generator.
Definition: Random.H:59
Foam::polyMesh::points
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:1069
Foam::polyMesh::oldCellCentres
virtual const pointField & oldCellCentres() const
Return old cellCentres (mesh motion)
Definition: polyMesh.C:1141
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::treeBoundBox::extend
treeBoundBox extend(Random &rndGen, const scalar s) const
Return slightly wider bounding box.
Definition: treeBoundBoxI.H:325
InfoInFunction
#define InfoInFunction
Report an information message using Foam::Info.
Definition: messageStream.H:350
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::IOobject::AUTO_WRITE
Definition: IOobject.H:194
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::polyMesh::resetMotion
void resetMotion() const
Reset motion.
Definition: polyMesh.C:1287
Foam::polyMesh::cellDecomposition
cellDecomposition
Enumeration defining the decomposition of the cell for.
Definition: polyMesh.H:100
Foam::VectorSpace< Vector< Cmpt >, Cmpt, 3 >::uniform
static Vector< Cmpt > uniform(const Cmpt &s)
Return a VectorSpace with all elements = s.
Definition: VectorSpaceI.H:164
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
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::polyMesh::defaultRegion
static word defaultRegion
Return the default region name.
Definition: polyMesh.H:318
Foam::fileName::path
static std::string path(const std::string &str)
Return directory path name (part before last /)
Definition: fileNameI.H:176
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::regIOobject::upToDate
bool upToDate(const regIOobject &) const
Return true if up-to-date with respect to given object.
Definition: regIOobject.C:337
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::polyMesh::nGeometricD
label nGeometricD() const
Return the number of valid geometric dimensions in the mesh.
Definition: polyMesh.C:869
Foam::polyMesh::movePoints
virtual tmp< scalarField > movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
Definition: polyMesh.C:1160
Foam::IOobject::typeHeaderOk
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (uses typeFilePath to find file) and check its info.
Definition: IOobjectTemplates.C:39
globalMeshData.H
Foam::polyMeshTetDecomposition::findFaceBasePts
static labelList findFaceBasePts(const polyMesh &mesh, scalar tol=minTetQuality, bool report=false)
Definition: polyMeshTetDecomposition.C:225
wedgePolyPatch.H
Foam::polyMesh::dbDir
virtual const fileName & dbDir() const
Override the objectRegistry dbDir for a single-region case.
Definition: polyMesh.C:829
Foam::treeBoundBox
Standard boundBox with extra functionality for use in octree.
Definition: treeBoundBox.H:86
Foam::polyMesh::meshSubDir
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
Definition: polyMesh.H:321
indexedOctree.H
Foam::primitiveMesh::pointInCell
bool pointInCell(const point &p, label celli) const
Return true if the point is in the cell.
Definition: primitiveMeshFindCell.C:61
Foam::tetIndices::face
label face() const
Return the face.
Definition: tetIndicesI.H:43
Foam::polyMesh::facesInstance
const fileName & facesInstance() const
Return the current instance directory for faces.
Definition: polyMesh.C:852
Foam::rm
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
Definition: MSwindows.C:1004
Foam::polyMesh::boundaryMesh
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:444
Foam::polyMesh::init
virtual bool init(const bool doInit)
Initialise all non-demand-driven data.
Definition: polyMesh.C:367
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::boundBox::max
const point & max() const
Maximum describing the bounding box.
Definition: boundBoxI.H:97
Foam::IOobject::headerClassName
const word & headerClassName() const noexcept
Return name of the class name read from header.
Definition: IOobjectI.H:83
Foam::regIOobject::eventNo
label eventNo() const
Event number at last update.
Definition: regIOobjectI.H:185
Foam::polyMesh::solutionD
const Vector< label > & solutionD() const
Return the vector of solved-for directions in mesh.
Definition: polyMesh.C:875
Foam::Pout
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Foam::polyMesh::removeFiles
void removeFiles() const
Remove all files from mesh instance()
Definition: polyMesh.C:1349
polyMesh.H
Foam::IOobject::writeOpt
writeOption writeOpt() const noexcept
The write option.
Definition: IOobjectI.H:179
Foam::labelIOList
IOList< label > labelIOList
Label container classes.
Definition: labelIOList.H:44
Foam::polyMesh::geometricD
const Vector< label > & geometricD() const
Return the vector of geometric directions in mesh.
Definition: polyMesh.C:858
Foam::polyMesh::pointInCell
bool pointInCell(const point &p, label celli, const cellDecomposition=CELL_TETS) const
Test if point p is in the celli.
Definition: polyMesh.C:1397
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::polyMesh::comm
label comm() const noexcept
Return communicator used for parallel communication.
Definition: polyMesh.C:1313
polyMeshTetDecomposition.H
Foam::boundBox::min
const point & min() const
Minimum describing the bounding box.
Definition: boundBoxI.H:91
Foam::sumOp
Definition: ops.H:213
Foam::primitiveMesh::nPoints
label nPoints() const noexcept
Number of mesh points.
Definition: primitiveMeshI.H:37
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::triangle::centre
Point centre() const
Return centre (centroid)
Definition: triangleI.H:105
nPoints
label nPoints
Definition: gmvOutputHeader.H:2
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::cmptMag
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:400
Foam::triangle
A triangle primitive used to calculate face normals and swept volumes.
Definition: triangle.H:59
Foam::polyMesh::pointsInstance
const fileName & pointsInstance() const
Return the current instance directory for points.
Definition: polyMesh.C:846
Foam::objectRegistry::dbDir
virtual const fileName & dbDir() const
Local directory path of this objectRegistry relative to the time.
Definition: objectRegistry.H:187
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::primitiveMesh::nCells
label nCells() const noexcept
Number of mesh cells.
Definition: primitiveMeshI.H:96
Foam::treeDataCell
Encapsulation of data needed to search in/for cells. Used to find the cell containing a point (e....
Definition: treeDataCell.H:56
Foam::UPstream
Inter-processor communications stream.
Definition: UPstream.H:61
Foam::Field< vector >
Foam::regIOobject::write
virtual bool write(const bool valid=true) const
Write using setting from DB.
Definition: regIOobjectWrite.C:132
Foam::tetIndices::faceTri
triPointRef faceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the face for.
Definition: tetIndicesI.H:170
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
DebugInFunction
#define DebugInFunction
Report an information message using Foam::Info.
Definition: messageStream.H:388
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
Foam::polyPatchList
PtrList< polyPatch > polyPatchList
container classes for polyPatch
Definition: polyPatchList.H:47
Foam::polyMesh::faceOwner
virtual const labelList & faceOwner() const
Return face owner.
Definition: polyMesh.C:1107
Foam::IOobject::READ_IF_PRESENT
Definition: IOobject.H:187
Foam::polyMesh::resetPrimitives
void resetPrimitives(autoPtr< pointField > &&points, autoPtr< faceList > &&faces, autoPtr< labelList > &&owner, autoPtr< labelList > &&neighbour, const labelUList &patchSizes, const labelUList &patchStarts, const bool validBoundary=true)
Reset mesh primitive data. Assumes all patch info correct.
Definition: polyMesh.C:718
Foam::indexedOctree< Foam::treeDataCell >
Foam::CompactIOList
A List of objects of type <T> with automated input and output using a compact storage....
Definition: CompactIOList.H:55
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Foam::indexedOctree::findInside
label findInside(const point &) const
Find shape containing point. Only implemented for certain.
Definition: indexedOctree.C:2629
Foam::polyMesh::oldPoints
virtual const pointField & oldPoints() const
Return old points (mesh motion)
Definition: polyMesh.C:1119
timeName
word timeName
Definition: getTimeIndex.H:3
Foam::FatalError
error FatalError
processorPolyPatch.H
Foam::globalMeshData
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
Definition: globalMeshData.H:107
Foam::polyMesh::findCellFacePt
void findCellFacePt(const point &p, label &celli, label &tetFacei, label &tetPti) const
Find the cell, tetFacei and tetPti for point p.
Definition: polyMesh.C:1356
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::polyMesh::upToDatePoints
virtual bool upToDatePoints(const regIOobject &io) const
Return true if io is up-to-date with points.
Definition: polyMesh.C:1082
Foam::polyMeshTetDecomposition::findTet
static tetIndices findTet(const polyMesh &mesh, label cI, const point &pt)
Find the tet decomposition of the cell containing the given point.
Definition: polyMeshTetDecomposition.C:595
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::cmptSum
Cmpt cmptSum(const SphericalTensor< Cmpt > &st)
Return the sum of components of a SphericalTensor.
Definition: SphericalTensorI.H:164
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
treeDataCell.H
Foam::tetIndices::tetPt
label tetPt() const
Return the characterising tetPtI.
Definition: tetIndicesI.H:55
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
emptyPolyPatch.H
Foam::polyMesh::meshDir
fileName meshDir() const
Return the local mesh directory (dbDir()/meshSubDir)
Definition: polyMesh.C:840
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::polyMesh::nSolutionD
label nSolutionD() const
Return the number of valid solved-for dimensions in the mesh.
Definition: polyMesh.C:886
Time.H
Foam::tetIndices
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
Definition: tetIndices.H:83
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::polyMesh::cellTree
const indexedOctree< treeDataCell > & cellTree() const
Return the cell search tree.
Definition: polyMesh.C:926
Foam::polyMesh::~polyMesh
virtual ~polyMesh()
Destructor.
Definition: polyMesh.C:820
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:73
Foam::polyMesh::findCell
label findCell(const point &p, const cellDecomposition=CELL_TETS) const
Find cell enclosing this location and return index.
Definition: polyMesh.C:1507
Foam::polyMesh::faces
virtual const faceList & faces() const
Return raw faces.
Definition: polyMesh.C:1094
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::nl
constexpr char nl
Definition: Ostream.H:404
Foam::primitiveMesh::init
virtual bool init(const bool doInit)
Initialise all non-demand-driven data.
Definition: primitiveMesh.H:475
f
labelList f(nPoints)
Foam::rmDir
bool rmDir(const fileName &directory, const bool silent=false)
Remove a directory and its contents (optionally silencing warnings)
Definition: MSwindows.C:1028
Foam::Vector
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Definition: Vector.H:62
Foam::UPstream::worldComm
static label worldComm
Default communicator (all processors)
Definition: UPstream.H:293
Foam::UPstream::parRun
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:433
Foam::List< face >
Foam::UList< label >
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::constant::electromagnetic::e
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
Foam::IOList< label >
Foam::primitiveMesh::movePoints
tmp< scalarField > movePoints(const pointField &p, const pointField &oldP)
Move points, returns volumes swept by faces in motion.
Definition: primitiveMesh.C:322
Foam::sum
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:327
Foam::direction
uint8_t direction
Definition: direction.H:52
Foam::boundBox
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:63
MeshObject.H
rndGen
Random rndGen
Definition: createFields.H:23
Foam::boundaryMesh
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
Definition: boundaryMesh.H:62
Foam::Field< vector >::subField
SubField< vector > subField
Declare type of subField.
Definition: Field.H:89
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:72
timeIndex
label timeIndex
Definition: getTimeIndex.H:30
cells
const cellShapeList & cells
Definition: gmvOutputHeader.H:3
Foam::polyMesh::globalData
const globalMeshData & globalData() const
Return parallel info.
Definition: polyMesh.C:1295
Foam::triangle::areaNormal
vector areaNormal() const
The area normal - with magnitude equal to area of triangle.
Definition: triangleI.H:112
Foam::IOobject::NO_READ
Definition: IOobject.H:188
Foam::orOp
Definition: ops.H:234
Foam::polyMesh::findTetFacePt
void findTetFacePt(const label celli, const point &p, label &tetFacei, label &tetPti) const
Find the tetFacei and tetPti for point p in celli.
Definition: polyMesh.C:1381
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:328
Foam::cell
A cell is defined as a list of faces with extra functionality.
Definition: cell.H:54
Foam::polyMesh::addZones
void addZones(const List< pointZone * > &pz, const List< faceZone * > &fz, const List< cellZone * > &cz)
Add mesh zones.
Definition: polyMesh.C:999
cellIOList.H
Foam::objectRegistry::time
const Time & time() const noexcept
Return time registry.
Definition: objectRegistry.H:178
Foam::polyMesh::setUpToDatePoints
virtual void setUpToDatePoints(regIOobject &io) const
Set io to be up-to-date with points.
Definition: polyMesh.C:1088
pointMesh.H
Foam::polyMesh::faceNeighbour
virtual const labelList & faceNeighbour() const
Return face neighbour.
Definition: polyMesh.C:1113
Foam::VectorSpace< Vector< scalar >, scalar, 3 >::nComponents
static constexpr direction nComponents
Number of components in this vector space.
Definition: VectorSpace.H:101
Foam::isDir
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
Definition: MSwindows.C:643
Foam::zero
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:62
Foam::IOobject::MUST_READ
Definition: IOobject.H:185
Foam::polyMesh::tetBasePtIs
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.
Definition: polyMesh.C:892
Foam::primitiveMesh
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:78