difference.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::difference
26 
27 Description
28  A zoneGenerator which selects the elements in the first zones generated by
29  the given list of zoneGenerators and removes the elements which are in
30  subsequent zones
31 
32  An difference faceZones is oriented if the first faceZones is oriented,
33  otherwise the returned faceZone is unoriented.
34 
35 Usage
36  \table
37  Property | Description | Required | Default value
38  type | Type: difference | yes |
39  name | Name of the zone | no | zoneGenerator name
40  zoneType | Type of zone | no | all the zone types
41  moveUpdate | Switch to update after mesh motion | no | false
42  \endtable
43  These options are followed by a list of any number of zoneGenerators which
44  can either generate the zones locally or return zones from the lists of
45  zones held by the mesh using the zoneGenerators::lookup zoneGenerator. The
46  resultant zones are initialised by the first zoneGenerator in the list and
47  then the zones generated by subsequent zoneGenerator are subtracted
48  from them.
49 
50  Each zoneGenerator returns a zoneSet containing a pointZone and/or a
51  cellZone and/or a faceZone, the zoneGenerators::difference operation
52  combines each of the zone types unless the \c zoneType is specified in which
53  case only the zones of that type are combined.
54 
55  A cellZone named \c coneNotAnnulus containing the with centres inside the
56  predefined \c cone1 which is looked-up from the cellZoneList less the
57  cells in locally defined annulus is be generated by
58  \verbatim
59  notConeOrAnnulus
60  {
61  type difference;
62 
63  cone1;
64 
65  annulus1
66  {
67  type annulus;
68  zoneType cell;
69 
70  point1 (-0.0075 0 -1);
71  point2 (-0.003 0.0025 1);
72  outerRadius 0.002;
73  innerRadius 0.001;
74  }
75  }
76  \endverbatim
77 
78 See also
79  zoneGenerators::Union
80  zoneGenerators::intersection
81  zoneGeneratorList
82 
83 SourceFiles
84  difference.C
85 
86 \*---------------------------------------------------------------------------*/
87 
88 #ifndef difference_zoneGenerator_H
89 #define difference_zoneGenerator_H
90 
91 #include "zoneGeneratorList.H"
92 #include "union.H"
93 
94 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
95 
96 namespace Foam
97 {
98 namespace zoneGenerators
99 {
100 
101 /*---------------------------------------------------------------------------*\
102  Class difference Declaration
103 \*---------------------------------------------------------------------------*/
104 
105 class difference
106 :
107  public Union
108 {
109 
110 public:
111 
112  //- Runtime type information
113  TypeName("difference");
114 
115 
116  // Constructors
117 
118  //- Construct from dictionary
119  difference
120  (
121  const word& name,
122  const polyMesh& mesh,
123  const dictionary& dict
124  );
125 
126 
127  //- Destructor
128  virtual ~difference();
129 
130 
131  // Member Functions
132 
133  virtual zoneSet generate() const;
134 };
135 
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 } // End namespace zoneGenerators
140 } // End namespace Foam
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 #endif
145 
146 // ************************************************************************* //
const word & name() const
TypeName("difference")
Runtime type information.
virtual zoneSet generate() const
Generate and return the zoneSet.
Definition: difference.C:63
virtual ~difference()
Destructor.
Definition: difference.C:57
difference(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
Definition: difference.C:45
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.
dictionary dict