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 | Copyright (C) 2011 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 Description
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "error.H"
29 #include "cellModel.H"
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 
36 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
37 
38 inline const word& cellModel::name() const
39 {
40  return name_;
41 }
42 
43 
44 inline label cellModel::index() const
45 {
46  return index_;
47 }
48 
49 
50 inline label cellModel::nPoints() const
51 {
52  return nPoints_;
53 }
54 
55 
56 inline label cellModel::nEdges() const
57 {
58  return edges_.size();
59 }
60 
61 
62 inline label cellModel::nFaces() const
63 {
64  return faces_.size();
65 }
66 
67 
68 // Return the faces of a cellModel by untangling the geometry
69 // supplied in terms of the face labels
71 {
72  edgeList e(edges_.size());
73 
74  // Translate model lebels into global labels
75  forAll(edges_, edgeI)
76  {
77  e[edgeI] =
78  edge
79  (
80  pointLabels[edges_[edgeI].start()],
81  pointLabels[edges_[edgeI].end()]
82  );
83  }
84 
85  return e;
86 }
87 
88 
89 // Return a raw list of model faces
90 inline const faceList& cellModel::modelFaces() const
91 {
92  return faces_;
93 }
94 
95 // Return the faces of a cellModel by untangling the geometry
96 // supplied in terms of the face labels
98 {
99  faceList f(faces_.size());
100 
101  // Translate model lebels into global labels
102  forAll(faces_, faceI)
103  {
104  const labelList& curModelLabels = faces_[faceI];
105 
106  face& curFace = f[faceI];
107 
108  curFace.setSize(curModelLabels.size());
109 
110  forAll(curModelLabels, labelI)
111  {
112  curFace[labelI] = pointLabels[curModelLabels[labelI]];
113  }
114  }
115 
116  return f;
117 }
118 
119 
120 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
121 
122 // Equality operator: true => ptr to models are equal !
123 inline bool operator==(const cellModel& m1, const cellModel& m2)
124 {
125  return (&m1 == &m2);
126 }
127 
128 // Inequality operator: true => ptr to models are not equal !
129 inline bool operator!=(const cellModel& m1, const cellModel& m2)
130 {
131  return (&m1 != &m2);
132 }
133 
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 } // End namespace Foam
138 
139 // ************************************************************************* //
labelList pointLabels(nPoints,-1)
labelList f(nPoints)
const word & name() const
Return model name.
Definition: cellModelI.H:38
A class for handling words, derived from string.
Definition: word.H:59
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
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:76
static const labelSphericalTensor labelI(1)
Identity labelTensor.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:58
Namespace for OpenFOAM.
const faceList & modelFaces() const
Return a raw list of model faces.
Definition: cellModelI.H:90
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
const double e
Elementary charge.
Definition: doubleFloat.H:78
void setSize(const label)
Reset size of List.
Definition: List.C:318
edgeList edges(const labelList &pointLabels) const
Return list of edges.
Definition: cellModelI.H:70
#define forAll(list, i)
Definition: UList.H:421
Maps a geometry to a set of cell primitives, which enables geometric cell data to be calculated witho...
Definition: cellModel.H:64
faceList faces(const labelList &pointLabels) const
Return list of faces.
Definition: cellModelI.H:97
label nFaces() const
Return number of faces.
Definition: cellModelI.H:62
label nPoints() const
Return number of points.
Definition: cellModelI.H:50
friend bool operator==(const cellModel &, const cellModel &)
Equality operator: true => ptr to models are equal !
Definition: cellModelI.H:123
label nEdges() const
Return number of edges.
Definition: cellModelI.H:56
friend bool operator!=(const cellModel &, const cellModel &)
Inequality operator: true => ptr to models are not equal !
Definition: cellModelI.H:129
label index() const
Return index of model in the model list.
Definition: cellModelI.H:44