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 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 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
33 }
34 
35 
36 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
37 
39 (
40  const label facei,
41  const labelList& faceiZones
42 )
43 {
44  labelList zones(whichZones(facei));
45  boolList flipFaces(zones.size());
46 
47  forAll(zones, zi)
48  {
49  const faceZone& fz = this->operator[](zi);
50  flipFaces[zi] = fz.flipMap()[fz.localIndex(facei)];
51  }
52 
53  return flipFaces;
54 }
55 
56 
57 void Foam::faceZoneList::insert(const List<Map<bool>>& zonesIndices)
58 {
59  PtrList<faceZone>& zones = *this;
60 
61  if (zonesIndices.size() != zones.size())
62  {
64  << "zonesIndices.size() " << zonesIndices.size()
65  << " != number of zones " << zones.size()
66  << exit(FatalError);
67  }
68 
69  forAll(zonesIndices, zonei)
70  {
71  zones[zonei].insert(zonesIndices[zonei]);
72  }
73 }
74 
75 
76 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
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
const T & operator[](const word &key) const
Find and return entry.
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
labelList whichZones(const label objectIndex) const
Given a global object index, return the list of zones it is in.
Definition: ZoneList.C:140
label localIndex(const label globalIndex) const
Map storing the local index for every global index. Used to find.
Definition: Zone.C:240
void insert(const List< Map< bool >> &zonesIndices)
Insert given indices and corresponding face flips into zones.
Definition: faceZoneList.C:57
boolList zonesFlipFace(const label facei, const labelList &faceiZones)
Return the list of flips for the facei.
Definition: faceZoneList.C:39
A subset of mesh faces organised as a primitive patch.
Definition: faceZone.H:59
const boolList & flipMap() const
Return face flip map.
Definition: faceZone.H:204
#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