OpenFOAM-dev / data /src /finiteVolume /fields /DimensionedFields /DimensionedFieldFunctions /DimensionedFieldFunction /DimensionedFieldFunction.H
Download data/src/finiteVolume/fields/DimensionedFields/DimensionedFieldFunctions/DimensionedFieldFunction/DimensionedFieldFunction.H from introvoyz042/OpenFOAM-dev: direct link, hf CLI and curl.
- Browser
- Download file 7.84 kB
-
https://huggingface.co/datasets/introvoyz042/OpenFOAM-dev/resolve/main/data/src/finiteVolume/fields/DimensionedFields/DimensionedFieldFunctions/DimensionedFieldFunction/DimensionedFieldFunction.H
- Command line
-
hf download hf://datasets/introvoyz042/OpenFOAM-dev/data/src/finiteVolume/fields/DimensionedFields/DimensionedFieldFunctions/DimensionedFieldFunction/DimensionedFieldFunction.H
-
curl -L -o DimensionedFieldFunction.H https://huggingface.co/datasets/introvoyz042/OpenFOAM-dev/resolve/main/data/src/finiteVolume/fields/DimensionedFields/DimensionedFieldFunctions/DimensionedFieldFunction/DimensionedFieldFunction.H
7.84 kB
| /*---------------------------------------------------------------------------*\ | |
| ========= | | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | |
| \\ / O peration | Website: https://openfoam.org | |
| \\ / A nd | Copyright (C) 2026 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::DimensionedFieldFunction | |
| Description | |
| Base class for run-time selectable internal and patch field initialisation | |
| evaluation and update with dimension checking. | |
| SourceFiles | |
| DimensionedFieldFunction.C | |
| \*---------------------------------------------------------------------------*/ | |
| // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | |
| namespace Foam | |
| { | |
| /*---------------------------------------------------------------------------*\ | |
| Class DimensionedFieldFunction Declaration | |
| \*---------------------------------------------------------------------------*/ | |
| template<class DimensionedFieldType> | |
| class DimensionedFieldFunction | |
| { | |
| protected: | |
| //- Reference to the field the function applies to | |
| DimensionedFieldType& field_; | |
| public: | |
| //- Runtime type information | |
| TypeName("DimensionedFieldFunction"); | |
| // Declare runtime constructor selection tables | |
| declareRunTimeSelectionTable | |
| ( | |
| autoPtr, | |
| DimensionedFieldFunction, | |
| dictionary, | |
| ( | |
| const dictionary& dict, | |
| DimensionedFieldType& field | |
| ), | |
| (dict, field) | |
| ); | |
| // Constructors | |
| //- Construct with dictionary to initialise given field | |
| DimensionedFieldFunction | |
| ( | |
| const dictionary& dict, | |
| DimensionedFieldType& field | |
| ); | |
| //- Construct a copy for the given field | |
| DimensionedFieldFunction | |
| ( | |
| const DimensionedFieldFunction& dff, | |
| DimensionedFieldType& field | |
| ); | |
| //- Disallow default bitwise copy construction | |
| DimensionedFieldFunction | |
| ( | |
| const DimensionedFieldFunction<DimensionedFieldType>& | |
| ) = delete; | |
| //- Construct and return a clone for the specified field | |
| virtual autoPtr<DimensionedFieldFunction<DimensionedFieldType>> | |
| clone(DimensionedFieldType& field) const = 0; | |
| //- Construct and return a clone for the specified field | |
| virtual autoPtr<DimensionedFieldFunction<DimensionedFieldType>> | |
| clone() const | |
| { | |
| NotImplemented; | |
| return autoPtr<DimensionedFieldFunction<DimensionedFieldType>> | |
| ( | |
| nullptr | |
| ); | |
| } | |
| // Selectors | |
| //- Select null constructed | |
| static autoPtr<DimensionedFieldFunction<DimensionedFieldType>> New | |
| ( | |
| const dictionary& dict, | |
| DimensionedFieldType& field | |
| ); | |
| //- Destructor | |
| virtual ~DimensionedFieldFunction() | |
| {} | |
| // Member Functions | |
| //- Evaluate the function and set the field | |
| virtual void evaluate() = 0; | |
| //- Update the field if the function has changed and return true | |
| // otherwise return false | |
| virtual bool update() | |
| { | |
| return false; | |
| } | |
| //- Reset the field size | |
| virtual void reset() | |
| { | |
| field_.setSize(field_.mesh().size()); | |
| evaluate(); | |
| } | |
| //- Write data to dictionary stream | |
| virtual void write(Ostream& os) const = 0; | |
| // Member Operators | |
| //- Disallow default bitwise assignment | |
| void operator= | |
| ( | |
| const DimensionedFieldFunction<DimensionedFieldType>& | |
| ) = delete; | |
| }; | |
| template<class DimensionedFieldType> | |
| void writeEntry | |
| ( | |
| Ostream& os, | |
| const word& key, | |
| const DimensionedFieldFunction<DimensionedFieldType>& f | |
| ); | |
| namespace DimensionedFieldFunctions | |
| { | |
| //- Dummy function to call on a variable to avoid "unused variable" warnings | |
| template<class T> void ignore(const T&){} | |
| } | |
| // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | |
| } // End namespace Foam | |
| // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | |
| // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | |
| // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | |
| // ************************************************************************* // | |