objectMap.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011 OpenFOAM Foundation
9  Copyright (C) 2024 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::objectMap
29 
30 Description
31  An objectMap is a pair of labels defining the mapping of an object from
32  another object, e.g. a cell mapped from a point.
33 
34 SourceFiles
35  objectMapI.H
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef Foam_objectMap_H
40 #define Foam_objectMap_H
41 
42 #include "List.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward Declarations
50 class objectMap;
51 inline bool operator==(const objectMap& a, const objectMap& b);
52 inline bool operator!=(const objectMap& a, const objectMap& b);
53 inline Ostream& operator<<(Ostream&, const objectMap&);
54 inline Istream& operator>>(Istream&, objectMap&);
55 
56 
57 /*---------------------------------------------------------------------------*\
58  Class objectMap Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 class objectMap
62 {
63  // Private Data
64 
65  //- Object index
66  label index_;
67 
68  //- Master object indices
69  labelList objects_;
70 
71 
72 public:
73 
74  // Constructors
75 
76  //- Default construct, with index=-1 and no objects
77  objectMap() noexcept : index_(-1) {}
78 
79  //- Copy construct from components
80  inline objectMap(const label index, const labelUList& master);
81 
82  //- Move construct from components
83  inline objectMap(const label index, labelList&& master);
84 
85  //- Construct from Istream
86  inline explicit objectMap(Istream& is);
87 
88 
89  // Member Functions
90 
91  //- True if there are no objects
92  bool empty() const noexcept { return objects_.empty(); }
93 
94  //- The number of objects
95  label size() const noexcept { return objects_.size(); }
96 
97  //- The object index
98  label& index() noexcept { return index_; }
99 
100  //- The object index
101  label index() const noexcept { return index_; }
102 
103  //- The master object indices
104  labelList& masterObjects() noexcept { return objects_; }
105 
106  //- The master object indices
107  const labelList& masterObjects() const noexcept { return objects_; }
108 
109 
110  // Friend Operators
112  friend bool operator==(const objectMap& a, const objectMap& b);
113  friend bool operator!=(const objectMap& a, const objectMap& b);
114 
115 
116  // IOstream Operators
117 
118  friend Ostream& operator<<(Ostream&, const objectMap&);
119  friend Istream& operator>>(Istream&, objectMap&);
120 };
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 } // End namespace Foam
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 #include "objectMapI.H"
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 #endif
134 
135 // ************************************************************************* //
label size() const noexcept
The number of objects.
Definition: objectMap.H:106
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:116
friend bool operator!=(const objectMap &a, const objectMap &b)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
bool empty() const noexcept
True if List is empty (ie, size() is zero)
Definition: UList.H:675
friend Ostream & operator<<(Ostream &, const objectMap &)
label & index() noexcept
The object index.
Definition: objectMap.H:111
An objectMap is a pair of labels defining the mapping of an object from another object, e.g. a cell mapped from a point.
Definition: objectMap.H:56
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Istream & operator>>(Istream &, directionInfo &)
friend Istream & operator>>(Istream &, objectMap &)
labelList & masterObjects() noexcept
The master object indices.
Definition: objectMap.H:121
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
const direction noexcept
Definition: Scalar.H:258
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:77
bool operator!=(const eddy &a, const eddy &b)
Definition: eddy.H:297
objectMap() noexcept
Default construct, with index=-1 and no objects.
Definition: objectMap.H:78
friend bool operator==(const objectMap &a, const objectMap &b)
bool empty() const noexcept
True if there are no objects.
Definition: objectMap.H:101
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Namespace for OpenFOAM.