faceZoneList.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) 2024-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 \*---------------------------------------------------------------------------*/
25 
26 #include "faceZoneList.H"
27 #include "polyMesh.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
34 }
35 
36 
37 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
38 
40 {
41  return mesh().nFaces();
42 }
43 
44 
45 void Foam::faceZoneList::insert(const List<Map<bool>>& zonesOrientedIndices)
46 {
47  PtrList<faceZone>& zones = *this;
48 
49  if (zonesOrientedIndices.size() != zones.size())
50  {
52  << "zonesOrientedIndices.size() " << zonesOrientedIndices.size()
53  << " != number of zones " << zones.size()
54  << exit(FatalError);
55  }
56 
57  forAll(zonesOrientedIndices, zonei)
58  {
59  if (zonesOrientedIndices[zonei].size())
60  {
61  zones[zonei].insert(zonesOrientedIndices[zonei]);
62  }
63  }
64 }
65 
66 
68 {
69  PtrList<faceZone>& zones = *this;
70 
71  if (zonesIndices.size() != zones.size())
72  {
74  << "zonesIndices.size() " << zonesIndices.size()
75  << " != number of zones " << zones.size()
76  << exit(FatalError);
77  }
78 
79  forAll(zonesIndices, zonei)
80  {
81  if (zonesIndices[zonei].size())
82  {
83  zones[zonei].insert(zonesIndices[zonei]);
84  }
85  }
86 }
87 
88 
89 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:433
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
A HashTable to objects of type <T> with a label key.
Definition: Map.H:52
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
label size() const
Return the number of elements in the UPtrList.
Definition: UPtrListI.H:29
const polyMesh & mesh() const
Return the mesh reference.
Definition: ZoneList.H:117
void insert(const List< Map< bool >> &zonesOrientedIndices)
Insert given oriented indices.
Definition: faceZoneList.C:45
label allSize() const
Return number of faces in the mesh.
Definition: faceZoneList.C:39
label nFaces() const
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
Foam::faceZoneList.
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
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
defineTypeNameAndDebug(combustionModel, 0)
error FatalError