FreeFOAM The Cross-Platform CFD Toolkit
directionInfoI.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) 1991-2010 OpenCFD Ltd.
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 \*---------------------------------------------------------------------------*/
25 
26 #include <OpenFOAM/polyMesh.H>
27 
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
29 
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 // Null constructor
35 :
36  index_(-3),
37  n_(vector::zero)
38 {}
39 
40 
41 // Construct from components
43 (
44  const label index,
45  const vector& n
46 )
47 :
48  index_(index),
49  n_(n)
50 {}
51 
52 
53 // Construct as copy
55 :
56  index_(w2.index()),
57  n_(w2.n())
58 {}
59 
60 
61 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
62 
63 inline bool Foam::directionInfo::valid() const
64 {
65  return index_ != -3;
66 }
67 
68 
69 // No geometric data so never any problem on cyclics
71 (
72  const polyMesh&,
73  const directionInfo& w2,
74  const scalar tol
75 )
76  const
77 {
78  return true;
79 }
80 
81 
82 // index_ is already offset in face
84 (
85  const polyMesh&,
86  const polyPatch& patch,
87  const label patchFaceI,
88  const point& faceCentre
89 )
90 {}
91 
92 
93 // index_ is offset in face on other side. So reverse it here.
94 // (Note: f[0] on other domain is connected to f[0] in this domain,
95 // f[1] ,, f[size-1] ,,
96 // etc.)
98 (
99  const polyMesh&,
100  const polyPatch& patch,
101  const label patchFaceI,
102  const point& faceCentre
103 )
104 {
105  if (index_ >= 0)
106  {
107  const face& f = patch[patchFaceI];
108 
109  index_ = (f.size() - index_) % f.size();
110  }
111 }
112 
113 
114 // No geometric data.
116 (
117  const polyMesh&,
118  const tensor& rotTensor
119 )
120 {}
121 
122 
123 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
124 
126  const
127 {
128  return index() == rhs.index() && n() == rhs.n();
129 }
130 
131 
133  const
134 {
135  return !(*this == rhs);
136 }
137 
138 
139 // ************************ vim: set sw=4 sts=4 et: ************************ //