initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / utilities / thermophysical / mixtureAdiabaticFlameT / mixture.H
blob2b261142f6cef613a98980ca01a940fac97596ef
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::mixture
28 Description
30 SourceFiles
31     mixtureI.H
32     mixture.C
33     mixtureIO.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef mixture_H
38 #define mixture_H
40 #include "error.H"
42 #include "List.H"
43 #include "substance.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 namespace Foam
50 /*---------------------------------------------------------------------------*\
51                            Class mixture Declaration
52 \*---------------------------------------------------------------------------*/
54 class mixture
56     public List<substance>
58     // Private data
60         word name_;
63 public:
65     // Constructors
67         //- Construct from Istream
68         mixture(Istream& is)
69         :
70             List<substance>(is),
71             name_(is)
72         {
73             scalar volTot = 0;
75             for (label i = 0; i < size(); i++)
76             {
77                 volTot += operator[](i).volFrac();
78             }
80             if (volTot > 1.001 || volTot < 0.999)
81             {
82                 FatalErrorIn("mixture::mixture(istream& is)")
83                     << "Sum of volume fractions for Mixture " << name_
84                     << " = " << volTot << endl
85                     << "Should equal one."
86                     << abort(FatalError);
87             }
88         }
91     // Member Functions
93         // Access
95             const word& name() const
96             {
97                 return name_;
98             }
102 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
104 } // End namespace Foam
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 #endif
110 // ************************************************************************* //