surfaceLocation.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 Class
25  Foam::surfaceLocation
26 
27 Description
28  Contains information about location on a triSurface:
29  - pointIndexHit:
30  - location
31  - bool: hit/miss
32  - index (of triangle/point/edge)
33  - elementType():
34  - what index above relates to. In triangle::proxType
35  - triangle():
36  - last known triangle
37 
38 SourceFiles
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef surfaceLocation_H
43 #define surfaceLocation_H
44 
45 #include "pointIndexHit.H"
46 #include "triPointRef.H"
47 #include "InfoProxy.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 // Forward declaration of classes
55 class triSurface;
56 
57 /*---------------------------------------------------------------------------*\
58  Class surfaceLocation Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 class surfaceLocation
62 :
63  public pointIndexHit
64 {
65  // Private data
66 
68 
70 
71 public:
72 
73 
74  // Constructors
75 
76  //- Construct null
78  :
79  pointIndexHit(),
81  triangle_(-1)
82  {}
83 
84  //- Construct from components
86  (
87  const pointIndexHit& pih,
89  const label triangle
90  )
91  :
92  pointIndexHit(pih),
95  {}
96 
97  //- Construct from Istream
99  :
100  pointIndexHit(is),
101  elementType_(triPointRef::proxType(readLabel(is))),
102  triangle_(readLabel(is))
103  {}
104 
105 
106  // Member Functions
107 
109  {
110  return elementType_;
111  }
112 
114  {
115  return elementType_;
116  }
117 
118  label& triangle()
119  {
120  return triangle_;
121  }
122 
123  label triangle() const
124  {
125  return triangle_;
126  }
127 
128  //- Normal. Approximate for points.
129  vector normal(const triSurface& s) const;
130 
131  //- Return info proxy.
132  // Used to print token information to a stream
134  {
135  return *this;
136  }
137 
138  //- Write info to os
139  void write(Ostream& os, const triSurface& s) const;
140 
141 
142  // IOstream Operators
143 
144  friend Istream& operator>>(Istream& is, surfaceLocation& sl);
145 
146  friend Ostream& operator<<(Ostream& os, const surfaceLocation& sl);
147 
148  friend Ostream& operator<<
149  (
150  Ostream&,
152  );
153 };
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 } // End namespace Foam
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #endif
163 
164 // ************************************************************************* //
Foam::surfaceLocation::write
void write(Ostream &os, const triSurface &s) const
Write info to os.
Definition: surfaceLocation.C:67
pointIndexHit.H
Foam::InfoProxy
A helper class for outputting values to Ostream.
Definition: InfoProxy.H:45
InfoProxy.H
Foam::surfaceLocation
Contains information about location on a triSurface:
Definition: surfaceLocation.H:60
Foam::surfaceLocation::surfaceLocation
surfaceLocation(Istream &is)
Construct from Istream.
Definition: surfaceLocation.H:97
triPointRef.H
Foam::surfaceLocation::elementType_
triPointRef::proxType elementType_
Definition: surfaceLocation.H:66
Foam::surfaceLocation::elementType
triPointRef::proxType & elementType()
Definition: surfaceLocation.H:107
Foam::triangle
A triangle primitive used to calculate face normals and swept volumes.
Definition: triangle.H:59
Foam::PointIndexHit
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
Definition: PointIndexHit.H:53
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::triSurface
Triangulated surface description with patch information.
Definition: triSurface.H:57
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::surfaceLocation::operator>>
friend Istream & operator>>(Istream &is, surfaceLocation &sl)
Foam::surfaceLocation::normal
vector normal(const triSurface &s) const
Normal. Approximate for points.
Definition: surfaceLocation.C:31
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
s
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Foam::surfaceLocation::elementType
triPointRef::proxType elementType() const
Definition: surfaceLocation.H:112
Foam::pointIndexHit
PointIndexHit< point > pointIndexHit
Definition: pointIndexHit.H:42
Foam::surfaceLocation::triangle
label triangle() const
Definition: surfaceLocation.H:122
Foam::triangle::proxType
proxType
Return types for classify.
Definition: triangle.H:94
Foam::Vector< scalar >
Foam::surfaceLocation::operator<<
friend Ostream & operator<<(Ostream &os, const surfaceLocation &sl)
Foam::readLabel
label readLabel(Istream &is)
Definition: label.H:64
Foam::surfaceLocation::info
InfoProxy< surfaceLocation > info() const
Return info proxy.
Definition: surfaceLocation.H:132
Foam::surfaceLocation::triangle
label & triangle()
Definition: surfaceLocation.H:117
Foam::surfaceLocation::triangle_
label triangle_
Definition: surfaceLocation.H:68
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::surfaceLocation::surfaceLocation
surfaceLocation()
Construct null.
Definition: surfaceLocation.H:76