meshRefinementMerge.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2026 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "meshRefinement.H"
27 #include "combineFaces.H"
28 #include "polyTopoChange.H"
29 #include "removePoints.H"
30 #include "faceSet.H"
31 #include "Time.H"
32 #include "meshCheck.H"
33 #include "syncTools.H"
34 
35 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
36 
38 //Foam::label Foam::meshRefinement::mergePatchFaces
39 //(
40 // const scalar minCos,
41 // const scalar concaveCos,
42 // const labelList& patchIDs
43 //)
44 //{
45 // // Patch face merging engine
46 // combineFaces faceCombiner(mesh_);
47 //
48 // const polyBoundaryMesh& patches = mesh_.poly().boundary();
49 //
50 // // Pick up all candidate cells on boundary
51 // labelHashSet boundaryCells(mesh_.nFaces()-mesh_.nInternalFaces());
52 //
53 // forAll(patchIDs, i)
54 // {
55 // label patchi = patchIDs[i];
56 //
57 // const polyPatch& patch = patches[patchi];
58 //
59 // if (!patch.coupled())
60 // {
61 // forAll(patch, i)
62 // {
63 // boundaryCells.insert(mesh_.faceOwner()[patch.start()+i]);
64 // }
65 // }
66 // }
67 //
68 // // Get all sets of faces that can be merged
69 // labelListList mergeSets
70 // (
71 // faceCombiner.getMergeSets
72 // (
73 // minCos,
74 // concaveCos,
75 // boundaryCells
76 // )
77 // );
78 //
79 // label nFaceSets = returnReduce(mergeSets.size(), sumOp<label>());
80 //
81 // Info<< "mergePatchFaces : Merging " << nFaceSets
82 // << " sets of faces." << endl;
83 //
84 // if (nFaceSets > 0)
85 // {
86 // // Topology changes container
87 // polyTopoChange meshMod(mesh_);
88 //
89 // // Merge all faces of a set into the first face of the set. Remove
90 // // unused points.
91 // faceCombiner.setRefinement(mergeSets, meshMod);
92 //
93 // // Change the mesh (without keeping old points)
94 // autoPtr<polyTopoChangeMap> map =
95 // meshMod.changeMesh(mesh_, true);
96 //
97 // // Update fields
98 // mesh_.topoChange(map);
99 //
100 // // Reset the instance for if in overwrite mode
101 // mesh_.setInstance(name());
102 //
103 // faceCombiner.topoChange(map);
104 //
105 // // Get the kept faces that need to be recalculated.
106 // // Merging two boundary faces might shift the cell centre
107 // // (unless the faces are absolutely planar)
108 // labelHashSet retestFaces(6*mergeSets.size());
109 //
110 // forAll(mergeSets, seti)
111 // {
112 // label oldMasterI = mergeSets[seti][0];
113 //
114 // label facei = map().reverseFaceMap()[oldMasterI];
115 //
116 // // facei is always uncoupled boundary face
117 // const cell& cFaces = mesh_.cells()[mesh_.faceOwner()[facei]];
118 //
119 // forAll(cFaces, i)
120 // {
121 // retestFaces.insert(cFaces[i]);
122 // }
123 // }
124 // topoChange(map, retestFaces.toc());
125 // }
126 //
127 //
128 // return nFaceSets;
129 //}
130 //
131 //
134 //Foam::autoPtr<Foam::polyTopoChangeMap> Foam::meshRefinement::mergeEdges
135 //(
136 // const scalar minCos
137 //)
138 //{
139 // // Point removal analysis engine
140 // removePoints pointRemover(mesh_);
141 //
142 // // Count usage of points
143 // boolList pointCanBeDeleted;
144 // label nRemove = pointRemover.countPointUsage(minCos, pointCanBeDeleted);
145 //
146 // Info<< "Removing " << nRemove
147 // << " straight edge points." << endl;
148 //
149 // autoPtr<polyTopoChangeMap> map;
150 //
151 // if (nRemove > 0)
152 // {
153 // // Save my local faces that will change. These changed faces might
154 // // cause a shift in the cell centre which needs to be retested.
155 // // Have to do this before changing mesh since point will be removed.
156 // labelHashSet retestOldFaces(nRemove / Pstream::nProcs());
157 //
158 // {
159 // const faceList& faces = mesh_.faces();
160 //
161 // forAll(faces, facei)
162 // {
163 // const face& f = faces[facei];
164 //
165 // forAll(f, fp)
166 // {
167 // if (pointCanBeDeleted[f[fp]])
168 // {
169 // retestOldFaces.insert(facei);
170 // break;
171 // }
172 // }
173 // }
174 // }
175 //
176 // // Topology changes container
177 // polyTopoChange meshMod(mesh_);
178 //
179 // pointRemover.setRefinement(pointCanBeDeleted, meshMod);
180 //
181 // // Change the mesh (without keeping old points)
182 // map = meshMod.changeMesh(mesh_, true);
183 //
184 // // Update fields
185 // mesh_.topoChange(map);
186 //
187 // // Reset the instance for if in overwrite mode
188 // mesh_.setInstance(name());
189 //
190 // pointRemover.topoChange(map);
191 //
192 // // Get the kept faces that need to be recalculated.
193 // labelHashSet retestFaces(6*retestOldFaces.size());
194 //
195 // const cellList& cells = mesh_.cells();
196 //
197 // forAllConstIter(labelHashSet, retestOldFaces, iter)
198 // {
199 // label facei = map().reverseFaceMap()[iter.key()];
200 //
201 // const cell& ownFaces = cells[mesh_.faceOwner()[facei]];
202 //
203 // forAll(ownFaces, i)
204 // {
205 // retestFaces.insert(ownFaces[i]);
206 // }
207 //
208 // if (mesh_.isInternalFace(facei))
209 // {
210 // const cell& neiFaces = cells[mesh_.faceNeighbour()[facei]];
211 //
212 // forAll(neiFaces, i)
213 // {
214 // retestFaces.insert(neiFaces[i]);
215 // }
216 // }
217 // }
218 // topoChange(map, retestFaces.toc());
219 // }
220 //
221 // return map;
222 //}
223 
224 
226 (
227  const scalar minCos,
228  const scalar concaveCos,
229  const labelHashSet& patchIDs,
230  const dictionary& motionDict,
231  const labelList& preserveFaces
232 )
233 {
234  // Patch face merging engine
235  combineFaces faceCombiner(mesh_, true);
236 
237  // Get all sets of faces that can be merged. Since only faces on the same
238  // patch get merged there is no risk of e.g. patchID faces getting merged
239  // with original patches (or even processor patches). There is a risk
240  // though of original patch faces getting merged if they make a small
241  // angle. Would be pretty weird starting mesh though.
242  labelListList allFaceSets
243  (
244  faceCombiner.getMergeSets(minCos, concaveCos, patchIDs)
245  );
246 
247  // Filter out any set that contains any preserveFace
248  label compactI = 0;
249  forAll(allFaceSets, i)
250  {
251  const labelList& set = allFaceSets[i];
252 
253  bool keep = true;
254  forAll(set, j)
255  {
256  if (preserveFaces[set[j]] != -1)
257  {
258  keep = false;
259  break;
260  }
261  }
262 
263  if (keep)
264  {
265  if (compactI != i)
266  {
267  allFaceSets[compactI] = set;
268  }
269 
270  compactI++;
271  }
272  }
273  allFaceSets.setSize(compactI);
274 
275  label nFaceSets = returnReduce(allFaceSets.size(), sumOp<label>());
276 
277  Info<< "Merging " << nFaceSets << " sets of faces." << nl << endl;
278 
279  if (nFaceSets > 0)
280  {
281  if (debug&meshRefinement::MESH)
282  {
283  faceSet allSets(mesh_, "allFaceSets", allFaceSets.size());
284  forAll(allFaceSets, seti)
285  {
286  forAll(allFaceSets[seti], i)
287  {
288  allSets.insert(allFaceSets[seti][i]);
289  }
290  }
291  Pout<< "Writing all faces to be merged to set "
292  << allSets.objectPath() << endl;
293  allSets.instance() = name();
294  allSets.write();
295 
296  const_cast<Time&>(mesh_.time())++;
297  }
298 
299 
300  // Topology changes container
301  polyTopoChange meshMod(mesh_);
302 
303  // Merge all faces of a set into the first face of the set.
304  faceCombiner.setRefinement(allFaceSets, meshMod);
305 
306  // Change the mesh
307  autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(mesh_, true);
308 
309  // Update fields
310  mesh_.topoChange(map);
311 
312  // Reset the instance for if in overwrite mode
313  mesh_.setInstance(name());
314 
315  faceCombiner.topoChange(map);
316 
317  // Get the kept faces that need to be recalculated.
318  // Merging two boundary faces might shift the cell centre
319  // (unless the faces are absolutely planar)
320  labelHashSet retestFaces(2*allFaceSets.size());
321 
322  forAll(allFaceSets, seti)
323  {
324  const label oldMasterI = allFaceSets[seti][0];
325  retestFaces.insert(map().reverseFaceMap()[oldMasterI]);
326  }
327  topoChange(map, growFaceCellFace(retestFaces));
328 
329  if (debug&meshRefinement::MESH)
330  {
331  // Check sync
332  Pout<< "Checking sync after initial merging " << nFaceSets
333  << " faces." << endl;
334  checkData();
335 
336  Pout<< "Writing initial merged-faces mesh to time "
337  << name() << nl << endl;
338  write();
339  }
340 
341  for (label iteration = 0; iteration < 100; iteration++)
342  {
343  Info<< nl
344  << "Undo iteration " << iteration << nl
345  << "----------------" << endl;
346 
347 
348  // Check mesh for errors
349  // ~~~~~~~~~~~~~~~~~~~~~
350 
351  faceSet errorFaces
352  (
353  mesh_,
354  "errorFaces",
355  mesh_.nFaces()-mesh_.nInternalFaces()
356  );
357  bool hasErrors = meshCheck::checkMesh
358  (
359  false, // report
360  mesh_,
361  motionDict,
362  errorFaces
363  );
364 
365  // if (checkEdgeConnectivity)
366  //{
367  // Info<< "Checking edge-face connectivity (duplicate faces"
368  // << " or non-consecutive shared vertices)" << endl;
369  //
370  // label nOldSize = errorFaces.size();
371  //
372  // hasErrors =
373  // mesh_.checkFaceFaces
374  // (
375  // false,
376  // &errorFaces
377  // )
378  // || hasErrors;
379  //
380  // Info<< "Detected additional "
381  // << returnReduce
382  // (
383  // errorFaces.size() - nOldSize,
384  // sumOp<label>()
385  // )
386  // << " faces with illegal face-face connectivity"
387  // << endl;
388  //}
389 
390  if (!hasErrors)
391  {
392  break;
393  }
394 
395 
396  if (debug&meshRefinement::MESH)
397  {
398  errorFaces.instance() = name();
399  Pout<< "Writing all faces in error to faceSet "
400  << errorFaces.objectPath() << nl << endl;
401  errorFaces.write();
402  }
403 
404 
405  // Check any master cells for using any of the error faces
406  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
407 
408  DynamicList<label> mastersToRestore(allFaceSets.size());
409 
410  forAll(allFaceSets, seti)
411  {
412  const label masterFacei = faceCombiner.masterFace()[seti];
413 
414  if (masterFacei != -1)
415  {
416  const label masterCellII = mesh_.faceOwner()[masterFacei];
417 
418  const cell& cFaces = mesh_.cells()[masterCellII];
419 
420  forAll(cFaces, i)
421  {
422  if (errorFaces.found(cFaces[i]))
423  {
424  mastersToRestore.append(masterFacei);
425  break;
426  }
427  }
428  }
429  }
430  mastersToRestore.shrink();
431 
432  const label nRestore = returnReduce
433  (
434  mastersToRestore.size(),
435  sumOp<label>()
436  );
437 
438  Info<< "Masters that need to be restored:"
439  << nRestore << endl;
440 
441  if (debug&meshRefinement::MESH)
442  {
443  faceSet restoreSet(mesh_, "mastersToRestore", mastersToRestore);
444  restoreSet.instance() = name();
445  Pout<< "Writing all " << mastersToRestore.size()
446  << " masterfaces to be restored to set "
447  << restoreSet.objectPath() << endl;
448  restoreSet.write();
449  }
450 
451 
452  if (nRestore == 0)
453  {
454  break;
455  }
456 
457 
458  // Undo
459  // ~~~~
460 
461  if (debug)
462  {
463  const_cast<Time&>(mesh_.time())++;
464  }
465 
466  // Topology changes container
467  polyTopoChange meshMod(mesh_);
468 
469  // Merge all faces of a set into the first face of the set.
470  Map<label> restoredFaces(0);
471  faceCombiner.setUnrefinement
472  (
473  mastersToRestore,
474  meshMod,
475  restoredFaces
476  );
477 
478  // Change the mesh (without keeping old points)
479  autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(mesh_, true);
480 
481  // Update fields
482  mesh_.topoChange(map);
483 
484  // Reset the instance for if in overwrite mode
485  mesh_.setInstance(name());
486 
487  faceCombiner.topoChange(map);
488 
489  // Renumber restore maps
490  inplaceMapKey(map().reverseFaceMap(), restoredFaces);
491 
492  // Get the kept faces that need to be recalculated.
493  // Merging two boundary faces might shift the cell centre
494  // (unless the faces are absolutely planar)
495  labelHashSet retestFaces(2*restoredFaces.size());
496  forAllConstIter(Map<label>, restoredFaces, iter)
497  {
498  retestFaces.insert(iter.key());
499  }
500 
501  topoChange(map, growFaceCellFace(retestFaces));
502 
503  if (debug&meshRefinement::MESH)
504  {
505  // Check sync
506  Pout<< "Checking sync after restoring " << retestFaces.size()
507  << " faces." << endl;
508  checkData();
509 
510  Pout<< "Writing merged-faces mesh to time "
511  << name() << nl << endl;
512  write();
513  }
514 
515  Info<< endl;
516  }
517  }
518  else
519  {
520  Info<< "No faces merged ..." << endl;
521  }
522 
523  return nFaceSets;
524 }
525 
526 
527 // Remove points. pointCanBeDeleted is parallel synchronised.
529 (
530  removePoints& pointRemover,
531  const boolList& pointCanBeDeleted
532 )
533 {
534  // Topology changes container
535  polyTopoChange meshMod(mesh_);
536 
537  pointRemover.setRefinement(pointCanBeDeleted, meshMod);
538 
539  // Change the mesh
540  autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(mesh_, true);
541 
542  // Update fields
543  mesh_.topoChange(map);
544 
545  // Reset the instance for if in overwrite mode
546  mesh_.setInstance(name());
547 
548  pointRemover.topoChange(map);
549 
550 
551  // Retest all affected faces and all the cells using them
552  labelHashSet retestFaces(pointRemover.savedFaceLabels().size());
553  forAll(pointRemover.savedFaceLabels(), i)
554  {
555  const label facei = pointRemover.savedFaceLabels()[i];
556  if (facei >= 0)
557  {
558  retestFaces.insert(facei);
559  }
560  }
561  topoChange(map, growFaceCellFace(retestFaces));
562 
563  if (debug)
564  {
565  // Check sync
566  Pout<< "Checking sync after removing points." << endl;
567  checkData();
568  }
569 
570  return map;
571 }
572 
573 
575 (
576  removePoints& pointRemover,
577  const labelList& facesToRestore
578 )
579 {
580  // Topology changes container
581  polyTopoChange meshMod(mesh_);
582 
583  // Determine sets of points and faces to restore
584  labelList localFaces, localPoints;
585  pointRemover.getUnrefimentSet
586  (
587  facesToRestore,
588  localFaces,
589  localPoints
590  );
591 
592  // Undo the changes on the faces that are in error.
593  pointRemover.setUnrefinement
594  (
595  localFaces,
596  localPoints,
597  meshMod
598  );
599 
600  // Change the mesh
601  autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(mesh_, true);
602 
603  // Update fields
604  mesh_.topoChange(map);
605 
606  // Reset the instance for if in overwrite mode
607  mesh_.setInstance(name());
608 
609  pointRemover.topoChange(map);
610 
611  labelHashSet retestFaces(2*facesToRestore.size());
612  forAll(facesToRestore, i)
613  {
614  const label facei = map().reverseFaceMap()[facesToRestore[i]];
615  if (facei >= 0)
616  {
617  retestFaces.insert(facei);
618  }
619  }
620  topoChange(map, growFaceCellFace(retestFaces));
621 
622  if (debug)
623  {
624  // Check sync
625  Pout<< "Checking sync after restoring points on "
626  << facesToRestore.size() << " faces." << endl;
627  checkData();
628  }
629 
630  return map;
631 }
632 
633 
634 // Collect all faces that are both in candidateFaces and in the set.
635 // If coupled face also collects the coupled face.
637 (
638  const labelList& candidateFaces,
639  const labelHashSet& set
640 ) const
641 {
642  // Has face been selected?
643  boolList selected(mesh_.nFaces(), false);
644 
645  forAll(candidateFaces, i)
646  {
647  const label facei = candidateFaces[i];
648 
649  if (set.found(facei))
650  {
651  selected[facei] = true;
652  }
653  }
655  (
656  mesh_,
657  selected,
658  orEqOp<bool>() // combine operator
659  );
660 
661  labelList selectedFaces(findIndices(selected, true));
662 
663  return selectedFaces;
664 }
665 
666 
667 // Pick up faces of cells of faces in set.
669 (
670  const labelHashSet& set
671 ) const
672 {
673  boolList selected(mesh_.nFaces(), false);
674 
675  forAllConstIter(faceSet, set, iter)
676  {
677  const label facei = iter.key();
678  const label own = mesh_.faceOwner()[facei];
679 
680  const cell& ownFaces = mesh_.cells()[own];
681  forAll(ownFaces, ownFacei)
682  {
683  selected[ownFaces[ownFacei]] = true;
684  }
685 
686  if (mesh_.isInternalFace(facei))
687  {
688  const label nbr = mesh_.faceNeighbour()[facei];
689 
690  const cell& nbrFaces = mesh_.cells()[nbr];
691  forAll(nbrFaces, nbrFacei)
692  {
693  selected[nbrFaces[nbrFacei]] = true;
694  }
695  }
696  }
698  (
699  mesh_,
700  selected,
701  orEqOp<bool>() // combine operator
702  );
703  return findIndices(selected, true);
704 }
705 
706 
707 // Remove points not used by any face or points used by only two faces where
708 // the edges are in line
710 (
711  const scalar minCos,
712  const dictionary& motionDict
713 )
714 {
715  Info<< nl
716  << "Merging all points on surface that" << nl
717  << "- are used by only two boundary faces and" << nl
718  << "- make an angle with a cosine of more than " << minCos
719  << "." << nl << endl;
720 
721  // Point removal analysis engine with undo
722  removePoints pointRemover(mesh_, true);
723 
724  // Count usage of points
725  boolList pointCanBeDeleted;
726  label nRemove = pointRemover.countPointUsage(minCos, pointCanBeDeleted);
727 
728  if (nRemove > 0)
729  {
730  Info<< "Removing " << nRemove
731  << " straight edge points ..." << nl << endl;
732 
733  // Remove points
734  // ~~~~~~~~~~~~~
735 
736  doRemovePoints(pointRemover, pointCanBeDeleted);
737 
738 
739  for (label iteration = 0; iteration < 100; iteration++)
740  {
741  Info<< nl
742  << "Undo iteration " << iteration << nl
743  << "----------------" << endl;
744 
745 
746  // Check mesh for errors
747  // ~~~~~~~~~~~~~~~~~~~~~
748 
749  faceSet errorFaces
750  (
751  mesh_,
752  "errorFaces",
753  mesh_.nFaces()-mesh_.nInternalFaces()
754  );
755  bool hasErrors = meshCheck::checkMesh
756  (
757  false, // report
758  mesh_,
759  motionDict,
760  errorFaces
761  );
762  // if (checkEdgeConnectivity)
763  //{
764  // Info<< "Checking edge-face connectivity (duplicate faces"
765  // << " or non-consecutive shared vertices)" << endl;
766  //
767  // label nOldSize = errorFaces.size();
768  //
769  // hasErrors =
770  // mesh_.checkFaceFaces
771  // (
772  // false,
773  // &errorFaces
774  // )
775  // || hasErrors;
776  //
777  // Info<< "Detected additional "
778  // << returnReduce(errorFaces.size()-nOldSize,sumOp<label>())
779  // << " faces with illegal face-face connectivity"
780  // << endl;
781  //}
782 
783  if (!hasErrors)
784  {
785  break;
786  }
787 
788  if (debug&meshRefinement::MESH)
789  {
790  errorFaces.instance() = name();
791  Pout<< "**Writing all faces in error to faceSet "
792  << errorFaces.objectPath() << nl << endl;
793  errorFaces.write();
794  }
795 
796  labelList masterErrorFaces
797  (
798  collectFaces
799  (
800  pointRemover.savedFaceLabels(),
801  errorFaces
802  )
803  );
804 
805  const label n = returnReduce
806  (
807  masterErrorFaces.size(),
808  sumOp<label>()
809  );
810 
811  Info<< "Detected " << n
812  << " error faces on boundaries that have been merged."
813  << " These will be restored to their original faces." << nl
814  << endl;
815 
816  if (n == 0)
817  {
818  if (hasErrors)
819  {
820  Info<< "Detected "
821  << returnReduce(errorFaces.size(), sumOp<label>())
822  << " error faces in mesh."
823  << " Restoring neighbours of faces in error." << nl
824  << endl;
825 
826  labelList expandedErrorFaces
827  (
828  growFaceCellFace
829  (
830  errorFaces
831  )
832  );
833 
834  doRestorePoints(pointRemover, expandedErrorFaces);
835  }
836 
837  break;
838  }
839 
840  doRestorePoints(pointRemover, masterErrorFaces);
841  }
842 
843  if (debug&meshRefinement::MESH)
844  {
845  const_cast<Time&>(mesh_.time())++;
846  Pout<< "Writing merged-edges mesh to time "
847  << name() << nl << endl;
848  write();
849  }
850  }
851  else
852  {
853  Info<< "No straight edges simplified and no points removed ..." << endl;
854  }
855 
856  return nRemove;
857 }
858 
859 
860 // ************************************************************************* //
label n
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:492
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Definition: DynamicListI.H:296
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
Definition: DynamicListI.H:252
bool insert(const Key &key)
Insert a new entry.
Definition: HashSet.H:109
label size() const
Return number of elements in table.
Definition: HashTableI.H:65
bool found(const Key &) const
Return true if hashedEntry is found in table.
Definition: HashTable.C:138
fileName & instance() const
Return the instance directory, constant, system, <time> etc.
Definition: IOobject.C:352
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
void setSize(const label)
Reset size of List.
Definition: List.C:281
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A cell is defined as a list of faces with extra functionality.
Definition: cell.H:60
Combines boundary faces into single face. The faces get the patch of the first face ('the master')
Definition: combineFaces.H:56
labelListList getMergeSets(const scalar featureCos, const scalar minConcaveCos, const labelHashSet &patchIDs, const labelHashSet &boundaryCells) const
Extract lists of all (non-coupled) boundary faces on selected.
Definition: combineFaces.C:300
void setRefinement(const labelListList &faceSets, polyTopoChange &meshMod)
Play commands into polyTopoChange to combine faces. Gets.
Definition: combineFaces.C:558
void setUnrefinement(const labelList &masterFaces, polyTopoChange &meshMod, Map< label > &restoredFaces)
Play commands into polyTopoChange to reinsert original faces.
Definition: combineFaces.C:815
void topoChange(const polyTopoChangeMap &map)
Force recalculation of locally stored data on topological change.
Definition: combineFaces.C:766
const labelList & masterFace() const
If undoable: master face for every set.
Definition: combineFaces.H:136
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
A list of face labels.
Definition: faceSet.H:51
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:433
virtual void topoChange(const polyTopoChangeMap &map)
Update mesh corresponding to the given map.
Definition: fvMesh.C:1335
autoPtr< polyTopoChangeMap > doRestorePoints(removePoints &pointRemover, const labelList &facesToRestore)
label mergeEdgesUndo(const scalar minCos, const dictionary &motionDict)
Merge edges, maintain mesh quality. Return global number.
void checkData()
Debugging: check that all faces still obey start()>end()
void topoChange(const polyTopoChangeMap &, const labelList &changedFaces)
Update for external change to mesh. changedFaces are in new mesh.
word name() const
Replacement for Time::name() : return oldInstance (if.
label mergePatchFacesUndo(const scalar minCos, const scalar concaveCos, const labelHashSet &patchIDs, const dictionary &motionDict, const labelList &preserveFaces)
Merge coplanar faces. preserveFaces is != -1 for faces.
autoPtr< polyTopoChangeMap > doRemovePoints(removePoints &pointRemover, const boolList &pointCanBeDeleted)
labelList collectFaces(const labelList &candidateFaces, const labelHashSet &set) const
bool write() const
Write mesh and all data.
labelList growFaceCellFace(const labelHashSet &set) const
virtual const labelList & faceOwner() const
Return face owner.
Definition: polyMesh.C:1321
void setInstance(const fileName &)
Set the instance for mesh files.
Definition: polyMeshIO.C:102
Direct mesh changes based on v1.3 polyTopoChange syntax.
autoPtr< polyTopoChangeMap > changeMesh(polyMesh &mesh, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
label nInternalFaces() const
const cellList & cells() const
label nFaces() const
fileName objectPath() const
Return complete path + object name.
Definition: regIOobject.H:155
virtual bool write(const bool write=true) const
Write using setting from DB.
Removes selected points from mesh and updates faces using these points.
Definition: removePoints.H:59
label countPointUsage(const scalar minCos, boolList &pointCanBeDeleted) const
Mark in pointCanBeDeleted the points that can be deleted.
Definition: removePoints.C:125
void setUnrefinement(const labelList &localFaces, const labelList &localPoints, polyTopoChange &)
Restore selected faces and vertices.
Definition: removePoints.C:750
void topoChange(const polyTopoChangeMap &)
Force recalculation of locally stored data on topological change.
Definition: removePoints.C:436
void setRefinement(const boolList &, polyTopoChange &)
Play commands into polyTopoChange to remove points. Gets.
Definition: removePoints.C:276
const labelList & savedFaceLabels() const
If undoable: affected face labels. Already restored faces.
Definition: removePoints.H:111
void getUnrefimentSet(const labelList &undoFaces, labelList &localFaces, labelList &localPoints) const
Given set of faces to restore calculates a consistent set of.
Definition: removePoints.C:538
static void syncFaceList(const polyMesh &mesh, UList< T > &l, const CombineOp &cop)
Synchronise values on all mesh faces.
Definition: syncTools.H:387
Functions for checking mesh topology and geometry.
bool checkMesh(const bool report, const polyMesh &mesh, const dictionary &dict, const labelList &checkFaces, const List< labelPair > &baffles, labelHashSet &wrongFaces)
Check (subset of mesh including baffles) with mesh settings in dict.
Definition: checkMesh.C:33
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:288
labelList findIndices(const ListType &, typename ListType::const_reference, const label start=0)
Find all occurrences of given element. Linear search.
void inplaceMapKey(const labelUList &oldToNew, Container &)
Recreate with mapped keys. Do not map elements with negative key.
messageStream Info
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
prefixOSstream Pout(cout, "Pout")
Definition: IOstreams.H:53
static const char nl
Definition: Ostream.H:297