laplacianScheme.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 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 \*---------------------------------------------------------------------------*/
25 
26 #include "fv.H"
27 #include "HashTable.H"
28 #include "linear.H"
29 #include "fvMatrix.H"
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 
38 namespace fv
39 {
40 
41 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
42 
43 template<class Type, class GType>
44 tmp<laplacianScheme<Type, GType> > laplacianScheme<Type, GType>::New
45 (
46  const fvMesh& mesh,
47  Istream& schemeData
48 )
49 {
50  if (fv::debug)
51  {
52  Info<< "laplacianScheme<Type, GType>::New(const fvMesh&, Istream&) : "
53  "constructing laplacianScheme<Type, GType>"
54  << endl;
55  }
56 
57  if (schemeData.eof())
58  {
60  (
61  "laplacianScheme<Type, GType>::New(const fvMesh&, Istream&)",
62  schemeData
63  ) << "Laplacian scheme not specified" << endl << endl
64  << "Valid laplacian schemes are :" << endl
65  << IstreamConstructorTablePtr_->sortedToc()
66  << exit(FatalIOError);
67  }
68 
69  const word schemeName(schemeData);
70 
71  typename IstreamConstructorTable::iterator cstrIter =
72  IstreamConstructorTablePtr_->find(schemeName);
73 
74  if (cstrIter == IstreamConstructorTablePtr_->end())
75  {
77  (
78  "laplacianScheme<Type, GType>::New(const fvMesh&, Istream&)",
79  schemeData
80  ) << "Unknown laplacian scheme " << schemeName << nl << nl
81  << "Valid laplacian schemes are :" << endl
82  << IstreamConstructorTablePtr_->sortedToc()
83  << exit(FatalIOError);
84  }
85 
86  return cstrIter()(mesh, schemeData);
87 }
88 
89 
90 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
91 
92 template<class Type, class GType>
94 {}
95 
96 
97 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
98 
99 template<class Type, class GType>
102 (
105 )
106 {
107  return fvmLaplacian(tinterpGammaScheme_().interpolate(gamma)(), vf);
108 }
109 
110 
111 template<class Type, class GType>
114 (
117 )
118 {
119  return fvcLaplacian(tinterpGammaScheme_().interpolate(gamma)(), vf);
120 }
121 
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 } // End namespace fv
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 } // End namespace Foam
130 
131 // ************************************************************************* //
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
virtual tmp< fvMatrix< Type > > fvmLaplacian(const GeometricField< GType, fvsPatchField, surfaceMesh > &, const GeometricField< Type, fvPatchField, volMesh > &)=0
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
Definition: curveTools.C:75
A class for handling words, derived from string.
Definition: word.H:59
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
messageStream Info
dynamicFvMesh & mesh
Namespace for OpenFOAM.
bool eof() const
Return true if end of input seen.
Definition: IOstream.H:339
static const char nl
Definition: Ostream.H:260
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
IOerror FatalIOError
virtual tmp< GeometricField< Type, fvPatchField, volMesh > > fvcLaplacian(const GeometricField< Type, fvPatchField, volMesh > &)=0
Generic GeometricField class.
virtual ~laplacianScheme()
Destructor.
static tmp< laplacianScheme< Type, GType > > New(const fvMesh &mesh, Istream &schemeData)
Return a pointer to a new laplacianScheme created on freestore.
labelList fv(nPoints)
#define FatalIOErrorIn(functionName, ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:325
A class for managing temporary objects.
Definition: PtrList.H:118