introvoyz042's picture
Migrated from GitHub
5a600cf verified
Raw History Blame Contribute Delete
8.77 kB
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "IOobject.H"
#include "dictionary.H"
#include "fvMesh.H"
#include "fieldMapper.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::fvsPatchField<Type>::fvsPatchField
(
const fvPatch& p,
const DimensionedField<Type, surfaceMesh>& iF
)
:
Field<Type>(p.size()),
patch_(p),
internalField_(iF)
{}
template<class Type>
Foam::fvsPatchField<Type>::fvsPatchField
(
const fvPatch& p,
const DimensionedField<Type, surfaceMesh>& iF,
const Field<Type>& f
)
:
Field<Type>(f),
patch_(p),
internalField_(iF)
{}
template<class Type>
Foam::fvsPatchField<Type>::fvsPatchField
(
const fvPatch& p,
const DimensionedField<Type, surfaceMesh>& iF,
const dictionary& dict,
const bool valueRequired
)
:
Field<Type>(p.size()),
patch_(p),
internalField_(iF)
{
if (valueRequired)
{
if (dict.found("value"))
{
Field<Type>::operator=
(
Field<Type>("value", iF.dimensions(), dict, p.size())
);
}
else
{
FatalIOErrorInFunction
(
dict
) << "essential value entry not provided"
<< exit(FatalIOError);
}
}
}
template<class Type>
Foam::fvsPatchField<Type>::fvsPatchField
(
const fvsPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, surfaceMesh>& iF,
const fieldMapper& mapper,
const bool mappingRequired
)
:
Field<Type>(p.size()),
patch_(p),
internalField_(iF)
{
if (mappingRequired)
{
mapper(*this, ptf);
}
}
template<class Type>
Foam::fvsPatchField<Type>::fvsPatchField
(
const fvsPatchField<Type>& ptf,
const DimensionedField<Type, surfaceMesh>& iF
)
:
Field<Type>(static_cast<const Field<Type>&>(ptf)),
patch_(ptf.patch_),
internalField_(iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
const Foam::objectRegistry& Foam::fvsPatchField<Type>::db() const
{
return patch_.mesh();
}
template<class Type>
const Foam::Time& Foam::fvsPatchField<Type>::time() const
{
return patch_.time();
}
template<class Type>
void Foam::fvsPatchField<Type>::check(const fvsPatchField<Type>& ptf) const
{
if (&patch_ != &(ptf.patch_))
{
FatalErrorInFunction
<< "different patches for fvsPatchField<Type>s"
<< abort(FatalError);
}
}
template<class Type>
void Foam::fvsPatchField<Type>::map
(
const fvsPatchField<Type>& ptf,
const fieldMapper& mapper
)
{
mapper(*this, ptf);
}
template<class Type>
void Foam::fvsPatchField<Type>::reset(const fvsPatchField<Type>& ptf)
{
Field<Type>::reset(ptf);
}
template<class Type>
void Foam::fvsPatchField<Type>::write(Ostream& os) const
{
writeEntry(os, "type", type());
if (overridesConstraint())
{
writeEntry(os, "patchType", patch().type());
}
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type>
void Foam::fvsPatchField<Type>::operator=
(
const UList<Type>& ul
)
{
Field<Type>::operator=(ul);
}
template<class Type>
void Foam::fvsPatchField<Type>::operator=
(
const Field<Type>& ul
)
{
Field<Type>::operator=(ul);
}
template<class Type>
void Foam::fvsPatchField<Type>::operator=
(
const fvsPatchField<Type>& ptf
)
{
check(ptf);
Field<Type>::operator=(static_cast<const Field<Type>&>(ptf));
}
template<class Type>
void Foam::fvsPatchField<Type>::operator=
(
const expression::Assignment<Field<Type>>& a
)
{
a.assign(static_cast<Field<Type>&>(*this));
}
template<class Type>
template<class Expression, class>
void Foam::fvsPatchField<Type>::operator=(const Expression& e)
{
operator=
(
static_cast<const expression::Assignment<Field<Type>>&>
(
expression::assignment<Field<Type>>
(
expression::access(e, expression::Base())
)
)
);
}
template<class Type>
void Foam::fvsPatchField<Type>::operator+=
(
const fvsPatchField<Type>& ptf
)
{
check(ptf);
Field<Type>::operator+=(ptf);
}
template<class Type>
void Foam::fvsPatchField<Type>::operator-=
(
const fvsPatchField<Type>& ptf
)
{
check(ptf);
Field<Type>::operator-=(ptf);
}
template<class Type>
void Foam::fvsPatchField<Type>::operator*=
(
const fvsPatchField<scalar>& ptf
)
{
if (&patch_ != &ptf.patch())
{
FatalErrorInFunction
<< "incompatible patches for patch fields"
<< abort(FatalError);
}
Field<Type>::operator*=(ptf);
}
template<class Type>
void Foam::fvsPatchField<Type>::operator/=
(
const fvsPatchField<scalar>& ptf
)
{
if (&patch_ != &ptf.patch())
{
FatalErrorInFunction
<< abort(FatalError);
}
Field<Type>::operator/=(ptf);
}
template<class Type>
void Foam::fvsPatchField<Type>::operator+=
(
const Field<Type>& tf
)
{
Field<Type>::operator+=(tf);
}
template<class Type>
void Foam::fvsPatchField<Type>::operator-=
(
const Field<Type>& tf
)
{
Field<Type>::operator-=(tf);
}
template<class Type>
void Foam::fvsPatchField<Type>::operator*=
(
const scalarField& tf
)
{
Field<Type>::operator*=(tf);
}
template<class Type>
void Foam::fvsPatchField<Type>::operator/=
(
const scalarField& tf
)
{
Field<Type>::operator/=(tf);
}
template<class Type>
void Foam::fvsPatchField<Type>::operator=
(
const Type& t
)
{
Field<Type>::operator=(t);
}
template<class Type>
void Foam::fvsPatchField<Type>::operator+=
(
const Type& t
)
{
Field<Type>::operator+=(t);
}
template<class Type>
void Foam::fvsPatchField<Type>::operator-=
(
const Type& t
)
{
Field<Type>::operator-=(t);
}
template<class Type>
void Foam::fvsPatchField<Type>::operator*=
(
const scalar s
)
{
Field<Type>::operator*=(s);
}
template<class Type>
void Foam::fvsPatchField<Type>::operator/=
(
const scalar s
)
{
Field<Type>::operator/=(s);
}
template<class Type>
void Foam::fvsPatchField<Type>::operator==
(
const fvsPatchField<Type>& ptf
)
{
Field<Type>::operator=(static_cast<const Field<Type>&>(ptf));
}
template<class Type>
void Foam::fvsPatchField<Type>::operator==
(
const Field<Type>& tf
)
{
Field<Type>::operator=(tf);
}
template<class Type>
void Foam::fvsPatchField<Type>::operator==
(
const Type& t
)
{
Field<Type>::operator=(t);
}
template<class Type>
void Foam::fvsPatchField<Type>::operator==
(
const expression::Assignment<Field<Type>>& a
)
{
a.assign(static_cast<Field<Type>&>(*this));
}
template<class Type>
template<class Expression, class>
void Foam::fvsPatchField<Type>::operator==(const Expression& e)
{
operator==
(
static_cast<const expression::Assignment<Field<Type>>&>
(
expression::assignment<Field<Type>>
(
expression::access(e, expression::Base())
)
)
);
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
Foam::Ostream& Foam::operator<<(Ostream& os, const fvsPatchField<Type>& ptf)
{
ptf.write(os);
os.check("Ostream& operator<<(Ostream&, const fvsPatchField<Type>&");
return os;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "fvsPatchFieldNew.C"
// ************************************************************************* //