OpenFOAM-5.x/src/fvOptions/fvOption/fvOptionList.H

220 lines
5.8 KiB
C++

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::fv::optionList
Description
List of finite volume options
SourceFile
optionList.C
\*---------------------------------------------------------------------------*/
#ifndef optionList_H
#define optionList_H
#include "PtrList.H"
#include "GeometricField.H"
#include "fvPatchField.H"
#include "fvOption.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of friend functions and operators
namespace fv
{
class optionList;
}
Ostream& operator<<(Ostream& os, const fv::optionList& options);
namespace fv
{
/*---------------------------------------------------------------------------*\
Class optionList Declaration
\*---------------------------------------------------------------------------*/
class optionList
:
public PtrList<option>
{
protected:
// Protected data
//- Reference to the mesh database
const fvMesh& mesh_;
//- Time index to check that all defined sources have been applied
label checkTimeIndex_;
// Protected Member Functions
//- Return the "options" sub-dictionary if present otherwise return dict
const dictionary& optionsDict(const dictionary& dict) const;
//- Read options dictionary
bool readOptions(const dictionary& dict);
//- Check that all sources have been applied
void checkApplied() const;
//- Disallow default bitwise copy construct
optionList(const optionList&);
//- Disallow default bitwise assignment
void operator=(const optionList&);
public:
//- Runtime type information
TypeName("optionList");
// Constructors
//- Construct null
optionList(const fvMesh& mesh);
//- Construct from mesh and dictionary
optionList(const fvMesh& mesh, const dictionary& dict);
//- Destructor
virtual ~optionList()
{}
// Member Functions
//- Reset the source list
void reset(const dictionary& dict);
//- Correct
template<class Type>
void correct(GeometricField<Type, fvPatchField, volMesh>& fld);
// Sources
//- Return source for equation
template<class Type>
tmp<fvMatrix<Type> > operator()
(
GeometricField<Type, fvPatchField, volMesh>& fld
);
//- Return source for equation with specified name
template<class Type>
tmp<fvMatrix<Type> > operator()
(
GeometricField<Type, fvPatchField, volMesh>& fld,
const word& fieldName
);
//- Return source for equation
template<class Type>
tmp<fvMatrix<Type> > operator()
(
const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& fld
);
//- Return source for equation with specified name
template<class Type>
tmp<fvMatrix<Type> > operator()
(
const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& fld,
const word& fieldName
);
//- Return source for equation
template<class Type>
tmp<fvMatrix<Type> > operator()
(
const volScalarField& alpha,
const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& fld
);
//- Return source for equation with specified name
template<class Type>
tmp<fvMatrix<Type> > operator()
(
const volScalarField& alpha,
const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& fld,
const word& fieldName
);
// Constraints
//- Apply constraints to equation
template<class Type>
void constrain(fvMatrix<Type>& eqn);
// IO
//- Read dictionary
virtual bool read(const dictionary& dict);
//- Write data to Ostream
virtual bool writeData(Ostream& os) const;
//- Ostream operator
friend Ostream& operator<<
(
Ostream& os,
const optionList& options
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "fvOptionListTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //