1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
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
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
26 Constructor of cellModeller: just sets the cellModeller's params.
28 \*---------------------------------------------------------------------------*/
30 #include "cellModeller.H"
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 Foam::cellModeller::cellModeller()
36 if (modelPtrs_.size())
38 FatalErrorIn("cellModeller::cellModeller(const fileName&)")
39 << "attempt to re-construct cellModeller when it already exists"
46 if (models_[i].index() > maxIndex) maxIndex = models_[i].index();
49 modelPtrs_.setSize(maxIndex + 1);
52 // For all the words in the wordlist, set the details of the model
53 // to those specified by the word name and the other parameters
54 // given. This should result in an automatic 'read' of the model
55 // from its File (see cellModel class).
58 if (modelPtrs_[models_[i].index()])
60 FatalErrorIn("cellModeller::cellModeller(const fileName&)")
61 << "more than one model share the index "
66 modelPtrs_[models_[i].index()] = &models_[i];
68 if (modelDictionary_.found(models_[i].name()))
70 FatalErrorIn("cellModeller::cellModeller(const fileName&)")
71 << "more than one model share the name "
76 modelDictionary_.insert(models_[i].name(), &models_[i]);
81 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
83 Foam::cellModeller::~cellModeller()
87 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
89 // Returns a pointer to a model which matches the string symbol
90 // supplied. A null pointer is returned if there is no suitable match.
92 const Foam::cellModel* Foam::cellModeller::lookup(const word& name)
94 HashTable<const cellModel*>::iterator iter = modelDictionary_.find(name);
96 if (iter != modelDictionary_.end())
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
109 // ************************************************************************* //