passiveParticle.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 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::passiveParticle
29 
30 Description
31  Copy of base particle
32 
33 SourceFiles
34  passiveParticle.H
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef Foam_passiveParticle_H
39 #define Foam_passiveParticle_H
40 
41 #include "particle.H"
42 #include "IOstream.H"
43 #include "autoPtr.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class passiveParticle Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class passiveParticle
55 :
56  public particle
57 {
58 public:
59 
60  // Constructors
61 
62  //- Construct from components
64  (
65  const polyMesh& mesh,
66  const barycentric& coordinates,
67  const label celli,
68  const label tetFacei,
69  const label tetPti
70  )
71  :
72  particle(mesh, coordinates, celli, tetFacei, tetPti)
73  {}
74 
75 
76  //- Construct from a position and a cell.
77  // Searches for the rest of the required topology.
79  (
80  const polyMesh& mesh,
81  const vector& position,
82  const label celli = -1
83  )
84  :
85  particle(mesh, position, celli)
86  {}
87 
88 
89  //- Construct from Istream
91  (
92  const polyMesh& mesh,
93  Istream& is,
94  bool readFields = true,
95  bool newFormat = true
96  )
97  :
98  particle(mesh, is, readFields, newFormat)
99  {}
100 
101 
102  //- Construct as copy
104  :
105  particle(p)
106  {}
108 
109  //- Construct and return a clone
110  virtual autoPtr<particle> clone() const
111  {
112  return autoPtr<particle>(new passiveParticle(*this));
113  }
114 
115 
116  //- Factory class to read-construct particles (for parallel transfer)
117  class iNew
118  {
119  const polyMesh& mesh_;
120 
121  public:
122 
123  iNew(const polyMesh& mesh)
124  :
125  mesh_(mesh)
126  {}
127 
129  {
130  return autoPtr<passiveParticle>::New(mesh_, is, true);
131  }
132  };
133 };
134 
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 } // End namespace Foam
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 #endif
143 
144 // ************************************************************************* //
autoPtr< passiveParticle > operator()(Istream &is) const
const barycentric & coordinates() const noexcept
Return current particle coordinates.
Definition: particleI.H:116
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
virtual autoPtr< particle > clone() const
Construct and return a clone.
Factory class to read-construct particles (for parallel transfer)
Base particle class.
Definition: particle.H:69
iNew(const polyMesh &mesh)
particle(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti)
Construct from components.
Definition: particle.C:507
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
const polyMesh & mesh() const noexcept
Return the mesh database.
Definition: particleI.H:110
static void readFields(TrackCloudType &c)
Read the fields associated with the owner cloud.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
volScalarField & p
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Definition: autoPtr.H:178
Copy of base particle.
vector position() const
Return current particle position.
Definition: particleI.H:283
passiveParticle(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti)
Construct from components.
Namespace for OpenFOAM.