empty handling

This commit is contained in:
mattijs
2009-07-21 16:51:21 +01:00
parent d069739d17
commit 4bf0ae136c
2 changed files with 50 additions and 9 deletions

View File

@ -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);

View File

@ -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();
}
} }
} }
} }