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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Description
27  Abstract base class for finite volume calculus div schemes.
28 
29 \*---------------------------------------------------------------------------*/
30 
31 #include "fv.H"
32 #include "HashTable.H"
33 #include "linear.H"
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 
37 namespace Foam
38 {
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace fv
43 {
44 
45 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
46 
47 template<class Type>
48 tmp<divScheme<Type>> divScheme<Type>::New
49 (
50  const fvMesh& mesh,
51  Istream& schemeData
52 )
53 {
54  if (fv::debug)
55  {
56  InfoInFunction << "Constructing divScheme<Type>" << endl;
57  }
58 
59  if (schemeData.eof())
60  {
61  FatalIOErrorInFunction(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  auto cstrIter = IstreamConstructorTablePtr_->cfind(schemeName);
71 
72  if (!cstrIter.found())
73  {
74  FatalIOErrorInFunction(schemeData)
75  << "unknown div scheme "
76  << schemeName << nl << nl
77  << "Valid div schemes are :" << endl
78  << IstreamConstructorTablePtr_->sortedToc()
79  << exit(FatalIOError);
80  }
81 
82  return cstrIter()(mesh, schemeData);
83 }
84 
85 
86 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
87 
88 } // End namespace fv
89 
90 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
91 
92 } // End namespace Foam
93 
94 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
InfoInFunction
#define InfoInFunction
Report an information message using Foam::Info.
Definition: messageStream.H:325
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
fv.H
HashTable.H
Foam::IOstream::eof
bool eof() const
Return true if end of input seen.
Definition: IOstream.H:230
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::fv::divScheme::New
static tmp< divScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return a pointer to a new divScheme created on freestore.
Definition: divScheme.C:49
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:83
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
fv
labelList fv(nPoints)
Foam::nl
constexpr char nl
Definition: Ostream.H:385
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:401