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 passiveParticle_H
39 #define 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 
59 public:
60 
61  // Constructors
62 
63  //- Construct from components
65  (
66  const polyMesh& mesh,
67  const barycentric& coordinates,
68  const label celli,
69  const label tetFacei,
70  const label tetPti
71  )
72  :
73  particle(mesh, coordinates, celli, tetFacei, tetPti)
74  {}
75 
76 
77  //- Construct from a position and a cell.
78  // Searches for the rest of the required topology.
80  (
81  const polyMesh& mesh,
82  const vector& position,
83  const label celli = -1
84  )
85  :
86  particle(mesh, position, celli)
87  {}
88 
89 
90  //- Construct from Istream
92  (
93  const polyMesh& mesh,
94  Istream& is,
95  bool readFields = true,
96  bool newFormat = true
97  )
98  :
99  particle(mesh, is, readFields, newFormat)
100  {}
101 
102 
103  //- Construct as copy
105  :
106  particle(p)
107  {}
108 
109 
110  //- Construct and return a clone
111  virtual autoPtr<particle> clone() const
112  {
113  return autoPtr<particle>(new passiveParticle(*this));
114  }
115 
116 
117  //- Factory class to read-construct particles (for parallel transfer)
118  class iNew
119  {
120  const polyMesh& mesh_;
121 
122  public:
123 
124  iNew(const polyMesh& mesh)
125  :
126  mesh_(mesh)
127  {}
128 
130  {
131  return autoPtr<passiveParticle>::New(mesh_, is, true);
132  }
133  };
134 };
135 
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 } // End namespace Foam
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 #endif
144 
145 // ************************************************************************* //
Foam::passiveParticle::clone
virtual autoPtr< particle > clone() const
Construct and return a clone.
Definition: passiveParticle.H:110
Foam::autoPtr::New
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::passiveParticle
Copy of base particle.
Definition: passiveParticle.H:53
Foam::particle::readFields
static void readFields(TrackCloudType &c)
Read the fields associated with the owner cloud.
Definition: particleTemplates.C:140
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::particle::coordinates
const barycentric & coordinates() const
Return current particle coordinates.
Definition: particleI.H:143
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
IOstream.H
Foam::particle::position
vector position() const
Return current particle position.
Definition: particleI.H:314
Foam::Barycentric< scalar >
Foam::particle::mesh
const polyMesh & mesh() const
Return the mesh database.
Definition: particleI.H:137
Foam::passiveParticle::iNew::iNew
iNew(const polyMesh &mesh)
Definition: passiveParticle.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::passiveParticle::iNew::operator()
autoPtr< passiveParticle > operator()(Istream &is) const
Definition: passiveParticle.H:128
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::Vector< scalar >
Foam::particle
Base particle class.
Definition: particle.H:76
Foam::passiveParticle::passiveParticle
passiveParticle(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti)
Construct from components.
Definition: passiveParticle.H:64
particle.H
Foam::passiveParticle::iNew
Factory class to read-construct particles (for parallel transfer)
Definition: passiveParticle.H:117
Foam::passiveParticle::passiveParticle
passiveParticle(const passiveParticle &p)
Construct as copy.
Definition: passiveParticle.H:103
Foam::particle::particle
particle(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti)
Construct from components.
Definition: particle.C:516
autoPtr.H