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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd.
Copyright (C) 2021-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -80,7 +80,7 @@ template<class Type>
static void doCorrectBoundaryConditions
(
bool correctBCs,
GeometricField<Type, fvPatchField, volMesh>& field
VolumeField<Type>& field
)
{
if (correctBCs)
@ -104,7 +104,7 @@ template<class Type>
void doCorrectBoundaryConditions
(
bool correctBCs,
GeometricField<Type, pointPatchField, pointMesh>& field
PointField<Type>& field
)
{
if (correctBCs)
@ -119,7 +119,7 @@ template<class Type>
void doCorrectBoundaryConditions
(
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>
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
(
loadAndStore<VolFieldType>(io)
/// || loadAndStore<IntVolFieldType>(io)
|| loadAndStore<SurfaceFieldType>(io)
loadAndStore<VolumeField<Type>>(io)
/// || loadAndStore<VolumeInternalField<Type>>(io)
|| loadAndStore<SurfaceField<Type>>(io)
);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -71,8 +71,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef sampledSurface_H
#define sampledSurface_H
#ifndef Foam_sampledSurface_H
#define Foam_sampledSurface_H
#include "polySurface.H"
#include "typeInfo.H"
@ -148,9 +148,9 @@ protected:
//- Create cell values by averaging the point values
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>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
Foam::tmp<Foam::VolumeField<Type>>
Foam::sampledSurface::pointAverage
(
const GeometricField<Type, pointPatchField, pointMesh>& pfld
const PointField<Type>& pfld
)
{
const fvMesh& mesh = dynamic_cast<const fvMesh&>(pfld.mesh()());
auto tcellAvg = tmp<GeometricField<Type, fvPatchField, volMesh>>::New
auto tcellAvg = tmp<VolumeField<Type>>::New
(
IOobject
(

View File

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

View File

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

View File

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

View File

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

View File

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