intersection.H
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 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 Class
25  Foam::zoneGenerators::intersection
26 
27 Description
28  A zoneGenerator which selects the elements which are in all the zones
29  generated by the given list of zoneGenerators
30 
31  An intersection of faceZones is oriented if any of the faceZones combined
32  are oriented, otherwise the returned faceZone is unoriented.
33 
34 Usage
35  \table
36  Property | Description | Required | Default value
37  type | Type: intersection | yes |
38  name | Name of the zone | no | zoneGenerator name
39  zoneType | Type of zone | no | all the zone types
40  moveUpdate | Switch to update after mesh motion | no | false
41  \endtable
42  These options are followed by a list of any number of zoneGenerators
43  which can either generate the zones locally or return zones from the lists
44  of zones held by the mesh using the zoneGenerators::lookup zoneGenerator.
45 
46  Each zoneGenerator returns a zoneSet containing a pointZone and/or a
47  cellZone and/or a faceZone, the zoneGenerators::intersection operation
48  combines each of the zone types unless the \c zoneType is specified in which
49  case only the zones of that type are combined.
50 
51  A cellZone named \c coneAnnulus containing the cells with centres inside the
52  intersection of the predefined \c cone1 cellZone which is looked-up from the
53  cellZoneList and are also inside the locally defined annulus is be
54  generated by
55  \verbatim
56  coneAnnulus
57  {
58  type intersection;
59 
60  cone1;
61 
62  annulus1
63  {
64  type annulus;
65  zoneType cell;
66 
67  point1 (-0.0075 0 -1);
68  point2 (-0.003 0.0025 1);
69  outerRadius 0.002;
70  innerRadius 0.001;
71  }
72  }
73  \endverbatim
74 
75 See also
76  zoneGenerators::Union
77  zoneGenerators::difference
78  zoneGeneratorList
79 
80 SourceFiles
81  intersection.C
82 
83 \*---------------------------------------------------------------------------*/
84 
85 #ifndef intersection_zoneGenerator_H
86 #define intersection_zoneGenerator_H
87 
88 #include "zoneGeneratorList.H"
89 
90 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
91 
92 namespace Foam
93 {
94 namespace zoneGenerators
95 {
96 
97 /*---------------------------------------------------------------------------*\
98  Class intersection Declaration
99 \*---------------------------------------------------------------------------*/
100 
101 class intersection
102 :
103  public zoneGenerator
104 {
105  // Private Data
106 
107  //- The type of zone to lookup (optional)
108  zoneTypesAll zoneType_;
109 
110  zoneGeneratorList zoneGenerators_;
111 
112 
113  // Private Member Functions
114 
115  //- Count the zone intersections
116  void countIntersections
117  (
118  labelList& nIntersections,
119  const labelList& indices
120  ) const;
121 
122  //- Count the faceZone intersections and set the corresponding flipMap
123  void countIntersections
124  (
125  labelList& nIntersections,
126  boolList& flipMap,
127  const labelList& indices,
128  const boolList& zoneFlipMap
129  ) const;
130 
131  //- Return the list of indices
132  // for which the number of intersection == the number of zones
133  labelList indices(const labelList& nIntersections) const;
134 
135 
136 public:
137 
138  //- Runtime type information
139  TypeName("intersection");
140 
141 
142  // Constructors
143 
144  //- Construct from dictionary
146  (
147  const word& name,
148  const polyMesh& mesh,
149  const dictionary& dict
150  );
151 
152 
153  //- Destructor
154  virtual ~intersection();
155 
156 
157  // Member Functions
158 
159  virtual zoneSet generate() const;
160 };
161 
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 } // End namespace zoneGenerators
166 } // End namespace Foam
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #endif
171 
172 // ************************************************************************* //
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:80
A class for handling words, derived from string.
Definition: word.H:62
friend class zoneGeneratorList
Definition: zoneGenerator.H:80
const word & name() const
TypeName("intersection")
Runtime type information.
virtual zoneSet generate() const
Generate and return the zoneSet.
Definition: intersection.C:131
virtual ~intersection()
Destructor.
Definition: intersection.C:125
intersection(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
Definition: intersection.C:106
Zone container returned by zoneGenerator::generate.
Definition: zoneSet.H:94
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
Namespace for OpenFOAM.
zoneTypesAll
Enumeration defining the zone types with an option for all the types.
Definition: zoneSet.H:77
List< label > labelList
A List of labels.
Definition: labelList.H:56
dictionary dict