/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2019-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- 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 . \*---------------------------------------------------------------------------*/ #include "valuePointPatchField.H" #include "pointPatchFieldMapper.H" // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // template bool Foam::valuePointPatchField::readValueEntry ( const dictionary& dict, IOobjectOption::readOption readOpt ) { if (!IOobjectOption::isAnyRead(readOpt)) return false; const auto& p = pointPatchFieldBase::patch(); const auto* eptr = dict.findEntry("value", keyType::LITERAL); if (eptr) { Field::assign(*eptr, p.size()); return true; } if (IOobjectOption::isReadRequired(readOpt)) { FatalIOErrorInFunction(dict) << "Required entry 'value' : missing for patch " << p.name() << " in dictionary " << dict.relativeName() << nl << exit(FatalIOError); } return false; } template void Foam::valuePointPatchField::extrapolateInternal() { const labelUList& meshPoints = pointPatchFieldBase::patch().meshPoints(); const Field& iF = this->primitiveField(); Field& pfld = *this; pfld.resize_nocopy(meshPoints.size()); // In general this is a no-op forAll(meshPoints, i) { pfld[i] = iF[meshPoints[i]]; } } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * // template Foam::valuePointPatchField::valuePointPatchField ( const pointPatch& p, const DimensionedField& iF ) : pointPatchField(p, iF), Field(p.size()) {} template Foam::valuePointPatchField::valuePointPatchField ( const pointPatch& p, const DimensionedField& iF, const Type& value ) : pointPatchField(p, iF), Field(p.size(), value) {} template Foam::valuePointPatchField::valuePointPatchField ( const pointPatch& p, const DimensionedField& iF, const dictionary& dict, IOobjectOption::readOption requireValue ) : pointPatchField(p, iF, dict), Field(p.size()) { if (!readValueEntry(dict, requireValue)) { // Not read (eg, optional and missing): define zero Field::operator=(Zero); } } template Foam::valuePointPatchField::valuePointPatchField ( const valuePointPatchField& ptf, const pointPatch& p, const DimensionedField& iF, const pointPatchFieldMapper& mapper ) : pointPatchField(ptf, p, iF, mapper), Field(ptf, mapper) {} template Foam::valuePointPatchField::valuePointPatchField ( const valuePointPatchField& ptf, const DimensionedField& iF ) : pointPatchField(ptf, iF), Field(ptf) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template void Foam::valuePointPatchField::autoMap ( const pointPatchFieldMapper& m ) { Field::autoMap(m); } template void Foam::valuePointPatchField::rmap ( const pointPatchField& ptf, const labelList& addr ) { Field::rmap ( refCast> ( ptf ), addr ); } template void Foam::valuePointPatchField::updateCoeffs() { if (this->updated()) { return; } // Get internal field to insert values into Field& iF = const_cast&>(this->primitiveField()); this->setInInternalField(iF, *this); pointPatchField::updateCoeffs(); } template void Foam::valuePointPatchField::evaluate(const Pstream::commsTypes) { // Get internal field to insert values into Field& iF = const_cast&>(this->primitiveField()); this->setInInternalField(iF, *this); pointPatchField::evaluate(); } template void Foam::valuePointPatchField::write(Ostream& os) const { pointPatchField::write(os); this->writeValueEntry(os); } // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template void Foam::valuePointPatchField::operator= ( const valuePointPatchField& ptf ) { Field::operator=(ptf); } template void Foam::valuePointPatchField::operator= ( const pointPatchField& ptf ) { // pointPatchField has no values to copy, assign internal values this->extrapolateInternal(); } template void Foam::valuePointPatchField::operator= ( const Field& tf ) { Field::operator=(tf); } template void Foam::valuePointPatchField::operator= ( const Type& t ) { Field::operator=(t); } template void Foam::valuePointPatchField::operator== ( const valuePointPatchField& ptf ) { Field::operator=(ptf); } template void Foam::valuePointPatchField::operator== ( const pointPatchField& ptf ) { // pointPatchField has no values to copy, assign internal values this->extrapolateInternal(); } template void Foam::valuePointPatchField::operator== ( const Field& tf ) { Field::operator=(tf); } template void Foam::valuePointPatchField::operator== ( const Type& t ) { Field::operator=(t); } // ************************************************************************* //