ignitionSite.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::ignitionSite
26 
27 Description
28  Foam::ignitionSite
29 
30 SourceFiles
31  ignitionSiteI.H
32  ignitionSite.C
33  ignitionSiteIO.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef ignitionSite_H
38 #define ignitionSite_H
39 
40 #include "vector.H"
41 #include "labelList.H"
42 #include "scalarList.H"
43 #include "autoPtr.H"
44 #include "dictionary.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 class Time;
52 class engineTime;
53 class fvMesh;
54 
55 /*---------------------------------------------------------------------------*\
56  Class ignitionSite Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class ignitionSite
60 {
61  // Private data
62 
63  const Time& db_;
64  const fvMesh& mesh_;
65 
66  dictionary ignitionSiteDict_;
67 
68  vector location_;
69  scalar diameter_;
70  scalar time_;
71  scalar duration_;
72  scalar strength_;
73 
74  labelList cells_;
75  scalarList cellVolumes_;
76 
77  //- Current time index.
78  // Used during the update for moving meshes
79  mutable label timeIndex_;
80 
81 
82  // Private Member Functions
83 
84  void findIgnitionCells(const fvMesh&);
85 
86 
87 public:
88 
89  // Public classes
90 
91  //- Class used for the read-construction of
92  // PtrLists of ignitionSite
93  class iNew
94  {
95  const Time& db_;
96  const fvMesh& mesh_;
97 
98  public:
99 
100  iNew(const Time& db, const fvMesh& mesh)
101  :
102  db_(db),
103  mesh_(mesh)
104  {}
107  {
108  return autoPtr<ignitionSite>(new ignitionSite(is, db_, mesh_));
109  }
110  };
111 
112 
113  // Constructors
114 
115  //- Construct from Istream and database
116  ignitionSite(Istream&, const Time&, const fvMesh&);
117 
118  //- Construct from Istream and engineTime
119  ignitionSite(Istream&, const engineTime&, const fvMesh&);
120 
121  //- Clone
123  {
124  return autoPtr<ignitionSite>(new ignitionSite(*this));
125  }
126 
127 
128  // Member Functions
129 
130  // Access
132  const vector& location() const
133  {
134  return location_;
135  }
137  scalar diameter() const
138  {
139  return diameter_;
140  }
142  scalar time() const
143  {
144  return time_;
145  }
147  scalar duration() const
148  {
149  return duration_;
150  }
152  scalar strength() const
153  {
154  return strength_;
155  }
156 
157  //- Return the ignition cells updated if the mesh moved
158  const labelList& cells() const;
160  const scalarList& cellVolumes() const
161  {
162  return cellVolumes_;
163  }
164 
165 
166  // Check
167 
168  bool igniting() const;
169 
170  bool ignited() const;
171 
172 
173  // Member Operators
174 
175  void operator=(const ignitionSite&);
176 };
177 
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 } // End namespace Foam
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 #endif
186 
187 // ************************************************************************* //
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
bool ignited() const
Definition: ignitionSite.C:112
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
ignitionSite(Istream &, const Time &, const fvMesh &)
Construct from Istream and database.
scalar duration() const
Definition: ignitionSite.H:146
scalar diameter() const
Definition: ignitionSite.H:136
An abstract class for the time description of the piston motion.
Definition: engineTime.H:51
const scalarList & cellVolumes() const
Definition: ignitionSite.H:159
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
void operator=(const ignitionSite &)
Definition: ignitionSite.C:123
const vector & location() const
Definition: ignitionSite.H:131
dynamicFvMesh & mesh
const labelList & cells() const
Return the ignition cells updated if the mesh moved.
Definition: ignitionSite.C:86
bool igniting() const
Definition: ignitionSite.C:98
iNew(const Time &db, const fvMesh &mesh)
Definition: ignitionSite.H:99
Foam::ignitionSite.
Definition: ignitionSite.H:58
autoPtr< ignitionSite > operator()(Istream &is) const
Definition: ignitionSite.H:105
scalar time() const
Definition: ignitionSite.H:141
autoPtr< ignitionSite > clone() const
Clone.
Definition: ignitionSite.H:121
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Class used for the read-construction of.
Definition: ignitionSite.H:92
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Namespace for OpenFOAM.
scalar strength() const
Definition: ignitionSite.H:151