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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::surfaceLocation
29
30Description
31 Contains information about location on a triSurface
32
33 Access to data:
34 - pointIndexHit provides
35 - location
36 - bool: hit/miss
37 - index (of triangle/point/edge)
38 - elementType() provides
39 - what index above relates to. In triangle::proxType
40 - triangle() provides
41 - last known triangle
42
43SourceFiles
44 surfaceLocation.C
45
46\*---------------------------------------------------------------------------*/
47
48#ifndef surfaceLocation_H
49#define surfaceLocation_H
50
51#include "pointIndexHit.H"
52#include "triPointRef.H"
53#include "InfoProxy.H"
54
55// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56
57namespace Foam
58{
59
60// Forward Declarations
61class surfaceLocation;
62class triSurface;
63
64Istream& operator>>(Istream&, surfaceLocation&);
65Ostream& operator<<(Ostream&, const surfaceLocation&);
66Ostream& operator<<(Ostream&, const InfoProxy<surfaceLocation>&);
67
68/*---------------------------------------------------------------------------*\
69 Class surfaceLocation Declaration
70\*---------------------------------------------------------------------------*/
73:
74 public pointIndexHit
75{
76 // Private Data
77
78 triPointRef::proxType elementType_;
79
80 label triangle_;
81
82
83public:
84
85 // Constructors
86
87 //- Default construct
89 :
91 elementType_(triPointRef::NONE),
92 triangle_(-1)
93 {}
94
95 //- Construct from components
97 (
98 const pointIndexHit& pHit,
100 const label triangle
101 )
102 :
103 pointIndexHit(pHit),
104 elementType_(elementType),
105 triangle_(triangle)
106 {}
107
108 //- Construct from Istream
109 explicit surfaceLocation(Istream& is)
110 :
111 pointIndexHit(is),
112 elementType_(triPointRef::proxType(readLabel(is))),
113 triangle_(readLabel(is))
114 {}
115
116
117 // Member Functions
120 {
121 return elementType_;
122 }
125 {
126 return elementType_;
127 }
129 label& triangle() noexcept
130 {
131 return triangle_;
132 }
134 label triangle() const noexcept
135 {
136 return triangle_;
137 }
138
139 //- Normal. Approximate for points.
140 vector normal(const triSurface& s) const;
141
142 //- Return info proxy, to print information to a stream
144 {
145 return *this;
146 }
147
148 //- Write info about selected face index to a stream
149 void write(Ostream& os, const triSurface& s) const;
150
151
152 // IOstream Operators
154 friend Istream& operator>>(Istream& is, surfaceLocation& sl);
156 friend Ostream& operator<<(Ostream& os, const surfaceLocation& sl);
158 friend Ostream& operator<<
159 (
160 Ostream& os,
162 );
163};
164
165
166// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167
168} // End namespace Foam
169
170// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171
172#endif
173
174// ************************************************************************* //
A helper class for outputting values to Ostream.
Definition: InfoProxy.H:52
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
Definition: PointIndexHit.H:66
Contains information about location on a triSurface.
vector normal(const triSurface &s) const
Normal. Approximate for points.
surfaceLocation(const pointIndexHit &pHit, const triPointRef::proxType elementType, const label triangle)
Construct from components.
label triangle() const noexcept
friend Ostream & operator<<(Ostream &os, const surfaceLocation &sl)
triPointRef::proxType elementType() const noexcept
surfaceLocation(Istream &is)
Construct from Istream.
InfoProxy< surfaceLocation > info() const
Return info proxy, to print information to a stream.
triPointRef::proxType & elementType() noexcept
friend Istream & operator>>(Istream &is, surfaceLocation &sl)
surfaceLocation()
Default construct.
label & triangle() noexcept
Triangulated surface description with patch information.
Definition: triSurface.H:79
A triangle primitive used to calculate face normals and swept volumes.
Definition: triangle.H:80
proxType
The proximity classifications.
Definition: triangle.H:94
OBJstream os(runTime.globalPath()/outputName)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
Namespace for OpenFOAM.
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
Definition: label.H:66
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Istream & operator>>(Istream &, directionInfo &)
const direction noexcept
Definition: Scalar.H:223
runTime write()