ensightCellsI.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) 2016-2022 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
29 
30 inline Foam::label Foam::ensightCells::add(const elemType etype, label id)
31 {
32  // Linear addressing location
33  const label index = offsets_[etype] + sizes_[etype]++;
34 
35  addressing()[index] = id;
36 
37  return index;
38 }
39 
40 
41 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
42 
43 inline bool Foam::ensightCells::manifold() const noexcept
44 {
45  return manifold_;
46 }
47 
48 
49 inline const char* Foam::ensightCells::key(const elemType etype) noexcept
50 {
51  return elemNames[etype];
52 }
53 
54 
56 {
57  return sizes_;
58 }
59 
60 
61 inline Foam::label Foam::ensightCells::total(const elemType etype) const
62 {
63  return sizes_[etype];
64 }
65 
66 
67 inline Foam::label Foam::ensightCells::size(const elemType etype) const
68 {
69  return (offsets_[etype+1] - offsets_[etype]);
70 }
71 
72 
73 inline Foam::labelRange Foam::ensightCells::range(const elemType etype) const
74 {
75  return labelRange(offsets_[etype], offsets_[etype+1] - offsets_[etype]);
76 }
77 
78 
80 {
81  return addressing();
82 }
83 
84 
85 inline const Foam::labelUList
86 Foam::ensightCells::cellIds(const elemType etype) const
87 {
88  return addressing().slice(range(etype));
89 }
90 
91 
92 inline void Foam::ensightCells::incrCellIds(const label off)
93 {
94  incrAddressing(off);
95 }
96 
97 
98 inline void Foam::ensightCells::decrCellIds(const label off)
99 {
100  decrAddressing(off);
101 }
102 
103 
104 // ************************************************************************* //
A 1D vector of objects of type <T> with a fixed length <N>.
Definition: HashTable.H:107
A range or interval of labels defined by a start and a size.
Definition: labelRange.H:52
label size() const noexcept
Processor-local size of all elements.
Definition: ensightPart.H:193
labelRange range(const elemType etype) const
Processor-local offset/size of element type.
Definition: ensightCellsI.H:66
scalar range
void decrCellIds(const label off)
Decrease face ids by specified offset value.
Definition: ensightCellsI.H:91
label total() const noexcept
Same as totalSize()
Definition: ensightCells.H:231
SubList< T > slice(const label pos, label len=-1)
Return SubList slice (non-const access) - no range checking.
Definition: SubList.H:246
elemType
Supported ensight &#39;Cell&#39; element types.
Definition: ensightCells.H:62
void incrCellIds(const label off)
Increase cell ids by specified offset value.
Definition: ensightCellsI.H:85
const labelList & addressing() const noexcept
Element addressing.
Definition: ensightPart.H:85
const direction noexcept
Definition: Scalar.H:258
label index() const noexcept
The index in a list (0-based)
Definition: ensightPart.H:153
static const char * key(const elemType etype) noexcept
The ensight element name for the specified &#39;Cell&#39; type.
Definition: ensightCellsI.H:42
const FixedList< label, nTypes > & totals() const
The global sizes for each element type.
Definition: ensightCellsI.H:48
bool manifold() const noexcept
Manifold mesh cells detected? Globally consistent quantity.
Definition: ensightCellsI.H:36
const labelList & cellIds() const
Processor-local cell ids of all elements.
Definition: ensightCellsI.H:72