mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
empty handling
This commit is contained in:
@ -81,7 +81,11 @@ Foam::isoSurface::adaptPatchFields
|
|||||||
{
|
{
|
||||||
const polyPatch& pp = patches[patchI];
|
const polyPatch& pp = patches[patchI];
|
||||||
|
|
||||||
if (isA<emptyPolyPatch>(pp))
|
if
|
||||||
|
(
|
||||||
|
isA<emptyPolyPatch>(pp)
|
||||||
|
&& pp.size() != sliceFld.boundaryField()[patchI].size()
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// Clear old value. Cannot resize it since is a slice.
|
// Clear old value. Cannot resize it since is a slice.
|
||||||
sliceFld.boundaryField().set(patchI, NULL);
|
sliceFld.boundaryField().set(patchI, NULL);
|
||||||
|
|||||||
@ -37,7 +37,13 @@ License
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(sampledCuttingPlane, 0);
|
defineTypeNameAndDebug(sampledCuttingPlane, 0);
|
||||||
addNamedToRunTimeSelectionTable(sampledSurface, sampledCuttingPlane, word, cuttingPlane);
|
addNamedToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
sampledSurface,
|
||||||
|
sampledCuttingPlane,
|
||||||
|
word,
|
||||||
|
cuttingPlane
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
@ -118,7 +124,7 @@ void Foam::sampledCuttingPlane::createGeometry()
|
|||||||
|
|
||||||
// Internal field
|
// Internal field
|
||||||
{
|
{
|
||||||
const pointField& cc = fvm.C();
|
const pointField& cc = fvm.cellCentres();
|
||||||
scalarField& fld = cellDistance.internalField();
|
scalarField& fld = cellDistance.internalField();
|
||||||
|
|
||||||
forAll(cc, i)
|
forAll(cc, i)
|
||||||
@ -130,14 +136,45 @@ void Foam::sampledCuttingPlane::createGeometry()
|
|||||||
|
|
||||||
// Patch fields
|
// Patch fields
|
||||||
{
|
{
|
||||||
forAll(fvm.C().boundaryField(), patchI)
|
forAll(cellDistance.boundaryField(), patchI)
|
||||||
{
|
{
|
||||||
const pointField& cc = fvm.C().boundaryField()[patchI];
|
if
|
||||||
fvPatchScalarField& fld = cellDistance.boundaryField()[patchI];
|
(
|
||||||
|
isA<emptyFvPatchScalarField>
|
||||||
forAll(fld, i)
|
(
|
||||||
|
cellDistance.boundaryField()[patchI]
|
||||||
|
)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
fld[i] = (cc[i] - plane_.refPoint()) & plane_.normal();
|
cellDistance.boundaryField().set
|
||||||
|
(
|
||||||
|
patchI,
|
||||||
|
new calculatedFvPatchScalarField
|
||||||
|
(
|
||||||
|
fvm.boundary()[patchI],
|
||||||
|
cellDistance
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
const polyPatch& pp = fvm.boundary()[patchI].patch();
|
||||||
|
pointField::subField cc = pp.patchSlice(fvm.faceCentres());
|
||||||
|
|
||||||
|
fvPatchScalarField& fld = cellDistance.boundaryField()[patchI];
|
||||||
|
fld.setSize(pp.size());
|
||||||
|
forAll(fld, i)
|
||||||
|
{
|
||||||
|
fld[i] = (cc[i] - plane_.refPoint()) & plane_.normal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const pointField& cc = fvm.C().boundaryField()[patchI];
|
||||||
|
fvPatchScalarField& fld = cellDistance.boundaryField()[patchI];
|
||||||
|
|
||||||
|
forAll(fld, i)
|
||||||
|
{
|
||||||
|
fld[i] = (cc[i] - plane_.refPoint()) & plane_.normal();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user