subsetMesh.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-2016 OpenFOAM Foundation
9 Copyright (C) 2016-2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Application
28 subsetMesh
29
30Group
31 grpMeshManipulationUtilities
32
33Description
34 Create a mesh subset for a particular region of interest based on a
35 cellSet or cellZone.
36
37 See setSet/topoSet utilities on how to define select cells based on
38 various shapes.
39
40 Will subset all points, faces and cells needed to make a sub-mesh,
41 but not preserve attached boundary types.
42
43\*---------------------------------------------------------------------------*/
44
45#include "fvMeshSubsetter.H" // Not fvMeshSubset (need two-step subsetting)
46#include "argList.H"
47#include "IOobjectList.H"
48#include "volFields.H"
49#include "topoDistanceData.H"
50#include "FaceCellWave.H"
51#include "cellSet.H"
52#include "faceSet.H"
53#include "pointSet.H"
54#include "ReadFields.H"
55#include "processorMeshes.H"
56
57using namespace Foam;
58
59// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60
61// Get the exposed patchId or define the exposedPatchName in fvMeshSubset
62label getExposedPatchId(const polyMesh& mesh, const word& patchName)
63{
64 const label patchId = mesh.boundaryMesh().findPatchID(patchName);
65
66 if (patchId == -1)
67 {
68 fvMeshSubset::exposedPatchName = patchName;
69 }
70
71 Info<< "Adding exposed internal faces to "
72 << (patchId == -1 ? "new" : "existing")
73 << " patch \"" << patchName << "\"" << nl << endl;
74
75 return patchId;
76}
77
78
79labelList nearestPatch(const polyMesh& mesh, const labelList& patchIDs)
80{
81 const polyBoundaryMesh& pbm = mesh.boundaryMesh();
82
83 // Count number of faces in exposedPatchIDs
84 label nFaces = 0;
85 for (const label patchi : patchIDs)
86 {
87 nFaces += pbm[patchi].size();
88 }
89
90 // Field on cells and faces.
91 List<topoDistanceData<label>> cellData(mesh.nCells());
92 List<topoDistanceData<label>> faceData(mesh.nFaces());
93
94 // Start of changes
95 labelList patchFaces(nFaces);
97 nFaces = 0;
98 for (const label patchi : patchIDs)
99 {
100 const polyPatch& pp = pbm[patchi];
101
102 forAll(pp, i)
103 {
104 patchFaces[nFaces] = pp.start()+i;
105 patchData[nFaces] = topoDistanceData<label>(0, patchi);
106 ++nFaces;
107 }
108 }
109
110 // Propagate information inwards
112 (
113 mesh,
114 patchFaces,
115 patchData,
116 faceData,
117 cellData,
118 mesh.globalData().nTotalCells()+1
119 );
120
121 // And extract
122
123 labelList nearest(mesh.nFaces());
124
125 bool haveWarned = false;
126 forAll(faceData, faceI)
127 {
128 if (!faceData[faceI].valid(deltaCalc.data()))
129 {
130 if (!haveWarned)
131 {
133 << "Did not visit some faces, e.g. face " << faceI
134 << " at " << mesh.faceCentres()[faceI] << nl
135 << "Using patch " << patchIDs[0] << " as nearest"
136 << endl;
137 haveWarned = true;
138 }
139 nearest[faceI] = patchIDs[0];
140 }
141 else
142 {
143 nearest[faceI] = faceData[faceI].data();
144 }
145 }
146
147 return nearest;
148}
149
150
151//
152// Subset field-type, availability information cached
153// in the availableFields hashtable.
154//
155template<class Type, template<class> class PatchField, class GeoMesh>
156void subsetFields
157(
158 const fvMeshSubset& subsetter,
159 HashTable<wordHashSet>& availableFields,
161)
162{
164 const word fieldType = FieldType::typeName;
165
166 const wordList fieldNames = availableFields(fieldType).sortedToc();
167 subFields.setSize(fieldNames.size());
168
169 const fvMesh& baseMesh = subsetter.baseMesh();
170
171 label nFields = 0;
172 for (const word& fieldName : fieldNames)
173 {
174 if (!nFields)
175 {
176 Info<< "Subsetting " << fieldType << " (";
177 }
178 else
179 {
180 Info<< ' ';
181 }
182 Info<< fieldName;
183
184 FieldType fld
185 (
187 (
188 fieldName,
189 baseMesh.time().timeName(),
190 baseMesh,
191 IOobject::MUST_READ,
192 IOobject::NO_WRITE
193 ),
194 baseMesh
195 );
196
197 subFields.set(nFields, subsetter.interpolate(fld));
198
199 // Subsetting adds 'subset' prefix - rename to match original.
200 subFields[nFields].rename(fieldName);
201
202 ++nFields;
203 }
204
205 if (nFields)
206 {
207 Info<< ')' << nl;
208 }
209}
210
211
212template<class Type>
213void subsetPointFields
214(
215 const fvMeshSubset& subsetter,
216 const pointMesh& pMesh,
217 HashTable<wordHashSet>& availableFields,
219)
220{
222 const word fieldType = FieldType::typeName;
223
224 const wordList fieldNames = availableFields(fieldType).sortedToc();
225 subFields.setSize(fieldNames.size());
226
227 const fvMesh& baseMesh = subsetter.baseMesh();
228
229 label nFields = 0;
230 for (const word& fieldName : fieldNames)
231 {
232 if (!nFields)
233 {
234 Info<< "Subsetting " << fieldType << " (";
235 }
236 else
237 {
238 Info<< ' ';
239 }
240 Info<< fieldName;
241
242 FieldType fld
243 (
245 (
246 fieldName,
247 baseMesh.time().timeName(),
248 baseMesh,
249 IOobject::MUST_READ,
250 IOobject::NO_WRITE
251 ),
252 pMesh
253 );
254
255 subFields.set(nFields, subsetter.interpolate(fld));
256
257 // Subsetting adds 'subset' prefix - rename to match original.
258 subFields[nFields].rename(fieldName);
259
260 ++nFields;
261 }
262
263 if (nFields)
264 {
265 Info<< ')' << nl;
266 }
267}
268
269
270template<class Type>
271void subsetDimensionedFields
272(
273 const fvMeshSubset& subsetter,
274 HashTable<wordHashSet>& availableFields,
276)
277{
278 typedef DimensionedField<Type, volMesh> FieldType;
279 const word fieldType = FieldType::typeName;
280
281 const wordList fieldNames = availableFields(fieldType).sortedToc();
282 subFields.setSize(fieldNames.size());
283
284 const fvMesh& baseMesh = subsetter.baseMesh();
285
286 label nFields = 0;
287 for (const word& fieldName : fieldNames)
288 {
289 if (!nFields)
290 {
291 Info<< "Subsetting " << fieldType << " (";
292 }
293 else
294 {
295 Info<< ' ';
296 }
297 Info<< fieldName;
298
299 FieldType fld
300 (
302 (
303 fieldName,
304 baseMesh.time().timeName(),
305 baseMesh,
306 IOobject::MUST_READ,
307 IOobject::NO_WRITE
308 ),
309 baseMesh
310 );
311
312 subFields.set(nFields, subsetter.interpolate(fld));
313
314 // Subsetting adds 'subset' prefix - rename to match original.
315 subFields[nFields].rename(fieldName);
316
317 ++nFields;
318 }
319
320 if (nFields)
321 {
322 Info<< ')' << nl;
323 }
324}
325
326
327template<class TopoSet>
328void subsetTopoSets
329(
330 const fvMesh& mesh,
331 const IOobjectList& objects,
332 const labelList& map,
333 const fvMesh& subMesh,
334 PtrList<TopoSet>& subSets
335)
336{
337 // Read original sets
338 PtrList<TopoSet> sets;
339 ReadFields<TopoSet>(objects, sets);
340
341 subSets.setSize(sets.size());
342 forAll(sets, seti)
343 {
344 const TopoSet& set = sets[seti];
345
346 Info<< "Subsetting " << set.type() << " " << set.name() << endl;
347
348 labelHashSet subset(2*min(set.size(), map.size()));
349
350 forAll(map, i)
351 {
352 if (set.found(map[i]))
353 {
354 subset.insert(i);
355 }
356 }
357
358 subSets.set
359 (
360 seti,
361 new TopoSet
362 (
363 subMesh,
364 set.name(),
365 std::move(subset),
366 IOobject::AUTO_WRITE
367 )
368 );
369 }
370}
371
372
373
374int main(int argc, char *argv[])
375{
376 argList::addNote
377 (
378 "Create a mesh subset for a particular region of interest based on a"
379 " cellSet or cellZone(s) specified as the first command argument.\n"
380 "See setSet/topoSet utilities on how to select cells based on"
381 " various shapes."
382 );
383
384 #include "addOverwriteOption.H"
385 #include "addRegionOption.H"
386 argList::addArgument
387 (
388 "cell-selection",
389 "The cellSet name, but with the -zone option this is interpreted"
390 " to be a cellZone selection by name(s) or regex.\n"
391 "Eg 'mixer' or '( mixer \"moving.*\" )'"
392 );
393
394 argList::addOption
395 (
396 "patch",
397 "name",
398 "Add exposed internal faces to specified patch"
399 " instead of \"oldInternalFaces\""
400 );
401 argList::addOption
402 (
403 "patches",
404 "wordRes",
405 "Add exposed internal faces to closest of specified patches"
406 " instead of \"oldInternalFaces\""
407 );
408 argList::addBoolOption
409 (
410 "zone",
411 "Subset with cellZone(s) instead of cellSet."
412 " The command argument may be a list of words or regexs"
413 );
414 argList::addOption
415 (
416 "resultTime",
417 "time",
418 "Specify a time for the resulting mesh"
419 );
420
421 argList::noFunctionObjects(); // Never use function objects
422
423 #include "setRootCase.H"
424 #include "createTime.H"
425
426 #include "createNamedMesh.H"
427
428 // arg[1] = word (cellSet) or wordRes (cellZone)
429 // const word selectionName = args[1];
430
431 word meshInstance = mesh.pointsInstance();
432 word fieldsInstance = runTime.timeName();
433
434 const bool useCellZone = args.found("zone");
435 const bool overwrite = args.found("overwrite");
436 const bool specifiedInstance = args.readIfPresent
437 (
438 "resultTime",
439 fieldsInstance
440 );
441 if (specifiedInstance)
442 {
443 // Set both mesh and field to this time
444 meshInstance = fieldsInstance;
445 }
446
447
448 // Default exposed patch id
449 labelList exposedPatchIDs(one{}, -1);
450
451 if (args.found("patches"))
452 {
453 const wordRes patchNames(args.getList<wordRe>("patches"));
454
455 if (patchNames.size() == 1 && patchNames.first().isLiteral())
456 {
457 exposedPatchIDs.first() =
458 getExposedPatchId(mesh, patchNames.first());
459 }
460 else
461 {
462 exposedPatchIDs =
463 mesh.boundaryMesh().patchSet(patchNames).sortedToc();
464
465 Info<< "Adding exposed internal faces to nearest of patches "
466 << flatOutput(patchNames) << nl << endl;
467
468 if (exposedPatchIDs.empty())
469 {
471 << nl << "No patches matched. Patches: "
472 << mesh.boundaryMesh().names() << nl
473 << exit(FatalError);
474 }
475 }
476 }
477 else if (args.found("patch"))
478 {
479 exposedPatchIDs.first() =
480 getExposedPatchId(mesh, args.get<word>("patch"));
481 }
482 else
483 {
484 Info<< "Adding exposed internal faces to patch \""
485 << fvMeshSubset::exposedPatchName
486 << "\" (created if necessary)" << nl
487 << nl;
488 }
489
490
491 autoPtr<cellSet> cellSetPtr;
492
493 // arg[1] can be a word (for cellSet) or wordRes (for cellZone)
494
495 wordRes zoneNames;
496 if (useCellZone)
497 {
498 wordRes selectionNames(args.getList<wordRe>(1));
499 zoneNames.transfer(selectionNames);
500
501 Info<< "Using cellZone " << flatOutput(zoneNames) << nl << endl;
502
503 if (mesh.cellZones().findIndex(zoneNames) == -1)
504 {
506 << "No cellZones found: " << flatOutput(zoneNames) << nl << nl
507 << exit(FatalError);
508 }
509 }
510 else
511 {
512 const word selectionName = args[1];
513
514 Info<< "Using cellSet " << selectionName << nl << endl;
515
516 cellSetPtr = autoPtr<cellSet>::New(mesh, selectionName);
517 }
518
519
520 // Two-step mesh subsetting engine
521 fvMeshSubsetter subsetter(mesh);
522
523 {
524 bitSet selectedCells =
525 (
526 cellSetPtr
527 ? BitSetOps::create(mesh.nCells(), *cellSetPtr)
528 : mesh.cellZones().selection(zoneNames)
529 );
530
531 if (exposedPatchIDs.size() == 1)
532 {
533 // Single patch for exposed faces (syncPar)
534 subsetter.reset(selectedCells, exposedPatchIDs.first(), true);
535 }
536 else
537 {
538 // The nearest patch per face
539 labelList nearestExposedPatch(nearestPatch(mesh, exposedPatchIDs));
540
541 labelList exposedFaces
542 (
543 subsetter.getExposedFaces(selectedCells, true) // syncPar
544 );
545
546 subsetter.setCellSubset
547 (
548 selectedCells,
549 exposedFaces,
550 labelUIndList(nearestExposedPatch, exposedFaces)(),
551 true // syncPar
552 );
553 }
554
555 Info<< "Subset "
556 << returnReduce(subsetter.subMesh().nCells(), sumOp<label>())
557 << " of "
558 << returnReduce(mesh.nCells(), sumOp<label>())
559 << " cells" << nl << nl;
560 }
561
562
563 IOobjectList objects(mesh, runTime.timeName());
564 HashTable<wordHashSet> availableFields = objects.classes();
565
566
567 // Read vol fields and subset
568 // ~~~~~~~~~~~~~~~~~~~~~~~~~~
569
570 PtrList<volScalarField> vScalarFlds;
571 subsetFields(subsetter, availableFields, vScalarFlds);
572
573 PtrList<volVectorField> vVectorFlds;
574 subsetFields(subsetter, availableFields, vVectorFlds);
575
577 subsetFields(subsetter, availableFields, vSphTensorFlds);
578
579 PtrList<volSymmTensorField> vSymmTensorFlds;
580 subsetFields(subsetter, availableFields, vSymmTensorFlds);
581
582 PtrList<volTensorField> vTensorFlds;
583 subsetFields(subsetter, availableFields, vTensorFlds);
584
585
586 // Read surface fields and subset
587 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
588
589 PtrList<surfaceScalarField> sScalarFlds;
590 subsetFields(subsetter, availableFields, sScalarFlds);
591
592 PtrList<surfaceVectorField> sVectorFlds;
593 subsetFields(subsetter, availableFields, sVectorFlds);
594
596 subsetFields(subsetter, availableFields, sSphTensorFlds);
597
598 PtrList<surfaceSymmTensorField> sSymmTensorFlds;
599 subsetFields(subsetter, availableFields, sSymmTensorFlds);
600
601 PtrList<surfaceTensorField> sTensorFlds;
602 subsetFields(subsetter, availableFields, sTensorFlds);
603
604
605 // Read point fields and subset
606 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
607
608 const pointMesh& pMesh = pointMesh::New(mesh);
609
610 PtrList<pointScalarField> pScalarFlds;
611 subsetPointFields(subsetter, pMesh, availableFields, pScalarFlds);
612
613 PtrList<pointVectorField> pVectorFlds;
614 subsetPointFields(subsetter, pMesh, availableFields, pVectorFlds);
615
617 subsetPointFields(subsetter, pMesh, availableFields, pSphTensorFlds);
618
619 PtrList<pointSymmTensorField> pSymmTensorFlds;
620 subsetPointFields(subsetter, pMesh, availableFields, pSymmTensorFlds);
621
622 PtrList<pointTensorField> pTensorFlds;
623 subsetPointFields(subsetter, pMesh, availableFields, pTensorFlds);
624
625
626 // Read dimensioned fields and subset
627 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
628
630 subsetDimensionedFields(subsetter, availableFields, dScalarFlds);
631
633 subsetDimensionedFields(subsetter, availableFields, dVectorFlds);
634
636 subsetDimensionedFields(subsetter, availableFields, dSphTensorFlds);
637
639 subsetDimensionedFields(subsetter, availableFields, dSymmTensorFlds);
640
642 subsetDimensionedFields(subsetter, availableFields, dTensorFlds);
643
644
645 // Read topoSets and subset
646 // ~~~~~~~~~~~~~~~~~~~~~~~~
647
648 PtrList<cellSet> cellSets;
649 PtrList<faceSet> faceSets;
650 PtrList<pointSet> pointSets;
651
652 {
653 IOobjectList objects(mesh, mesh.facesInstance(), "polyMesh/sets");
654 if (cellSetPtr)
655 {
656 objects.remove(*cellSetPtr);
657 }
658 subsetTopoSets
659 (
660 mesh,
661 objects,
662 subsetter.cellMap(),
663 subsetter.subMesh(),
664 cellSets
665 );
666 subsetTopoSets
667 (
668 mesh,
669 objects,
670 subsetter.faceMap(),
671 subsetter.subMesh(),
672 faceSets
673 );
674 subsetTopoSets
675 (
676 mesh,
677 objects,
678 subsetter.pointMap(),
679 subsetter.subMesh(),
680 pointSets
681 );
682 }
683
684
685 // Write mesh and fields to new time
686 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
687
688 if (overwrite || specifiedInstance)
689 {
690 runTime.setTime(instant(fieldsInstance), 0);
691 subsetter.subMesh().setInstance(meshInstance);
692 topoSet::setInstance(meshInstance, cellSets);
693 topoSet::setInstance(meshInstance, faceSets);
694 topoSet::setInstance(meshInstance, pointSets);
695 }
696 else
697 {
698 ++runTime;
699 subsetter.subMesh().setInstance(runTime.timeName());
700 }
701
702 Info<< "Writing subsetted mesh and fields to time " << runTime.timeName()
703 << endl;
704 subsetter.subMesh().write();
705 processorMeshes::removeFiles(subsetter.subMesh());
706
707
708 // Volume fields
709 for (const auto& fld : vScalarFlds) { fld.write(); }
710 for (const auto& fld : vVectorFlds) { fld.write(); }
711 for (const auto& fld : vSphTensorFlds) { fld.write(); }
712 for (const auto& fld : vSymmTensorFlds) { fld.write(); }
713 for (const auto& fld : vTensorFlds) { fld.write(); }
714
715 // Surface fields
716 for (const auto& fld : sScalarFlds) { fld.write(); }
717 for (const auto& fld : sVectorFlds) { fld.write(); }
718 for (const auto& fld : sSphTensorFlds) { fld.write(); }
719 for (const auto& fld : sSymmTensorFlds) { fld.write(); }
720 for (const auto& fld : sTensorFlds) { fld.write(); }
721
722 // Point fields
723 for (const auto& fld : pScalarFlds) { fld.write(); }
724 for (const auto& fld : pVectorFlds) { fld.write(); }
725 for (const auto& fld : pSphTensorFlds) { fld.write(); }
726 for (const auto& fld : pSymmTensorFlds) { fld.write(); }
727 for (const auto& fld : pTensorFlds) { fld.write(); }
728
729 // Dimensioned fields
730 for (const auto& fld : dScalarFlds) { fld.write(); }
731 for (const auto& fld : dVectorFlds) { fld.write(); }
732 for (const auto& fld : dSphTensorFlds) { fld.write(); }
733 for (const auto& fld : dSymmTensorFlds) { fld.write(); }
734 for (const auto& fld : dTensorFlds) { fld.write(); }
735
736 Info<< "\nEnd\n" << endl;
737
738 return 0;
739}
740
741
742// ************************************************************************* //
Field reading functions for post-processing utilities.
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Wave propagation of information through grid. Every iteration information goes through one layer of c...
Definition: FaceCellWave.H:81
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition: GeoMesh.H:49
Generic GeometricField class.
A HashTable similar to std::unordered_map.
Definition: HashTable.H:123
List< Key > sortedToc() const
The table of contents (the keys) in sorted order.
Definition: HashTable.C:137
List of IOobjects with searching and retrieving facilities.
Definition: IOobjectList.H:59
HashTable< wordHashSet > classes() const
A summary hash of classes used and their associated object names.
Definition: IOobjectList.C:320
bool remove(const IOobject &io)
Remove IOobject from the list.
Definition: IOobjectList.C:259
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
void transfer(List< T > &list)
Definition: List.C:447
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
const T * set(const label i) const
Definition: PtrList.H:138
void setSize(const label newLen)
Same as resize()
Definition: PtrList.H:151
static word timeName(const scalar t, const int precision=precision_)
Definition: Time.C:780
A List with indirect addressing. Like IndirectList but does not store addressing.
Definition: IndirectList.H:79
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
label size() const noexcept
The number of elements in the list.
Definition: UPtrListI.H:106
T get(const label index) const
Get a value from the argument at index.
Definition: argListI.H:278
bool found(const word &optName) const
Return true if the named option is found.
Definition: argListI.H:178
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
Definition: argListI.H:323
List< T > getList(const label index) const
Get a List of values from the argument at index.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:66
Holds a reference to the original mesh (the baseMesh) and optionally to a subset of that mesh (the su...
Definition: fvMeshSubset.H:80
const fvMesh & baseMesh() const noexcept
Original mesh.
Definition: fvMeshSubsetI.H:30
const labelList & faceMap() const
Return face map.
Definition: fvMeshSubsetI.H:72
const labelList & cellMap() const
Return cell map.
Definition: fvMeshSubsetI.H:91
void setCellSubset(const bitSet &selectedCells, const label patchID=-1, const bool syncPar=true)
Use the specified subset of cells. Same as reset()
Definition: fvMeshSubset.H:295
static tmp< DimensionedField< Type, volMesh > > interpolate(const DimensionedField< Type, volMesh > &, const fvMesh &sMesh, const labelUList &cellMap)
Map volume internal (dimensioned) field.
const fvMesh & subMesh() const
Return reference to subset mesh.
Definition: fvMeshSubsetI.H:48
const labelList & pointMap() const
Return point map.
Definition: fvMeshSubsetI.H:64
void reset()
Reset subMesh and all maps. Same as clear()
Definition: fvMeshSubset.C:493
Extends Foam::fvMeshSubset with two-step subsetting (uses polyTopoChange modification).
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
virtual bool write(const bool valid=true) const
Write mesh using IO settings from time.
Definition: fvMesh.C:1079
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:290
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name.
Definition: instant.H:56
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
Definition: one.H:62
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:55
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
void setInstance(const fileName &instance, const IOobject::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
Definition: polyMeshIO.C:36
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:75
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:364
label nCells() const noexcept
Number of mesh cells.
For use with FaceCellWave. Determines topological distance to starting faces. Templated on passive tr...
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
Definition: wordRe.H:83
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:54
A class for handling words, derived from Foam::string.
Definition: word.H:68
dynamicFvMesh & mesh
engineTime & runTime
Required Variables.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
const labelList nFaces(UPstream::listGatherValues< label >(aMesh.nFaces()))
label patchId(-1)
#define WarningInFunction
Report a warning using Foam::Warning.
void set(List< bool > &bools, const labelUList &locations)
Set the listed locations (assign 'true').
Definition: BitOps.C:38
Namespace for OpenFOAM.
messageStream Info
Information stream (stdout output on master, null elsewhere)
List< T > subset(const BoolListType &select, const UList< T > &input, const bool invert=false)
Extract elements of the input list when select is true.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
Definition: FlatOutput.H:215
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53
wordList patchNames(nPatches)
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333