initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / engine / ignition / ignitionSite.H
blob7f317e3cd72c2ea981e62e636e8969ad437e0dca
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
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.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::ignitionSite
28 Description
29     Foam::ignitionSite
31 SourceFiles
32     ignitionSiteI.H
33     ignitionSite.C
34     ignitionSiteIO.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef ignitionSite_H
39 #define ignitionSite_H
41 #include "vector.H"
42 #include "labelList.H"
43 #include "scalarList.H"
44 #include "autoPtr.H"
45 #include "dictionary.H"
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 namespace Foam
52 class Time;
53 class engineTime;
54 class fvMesh;
56 /*---------------------------------------------------------------------------*\
57                            Class ignitionSite Declaration
58 \*---------------------------------------------------------------------------*/
60 class ignitionSite
62     // Private data
64         const Time& db_;
65         const fvMesh& mesh_;
67         dictionary ignitionSiteDict_;
69         vector location_;
70         scalar diameter_;
71         scalar time_;
72         scalar duration_;
73         scalar strength_;
75         labelList cells_;
76         scalarList cellVolumes_;
78         //- Current time index.
79         //  Used during the update for moving meshes
80         mutable label timeIndex_;
83     // Private Member Functions
85         void findIgnitionCells(const fvMesh&);
88 public:
90     // Public classes
92         //- Class used for the read-construction of
93         //  PtrLists of ignitionSite
94         class iNew
95         {
96             const Time& db_;
97             const fvMesh& mesh_;
98         
99         public:
101             iNew(const Time& db, const fvMesh& mesh)
102             :
103                 db_(db),
104                 mesh_(mesh)
105             {}
107             autoPtr<ignitionSite> operator()(Istream& is) const
108             {
109                 return autoPtr<ignitionSite>(new ignitionSite(is, db_, mesh_));
110             }
111         };
114     // Constructors
116         //- Construct from Istream and database
117         ignitionSite(Istream&, const Time&, const fvMesh&);
119         //- Construct from Istream and engineTime
120         ignitionSite(Istream&, const engineTime&, const fvMesh&);
122         //- Clone
123         autoPtr<ignitionSite> clone() const
124         {
125             return autoPtr<ignitionSite>(new ignitionSite(*this));
126         }
129     // Member Functions
131         // Access
133             const vector& location() const
134             {
135                 return location_;
136             }
138             scalar diameter() const
139             {
140                 return diameter_;
141             }
143             scalar time() const
144             {
145                 return time_;
146             }
148             scalar duration() const
149             {
150                 return duration_;
151             }
153             scalar strength() const
154             {
155                 return strength_;
156             }
158             //- Return the ignition cells updated if the mesh moved
159             const labelList& cells() const;
161             const scalarList& cellVolumes() const
162             {
163                 return cellVolumes_;
164             }
167         // Check
169             bool igniting() const;
171             bool ignited() const;
174     // Member Operators
176         void operator=(const ignitionSite&);
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 } // End namespace Foam
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 #endif
188 // ************************************************************************* //