FreeFOAM The Cross-Platform CFD Toolkit
d2dt2Scheme.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 d2dt2 schemes.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include <finiteVolume/fv.H>
30 #include <OpenFOAM/HashTable.H>
31 
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 
39 namespace fv
40 {
41 
42 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
43 
44 template<class Type>
45 tmp<d2dt2Scheme<Type> > d2dt2Scheme<Type>::New
46 (
47  const fvMesh& mesh,
48  Istream& schemeData
49 )
50 {
51  if (fv::debug)
52  {
53  Info<< "d2dt2Scheme<Type>::New(const fvMesh&, Istream&) : "
54  "constructing d2dt2Scheme<Type>"
55  << endl;
56  }
57 
58  if (schemeData.eof())
59  {
61  (
62  "d2dt2Scheme<Type>::New(const fvMesh&, Istream&)",
63  schemeData
64  ) << "D2dt2 scheme not specified" << endl << endl
65  << "Valid d2dt2 schemes are :" << endl
66  << IstreamConstructorTablePtr_->sortedToc()
67  << exit(FatalIOError);
68  }
69 
70  word schemeName(schemeData);
71 
72  typename IstreamConstructorTable::iterator cstrIter =
73  IstreamConstructorTablePtr_->find(schemeName);
74 
75  if (cstrIter == IstreamConstructorTablePtr_->end())
76  {
78  (
79  "d2dt2Scheme<Type>::New(const fvMesh&, Istream&)",
80  schemeData
81  ) << "unknown d2dt2 scheme " << schemeName << endl << endl
82  << "Valid d2dt2 schemes are :" << endl
83  << IstreamConstructorTablePtr_->sortedToc()
84  << exit(FatalIOError);
85  }
86 
87  return cstrIter()(mesh, schemeData);
88 }
89 
90 
91 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
92 
93 template<class Type>
95 {}
96 
97 
98 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
99 
100 } // End namespace fv
101 
102 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
103 
104 } // End namespace Foam
105 
106 // ************************ vim: set sw=4 sts=4 et: ************************ //