Forward compatibility: flex
[foam-extend-3.2.git] / src / dynamicMesh / dynamicTopoFvMesh / fieldMapping / fluxCorrector.C
blob49112b186e14263f504bcaacc560f91d59eec280
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation, either version 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     fluxCorrector
27 Description
28     Implementation of the fluxCorrector base class
30 Author
31     Sandeep Menon
32     University of Massachusetts Amherst
33     All rights reserved
35 \*---------------------------------------------------------------------------*/
37 #include "fluxCorrector.H"
38 #include "dlLibraryTable.H"
40 namespace Foam
43 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
45 defineTypeNameAndDebug(fluxCorrector, 0);
46 defineRunTimeSelectionTable(fluxCorrector, mesh);
48 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
50 autoPtr<fluxCorrector> fluxCorrector::New
52     const fvMesh& mesh,
53     const dictionary& dict
56     // Check if an optional entry was specified
57     if (dict.found("fluxCorrector"))
58     {
59         word correctorTypeName(dict.lookup("fluxCorrector"));
61         // Open any supplied libraries in dictionary
62         dlLibraryTable::open
63         (
64             dict,
65             "fluxCorrectorLibs",
66             meshConstructorTablePtr_
67         );
69         if (!meshConstructorTablePtr_)
70         {
71             FatalErrorIn
72             (
73                 "autoPtr<fluxCorrector> fluxCorrector::New"
74                 "(const fvMesh& mesh, const dictionary& dict)"
75             )   << "fluxCorrector table is empty"
76                 << exit(FatalError);
77         }
79         correctorTypeName = word(dict.lookup("fluxCorrector"));
81         meshConstructorTable::iterator cstrIter =
82             meshConstructorTablePtr_->find(correctorTypeName);
84         if (cstrIter == meshConstructorTablePtr_->end())
85         {
86             FatalErrorIn
87             (
88                 "autoPtr<fluxCorrector> fluxCorrector::New"
89                 "(const fvMesh& mesh, const dictionary& dict)"
90             )   << "Unknown fluxCorrector type " << correctorTypeName
91                 << endl << endl
92                 << "Valid fluxCorrector types are: " << endl
93                 << meshConstructorTablePtr_->toc()
94                 << exit(FatalError);
95         }
97         return autoPtr<fluxCorrector>(cstrIter()(mesh, dict));
98     }
100     // Return the default fluxCorrector
101     return autoPtr<fluxCorrector>(new fluxCorrector(mesh, dict));
105 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
107 //- Return reference to mesh
108 const fvMesh& fluxCorrector::mesh() const
110     return mesh_;
114 //- Return reference to dictionary
115 const dictionary& fluxCorrector::dict() const
117     return dict_;
121 //- Is flux-correction required?
122 bool fluxCorrector::required() const
124     // Support for cases which do not involve a flow-solver.
125     // Notify the user, just in case.
126     Info << " ~~~ No flux correction ~~~ " << endl;
128     return false;
132 //- Interpolate fluxes to a specified list of faces
133 void fluxCorrector::interpolateFluxes(const labelList& faces) const
135     if (required())
136     {
137         // Throw an error stating that the scheme hasn't been implemented
138         notImplemented
139         (
140             "void fluxCorrector::interpolateFluxes"
141             "(const labelList& faces) const"
142         );
143     }
147 //- Update fluxes in the registry, if required
148 void fluxCorrector::updateFluxes() const
150     if (required())
151     {
152         // Throw an error stating that the scheme hasn't been implemented
153         notImplemented("void fluxCorrector::updateFluxes() const");
154     }
158 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
159 void fluxCorrector::operator=(const fluxCorrector& rhs)
161     // Check for assignment to self
162     if (this == &rhs)
163     {
164         FatalErrorIn("fluxCorrector::operator=(const fluxCorrector&)")
165             << "Attempted assignment to self"
166             << abort(FatalError);
167     }
170 } // End namespace Foam
172 // ************************************************************************* //