nearPatchCells_zoneGenerator.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) 2025-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 
27 #include "patchDistWave.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34  namespace zoneGenerators
35  {
38  (
42  );
43  }
44 }
45 
46 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
47 
49 (
50  const word& name,
51  const polyMesh& mesh,
52  const dictionary& dict
53 )
54 :
56  patchSet_(mesh.boundary().patchSet(dict)),
57  distance_(dict.lookup<scalar>("distance", dimLength))
58 {}
59 
60 
61 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
62 
64 {}
65 
66 
67 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
68 
70 {
71  scalarField cellWallDistance(mesh_.nCells());
72 
73  patchDistWave::calculate(mesh_, patchSet_, cellWallDistance);
74 
75  return zoneSet
76  (
77  new cellZone
78  (
79  zoneName_,
81  (
82  cellWallDistance,
83  [&](const scalar d)
84  {
85  return d <= distance_;
86  }
87  ),
88  mesh_.cellZones(),
89  moveUpdate_,
90  true
91  )
92  );
93 }
94 
95 
96 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Named list of cell indices representing a sub-set of the mesh.
Definition: cellZone.H:61
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:78
A class for handling words, derived from string.
Definition: word.H:63
Abstract base class for all zoneGenerators, providing runtime selection.
Definition: zoneGenerator.H:57
A zoneGenerator which looks-up and returns a zoneSet containing point, and/or cell and/or faces zones...
Definition: lookup.H:139
A zoneGenerator which constructs a cellZone of the cells within a distance from a set of patches.
virtual zoneSet generate() const
Generate and return the zoneSet.
nearPatchCells(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
Zone container returned by zoneGenerator::generate.
Definition: zoneSet.H:94
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
label calculate(const polyMesh &mesh, const labelHashSet &patchIDs, scalarField &cellDistance)
Calculate distance data from patches.
defineTypeNameAndDebug(cylinderHeadPoints, 0)
addToRunTimeSelectionTable(zoneGenerator, cylinderHeadPoints, dictionary)
Namespace for OpenFOAM.
labelList selectIndices(const ListType &, const BoolOp &bop, const label start=0)
Select all occurrences given a boolean critera. Linear search.
const dimensionSet & dimLength
Definition: dimensions.C:141
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
faceListList boundary(nPatches)
dictionary dict