ENH: use GeometricField type aliases in sampling and expressions

This commit is contained in:
Mark Olesen
2022-02-14 21:21:15 +01:00
parent a67f6bf7ae
commit 2a25b356b9
26 changed files with 311 additions and 433 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2010-2018 Bernhard Gschaider Copyright (C) 2010-2018 Bernhard Gschaider
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -166,7 +166,7 @@ protected:
template<class Type> template<class Type>
static inline word defaultBoundaryType static inline word defaultBoundaryType
( (
const GeometricField<Type, fvPatchField, volMesh>& const VolumeField<Type>&
) )
{ {
return "zeroGradient"; return "zeroGradient";
@ -180,7 +180,7 @@ protected:
template<class Type> template<class Type>
static inline void correctField static inline void correctField
( (
GeometricField<Type, fvPatchField, volMesh>& fld VolumeField<Type>& fld
) )
{ {
fld.correctBoundaryConditions(); fld.correctBoundaryConditions();

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2010-2018 Bernhard Gschaider Copyright (C) 2010-2018 Bernhard Gschaider
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -231,18 +231,14 @@ bool Foam::expressions::fvExprDriver::isField
Info<< "fvExprDriver::isField <" << name << '>' << endl; Info<< "fvExprDriver::isField <" << name << '>' << endl;
} }
typedef GeometricField<Type, fvPatchField, volMesh> vfieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sfieldType;
typedef GeometricField<Type, pointPatchField, pointMesh> pfieldType;
return return
( (
wantPointData wantPointData
? this->foundField<pfieldType>(name) ? this->foundField<PointField<Type>>(name)
: :
( (
this->foundField<vfieldType>(name) this->foundField<VolumeField<Type>>(name)
|| this->foundField<sfieldType>(name) || this->foundField<SurfaceField<Type>>(name)
) )
); );
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -118,17 +118,11 @@ Foam::expressions::patchExpr::parseDriver::getField(const word& name)
const label patchIndex = patch_.index(); const label patchIndex = patch_.index();
// Field types
typedef GeometricField<Type, fvPatchField, volMesh> vfieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sfieldType;
typedef GeometricField<Type, pointPatchField, pointMesh> pfieldType;
// Local, temporary storage and/or lookup values // Local, temporary storage and/or lookup values
bool found = false; bool found = false;
tmp<vfieldType> vfield; tmp<VolumeField<Type>> vfield;
tmp<sfieldType> sfield; tmp<SurfaceField<Type>> sfield;
tmp<pfieldType> pfield; tmp<PointField<Type>> pfield;
for (int checki = 0; !found && checki < 2; ++checki) for (int checki = 0; !found && checki < 2; ++checki)
{ {
@ -144,17 +138,17 @@ Foam::expressions::patchExpr::parseDriver::getField(const word& name)
if (!found) if (!found)
{ {
vfield.cref(dynamic_cast<const vfieldType*>(ioptr)); vfield.cref(dynamic_cast<const VolumeField<Type>*>(ioptr));
found = vfield.valid(); found = vfield.valid();
} }
if (!found) if (!found)
{ {
sfield.cref(dynamic_cast<const sfieldType*>(ioptr)); sfield.cref(dynamic_cast<const SurfaceField<Type>*>(ioptr));
found = sfield.valid(); found = sfield.valid();
} }
if (!found) if (!found)
{ {
pfield.cref(dynamic_cast<const pfieldType*>(ioptr)); pfield.cref(dynamic_cast<const PointField<Type>*>(ioptr));
found = pfield.valid(); found = pfield.valid();
} }
} }
@ -165,17 +159,17 @@ Foam::expressions::patchExpr::parseDriver::getField(const word& name)
{ {
const word fldType = this->getTypeOfField(name); const word fldType = this->getTypeOfField(name);
if (fldType == vfieldType::typeName) if (fldType == VolumeField<Type>::typeName)
{ {
vfield = this->readAndRegister<vfieldType>(name, mesh()); vfield = this->readAndRegister<VolumeField<Type>>(name, mesh());
} }
else if (fldType == sfieldType::typeName) else if (fldType == SurfaceField<Type>::typeName)
{ {
sfield = this->readAndRegister<sfieldType>(name, mesh()); sfield = this->readAndRegister<SurfaceField<Type>>(name, mesh());
} }
else if (fldType == pfieldType::typeName) else if (fldType == PointField<Type>::typeName)
{ {
pfield = this->readAndRegister<pfieldType> pfield = this->readAndRegister<PointField<Type>>
( (
name, name,
pointMesh::New(mesh()) pointMesh::New(mesh())
@ -209,16 +203,16 @@ Foam::expressions::patchExpr::parseDriver::getField(const word& name)
<< pTraits<Type>::typeName << nl << nl; << pTraits<Type>::typeName << nl << nl;
FatalError FatalError
<< vfieldType::typeName << " Fields: " << VolumeField<Type>::typeName << " Fields: "
<< flatOutput(obr.sortedNames<vfieldType>()) << nl; << flatOutput(obr.sortedNames<VolumeField<Type>>()) << nl;
FatalError FatalError
<< sfieldType::typeName << " Fields: " << SurfaceField<Type>::typeName << " Fields: "
<< flatOutput(obr.sortedNames<sfieldType>()) << nl; << flatOutput(obr.sortedNames<SurfaceField<Type>>()) << nl;
FatalError FatalError
<< pfieldType::typeName << " Fields: " << PointField<Type>::typeName << " Fields: "
<< flatOutput(obr.sortedNames<pfieldType>()) << nl; << flatOutput(obr.sortedNames<PointField<Type>>()) << nl;
FatalError FatalError
<< exit(FatalError); << exit(FatalError);
@ -245,15 +239,10 @@ Foam::expressions::patchExpr::parseDriver::patchInternalField
const label patchIndex = patch_.index(); const label patchIndex = patch_.index();
// Field types
typedef GeometricField<Type, fvPatchField, volMesh> vfieldType;
typedef GeometricField<Type, pointPatchField, pointMesh> pfieldType;
// Local, temporary storage and/or lookup values // Local, temporary storage and/or lookup values
bool found = false; bool found = false;
tmp<vfieldType> vfield; tmp<VolumeField<Type>> vfield;
tmp<pfieldType> pfield; tmp<PointField<Type>> pfield;
for (int checki = 0; !found && checki < 2; ++checki) for (int checki = 0; !found && checki < 2; ++checki)
{ {
@ -269,12 +258,12 @@ Foam::expressions::patchExpr::parseDriver::patchInternalField
if (!found) if (!found)
{ {
vfield.cref(dynamic_cast<const vfieldType*>(ioptr)); vfield.cref(dynamic_cast<const VolumeField<Type>*>(ioptr));
found = vfield.valid(); found = vfield.valid();
} }
if (!found) if (!found)
{ {
pfield.cref(dynamic_cast<const pfieldType*>(ioptr)); pfield.cref(dynamic_cast<const PointField<Type>*>(ioptr));
found = pfield.valid(); found = pfield.valid();
} }
} }
@ -285,13 +274,13 @@ Foam::expressions::patchExpr::parseDriver::patchInternalField
{ {
const word fldType = this->getTypeOfField(name); const word fldType = this->getTypeOfField(name);
if (fldType == vfieldType::typeName) if (fldType == VolumeField<Type>::typeName)
{ {
vfield = this->readAndRegister<vfieldType>(name, mesh()); vfield = this->readAndRegister<VolumeField<Type>>(name, mesh());
} }
else if (fldType == pfieldType::typeName) else if (fldType == PointField<Type>::typeName)
{ {
pfield = this->readAndRegister<pfieldType> pfield = this->readAndRegister<PointField<Type>>
( (
name, name,
pointMesh::New(mesh()) pointMesh::New(mesh())
@ -315,12 +304,12 @@ Foam::expressions::patchExpr::parseDriver::patchInternalField
<< pTraits<Type>::typeName << nl << nl; << pTraits<Type>::typeName << nl << nl;
FatalError FatalError
<< vfieldType::typeName << " Fields: " << VolumeField<Type>::typeName << " Fields: "
<< flatOutput(obr.sortedNames<vfieldType>()) << nl; << flatOutput(obr.sortedNames<VolumeField<Type>>()) << nl;
FatalError FatalError
<< pfieldType::typeName << " Fields: " << PointField<Type>::typeName << " Fields: "
<< flatOutput(obr.sortedNames<pfieldType>()) << nl; << flatOutput(obr.sortedNames<PointField<Type>>()) << nl;
FatalError FatalError
<< exit(FatalError); << exit(FatalError);
@ -347,13 +336,9 @@ Foam::expressions::patchExpr::parseDriver::patchNeighbourField
const label patchIndex = patch_.index(); const label patchIndex = patch_.index();
// Field types
typedef GeometricField<Type, fvPatchField, volMesh> vfieldType;
// Local, temporary storage and/or lookup values // Local, temporary storage and/or lookup values
bool found = false; bool found = false;
tmp<vfieldType> vfield; tmp<VolumeField<Type>> vfield;
for (int checki = 0; !found && checki < 2; ++checki) for (int checki = 0; !found && checki < 2; ++checki)
{ {
@ -369,7 +354,7 @@ Foam::expressions::patchExpr::parseDriver::patchNeighbourField
if (!found) if (!found)
{ {
vfield.cref(dynamic_cast<const vfieldType*>(ioptr)); vfield.cref(dynamic_cast<const VolumeField<Type>*>(ioptr));
found = vfield.valid(); found = vfield.valid();
} }
} }
@ -380,9 +365,9 @@ Foam::expressions::patchExpr::parseDriver::patchNeighbourField
{ {
const word fldType = this->getTypeOfField(name); const word fldType = this->getTypeOfField(name);
if (fldType == vfieldType::typeName) if (fldType == VolumeField<Type>::typeName)
{ {
vfield = this->readAndRegister<vfieldType>(name, mesh()); vfield = this->readAndRegister<VolumeField<Type>>(name, mesh());
} }
} }
@ -398,8 +383,8 @@ Foam::expressions::patchExpr::parseDriver::patchNeighbourField
<< pTraits<Type>::typeName << nl << nl; << pTraits<Type>::typeName << nl << nl;
FatalError FatalError
<< vfieldType::typeName << " Fields: " << VolumeField<Type>::typeName << " Fields: "
<< flatOutput(obr.sortedNames<vfieldType>()) << nl; << flatOutput(obr.sortedNames<VolumeField<Type>>()) << nl;
FatalError FatalError
<< exit(FatalError); << exit(FatalError);
@ -426,13 +411,9 @@ Foam::expressions::patchExpr::parseDriver::patchNormalField
const label patchIndex = patch_.index(); const label patchIndex = patch_.index();
// Field types
typedef GeometricField<Type, fvPatchField, volMesh> vfieldType;
// Local, temporary storage and/or lookup values // Local, temporary storage and/or lookup values
bool found = false; bool found = false;
tmp<vfieldType> vfield; tmp<VolumeField<Type>> vfield;
for (int checki = 0; !found && checki < 2; ++checki) for (int checki = 0; !found && checki < 2; ++checki)
{ {
@ -448,7 +429,7 @@ Foam::expressions::patchExpr::parseDriver::patchNormalField
if (!found) if (!found)
{ {
vfield.cref(dynamic_cast<const vfieldType*>(ioptr)); vfield.cref(dynamic_cast<const VolumeField<Type>*>(ioptr));
found = vfield.valid(); found = vfield.valid();
} }
} }
@ -459,9 +440,9 @@ Foam::expressions::patchExpr::parseDriver::patchNormalField
{ {
const word fldType = this->getTypeOfField(name); const word fldType = this->getTypeOfField(name);
if (fldType == vfieldType::typeName) if (fldType == VolumeField<Type>::typeName)
{ {
vfield = this->readAndRegister<vfieldType>(name, mesh()); vfield = this->readAndRegister<VolumeField<Type>>(name, mesh());
} }
} }
@ -477,8 +458,8 @@ Foam::expressions::patchExpr::parseDriver::patchNormalField
<< pTraits<Type>::typeName << nl << nl; << pTraits<Type>::typeName << nl << nl;
FatalError FatalError
<< vfieldType::typeName << " Fields: " << VolumeField<Type>::typeName << " Fields: "
<< flatOutput(obr.sortedNames<vfieldType>()) << nl; << flatOutput(obr.sortedNames<VolumeField<Type>>()) << nl;
FatalError FatalError
<< exit(FatalError); << exit(FatalError);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -325,60 +325,48 @@ public:
//- Set result (vol field) //- Set result (vol field)
template<class Type> template<class Type>
void setResult void setResult(VolumeField<Type>* ptr, bool logical = false);
(
GeometricField<Type, fvPatchField, volMesh>* ptr,
bool logical = false
);
//- Set result (surface field) //- Set result (surface field)
template<class Type> template<class Type>
void setResult void setResult(SurfaceField<Type>* ptr, bool logical = false);
(
GeometricField<Type, fvsPatchField, surfaceMesh>* ptr,
bool logical = false
);
//- Set result (point field) //- Set result (point field)
template<class Type> template<class Type>
void setResult void setResult(PointField<Type>* ptr, bool logical = false);
(
GeometricField<Type, pointPatchField, pointMesh>* ptr,
bool logical = false
);
// New Fields // New Fields
//- Return a new volume field with the mesh size //- Return a new volume field with the mesh size
template<class Type> template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh>> tmp<VolumeField<Type>>
newVolField(const Type& val = pTraits<Type>::zero) const; newVolField(const Type& val = pTraits<Type>::zero) const;
//- Return a new surface field with the mesh nInternalFaces size //- Return a new surface field with the mesh nInternalFaces size
template<class Type> template<class Type>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tmp<SurfaceField<Type>>
newSurfaceField(const Type& val = pTraits<Type>::zero) const; newSurfaceField(const Type& val = pTraits<Type>::zero) const;
//- Return a new point field with the mesh nPoints size //- Return a new point field with the mesh nPoints size
template<class Type> template<class Type>
tmp<GeometricField<Type, pointPatchField, pointMesh>> tmp<PointField<Type>>
newPointField(const Type& val = pTraits<Type>::zero) const; newPointField(const Type& val = pTraits<Type>::zero) const;
//- Retrieve field (vol field) //- Retrieve field (vol field)
template<class Type> template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh>> tmp<VolumeField<Type>>
getVolField(const word& fldName, bool getOldTime=false); getVolField(const word& fldName, bool getOldTime=false);
//- Retrieve field (surface field) //- Retrieve field (surface field)
template<class Type> template<class Type>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tmp<SurfaceField<Type>>
getSurfaceField(const word& fldName, bool getOldTime=false); getSurfaceField(const word& fldName, bool getOldTime=false);
//- Retrieve field (surface field) //- Retrieve field (surface field)
template<class Type> template<class Type>
tmp<GeometricField<Type, pointPatchField, pointMesh>> tmp<PointField<Type>>
getPointField(const word& fldName, bool getOldTime=false); getPointField(const word& fldName, bool getOldTime=false);
@ -386,57 +374,39 @@ public:
//- Interpolate cell to face values //- Interpolate cell to face values
template<class Type> template<class Type>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tmp<SurfaceField<Type>>
cellToFace cellToFace(const VolumeField<Type>& field) const;
(
const GeometricField<Type,fvPatchField,volMesh>& field
) const;
//- Interpolate cell to point values //- Interpolate cell to point values
template<class Type> template<class Type>
tmp<GeometricField<Type, pointPatchField, pointMesh>> tmp<PointField<Type>>
cellToPoint cellToPoint(const VolumeField<Type>& field) const;
(
const GeometricField<Type, fvPatchField, volMesh>& field
) const;
//- Interpolate point to cell values //- Interpolate point to cell values
template<class Type> template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh>> tmp<VolumeField<Type>>
pointToCell pointToCell(const PointField<Type>& field) const;
(
const GeometricField<Type, pointPatchField, pointMesh>& field
) const;
// Custom Field Functions // Custom Field Functions
//- The volume-weighted average of a field //- The volume-weighted average of a field
template<class Type> template<class Type>
Type volAverage Type volAverage(VolumeField<Type>& fld) const
(
GeometricField<Type, fvPatchField, volMesh>& fld
) const
{ {
return weightedAverage(fld.mesh().V(), fld.primitiveField()); return weightedAverage(fld.mesh().V(), fld.primitiveField());
} }
//- The volume-weighted sum of a field //- The volume-weighted sum of a field
template<class Type> template<class Type>
Type volSum Type volSum(VolumeField<Type>& fld) const
(
GeometricField<Type, fvPatchField, volMesh>& fld
) const
{ {
return weightedSum(fld.mesh().V(), fld.primitiveField()); return weightedSum(fld.mesh().V(), fld.primitiveField());
} }
//- The area-weighted average of a field //- The area-weighted average of a field
template<class Type> template<class Type>
Type areaAverage Type areaAverage(SurfaceField<Type>& fld) const
(
GeometricField<Type, fvsPatchField, surfaceMesh>& fld
) const
{ {
return weightedAverage return weightedAverage
( (
@ -447,10 +417,7 @@ public:
//- The area-weighted sum of a field //- The area-weighted sum of a field
template<class Type> template<class Type>
Type areaSum Type areaSum(SurfaceField<Type>& fld) const
(
GeometricField<Type, fvsPatchField, surfaceMesh>& fld
) const
{ {
return weightedSum return weightedSum
( (

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -62,16 +62,14 @@ void Foam::expressions::volumeExpr::parseDriver::setInternalFieldResult
template<class Type> template<class Type>
void Foam::expressions::volumeExpr::parseDriver::setResult void Foam::expressions::volumeExpr::parseDriver::setResult
( (
GeometricField<Type, fvPatchField, volMesh>* ptr, VolumeField<Type>* ptr,
bool logical bool logical
) )
{ {
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
resultField_.reset(nullptr); resultField_.reset(nullptr);
// Characteristics // Characteristics
resultType_ = pTraits<fieldType>::typeName; resultType_ = VolumeField<Type>::typeName;
isLogical_ = logical; isLogical_ = logical;
fieldGeoType_ = VOLUME_DATA; fieldGeoType_ = VOLUME_DATA;
@ -91,16 +89,14 @@ void Foam::expressions::volumeExpr::parseDriver::setResult
template<class Type> template<class Type>
void Foam::expressions::volumeExpr::parseDriver::setResult void Foam::expressions::volumeExpr::parseDriver::setResult
( (
GeometricField<Type, fvsPatchField, surfaceMesh>* ptr, SurfaceField<Type>* ptr,
bool logical bool logical
) )
{ {
typedef GeometricField<Type, fvsPatchField, surfaceMesh> fieldType;
resultField_.reset(nullptr); resultField_.reset(nullptr);
// Characteristics // Characteristics
resultType_ = pTraits<fieldType>::typeName; resultType_ = SurfaceField<Type>::typeName;
isLogical_ = logical; isLogical_ = logical;
fieldGeoType_ = FACE_DATA; fieldGeoType_ = FACE_DATA;
@ -120,16 +116,14 @@ void Foam::expressions::volumeExpr::parseDriver::setResult
template<class Type> template<class Type>
void Foam::expressions::volumeExpr::parseDriver::setResult void Foam::expressions::volumeExpr::parseDriver::setResult
( (
GeometricField<Type, pointPatchField, pointMesh>* ptr, PointField<Type>* ptr,
bool logical bool logical
) )
{ {
typedef GeometricField<Type, pointPatchField, pointMesh> fieldType;
resultField_.reset(nullptr); resultField_.reset(nullptr);
// Characteristics // Characteristics
resultType_ = pTraits<fieldType>::typeName; resultType_ = PointField<Type>::typeName;
isLogical_ = logical; isLogical_ = logical;
fieldGeoType_ = POINT_DATA; fieldGeoType_ = POINT_DATA;
@ -182,16 +176,14 @@ Foam::expressions::volumeExpr::parseDriver::isResultType
template<class Type> template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>> Foam::tmp<Foam::VolumeField<Type>>
Foam::expressions::volumeExpr::parseDriver::getVolField Foam::expressions::volumeExpr::parseDriver::getVolField
( (
const word& fldName, const word& fldName,
bool getOldTime bool getOldTime
) )
{ {
typedef GeometricField<Type, fvPatchField, volMesh> fieldType; return this->getOrReadField<VolumeField<Type>>
return this->getOrReadField<fieldType>
( (
fldName, fldName,
true, // mandatory true, // mandatory
@ -201,16 +193,14 @@ Foam::expressions::volumeExpr::parseDriver::getVolField
template<class Type> template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>> Foam::tmp<Foam::SurfaceField<Type>>
Foam::expressions::volumeExpr::parseDriver::getSurfaceField Foam::expressions::volumeExpr::parseDriver::getSurfaceField
( (
const word& fldName, const word& fldName,
bool getOldTime bool getOldTime
) )
{ {
typedef GeometricField<Type, fvsPatchField, surfaceMesh> fieldType; return this->getOrReadField<SurfaceField<Type>>
return this->getOrReadField<fieldType>
( (
fldName, fldName,
true, // mandatory true, // mandatory
@ -220,16 +210,14 @@ Foam::expressions::volumeExpr::parseDriver::getSurfaceField
template<class Type> template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh>> Foam::tmp<Foam::PointField<Type>>
Foam::expressions::volumeExpr::parseDriver::getPointField Foam::expressions::volumeExpr::parseDriver::getPointField
( (
const word& fldName, const word& fldName,
bool getOldTime bool getOldTime
) )
{ {
typedef GeometricField<Type, pointPatchField, pointMesh> fieldType; return this->getOrReadPointField<PointField<Type>>
return this->getOrReadPointField<fieldType>
( (
fldName, fldName,
true, // mandatory true, // mandatory
@ -239,15 +227,13 @@ Foam::expressions::volumeExpr::parseDriver::getPointField
template<class Type> template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>> Foam::tmp<Foam::VolumeField<Type>>
Foam::expressions::volumeExpr::parseDriver::newVolField Foam::expressions::volumeExpr::parseDriver::newVolField
( (
const Type& val const Type& val
) const ) const
{ {
typedef GeometricField<Type, fvPatchField, volMesh> fieldType; return VolumeField<Type>::New
return fieldType::New
( (
word("constant.") + word(pTraits<Type>::typeName), word("constant.") + word(pTraits<Type>::typeName),
mesh(), mesh(),
@ -257,15 +243,13 @@ Foam::expressions::volumeExpr::parseDriver::newVolField
template<class Type> template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>> Foam::tmp<Foam::SurfaceField<Type>>
Foam::expressions::volumeExpr::parseDriver::newSurfaceField Foam::expressions::volumeExpr::parseDriver::newSurfaceField
( (
const Type& val const Type& val
) const ) const
{ {
typedef GeometricField<Type, fvsPatchField, surfaceMesh> fieldType; return SurfaceField<Type>::New
return fieldType::New
( (
word("constant.") + word(pTraits<Type>::typeName), word("constant.") + word(pTraits<Type>::typeName),
mesh(), mesh(),
@ -275,15 +259,13 @@ Foam::expressions::volumeExpr::parseDriver::newSurfaceField
template<class Type> template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh>> Foam::tmp<Foam::PointField<Type>>
Foam::expressions::volumeExpr::parseDriver::newPointField Foam::expressions::volumeExpr::parseDriver::newPointField
( (
const Type& val const Type& val
) const ) const
{ {
typedef GeometricField<Type, pointPatchField, pointMesh> fieldType; return PointField<Type>::New
return fieldType::New
( (
word("constant.") + word(pTraits<Type>::typeName), word("constant.") + word(pTraits<Type>::typeName),
pointMesh::New(mesh()), pointMesh::New(mesh()),
@ -293,10 +275,10 @@ Foam::expressions::volumeExpr::parseDriver::newPointField
template<class Type> template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>> Foam::tmp<Foam::SurfaceField<Type>>
Foam::expressions::volumeExpr::parseDriver::cellToFace Foam::expressions::volumeExpr::parseDriver::cellToFace
( (
const GeometricField<Type, fvPatchField, volMesh>& field const VolumeField<Type>& field
) const ) const
{ {
return fvc::interpolate(field); return fvc::interpolate(field);
@ -304,10 +286,10 @@ Foam::expressions::volumeExpr::parseDriver::cellToFace
template<class Type> template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh>> Foam::tmp<Foam::PointField<Type>>
Foam::expressions::volumeExpr::parseDriver::cellToPoint Foam::expressions::volumeExpr::parseDriver::cellToPoint
( (
const GeometricField<Type, fvPatchField, volMesh>& field const VolumeField<Type>& field
) const ) const
{ {
volPointInterpolation interp(this->mesh()); volPointInterpolation interp(this->mesh());
@ -316,10 +298,10 @@ Foam::expressions::volumeExpr::parseDriver::cellToPoint
template<class Type> template<class Type>
Foam::tmp<Foam::GeometricField<Type,Foam::fvPatchField,Foam::volMesh>> Foam::tmp<Foam::VolumeField<Type>>
Foam::expressions::volumeExpr::parseDriver::pointToCell Foam::expressions::volumeExpr::parseDriver::pointToCell
( (
const GeometricField<Type, pointPatchField, pointMesh>& field const PointField<Type>& field
) const ) const
{ {
auto tresult = newVolField<Type>(); auto tresult = newVolField<Type>();

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd. Copyright (C) 2021-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -80,7 +80,7 @@ template<class Type>
static void doCorrectBoundaryConditions static void doCorrectBoundaryConditions
( (
bool correctBCs, bool correctBCs,
GeometricField<Type, fvPatchField, volMesh>& field VolumeField<Type>& field
) )
{ {
if (correctBCs) if (correctBCs)
@ -104,7 +104,7 @@ template<class Type>
void doCorrectBoundaryConditions void doCorrectBoundaryConditions
( (
bool correctBCs, bool correctBCs,
GeometricField<Type, pointPatchField, pointMesh>& field PointField<Type>& field
) )
{ {
if (correctBCs) if (correctBCs)
@ -119,7 +119,7 @@ template<class Type>
void doCorrectBoundaryConditions void doCorrectBoundaryConditions
( (
bool correctBCs, bool correctBCs,
GeometricField<Type, fvsPatchField, surfaceMesh>& field SurfaceField<Type>& field
) )
{} {}
@ -148,15 +148,11 @@ bool Foam::functionObjects::fvExpressionField::loadAndStore(const IOobject& io)
template<class Type> template<class Type>
bool Foam::functionObjects::fvExpressionField::loadField(const IOobject& io) bool Foam::functionObjects::fvExpressionField::loadField(const IOobject& io)
{ {
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
// typedef typename VolFieldType::Internal IntVolFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
return return
( (
loadAndStore<VolFieldType>(io) loadAndStore<VolumeField<Type>>(io)
/// || loadAndStore<IntVolFieldType>(io) /// || loadAndStore<VolumeInternalField<Type>>(io)
|| loadAndStore<SurfaceFieldType>(io) || loadAndStore<SurfaceField<Type>>(io)
); );
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd. Copyright (C) 2021-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -43,7 +43,7 @@ void Foam::Function1Types::Sample<Type>::setSampleCell() const
{ {
pointEventNo_ = points.eventNo(); pointEventNo_ = points.eventNo();
celli_ = this->template mesh<fvMesh>().findCell(position_); celli_ = mesh.findCell(position_);
if (!returnReduce(celli_ != -1, orOp<bool>())) if (!returnReduce(celli_ != -1, orOp<bool>()))
{ {
@ -104,18 +104,17 @@ Foam::Function1Types::Sample<Type>::Sample(const Sample& s)
template<class Type> template<class Type>
Type Foam::Function1Types::Sample<Type>::value(const scalar x) const Type Foam::Function1Types::Sample<Type>::value(const scalar x) const
{ {
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
const auto& mesh = this->template mesh<fvMesh>(); const auto& mesh = this->template mesh<fvMesh>();
const auto* fieldPtr = mesh.template cfindObject<VolFieldType>(fieldName_); const auto* fieldPtr =
mesh.template cfindObject<VolumeField<Type>>(fieldName_);
if (!fieldPtr) if (!fieldPtr)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Unable to find field " << fieldName_ << " on the mesh database" << "Unable to find field " << fieldName_ << " on the mesh database"
<< ". Valid " << VolFieldType::typeName << " fields are:" << ". Valid " << VolumeField<Type>::typeName << " fields are:"
<< mesh.names(VolFieldType::typeName) << mesh.template sortedNames<VolumeField<Type>>()
<< exit(FatalError); << exit(FatalError);
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2015-2020 OpenCFD Ltd. Copyright (C) 2015-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -73,9 +73,9 @@ Foam::meshToMesh::procMapMethodNames_
template<> template<>
void Foam::meshToMesh::mapInternalSrcToTgt void Foam::meshToMesh::mapInternalSrcToTgt
( (
const GeometricField<sphericalTensor, fvPatchField, volMesh>& field, const VolumeField<sphericalTensor>& field,
const plusEqOp<sphericalTensor>& cop, const plusEqOp<sphericalTensor>& cop,
GeometricField<sphericalTensor, fvPatchField, volMesh>& result, VolumeField<sphericalTensor>& result,
const bool secondOrder const bool secondOrder
) const ) const
{ {
@ -86,9 +86,9 @@ void Foam::meshToMesh::mapInternalSrcToTgt
template<> template<>
void Foam::meshToMesh::mapInternalSrcToTgt void Foam::meshToMesh::mapInternalSrcToTgt
( (
const GeometricField<sphericalTensor, fvPatchField, volMesh>& field, const VolumeField<sphericalTensor>& field,
const minusEqOp<sphericalTensor>& cop, const minusEqOp<sphericalTensor>& cop,
GeometricField<sphericalTensor, fvPatchField, volMesh>& result, VolumeField<sphericalTensor>& result,
const bool secondOrder const bool secondOrder
) const ) const
{ {
@ -99,9 +99,9 @@ void Foam::meshToMesh::mapInternalSrcToTgt
template<> template<>
void Foam::meshToMesh::mapInternalSrcToTgt void Foam::meshToMesh::mapInternalSrcToTgt
( (
const GeometricField<symmTensor, fvPatchField, volMesh>& field, const VolumeField<symmTensor>& field,
const plusEqOp<symmTensor>& cop, const plusEqOp<symmTensor>& cop,
GeometricField<symmTensor, fvPatchField, volMesh>& result, VolumeField<symmTensor>& result,
const bool secondOrder const bool secondOrder
) const ) const
{ {
@ -112,9 +112,9 @@ void Foam::meshToMesh::mapInternalSrcToTgt
template<> template<>
void Foam::meshToMesh::mapInternalSrcToTgt void Foam::meshToMesh::mapInternalSrcToTgt
( (
const GeometricField<symmTensor, fvPatchField, volMesh>& field, const VolumeField<symmTensor>& field,
const minusEqOp<symmTensor>& cop, const minusEqOp<symmTensor>& cop,
GeometricField<symmTensor, fvPatchField, volMesh>& result, VolumeField<symmTensor>& result,
const bool secondOrder const bool secondOrder
) const ) const
{ {
@ -125,9 +125,9 @@ void Foam::meshToMesh::mapInternalSrcToTgt
template<> template<>
void Foam::meshToMesh::mapInternalSrcToTgt void Foam::meshToMesh::mapInternalSrcToTgt
( (
const GeometricField<tensor, fvPatchField, volMesh>& field, const VolumeField<tensor>& field,
const plusEqOp<tensor>& cop, const plusEqOp<tensor>& cop,
GeometricField<tensor, fvPatchField, volMesh>& result, VolumeField<tensor>& result,
const bool secondOrder const bool secondOrder
) const ) const
{ {
@ -138,9 +138,9 @@ void Foam::meshToMesh::mapInternalSrcToTgt
template<> template<>
void Foam::meshToMesh::mapInternalSrcToTgt void Foam::meshToMesh::mapInternalSrcToTgt
( (
const GeometricField<tensor, fvPatchField, volMesh>& field, const VolumeField<tensor>& field,
const minusEqOp<tensor>& cop, const minusEqOp<tensor>& cop,
GeometricField<tensor, fvPatchField, volMesh>& result, VolumeField<tensor>& result,
const bool secondOrder const bool secondOrder
) const ) const
{ {
@ -151,9 +151,9 @@ void Foam::meshToMesh::mapInternalSrcToTgt
template<> template<>
void Foam::meshToMesh::mapInternalTgtToSrc void Foam::meshToMesh::mapInternalTgtToSrc
( (
const GeometricField<sphericalTensor, fvPatchField, volMesh>& field, const VolumeField<sphericalTensor>& field,
const plusEqOp<sphericalTensor>& cop, const plusEqOp<sphericalTensor>& cop,
GeometricField<sphericalTensor, fvPatchField, volMesh>& result, VolumeField<sphericalTensor>& result,
const bool secondOrder const bool secondOrder
) const ) const
{ {
@ -164,9 +164,9 @@ void Foam::meshToMesh::mapInternalTgtToSrc
template<> template<>
void Foam::meshToMesh::mapInternalTgtToSrc void Foam::meshToMesh::mapInternalTgtToSrc
( (
const GeometricField<sphericalTensor, fvPatchField, volMesh>& field, const VolumeField<sphericalTensor>& field,
const minusEqOp<sphericalTensor>& cop, const minusEqOp<sphericalTensor>& cop,
GeometricField<sphericalTensor, fvPatchField, volMesh>& result, VolumeField<sphericalTensor>& result,
const bool secondOrder const bool secondOrder
) const ) const
{ {
@ -177,9 +177,9 @@ void Foam::meshToMesh::mapInternalTgtToSrc
template<> template<>
void Foam::meshToMesh::mapInternalTgtToSrc void Foam::meshToMesh::mapInternalTgtToSrc
( (
const GeometricField<symmTensor, fvPatchField, volMesh>& field, const VolumeField<symmTensor>& field,
const plusEqOp<symmTensor>& cop, const plusEqOp<symmTensor>& cop,
GeometricField<symmTensor, fvPatchField, volMesh>& result, VolumeField<symmTensor>& result,
const bool secondOrder const bool secondOrder
) const ) const
{ {
@ -190,9 +190,9 @@ void Foam::meshToMesh::mapInternalTgtToSrc
template<> template<>
void Foam::meshToMesh::mapInternalTgtToSrc void Foam::meshToMesh::mapInternalTgtToSrc
( (
const GeometricField<symmTensor, fvPatchField, volMesh>& field, const VolumeField<symmTensor>& field,
const minusEqOp<symmTensor>& cop, const minusEqOp<symmTensor>& cop,
GeometricField<symmTensor, fvPatchField, volMesh>& result, VolumeField<symmTensor>& result,
const bool secondOrder const bool secondOrder
) const ) const
{ {
@ -203,9 +203,9 @@ void Foam::meshToMesh::mapInternalTgtToSrc
template<> template<>
void Foam::meshToMesh::mapInternalTgtToSrc void Foam::meshToMesh::mapInternalTgtToSrc
( (
const GeometricField<tensor, fvPatchField, volMesh>& field, const VolumeField<tensor>& field,
const plusEqOp<tensor>& cop, const plusEqOp<tensor>& cop,
GeometricField<tensor, fvPatchField, volMesh>& result, VolumeField<tensor>& result,
const bool secondOrder const bool secondOrder
) const ) const
{ {
@ -216,9 +216,9 @@ void Foam::meshToMesh::mapInternalTgtToSrc
template<> template<>
void Foam::meshToMesh::mapInternalTgtToSrc void Foam::meshToMesh::mapInternalTgtToSrc
( (
const GeometricField<tensor, fvPatchField, volMesh>& field, const VolumeField<tensor>& field,
const minusEqOp<tensor>& cop, const minusEqOp<tensor>& cop,
GeometricField<tensor, fvPatchField, volMesh>& result, VolumeField<tensor>& result,
const bool secondOrder const bool secondOrder
) const ) const
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2015-2018 OpenCFD Ltd. Copyright (C) 2015-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -42,8 +42,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef meshToMesh_H #ifndef Foam_meshToMesh_H
#define meshToMesh_H #define Foam_meshToMesh_H
#include "polyMesh.H" #include "polyMesh.H"
#include "treeBoundBox.H" #include "treeBoundBox.H"
@ -159,9 +159,9 @@ private:
template<class Type, class CombineOp> template<class Type, class CombineOp>
void mapInternalSrcToTgt void mapInternalSrcToTgt
( (
const GeometricField<Type, fvPatchField, volMesh>& field, const VolumeField<Type>& field,
const CombineOp& cop, const CombineOp& cop,
GeometricField<Type, fvPatchField, volMesh>& result, VolumeField<Type>& result,
const bool secondOrder const bool secondOrder
) const; ) const;
@ -170,9 +170,9 @@ private:
template<class Type, class CombineOp> template<class Type, class CombineOp>
void mapInternalTgtToSrc void mapInternalTgtToSrc
( (
const GeometricField<Type, fvPatchField, volMesh>& field, const VolumeField<Type>& field,
const CombineOp& cop, const CombineOp& cop,
GeometricField<Type, fvPatchField, volMesh>& result, VolumeField<Type>& result,
const bool secondOrder const bool secondOrder
) const; ) const;
@ -550,18 +550,18 @@ public:
template<class Type, class CombineOp> template<class Type, class CombineOp>
void mapSrcToTgt void mapSrcToTgt
( (
const GeometricField<Type, fvPatchField, volMesh>& field, const VolumeField<Type>& field,
const CombineOp& cop, const CombineOp& cop,
GeometricField<Type, fvPatchField, volMesh>& result, VolumeField<Type>& result,
const bool secondOrder = true const bool secondOrder = true
) const; ) const;
//- Interpolate a field with a defined operation. The initial //- Interpolate a field with a defined operation. The initial
// values of the result are set to zero // values of the result are set to zero
template<class Type, class CombineOp> template<class Type, class CombineOp>
tmp<GeometricField<Type, fvPatchField, volMesh>> mapSrcToTgt tmp<VolumeField<Type>> mapSrcToTgt
( (
const GeometricField<Type, fvPatchField, volMesh>& field, const VolumeField<Type>& field,
const CombineOp& cop, const CombineOp& cop,
const bool secondOrder = true const bool secondOrder = true
) const; ) const;
@ -569,10 +569,9 @@ public:
//- Interpolate a tmp field with a defined operation. The //- Interpolate a tmp field with a defined operation. The
// initial values of the result are set to zero // initial values of the result are set to zero
template<class Type, class CombineOp> template<class Type, class CombineOp>
tmp<GeometricField<Type, fvPatchField, volMesh>> mapSrcToTgt tmp<VolumeField<Type>> mapSrcToTgt
( (
const tmp<GeometricField<Type, fvPatchField, volMesh>>& const tmp<VolumeField<Type>>& tfield,
tfield,
const CombineOp& cop, const CombineOp& cop,
const bool secondOrder = true const bool secondOrder = true
) const; ) const;
@ -580,19 +579,18 @@ public:
//- Convenience function to map a field with a default //- Convenience function to map a field with a default
// operation (plusEqOp) // operation (plusEqOp)
template<class Type> template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh>> mapSrcToTgt tmp<VolumeField<Type>> mapSrcToTgt
( (
const GeometricField<Type, fvPatchField, volMesh>& field, const VolumeField<Type>& field,
const bool secondOrder = true const bool secondOrder = true
) const; ) const;
//- Convenience function to map a tmp field with a default //- Convenience function to map a tmp field with a default
// operation (plusEqOp) // operation (plusEqOp)
template<class Type> template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh>> mapSrcToTgt tmp<VolumeField<Type>> mapSrcToTgt
( (
const tmp<GeometricField<Type, fvPatchField, volMesh>>& const tmp<VolumeField<Type>>& tfield,
tfield,
const bool secondOrder = true const bool secondOrder = true
) const; ) const;
@ -606,18 +604,18 @@ public:
template<class Type, class CombineOp> template<class Type, class CombineOp>
void mapTgtToSrc void mapTgtToSrc
( (
const GeometricField<Type, fvPatchField, volMesh>& field, const VolumeField<Type>& field,
const CombineOp& cop, const CombineOp& cop,
GeometricField<Type, fvPatchField, volMesh>& result, VolumeField<Type>& result,
const bool secondOrder = true const bool secondOrder = true
) const; ) const;
//- Interpolate a field with a defined operation. The initial //- Interpolate a field with a defined operation. The initial
// values of the result are set to zero // values of the result are set to zero
template<class Type, class CombineOp> template<class Type, class CombineOp>
tmp<GeometricField<Type, fvPatchField, volMesh>> mapTgtToSrc tmp<VolumeField<Type>> mapTgtToSrc
( (
const GeometricField<Type, fvPatchField, volMesh>& field, const VolumeField<Type>& field,
const CombineOp& cop, const CombineOp& cop,
const bool secondOrder = true const bool secondOrder = true
) const; ) const;
@ -625,9 +623,9 @@ public:
//- Interpolate a tmp field with a defined operation. The //- Interpolate a tmp field with a defined operation. The
// initial values of the result are set to zero // initial values of the result are set to zero
template<class Type, class CombineOp> template<class Type, class CombineOp>
tmp<GeometricField<Type, fvPatchField, volMesh>> mapTgtToSrc tmp<VolumeField<Type>> mapTgtToSrc
( (
const tmp<GeometricField<Type, fvPatchField, volMesh>>& const tmp<VolumeField<Type>>&
tfield, tfield,
const CombineOp& cop, const CombineOp& cop,
const bool secondOrder = true const bool secondOrder = true
@ -636,19 +634,18 @@ public:
//- Convenience function to map a field with a default //- Convenience function to map a field with a default
// operation (plusEqOp) // operation (plusEqOp)
template<class Type> template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh>> mapTgtToSrc tmp<VolumeField<Type>> mapTgtToSrc
( (
const GeometricField<Type, fvPatchField, volMesh>& field, const VolumeField<Type>& field,
const bool secondOrder = true const bool secondOrder = true
) const; ) const;
//- Convenience function to map a tmp field with a default //- Convenience function to map a tmp field with a default
// operation (plusEqOp) // operation (plusEqOp)
template<class Type> template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh>> mapTgtToSrc tmp<VolumeField<Type>> mapTgtToSrc
( (
const tmp<GeometricField<Type, fvPatchField, volMesh>>& const tmp<VolumeField<Type>>& tfield,
tfield,
const bool secondOrder = true const bool secondOrder = true
) const; ) const;
}; };
@ -661,97 +658,97 @@ public:
template<> template<>
void meshToMesh::mapInternalSrcToTgt void meshToMesh::mapInternalSrcToTgt
( (
const GeometricField<sphericalTensor, fvPatchField, volMesh>&, const VolumeField<sphericalTensor>&,
const plusEqOp<sphericalTensor>&, const plusEqOp<sphericalTensor>&,
GeometricField<sphericalTensor, fvPatchField, volMesh>&, VolumeField<sphericalTensor>&,
const bool const bool
) const; ) const;
template<> template<>
void meshToMesh::mapInternalSrcToTgt void meshToMesh::mapInternalSrcToTgt
( (
const GeometricField<sphericalTensor, fvPatchField, volMesh>&, const VolumeField<sphericalTensor>&,
const minusEqOp<sphericalTensor>&, const minusEqOp<sphericalTensor>&,
GeometricField<sphericalTensor, fvPatchField, volMesh>&, VolumeField<sphericalTensor>&,
const bool const bool
) const; ) const;
template<> template<>
void meshToMesh::mapInternalSrcToTgt void meshToMesh::mapInternalSrcToTgt
( (
const GeometricField<symmTensor, fvPatchField, volMesh>&, const VolumeField<symmTensor>&,
const plusEqOp<symmTensor>&, const plusEqOp<symmTensor>&,
GeometricField<symmTensor, fvPatchField, volMesh>&, VolumeField<symmTensor>&,
const bool const bool
) const; ) const;
template<> template<>
void meshToMesh::mapInternalSrcToTgt void meshToMesh::mapInternalSrcToTgt
( (
const GeometricField<symmTensor, fvPatchField, volMesh>&, const VolumeField<symmTensor>&,
const minusEqOp<symmTensor>&, const minusEqOp<symmTensor>&,
GeometricField<symmTensor, fvPatchField, volMesh>&, VolumeField<symmTensor>&,
const bool const bool
) const; ) const;
template<> template<>
void meshToMesh::mapInternalSrcToTgt void meshToMesh::mapInternalSrcToTgt
( (
const GeometricField<tensor, fvPatchField, volMesh>&, const VolumeField<tensor>&,
const plusEqOp<tensor>&, const plusEqOp<tensor>&,
GeometricField<tensor, fvPatchField, volMesh>&, VolumeField<tensor>&,
const bool const bool
) const; ) const;
template<> template<>
void meshToMesh::mapInternalSrcToTgt void meshToMesh::mapInternalSrcToTgt
( (
const GeometricField<tensor, fvPatchField, volMesh>&, const VolumeField<tensor>&,
const minusEqOp<tensor>&, const minusEqOp<tensor>&,
GeometricField<tensor, fvPatchField, volMesh>&, VolumeField<tensor>&,
const bool const bool
) const; ) const;
template<> template<>
void meshToMesh::mapInternalTgtToSrc void meshToMesh::mapInternalTgtToSrc
( (
const GeometricField<sphericalTensor, fvPatchField, volMesh>&, const VolumeField<sphericalTensor>&,
const plusEqOp<sphericalTensor>&, const plusEqOp<sphericalTensor>&,
GeometricField<sphericalTensor, fvPatchField, volMesh>&, VolumeField<sphericalTensor>&,
const bool const bool
) const; ) const;
template<> template<>
void meshToMesh::mapInternalTgtToSrc void meshToMesh::mapInternalTgtToSrc
( (
const GeometricField<sphericalTensor, fvPatchField, volMesh>&, const VolumeField<sphericalTensor>&,
const minusEqOp<sphericalTensor>&, const minusEqOp<sphericalTensor>&,
GeometricField<sphericalTensor, fvPatchField, volMesh>&, VolumeField<sphericalTensor>&,
const bool const bool
) const; ) const;
template<> template<>
void meshToMesh::mapInternalTgtToSrc void meshToMesh::mapInternalTgtToSrc
( (
const GeometricField<symmTensor, fvPatchField, volMesh>&, const VolumeField<symmTensor>&,
const plusEqOp<symmTensor>&, const plusEqOp<symmTensor>&,
GeometricField<symmTensor, fvPatchField, volMesh>&, VolumeField<symmTensor>&,
const bool const bool
) const; ) const;
template<> template<>
void meshToMesh::mapInternalTgtToSrc void meshToMesh::mapInternalTgtToSrc
( (
const GeometricField<symmTensor, fvPatchField, volMesh>&, const VolumeField<symmTensor>&,
const minusEqOp<symmTensor>&, const minusEqOp<symmTensor>&,
GeometricField<symmTensor, fvPatchField, volMesh>&, VolumeField<symmTensor>&,
const bool const bool
) const; ) const;
template<> template<>
void meshToMesh::mapInternalTgtToSrc void meshToMesh::mapInternalTgtToSrc
( (
const GeometricField<tensor, fvPatchField, volMesh>&, const VolumeField<tensor>&,
const plusEqOp<tensor>&, const plusEqOp<tensor>&,
GeometricField<tensor, fvPatchField, volMesh>&, VolumeField<tensor>&,
const bool const bool
) const; ) const;
template<> template<>
void meshToMesh::mapInternalTgtToSrc void meshToMesh::mapInternalTgtToSrc
( (
const GeometricField<tensor, fvPatchField, volMesh>&, const VolumeField<tensor>&,
const minusEqOp<tensor>&, const minusEqOp<tensor>&,
GeometricField<tensor, fvPatchField, volMesh>&, VolumeField<tensor>&,
const bool const bool
) const; ) const;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2015 OpenCFD Ltd. Copyright (C) 2015-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -472,9 +472,9 @@ Foam::tmp<Foam::Field<Type>> Foam::meshToMesh::mapTgtToSrc
template<class Type, class CombineOp> template<class Type, class CombineOp>
void Foam::meshToMesh::mapInternalSrcToTgt void Foam::meshToMesh::mapInternalSrcToTgt
( (
const GeometricField<Type, fvPatchField, volMesh>& field, const VolumeField<Type>& field,
const CombineOp& cop, const CombineOp& cop,
GeometricField<Type, fvPatchField, volMesh>& result, VolumeField<Type>& result,
const bool secondOrder const bool secondOrder
) const ) const
{ {
@ -519,9 +519,9 @@ void Foam::meshToMesh::mapAndOpSrcToTgt
template<class Type, class CombineOp> template<class Type, class CombineOp>
void Foam::meshToMesh::mapSrcToTgt void Foam::meshToMesh::mapSrcToTgt
( (
const GeometricField<Type, fvPatchField, volMesh>& field, const VolumeField<Type>& field,
const CombineOp& cop, const CombineOp& cop,
GeometricField<Type, fvPatchField, volMesh>& result, VolumeField<Type>& result,
const bool secondOrder const bool secondOrder
) const ) const
{ {
@ -529,8 +529,7 @@ void Foam::meshToMesh::mapSrcToTgt
const PtrList<AMIPatchToPatchInterpolation>& AMIList = patchAMIs(); const PtrList<AMIPatchToPatchInterpolation>& AMIList = patchAMIs();
typename GeometricField<Type, fvPatchField, volMesh>:: auto& resultBf = result.boundaryFieldRef();
Boundary& resultBf = result.boundaryFieldRef();
forAll(AMIList, i) forAll(AMIList, i)
{ {
@ -581,21 +580,18 @@ void Foam::meshToMesh::mapSrcToTgt
template<class Type, class CombineOp> template<class Type, class CombineOp>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>> Foam::tmp<Foam::VolumeField<Type>>
Foam::meshToMesh::mapSrcToTgt Foam::meshToMesh::mapSrcToTgt
( (
const GeometricField<Type, fvPatchField, volMesh>& field, const VolumeField<Type>& field,
const CombineOp& cop, const CombineOp& cop,
const bool secondOrder const bool secondOrder
) const ) const
{ {
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const fvMesh& tgtMesh = static_cast<const fvMesh&>(tgtRegion_); const fvMesh& tgtMesh = static_cast<const fvMesh&>(tgtRegion_);
const fvBoundaryMesh& tgtBm = tgtMesh.boundary(); const fvBoundaryMesh& tgtBm = tgtMesh.boundary();
const typename fieldType::Boundary& srcBfld = const auto& srcBfld = field.boundaryField();
field.boundaryField();
PtrList<fvPatchField<Type>> tgtPatchFields(tgtBm.size()); PtrList<fvPatchField<Type>> tgtPatchFields(tgtBm.size());
@ -646,9 +642,8 @@ Foam::meshToMesh::mapSrcToTgt
} }
} }
tmp<fieldType> tresult auto tresult =
( tmp<VolumeField<Type>>::New
new fieldType
( (
IOobject IOobject
( (
@ -662,8 +657,7 @@ Foam::meshToMesh::mapSrcToTgt
field.dimensions(), field.dimensions(),
Field<Type>(tgtMesh.nCells(), Zero), Field<Type>(tgtMesh.nCells(), Zero),
tgtPatchFields tgtPatchFields
) );
);
mapSrcToTgt(field, cop, tresult.ref(), secondOrder); mapSrcToTgt(field, cop, tresult.ref(), secondOrder);
@ -672,10 +666,10 @@ Foam::meshToMesh::mapSrcToTgt
template<class Type, class CombineOp> template<class Type, class CombineOp>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>> Foam::tmp<Foam::VolumeField<Type>>
Foam::meshToMesh::mapSrcToTgt Foam::meshToMesh::mapSrcToTgt
( (
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tfield, const tmp<VolumeField<Type>>& tfield,
const CombineOp& cop, const CombineOp& cop,
const bool secondOrder const bool secondOrder
) const ) const
@ -685,10 +679,10 @@ Foam::meshToMesh::mapSrcToTgt
template<class Type> template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>> Foam::tmp<Foam::VolumeField<Type>>
Foam::meshToMesh::mapSrcToTgt Foam::meshToMesh::mapSrcToTgt
( (
const GeometricField<Type, fvPatchField, volMesh>& field, const VolumeField<Type>& field,
const bool secondOrder const bool secondOrder
) const ) const
{ {
@ -697,10 +691,10 @@ Foam::meshToMesh::mapSrcToTgt
template<class Type> template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>> Foam::tmp<Foam::VolumeField<Type>>
Foam::meshToMesh::mapSrcToTgt Foam::meshToMesh::mapSrcToTgt
( (
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tfield, const tmp<VolumeField<Type>>& tfield,
const bool secondOrder const bool secondOrder
) const ) const
{ {
@ -711,9 +705,9 @@ Foam::meshToMesh::mapSrcToTgt
template<class Type, class CombineOp> template<class Type, class CombineOp>
void Foam::meshToMesh::mapInternalTgtToSrc void Foam::meshToMesh::mapInternalTgtToSrc
( (
const GeometricField<Type, fvPatchField, volMesh>& field, const VolumeField<Type>& field,
const CombineOp& cop, const CombineOp& cop,
GeometricField<Type, fvPatchField, volMesh>& result, VolumeField<Type>& result,
const bool secondOrder const bool secondOrder
) const ) const
{ {
@ -758,9 +752,9 @@ void Foam::meshToMesh::mapAndOpTgtToSrc
template<class Type, class CombineOp> template<class Type, class CombineOp>
void Foam::meshToMesh::mapTgtToSrc void Foam::meshToMesh::mapTgtToSrc
( (
const GeometricField<Type, fvPatchField, volMesh>& field, const VolumeField<Type>& field,
const CombineOp& cop, const CombineOp& cop,
GeometricField<Type, fvPatchField, volMesh>& result, VolumeField<Type>& result,
const bool secondOrder const bool secondOrder
) const ) const
{ {
@ -817,21 +811,18 @@ void Foam::meshToMesh::mapTgtToSrc
template<class Type, class CombineOp> template<class Type, class CombineOp>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>> Foam::tmp<Foam::VolumeField<Type>>
Foam::meshToMesh::mapTgtToSrc Foam::meshToMesh::mapTgtToSrc
( (
const GeometricField<Type, fvPatchField, volMesh>& field, const VolumeField<Type>& field,
const CombineOp& cop, const CombineOp& cop,
const bool secondOrder const bool secondOrder
) const ) const
{ {
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const fvMesh& srcMesh = static_cast<const fvMesh&>(srcRegion_); const fvMesh& srcMesh = static_cast<const fvMesh&>(srcRegion_);
const fvBoundaryMesh& srcBm = srcMesh.boundary(); const fvBoundaryMesh& srcBm = srcMesh.boundary();
const typename fieldType::Boundary& tgtBfld = const auto& tgtBfld = field.boundaryField();
field.boundaryField();
PtrList<fvPatchField<Type>> srcPatchFields(srcBm.size()); PtrList<fvPatchField<Type>> srcPatchFields(srcBm.size());
@ -882,9 +873,8 @@ Foam::meshToMesh::mapTgtToSrc
} }
} }
tmp<fieldType> tresult auto tresult =
( tmp<VolumeField<Type>>::New
new fieldType
( (
IOobject IOobject
( (
@ -898,8 +888,7 @@ Foam::meshToMesh::mapTgtToSrc
field.dimensions(), field.dimensions(),
Field<Type>(srcMesh.nCells(), Zero), Field<Type>(srcMesh.nCells(), Zero),
srcPatchFields srcPatchFields
) );
);
mapTgtToSrc(field, cop, tresult.ref(), secondOrder); mapTgtToSrc(field, cop, tresult.ref(), secondOrder);
@ -908,10 +897,10 @@ Foam::meshToMesh::mapTgtToSrc
template<class Type, class CombineOp> template<class Type, class CombineOp>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>> Foam::tmp<Foam::VolumeField<Type>>
Foam::meshToMesh::mapTgtToSrc Foam::meshToMesh::mapTgtToSrc
( (
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tfield, const tmp<VolumeField<Type>>& tfield,
const CombineOp& cop, const CombineOp& cop,
const bool secondOrder const bool secondOrder
) const ) const
@ -921,10 +910,10 @@ Foam::meshToMesh::mapTgtToSrc
template<class Type> template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>> Foam::tmp<Foam::VolumeField<Type>>
Foam::meshToMesh::mapTgtToSrc Foam::meshToMesh::mapTgtToSrc
( (
const GeometricField<Type, fvPatchField, volMesh>& field, const VolumeField<Type>& field,
const bool secondOrder const bool secondOrder
) const ) const
{ {
@ -933,10 +922,10 @@ Foam::meshToMesh::mapTgtToSrc
template<class Type> template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>> Foam::tmp<Foam::VolumeField<Type>>
Foam::meshToMesh::mapTgtToSrc Foam::meshToMesh::mapTgtToSrc
( (
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tfield, const tmp<VolumeField<Type>>& tfield,
const bool secondOrder const bool secondOrder
) const ) const
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2020 OpenFOAM Foundation Copyright (C) 2011-2020 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -31,7 +31,7 @@ Description
Serial mesh to mesh interpolation class. Serial mesh to mesh interpolation class.
Note Note
This class is due to be deprecated in favour of meshToMesh0New This class is due to be deprecated in favour of meshToMesh
SourceFiles SourceFiles
meshToMesh0.C meshToMesh0.C
@ -41,8 +41,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef meshToMesh0_H #ifndef Foam_meshToMesh0_H
#define meshToMesh0_H #define Foam_meshToMesh0_H
#include "fvMesh.H" #include "fvMesh.H"
#include "HashTable.H" #include "HashTable.H"
@ -271,7 +271,7 @@ public:
void interpolateField void interpolateField
( (
Field<Type>&, Field<Type>&,
const GeometricField<Type, fvPatchField, volMesh>&, const VolumeField<Type>&,
const labelList& adr, const labelList& adr,
const scalarListList& weights, const scalarListList& weights,
const CombineOp& cop const CombineOp& cop
@ -282,7 +282,7 @@ public:
void interpolateField void interpolateField
( (
Field<Type>&, Field<Type>&,
const GeometricField<Type, fvPatchField, volMesh>&, const VolumeField<Type>&,
const labelListList& adr, const labelListList& adr,
const scalarListList& weights, const scalarListList& weights,
const CombineOp& cop const CombineOp& cop
@ -294,7 +294,7 @@ public:
void interpolateField void interpolateField
( (
Field<Type>&, Field<Type>&,
const GeometricField<Type, fvPatchField, volMesh>&, const VolumeField<Type>&,
const labelList& adr, const labelList& adr,
const vectorField& centres, const vectorField& centres,
const CombineOp& cop const CombineOp& cop
@ -306,7 +306,7 @@ public:
void interpolateInternalField void interpolateInternalField
( (
Field<Type>&, Field<Type>&,
const GeometricField<Type, fvPatchField, volMesh>&, const VolumeField<Type>&,
order=INTERPOLATE, order=INTERPOLATE,
const CombineOp& cop = eqOp<Type>() const CombineOp& cop = eqOp<Type>()
) const; ) const;
@ -315,7 +315,7 @@ public:
void interpolateInternalField void interpolateInternalField
( (
Field<Type>&, Field<Type>&,
const tmp<GeometricField<Type, fvPatchField, volMesh>>&, const tmp<VolumeField<Type>>&,
order=INTERPOLATE, order=INTERPOLATE,
const CombineOp& cop = eqOp<Type>() const CombineOp& cop = eqOp<Type>()
) const; ) const;
@ -325,8 +325,8 @@ public:
template<class Type, class CombineOp> template<class Type, class CombineOp>
void interpolate void interpolate
( (
GeometricField<Type, fvPatchField, volMesh>&, VolumeField<Type>&,
const GeometricField<Type, fvPatchField, volMesh>&, const VolumeField<Type>&,
order=INTERPOLATE, order=INTERPOLATE,
const CombineOp& cop = eqOp<Type>() const CombineOp& cop = eqOp<Type>()
) const; ) const;
@ -334,8 +334,8 @@ public:
template<class Type, class CombineOp> template<class Type, class CombineOp>
void interpolate void interpolate
( (
GeometricField<Type, fvPatchField, volMesh>&, VolumeField<Type>&,
const tmp<GeometricField<Type, fvPatchField, volMesh>>&, const tmp<VolumeField<Type>>&,
order=INTERPOLATE, order=INTERPOLATE,
const CombineOp& cop = eqOp<Type>() const CombineOp& cop = eqOp<Type>()
) const; ) const;
@ -343,17 +343,17 @@ public:
//- Interpolate volume field //- Interpolate volume field
template<class Type, class CombineOp> template<class Type, class CombineOp>
tmp<GeometricField<Type, fvPatchField, volMesh>> interpolate tmp<VolumeField<Type>> interpolate
( (
const GeometricField<Type, fvPatchField, volMesh>&, const VolumeField<Type>&,
order=INTERPOLATE, order=INTERPOLATE,
const CombineOp& cop = eqOp<Type>() const CombineOp& cop = eqOp<Type>()
) const; ) const;
template<class Type, class CombineOp> template<class Type, class CombineOp>
tmp<GeometricField<Type, fvPatchField, volMesh>> interpolate tmp<VolumeField<Type>> interpolate
( (
const tmp<GeometricField<Type, fvPatchField, volMesh>>&, const tmp<VolumeField<Type>>&,
order=INTERPOLATE, order=INTERPOLATE,
const CombineOp& cop = eqOp<Type>() const CombineOp& cop = eqOp<Type>()
) const; ) const;

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -60,7 +61,7 @@ template<class Type, class CombineOp>
void Foam::meshToMesh0::interpolateField void Foam::meshToMesh0::interpolateField
( (
Field<Type>& toF, Field<Type>& toF,
const GeometricField<Type, fvPatchField, volMesh>& fromVf, const VolumeField<Type>& fromVf,
const labelListList& adr, const labelListList& adr,
const scalarListList& weights, const scalarListList& weights,
const CombineOp& cop const CombineOp& cop
@ -87,7 +88,7 @@ template<class Type, class CombineOp>
void Foam::meshToMesh0::interpolateField void Foam::meshToMesh0::interpolateField
( (
Field<Type>& toF, Field<Type>& toF,
const GeometricField<Type, fvPatchField, volMesh>& fromVf, const VolumeField<Type>& fromVf,
const labelList& adr, const labelList& adr,
const scalarListList& weights, const scalarListList& weights,
const CombineOp& cop const CombineOp& cop
@ -122,7 +123,7 @@ template<class Type, class CombineOp>
void Foam::meshToMesh0::interpolateField void Foam::meshToMesh0::interpolateField
( (
Field<Type>& toF, Field<Type>& toF,
const GeometricField<Type, fvPatchField, volMesh>& fromVf, const VolumeField<Type>& fromVf,
const labelList& adr, const labelList& adr,
const vectorField& centres, const vectorField& centres,
const CombineOp& cop const CombineOp& cop
@ -153,7 +154,7 @@ template<class Type, class CombineOp>
void Foam::meshToMesh0::interpolateInternalField void Foam::meshToMesh0::interpolateInternalField
( (
Field<Type>& toF, Field<Type>& toF,
const GeometricField<Type, fvPatchField, volMesh>& fromVf, const VolumeField<Type>& fromVf,
meshToMesh0::order ord, meshToMesh0::order ord,
const CombineOp& cop const CombineOp& cop
) const ) const
@ -234,7 +235,7 @@ template<class Type, class CombineOp>
void Foam::meshToMesh0::interpolateInternalField void Foam::meshToMesh0::interpolateInternalField
( (
Field<Type>& toF, Field<Type>& toF,
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tfromVf, const tmp<VolumeField<Type>>& tfromVf,
meshToMesh0::order ord, meshToMesh0::order ord,
const CombineOp& cop const CombineOp& cop
) const ) const
@ -247,16 +248,15 @@ void Foam::meshToMesh0::interpolateInternalField
template<class Type, class CombineOp> template<class Type, class CombineOp>
void Foam::meshToMesh0::interpolate void Foam::meshToMesh0::interpolate
( (
GeometricField<Type, fvPatchField, volMesh>& toVf, VolumeField<Type>& toVf,
const GeometricField<Type, fvPatchField, volMesh>& fromVf, const VolumeField<Type>& fromVf,
meshToMesh0::order ord, meshToMesh0::order ord,
const CombineOp& cop const CombineOp& cop
) const ) const
{ {
interpolateInternalField(toVf, fromVf, ord, cop); interpolateInternalField(toVf, fromVf, ord, cop);
typename GeometricField<Type, fvPatchField, volMesh>:: auto& toVfBf = toVf.boundaryFieldRef();
Boundary& toVfBf = toVf.boundaryFieldRef();
forAll(toMesh_.boundaryMesh(), patchi) forAll(toMesh_.boundaryMesh(), patchi)
{ {
@ -346,8 +346,8 @@ void Foam::meshToMesh0::interpolate
template<class Type, class CombineOp> template<class Type, class CombineOp>
void Foam::meshToMesh0::interpolate void Foam::meshToMesh0::interpolate
( (
GeometricField<Type, fvPatchField, volMesh>& toVf, VolumeField<Type>& toVf,
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tfromVf, const tmp<VolumeField<Type>>& tfromVf,
meshToMesh0::order ord, meshToMesh0::order ord,
const CombineOp& cop const CombineOp& cop
) const ) const
@ -358,10 +358,10 @@ void Foam::meshToMesh0::interpolate
template<class Type, class CombineOp> template<class Type, class CombineOp>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>> Foam::tmp<Foam::VolumeField<Type>>
Foam::meshToMesh0::interpolate Foam::meshToMesh0::interpolate
( (
const GeometricField<Type, fvPatchField, volMesh>& fromVf, const VolumeField<Type>& fromVf,
meshToMesh0::order ord, meshToMesh0::order ord,
const CombineOp& cop const CombineOp& cop
) const ) const
@ -406,9 +406,8 @@ Foam::meshToMesh0::interpolate
// Create the complete field from the pieces // Create the complete field from the pieces
tmp<GeometricField<Type, fvPatchField, volMesh>> ttoF return
( tmp<VolumeField<Type>>::New
new GeometricField<Type, fvPatchField, volMesh>
( (
IOobject IOobject
( (
@ -422,24 +421,20 @@ Foam::meshToMesh0::interpolate
fromVf.dimensions(), fromVf.dimensions(),
internalField, internalField,
patchFields patchFields
) );
);
return ttoF;
} }
template<class Type, class CombineOp> template<class Type, class CombineOp>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>> Foam::tmp<Foam::VolumeField<Type>>
Foam::meshToMesh0::interpolate Foam::meshToMesh0::interpolate
( (
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tfromVf, const tmp<VolumeField<Type>>& tfromVf,
meshToMesh0::order ord, meshToMesh0::order ord,
const CombineOp& cop const CombineOp& cop
) const ) const
{ {
tmp<GeometricField<Type, fvPatchField, volMesh>> tint = tmp<VolumeField<Type>> tint = interpolate(tfromVf(), ord, cop);
interpolate(tfromVf(), ord, cop);
tfromVf.clear(); tfromVf.clear();
return tint; return tint;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -89,8 +89,8 @@ Foam::sampledDistanceSurface::sampleOnIsoSurfacePoints
// Assume volPointInterpolation for the point field! // Assume volPointInterpolation for the point field!
const auto& volFld = interpolator.psi(); const auto& volFld = interpolator.psi();
tmp<GeometricField<Type, fvPatchField, volMesh>> tvolFld(volFld); tmp<VolumeField<Type>> tvolFld(volFld);
tmp<GeometricField<Type, pointPatchField, pointMesh>> tpointFld; tmp<PointField<Type>> tpointFld;
// Interpolated point field // Interpolated point field
tpointFld.reset tpointFld.reset

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -93,8 +93,8 @@ Foam::sampledIsoSurface::sampleOnIsoSurfacePoints
// Assume volPointInterpolation for the point field! // Assume volPointInterpolation for the point field!
const auto& volFld = interpolator.psi(); const auto& volFld = interpolator.psi();
tmp<GeometricField<Type, fvPatchField, volMesh>> tvolFld(volFld); tmp<VolumeField<Type>> tvolFld(volFld);
tmp<GeometricField<Type, pointPatchField, pointMesh>> tpointFld; tmp<PointField<Type>> tpointFld;
if (subMeshPtr_) if (subMeshPtr_)
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -67,8 +67,8 @@ Foam::sampledCuttingPlane::sampleOnIsoSurfacePoints
// Assume volPointInterpolation for the point field! // Assume volPointInterpolation for the point field!
const auto& volFld = interpolator.psi(); const auto& volFld = interpolator.psi();
tmp<GeometricField<Type, fvPatchField, volMesh>> tvolFld(volFld); tmp<VolumeField<Type>> tvolFld(volFld);
tmp<GeometricField<Type, pointPatchField, pointMesh>> tpointFld; tmp<PointField<Type>> tpointFld;
if (subMeshPtr_) if (subMeshPtr_)
{ {

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020-2021 OpenCFD Ltd. Copyright (C) 2020-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -58,8 +58,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef sampledFaceZone_H #ifndef Foam_sampledFaceZone_H
#define sampledFaceZone_H #define Foam_sampledFaceZone_H
#include "sampledSurface.H" #include "sampledSurface.H"
#include "MeshedSurfaces.H" #include "MeshedSurfaces.H"
@ -116,7 +116,7 @@ class sampledFaceZone
template<class Type> template<class Type>
tmp<Field<Type>> sampleOnFaces tmp<Field<Type>> sampleOnFaces
( (
const GeometricField<Type, fvsPatchField, surfaceMesh>& sField const SurfaceField<Type>& sField
) const; ) const;
//- Interpolate volume/boundary field onto surface points //- Interpolate volume/boundary field onto surface points

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -72,7 +72,7 @@ template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::tmp<Foam::Field<Type>>
Foam::sampledFaceZone::sampleOnFaces Foam::sampledFaceZone::sampleOnFaces
( (
const GeometricField<Type, fvsPatchField, surfaceMesh>& sField const SurfaceField<Type>& sField
) const ) const
{ {
// One value per face // One value per face

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2021 OpenCFD Ltd. Copyright (C) 2016-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -58,8 +58,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef sampledPatch_H #ifndef Foam_sampledPatch_H
#define sampledPatch_H #define Foam_sampledPatch_H
#include "sampledSurface.H" #include "sampledSurface.H"
#include "MeshedSurfaces.H" #include "MeshedSurfaces.H"
@ -119,7 +119,7 @@ class sampledPatch
template<class Type> template<class Type>
tmp<Field<Type>> sampleOnFaces tmp<Field<Type>> sampleOnFaces
( (
const GeometricField<Type, fvsPatchField, surfaceMesh>& sField const SurfaceField<Type>& sField
) const; ) const;
//- Interpolate boundary field (from volume field) onto surface points //- Interpolate boundary field (from volume field) onto surface points

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -59,7 +59,7 @@ template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::tmp<Foam::Field<Type>>
Foam::sampledPatch::sampleOnFaces Foam::sampledPatch::sampleOnFaces
( (
const GeometricField<Type, fvsPatchField, surfaceMesh>& sField const SurfaceField<Type>& sField
) const ) const
{ {
// One value per face // One value per face

View File

@ -71,8 +71,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef sampledSurface_H #ifndef Foam_sampledSurface_H
#define sampledSurface_H #define Foam_sampledSurface_H
#include "polySurface.H" #include "polySurface.H"
#include "typeInfo.H" #include "typeInfo.H"
@ -148,9 +148,9 @@ protected:
//- Create cell values by averaging the point values //- Create cell values by averaging the point values
template<class Type> template<class Type>
static tmp<GeometricField<Type, fvPatchField, volMesh>> pointAverage static tmp<VolumeField<Type>> pointAverage
( (
const GeometricField<Type, pointPatchField, pointMesh>& pfld const PointField<Type>& pfld
); );

View File

@ -125,15 +125,15 @@ Foam::sampledSurface::sampleOnPoints
template<class Type> template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>> Foam::tmp<Foam::VolumeField<Type>>
Foam::sampledSurface::pointAverage Foam::sampledSurface::pointAverage
( (
const GeometricField<Type, pointPatchField, pointMesh>& pfld const PointField<Type>& pfld
) )
{ {
const fvMesh& mesh = dynamic_cast<const fvMesh&>(pfld.mesh()()); const fvMesh& mesh = dynamic_cast<const fvMesh&>(pfld.mesh()());
auto tcellAvg = tmp<GeometricField<Type, fvPatchField, volMesh>>::New auto tcellAvg = tmp<VolumeField<Type>>::New
( (
IOobject IOobject
( (

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2021 OpenCFD Ltd. Copyright (C) 2016-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -130,8 +130,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef distanceSurface_H #ifndef Foam_distanceSurface_H
#define distanceSurface_H #define Foam_distanceSurface_H
#include "sampledSurface.H" #include "sampledSurface.H"
#include "searchableSurface.H" #include "searchableSurface.H"
@ -249,7 +249,7 @@ protected:
template<class Type> template<class Type>
tmp<Field<Type>> isoSurfaceInterpolate tmp<Field<Type>> isoSurfaceInterpolate
( (
const GeometricField<Type, fvPatchField, volMesh>& cellValues, const VolumeField<Type>& cellValues,
const Field<Type>& pointValues const Field<Type>& pointValues
) const ) const
{ {

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -40,8 +40,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef isoSurfaceBase_H #ifndef Foam_isoSurfaceBase_H
#define isoSurfaceBase_H #define Foam_isoSurfaceBase_H
#include "isoSurfaceParams.H" #include "isoSurfaceParams.H"
#include "bitSet.H" #include "bitSet.H"
@ -139,7 +139,7 @@ protected:
template<class Type> template<class Type>
tmp<Field<Type>> interpolateTemplate tmp<Field<Type>> interpolateTemplate
( (
const GeometricField<Type, fvPatchField, volMesh>& cellValues, const VolumeField<Type>& cellValues,
const Field<Type>& pointValues const Field<Type>& pointValues
) const ) const
{ {
@ -274,7 +274,7 @@ public:
virtual tmp<Field<Type>> \ virtual tmp<Field<Type>> \
interpolate \ interpolate \
( \ ( \
const GeometricField<Type, fvPatchField, volMesh>& cellValues, \ const VolumeField<Type>& cellValues, \
const Field<Type>& pointValues \ const Field<Type>& pointValues \
) const; ) const;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -31,8 +31,8 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef isoSurfaceBaseMethods_H #ifndef Foam_isoSurfaceBaseMethods_H
#define isoSurfaceBaseMethods_H #define Foam_isoSurfaceBaseMethods_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -43,7 +43,7 @@ Description
#define defineIsoSurfaceInterpolateMethod(ThisClass, Type) \ #define defineIsoSurfaceInterpolateMethod(ThisClass, Type) \
Foam::tmp<Foam::Field<Type>> ThisClass::interpolate \ Foam::tmp<Foam::Field<Type>> ThisClass::interpolate \
( \ ( \
const GeometricField<Type, fvPatchField, volMesh>& cellValues, \ const VolumeField<Type>& cellValues, \
const Field<Type>& pointValues \ const Field<Type>& pointValues \
) const \ ) const \
{ \ { \

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2020 OpenCFD Ltd. Copyright (C) 2016-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -63,8 +63,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef isoSurfacePoint_H #ifndef Foam_isoSurfacePoint_H
#define isoSurfacePoint_H #define Foam_isoSurfacePoint_H
#include "bitSet.H" #include "bitSet.H"
#include "volFields.H" #include "volFields.H"
@ -206,12 +206,8 @@ class isoSurfacePoint
//- Return input field with coupled (and empty) patch values rewritten //- Return input field with coupled (and empty) patch values rewritten
template<class Type> template<class Type>
tmp<SlicedGeometricField tmp<VolumeSliceField<Type>>
<Type, fvPatchField, slicedFvPatchField, volMesh>> adaptPatchFields(const VolumeField<Type>& fld) const;
adaptPatchFields
(
const GeometricField<Type, fvPatchField, volMesh>& fld
) const;
//- Generate single point by interpolation or snapping //- Generate single point by interpolation or snapping
template<class Type> template<class Type>
@ -263,7 +259,7 @@ class isoSurfacePoint
const volScalarField& cVals, const volScalarField& cVals,
const scalarField& pVals, const scalarField& pVals,
const GeometricField<Type, fvPatchField, volMesh>& cCoords, const VolumeField<Type>& cCoords,
const Field<Type>& pCoords, const Field<Type>& pCoords,
const DynamicList<Type>& snappedPoints, const DynamicList<Type>& snappedPoints,
@ -286,7 +282,7 @@ class isoSurfacePoint
const volScalarField& cVals, const volScalarField& cVals,
const scalarField& pVals, const scalarField& pVals,
const GeometricField<Type, fvPatchField, volMesh>& cCoords, const VolumeField<Type>& cCoords,
const Field<Type>& pCoords, const Field<Type>& pCoords,
const DynamicList<Type>& snappedPoints, const DynamicList<Type>& snappedPoints,
@ -360,7 +356,7 @@ class isoSurfacePoint
template<class Type> template<class Type>
tmp<Field<Type>> interpolateTemplate tmp<Field<Type>> interpolateTemplate
( (
const GeometricField<Type, fvPatchField, volMesh>& cCoords, const VolumeField<Type>& cCoords,
const Field<Type>& pCoords const Field<Type>& pCoords
) const; ) const;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2021 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -36,27 +36,13 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::tmp<Foam::SlicedGeometricField Foam::tmp<Foam::VolumeSliceField<Type>>
<
Type,
Foam::fvPatchField,
Foam::slicedFvPatchField,
Foam::volMesh
>>
Foam::isoSurfacePoint::adaptPatchFields Foam::isoSurfacePoint::adaptPatchFields
( (
const GeometricField<Type, fvPatchField, volMesh>& fld const VolumeField<Type>& fld
) const ) const
{ {
typedef SlicedGeometricField auto tslice = tmp<VolumeSliceField<Type>>::New
<
Type,
fvPatchField,
slicedFvPatchField,
volMesh
> FieldType;
auto tslice = tmp<FieldType>::New
( (
IOobject IOobject
( (
@ -448,7 +434,7 @@ Foam::label Foam::isoSurfacePoint::generateFaceTriPoints
const volScalarField& cVals, const volScalarField& cVals,
const scalarField& pVals, const scalarField& pVals,
const GeometricField<Type, fvPatchField, volMesh>& cCoords, const VolumeField<Type>& cCoords,
const Field<Type>& pCoords, const Field<Type>& pCoords,
const DynamicList<Type>& snappedPoints, const DynamicList<Type>& snappedPoints,
@ -531,7 +517,7 @@ void Foam::isoSurfacePoint::generateTriPoints
const volScalarField& cVals, const volScalarField& cVals,
const scalarField& pVals, const scalarField& pVals,
const GeometricField<Type, fvPatchField, volMesh>& cCoords, const VolumeField<Type>& cCoords,
const Field<Type>& pCoords, const Field<Type>& pCoords,
const DynamicList<Type>& snappedPoints, const DynamicList<Type>& snappedPoints,
@ -809,18 +795,12 @@ template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::tmp<Foam::Field<Type>>
Foam::isoSurfacePoint::interpolateTemplate Foam::isoSurfacePoint::interpolateTemplate
( (
const GeometricField<Type, fvPatchField, volMesh>& cCoords, const VolumeField<Type>& cCoords,
const Field<Type>& pCoords const Field<Type>& pCoords
) const ) const
{ {
// Recalculate boundary values // Recalculate boundary values
tmp<SlicedGeometricField tmp<VolumeSliceField<Type>> c2(adaptPatchFields(cCoords));
<
Type,
fvPatchField,
slicedFvPatchField,
volMesh
>> c2(adaptPatchFields(cCoords));
DynamicList<Type> triPoints(3*nCutCells_); DynamicList<Type> triPoints(3*nCutCells_);