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) 2011-2015 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>
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  schemeData
64  ) << "Div scheme not specified" << endl << endl
65  << "Valid div schemes are :" << endl
66  << IstreamConstructorTablePtr_->sortedToc()
67  << exit(FatalIOError);
68  }
69 
70  const word schemeName(schemeData);
71 
72  typename IstreamConstructorTable::iterator cstrIter =
73  IstreamConstructorTablePtr_->find(schemeName);
74 
75  if (cstrIter == IstreamConstructorTablePtr_->end())
76  {
78  (
79  schemeData
80  ) << "unknown div scheme "
81  << schemeName << nl << nl
82  << "Valid div 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 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
99 
100 
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 
103 } // End namespace fv
104 
105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
106 
107 } // End namespace Foam
108 
109 // ************************************************************************* //
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
fv.H
HashTable.H
Foam::IOstream::eof
bool eof() const
Return true if end of input seen.
Definition: IOstream.H:339
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
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:47
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::Info
messageStream Info
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::fv::divScheme::~divScheme
virtual ~divScheme()
Destructor.
Definition: divScheme.C:94
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
fv
labelList fv(nPoints)
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:330