FreeFOAM The Cross-Platform CFD Toolkit
divScheme.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
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 Description
25  Abstract base class for finite volume calculus div schemes.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include <finiteVolume/fv.H>
30 #include <OpenFOAM/HashTable.H>
31 #include <finiteVolume/linear.H>
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 namespace fv
41 {
42 
43 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
44 
45 template<class Type>
46 tmp<divScheme<Type> > divScheme<Type>::New
47 (
48  const fvMesh& mesh,
49  Istream& schemeData
50 )
51 {
52  if (fv::debug)
53  {
54  Info<< "divScheme<Type>::New(const fvMesh&, Istream&) : "
55  "constructing divScheme<Type>"
56  << endl;
57  }
58 
59  if (schemeData.eof())
60  {
62  (
63  "divScheme<Type>::New(const fvMesh&, Istream&)",
64  schemeData
65  ) << "Div scheme not specified" << endl << endl
66  << "Valid div schemes are :" << endl
67  << IstreamConstructorTablePtr_->sortedToc()
68  << exit(FatalIOError);
69  }
70 
71  word schemeName(schemeData);
72 
73  typename IstreamConstructorTable::iterator cstrIter =
74  IstreamConstructorTablePtr_->find(schemeName);
75 
76  if (cstrIter == IstreamConstructorTablePtr_->end())
77  {
79  (
80  "divScheme<Type>::New(const fvMesh&, Istream&)",
81  schemeData
82  ) << "unknown div scheme " << schemeName << endl << endl
83  << "Valid div schemes are :" << endl
84  << IstreamConstructorTablePtr_->sortedToc()
85  << exit(FatalIOError);
86  }
87 
88  return cstrIter()(mesh, schemeData);
89 }
90 
91 
92 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
93 
94 template<class Type>
96 {}
97 
98 
99 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
100 
101 
102 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
103 
104 } // End namespace fv
105 
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107 
108 } // End namespace Foam
109 
110 // ************************ vim: set sw=4 sts=4 et: ************************ //