Loading...
Searching...
No Matches
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 Foam_surfaceLocation_H
49#define Foam_surfaceLocation_H
50
51#include "pointIndexHit.H"
52#include "triangle.H"
53#include "InfoProxy.H"
54
55// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56
57namespace Foam
58{
59
60// Forward Declarations
61class surfaceLocation;
62class triSurface;
63
66
68
70/*---------------------------------------------------------------------------*\
71 Class surfaceLocation Declaration
72\*---------------------------------------------------------------------------*/
73
75:
76 public pointIndexHit
77{
78 // Private Data
79
80 triPointRef::proxType elementType_;
81
82 label triangle_;
83
84
85public:
86
87 // Constructors
88
89 //- Default construct
91 :
93 elementType_(triPointRef::NONE),
94 triangle_(-1)
95 {}
96
97 //- Construct from components
99 (
100 const pointIndexHit& pHit,
102 const label triangle
103 )
104 :
105 pointIndexHit(pHit),
106 elementType_(elementType),
107 triangle_(triangle)
108 {}
109
110 //- Construct from Istream
111 explicit surfaceLocation(Istream& is)
113 pointIndexHit(is),
114 elementType_(triPointRef::proxType(readLabel(is))),
115 triangle_(readLabel(is))
116 {}
117
118
119 // Member Functions
120
123 return elementType_;
124 }
125
128 return elementType_;
129 }
130
131 label& triangle() noexcept
133 return triangle_;
134 }
135
136 label triangle() const noexcept
138 return triangle_;
139 }
140
141 //- Normal. Approximate for points.
142 vector normal(const triSurface& s) const;
143
144 //- Return info proxy,
145 //- to print information to a stream
146 InfoProxy<surfaceLocation> info() const noexcept { return *this; }
147
148 //- Write info about selected face index to a stream
149 void write(Ostream& os, const triSurface& s) const;
150
152 // IOstream Operators
153
154 friend Istream& operator>>(Istream& is, surfaceLocation& sl);
155
156 friend Ostream& operator<<(Ostream& os, const surfaceLocation& sl);
157};
158
159
160// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162} // End namespace Foam
164// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165
166#endif
167
168// ************************************************************************* //
A helper class for outputting values to Ostream.
Definition InfoProxy.H:49
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
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 noexcept
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:74
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:63
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
Istream & operator>>(Istream &, directionInfo &)
const direction noexcept
Definition scalarImpl.H:265
triangle< point, const point & > triPointRef
A triangle using referred points.
Definition triangleFwd.H:46
Vector< scalar > vector
Definition vector.H:57
PointIndexHit< point > pointIndexHit
A PointIndexHit with a 3D point.
runTime write()