Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::objectMap
29
30Description
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
34SourceFiles
35 objectMapI.H
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef Foam_objectMap_H
40#define Foam_objectMap_H
41
42#include "List.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
48
49// Forward Declarations
50class objectMap;
51inline bool operator==(const objectMap& a, const objectMap& b);
52inline bool operator!=(const objectMap& a, const objectMap& b);
53inline Ostream& operator<<(Ostream&, const objectMap&);
55
57/*---------------------------------------------------------------------------*\
58 Class objectMap Declaration
59\*---------------------------------------------------------------------------*/
60
61class objectMap
62{
63 // Private Data
64
65 //- Object index
66 label index_;
67
68 //- Master object indices
69 labelList objects_;
70
71
72public:
73
74 // Constructors
75
76 //- Default construct, with index=-1 and no objects
77 objectMap() noexcept : index_(-1) {}
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&);
120};
122
123// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124
125} // End namespace Foam
127// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128
129#include "objectMapI.H"
130
131// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133#endif
134
135// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
void size(const label n)
Older name for setAddressableSize.
Definition UList.H:118
An objectMap is a pair of labels defining the mapping of an object from another object,...
Definition objectMap.H:57
friend Ostream & operator<<(Ostream &, const objectMap &)
const labelList & masterObjects() const noexcept
The master object indices.
Definition objectMap.H:126
bool empty() const noexcept
True if there are no objects.
Definition objectMap.H:101
objectMap() noexcept
Default construct, with index=-1 and no objects.
Definition objectMap.H:78
label & index() noexcept
The object index.
Definition objectMap.H:111
label index() const noexcept
The object index.
Definition objectMap.H:116
friend bool operator==(const objectMap &a, const objectMap &b)
label size() const noexcept
The number of objects.
Definition objectMap.H:106
friend bool operator!=(const objectMap &a, const objectMap &b)
labelList & masterObjects() noexcept
The master object indices.
Definition objectMap.H:121
friend Istream & operator>>(Istream &, objectMap &)
Namespace for OpenFOAM.
bool operator!=(const eddy &a, const eddy &b)
Definition eddy.H:297
List< label > labelList
A List of labels.
Definition List.H:62
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Istream & operator>>(Istream &, directionInfo &)
const direction noexcept
Definition scalarImpl.H:265
UList< label > labelUList
A UList of labels.
Definition UList.H:75
volScalarField & b