/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-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 .
Class
Foam::UniformDimensionedField
Description
Dimensioned registered with the database as a registered IOobject
which has the functionality of a uniform field and allows values from the
top-level code to be passed to boundary conditions etc.
SourceFiles
UniformDimensionedField.C
\*---------------------------------------------------------------------------*/
#ifndef UniformDimensionedField_H
#define UniformDimensionedField_H
#include "regIOobject.H"
#include "dimensionedType.H"
#include "UniformField.H"
#include "OldTimeField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
template
class UniformDimensionedField;
template
struct OldTimeField0Type>
{
typedef UniformDimensionedField type;
};
template
struct OldTimeOtherFieldType>
{
template class OtherPrimitiveField>
using type = UniformDimensionedField;
};
/*---------------------------------------------------------------------------*\
Class UniformDimensionedField Declaration
\*---------------------------------------------------------------------------*/
template
class UniformDimensionedField
:
public regIOobject,
public dimensioned,
public tmp>::refCount,
public OldTimeField>
{
protected:
// Protected Member Functions
//- Construct from IOobject and dimensions without reading
UniformDimensionedField
(
const IOobject&,
const dimensionSet& dims,
const bool
);
//- Construct from IOobject and default value without reading
UniformDimensionedField
(
const IOobject&,
const dimensioned&,
const bool
);
//- Read the field and check the dimensions
void read
(
const IOobject::readOption& ro,
const dimensionSet& dims
);
public:
// Public Typedefs
//- Type of the non-dimensioned field
typedef UniformField FieldType;
//- Component type of the elements of the field
typedef typename UniformField::cmptType cmptType;
//- Runtime type information
TypeName("UniformDimensionedField");
// Constructors
//- Construct from IOobject
UniformDimensionedField(const IOobject&);
//- Construct from IOobject and dimensions
UniformDimensionedField(const IOobject&, const dimensionSet& dims);
//- Construct from IOobject and default value
// reading from the IOobject file according to read option
UniformDimensionedField(const IOobject&, const dimensioned&);
//- Copy constructor
UniformDimensionedField(const UniformDimensionedField&);
//- Destructor
virtual ~UniformDimensionedField();
// Member Functions
//- Name function provided to resolve the ambiguity between the
// name functions in regIOobject and dimensioned
virtual const word& name() const
{
return dimensioned::name();
}
//- Is object global
virtual bool global() const
{
return true;
}
//- Return a reference to the value after storing old-time values
Type& value();
//- Return a const-reference to the value
const Type& value() const
{
return dimensioned::value();
}
//- Reset the field values to the given field
// Equivalent to operator=
void reset(const UniformDimensionedField&);
//- Prevent warning due to read method
using regIOobject::read;
//- WriteData function required for regIOobject write operation
bool writeData(Ostream&) const;
// Member Operators
//- Assign to another field
void operator==(const UniformDimensionedField&);
//- Assign to another field
void operator=(const UniformDimensionedField&);
//- Assign to a dimensioned type
void operator=(const dimensioned&);
//- Access by index
const Type& operator[](const label) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "UniformDimensionedFieldExpression.H"
#ifdef NoRepository
#include "UniformDimensionedField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //