extrudeLayerI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
11  cfMesh is free software; you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by the
13  Free Software Foundation; either version 3 of the License, or (at your
14  option) any later version.
15 
16  cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
23 
24 Description
25 
26 
27 \*---------------------------------------------------------------------------*/
28 
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 
38 (
39  const label extrudedI
40 ) const
41 {
42  return extrudedFaces_[extrudedI].second();
43 }
44 
46 (
47  const label extrudedI,
48  const label pointI
49 ) const
50 {
51  const face& f = faces_[extrudedFaces_[extrudedI].first()];
52 
53  return f.which(pointI);
54 }
55 
57 (
58  const label extrudedI,
59  const label pos
60 ) const
61 {
62  const face& of = faces_[extrudedFaces_[extrudedI].second()];
63 
64  if( pairOrientation_[extrudedI] )
65  {
66  return of[pos];
67  }
68  else
69  {
70  return of[(of.size()-pos)%of.size()];
71  }
72 
74  (
75  "label extrudeLayer::addressingCalculator::origPointLabel"
76  "(const label, const label) const"
77  ) << "Cannot find point for the given position" << abort(FatalError);
78 
79  return -1;
80 }
81 
83 (
84  const label extrudedI,
85  const label pointI
86 ) const
87 {
88  const face& f = faces_[extrudedFaces_[extrudedI].first()];
89  const face& of = faces_[extrudedFaces_[extrudedI].second()];
90  const label pos = f.which(pointI);
91 
92  if( pairOrientation_[extrudedI] )
93  {
94  return of[pos];
95  }
96  else
97  {
98  return of[(of.size()-pos)%of.size()];
99  }
100 
102  (
103  "label extrudeLayer::addressingCalculator::origPoint"
104  "(const label, const label) const"
105  ) << "Cannot find point for the given position" << abort(FatalError);
106 
107  return -1;
108 }
109 
111 (
112  const label extrudedI,
113  const label eI
114 ) const
115 {
116  const face& f = faces_[extrudedFaces_[extrudedI].first()];
117 
118  const label pointI = f[eI];
119  const label nextI = f.nextLabel(eI);
120 
121  label otherFace(-1);
122  forAllRow(pointExtruded_, pointI, pfI)
123  {
124  const label currFaceI = pointExtruded_(pointI, pfI);
125 
126  if( currFaceI == extrudedI )
127  continue;
128 
129  if( pointExtruded_.contains(nextI, currFaceI) )
130  {
131  if( otherFace != -1 )
133  (
134  "label extrudeLayer::addressingCalculator::faceSharingEdge"
135  "(const label, const label) const"
136  ) << "Expected only one such face"
137  << abort(FatalError);
138 
139  otherFace = currFaceI;
140  }
141  }
142 
143  return otherFace;
144 }
145 
147 (
148  const label start,
149  const label end,
150  DynList<label>& edgeFaces
151 ) const
152 {
153  edgeFaces.clear();
154 
155  forAllRow(pointExtruded_, start, pfI)
156  {
157  const label currFaceI = pointExtruded_(start, pfI);
158 
159  if( pointExtruded_.contains(end, currFaceI) )
160  edgeFaces.append(currFaceI);
161  }
162 }
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 } // End namespace Foam
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::extrudeLayer::addressingCalculator::positionInFace
label positionInFace(const label extrudedI, const label pointI) const
return position of point in extruded face
Definition: extrudeLayerI.H:46
Foam::extrudeLayer::addressingCalculator::facesSharingEdge
void facesSharingEdge(const label start, const label end, DynList< label > &) const
find faces attached to both points
Definition: extrudeLayerI.H:147
Foam::extrudeLayer::addressingCalculator::origPoint
label origPoint(const label extrudedI, const label pointI) const
Definition: extrudeLayerI.H:83
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:59
Foam::extrudeLayer::addressingCalculator::origPointLabel
label origPointLabel(const label extrudedI, const label pos) const
return point label in the original face
Definition: extrudeLayerI.H:57
forAllRow
#define forAllRow(graph, rowI, index)
Definition: VRWGraph.H:277
Foam::FatalError
error FatalError
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:131
Foam::DynList< label >
Foam::extrudeLayer::addressingCalculator::faceSharingEdge
label faceSharingEdge(const label extrudedI, const label eI) const
find face sharing an edge with the given face
Definition: extrudeLayerI.H:111
f
labelList f(nPoints)
Foam::meshTools::otherFace
label otherFace(const primitiveMesh &, const label cellI, const label faceI, const label edgeI)
Return face on cell using edgeI but not faceI. Throws error.
Definition: meshTools.C:532
Foam::extrudeLayer::addressingCalculator::origFaceLabel
label origFaceLabel(const label extrudedI) const
return label of the original face for the given face
Definition: extrudeLayerI.H:38
FatalErrorIn
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:313
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
Foam::List::size
void size(const label)
Override size to be inconsistent with allocated storage.
Foam::DynList::clear
void clear()
Clear the list, i.e. set next free to zero.
Definition: DynListI.H:279
Foam::DynList::append
void append(const T &e)
Append an element at the end of the list.
Definition: DynListI.H:304
Foam::pos
dimensionedScalar pos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:190