divScheme.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
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 "fv.H"
30 #include "HashTable.H"
31 #include "linear.H"
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 namespace fv
41 {
42 
43 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
44 
45 template<class Type>
47 (
48  const fvMesh& mesh,
49  Istream& schemeData
50 )
51 {
52  if (fv::debug)
53  {
54  InfoInFunction << "Constructing divScheme<Type>" << endl;
55  }
56 
57  if (schemeData.eof())
58  {
60  (
61  schemeData
62  ) << "Div scheme not specified" << endl << endl
63  << "Valid div schemes are :" << endl
64  << IstreamConstructorTablePtr_->sortedToc()
65  << exit(FatalIOError);
66  }
67 
68  const word schemeName(schemeData);
69 
70  typename IstreamConstructorTable::iterator cstrIter =
71  IstreamConstructorTablePtr_->find(schemeName);
72 
73  if (cstrIter == IstreamConstructorTablePtr_->end())
74  {
76  (
77  schemeData
78  ) << "unknown div scheme "
79  << schemeName << nl << nl
80  << "Valid div schemes are :" << endl
81  << IstreamConstructorTablePtr_->sortedToc()
82  << exit(FatalIOError);
83  }
84 
85  return cstrIter()(mesh, schemeData);
86 }
87 
88 
89 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
90 
91 template<class Type>
93 {}
94 
95 
96 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
97 
98 
99 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100 
101 } // End namespace fv
102 
103 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
104 
105 } // End namespace Foam
106 
107 // ************************************************************************* //
bool eof() const
Return true if end of input seen.
Definition: IOstream.H:336
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
virtual ~divScheme()
Destructor.
Definition: divScheme.C:92
static tmp< divScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return a pointer to a new divScheme created on freestore.
Definition: divScheme.C:47
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:346
#define InfoInFunction
Report an information message using Foam::Info.
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:257
IOerror FatalIOError
static const char nl
Definition: Ostream.H:266
labelList fv(nPoints)