cellModelI.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-2016 OpenFOAM Foundation
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 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
29 
30 inline const Foam::word& Foam::cellModel::name() const
31 {
32  return name_;
33 }
34 
35 
37 {
38  return index_;
39 }
40 
41 
43 {
44  return nPoints_;
45 }
46 
47 
49 {
50  return edges_.size();
51 }
52 
53 
55 {
56  return faces_.size();
57 }
58 
59 
61 {
62  return edges_;
63 }
64 
65 
67 {
68  return faces_;
69 }
70 
71 
72 // Return the faces of a cellModel by untangling the geometry
73 // supplied in terms of the face labels
75 (
76  const labelUList& pointLabels
77 ) const
78 {
79  edgeList e(edges_.size());
80 
81  // Translate model labels into global labels
82  forAll(edges_, edgei)
83  {
84  e[edgei] =
85  edge
86  (
87  pointLabels[edges_[edgei].start()],
88  pointLabels[edges_[edgei].end()]
89  );
90  }
91 
92  return e;
93 }
94 
95 
96 // Return the faces of a cellModel by untangling the geometry
97 // supplied in terms of the face labels
99 (
100  const labelUList& pointLabels
101 ) const
102 {
103  faceList f(faces_.size());
104 
105  // Translate model labels into global labels
106  forAll(faces_, facei)
107  {
108  const labelList& curModelLabels = faces_[facei];
109 
110  face& curFace = f[facei];
111 
112  curFace.setSize(curModelLabels.size());
113 
114  forAll(curModelLabels, labeli)
115  {
116  curFace[labeli] = pointLabels[curModelLabels[labeli]];
117  }
118  }
119 
120  return f;
121 }
122 
123 
124 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
125 
126 inline bool Foam::operator==(const cellModel& lhs, const cellModel& rhs)
127 {
128  return (&lhs == &rhs);
129 }
130 
131 
132 inline bool Foam::operator!=(const cellModel& lhs, const cellModel& rhs)
133 {
134  return (&lhs != &rhs);
135 }
136 
137 
138 // ************************************************************************* //
Foam::cellModel::nFaces
label nFaces() const
Return number of faces.
Definition: cellModelI.H:54
Foam::cellModel::faces
faceList faces(const labelUList &pointLabels) const
Return list of faces.
Definition: cellModelI.H:99
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::edge
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:63
Foam::cellModel::nEdges
label nEdges() const
Return number of edges.
Definition: cellModelI.H:48
Foam::cellModel::edges
edgeList edges(const labelUList &pointLabels) const
Return list of edges.
Definition: cellModelI.H:75
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:290
Foam::operator!=
bool operator!=(const eddy &a, const eddy &b)
Definition: eddy.H:235
Foam::label
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:62
Foam::operator==
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::cellModel::modelFaces
const faceList & modelFaces() const
Return a raw list of model faces.
Definition: cellModelI.H:66
Foam::cellModel::name
const word & name() const
Return model name.
Definition: cellModelI.H:30
stdFoam::end
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
Definition: stdFoam.H:115
Foam::cellModel::modelEdges
const edgeList & modelEdges() const
Return a raw list of model edges.
Definition: cellModelI.H:60
f
labelList f(nPoints)
Foam::List< edge >
Foam::start
label ListType::const_reference const label start
Definition: ListOps.H:408
Foam::UList< label >
Foam::constant::electromagnetic::e
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:74
Foam::cellModel
Maps a geometry to a set of cell primitives.
Definition: cellModel.H:72
Foam::List::setSize
void setSize(const label newSize)
Alias for resize(const label)
Definition: ListI.H:146
Foam::cellModel::index
label index() const
Return index of model in the model list.
Definition: cellModelI.H:36
pointLabels
labelList pointLabels(nPoints, -1)
Foam::cellModel::nPoints
label nPoints() const
Return number of points.
Definition: cellModelI.H:42