indexedParticle.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-2017 OpenFOAM Foundation
9 Copyright (C) 2019 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::indexedParticle
29
30Description
31 Adds label index to base particle
32
33SourceFiles
34 indexedParticle.H
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef indexedParticle_H
39#define indexedParticle_H
40
41#include "particle.H"
42#include "IOstream.H"
43#include "autoPtr.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
49
50/*---------------------------------------------------------------------------*\
51 Class indexedParticle Declaration
52\*---------------------------------------------------------------------------*/
55:
56 public particle
57{
58 // Private data
59
60 label index_;
61
62
63public:
64
65 // Constructors
66
67 //- Construct from a position and a cell.
68 // Searches for the rest of the required topology.
69 // Other properties are zero initialised.
71 (
72 const polyMesh& mesh,
73 const vector& position,
74 const label celli = -1,
75 const label index = 0
76 )
77 :
78 particle(mesh, position, celli),
79 index_(index)
80 {}
81
82 //- Construct from components
84 (
85 const polyMesh& mesh,
87 const label celli,
88 const label tetFacei,
89 const label tetPti,
90 const label index = 0
91 )
92 :
93 particle(mesh, coordinates, celli, tetFacei, tetPti),
94 index_(index)
95 {}
96
97 //- Construct from Istream
99 (
100 const polyMesh& mesh,
101 Istream& is,
102 bool readFields = true,
103 bool newFormat = true
104 )
105 :
106 particle(mesh, is, readFields, newFormat)
107 {}
108
109 //- Construct as a copy
111 :
112 particle(p)
113 {}
114
115 //- Construct and return a clone
116 virtual autoPtr<particle> clone() const
117 {
118 return autoPtr<particle>(new indexedParticle(*this));
119 }
120
121
122 // Member Functions
124 label index() const
125 {
126 return index_;
127 }
129 label& index()
130 {
131 return index_;
132 }
133};
134
135
136// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137
138} // End namespace Foam
139
140// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141
142#endif
143
144// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
Adds label index to base particle.
indexedParticle(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti, const label index=0)
Construct from components.
virtual autoPtr< particle > clone() const
Construct and return a clone.
indexedParticle(const indexedParticle &p)
Construct as a copy.
indexedParticle(const polyMesh &mesh, Istream &is, bool readFields=true, bool newFormat=true)
Construct from Istream.
Base particle class.
Definition: particle.H:79
vector position() const
Return current particle position.
Definition: particleI.H:314
static void readFields(TrackCloudType &c)
Read the fields associated with the owner cloud.
const polyMesh & mesh() const noexcept
Return the mesh database.
Definition: particleI.H:137
const barycentric & coordinates() const noexcept
Return current particle coordinates.
Definition: particleI.H:143
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
volScalarField & p
Namespace for OpenFOAM.