boundaryField() -> boundaryFieldRef()

This commit is contained in:
Henry Weller
2016-04-24 22:07:37 +01:00
parent 3758659ac6
commit 2d5ff31649
155 changed files with 1650 additions and 1466 deletions

View File

@ -329,13 +329,16 @@ void Foam::meshToMesh::mapSrcToTgt
const PtrList<AMIPatchToPatchInterpolation>& AMIList = patchAMIs();
typename GeometricField<Type, fvPatchField, volMesh>::
GeometricBoundaryField& resultBf = result.boundaryFieldRef();
forAll(AMIList, i)
{
label srcPatchI = srcPatchID_[i];
label tgtPatchI = tgtPatchID_[i];
label srcPatchi = srcPatchID_[i];
label tgtPatchi = tgtPatchID_[i];
const fvPatchField<Type>& srcField = field.boundaryField()[srcPatchI];
fvPatchField<Type>& tgtField = result.boundaryField()[tgtPatchI];
const fvPatchField<Type>& srcField = field.boundaryField()[srcPatchi];
fvPatchField<Type>& tgtField = resultBf[tgtPatchi];
// 2.3 does not do distributed mapping yet so only do if
// running on single processor
@ -375,8 +378,8 @@ void Foam::meshToMesh::mapSrcToTgt
forAll(cuttingPatches_, i)
{
label patchI = cuttingPatches_[i];
fvPatchField<Type>& pf = result.boundaryField()[patchI];
label patchi = cuttingPatches_[i];
fvPatchField<Type>& pf = resultBf[patchi];
pf == pf.patchInternalField();
}
}
@ -405,22 +408,22 @@ Foam::meshToMesh::mapSrcToTgt
// entries, but these values will need to be reset
forAll(tgtPatchID_, i)
{
label srcPatchI = srcPatchID_[i];
label tgtPatchI = tgtPatchID_[i];
label srcPatchi = srcPatchID_[i];
label tgtPatchi = tgtPatchID_[i];
if (!tgtPatchFields.set(tgtPatchI))
if (!tgtPatchFields.set(tgtPatchi))
{
tgtPatchFields.set
(
tgtPatchI,
tgtPatchi,
fvPatchField<Type>::New
(
srcBfld[srcPatchI],
tgtMesh.boundary()[tgtPatchI],
srcBfld[srcPatchi],
tgtMesh.boundary()[tgtPatchi],
DimensionedField<Type, volMesh>::null(),
directFvPatchFieldMapper
(
labelList(tgtMesh.boundary()[tgtPatchI].size(), -1)
labelList(tgtMesh.boundary()[tgtPatchi].size(), -1)
)
)
);
@ -428,19 +431,19 @@ Foam::meshToMesh::mapSrcToTgt
}
// Any unset tgtPatchFields become calculated
forAll(tgtPatchFields, tgtPatchI)
forAll(tgtPatchFields, tgtPatchi)
{
if (!tgtPatchFields.set(tgtPatchI))
if (!tgtPatchFields.set(tgtPatchi))
{
// Note: use factory New method instead of direct generation of
// calculated so we keep constraints
tgtPatchFields.set
(
tgtPatchI,
tgtPatchi,
fvPatchField<Type>::New
(
calculatedFvPatchField<Type>::typeName,
tgtMesh.boundary()[tgtPatchI],
tgtMesh.boundary()[tgtPatchi],
DimensionedField<Type, volMesh>::null()
)
);
@ -520,11 +523,11 @@ void Foam::meshToMesh::mapTgtToSrc
forAll(AMIList, i)
{
label srcPatchI = srcPatchID_[i];
label tgtPatchI = tgtPatchID_[i];
label srcPatchi = srcPatchID_[i];
label tgtPatchi = tgtPatchID_[i];
fvPatchField<Type>& srcField = result.boundaryField()[srcPatchI];
const fvPatchField<Type>& tgtField = field.boundaryField()[tgtPatchI];
fvPatchField<Type>& srcField = result.boundaryField()[srcPatchi];
const fvPatchField<Type>& tgtField = field.boundaryField()[tgtPatchi];
// 2.3 does not do distributed mapping yet so only do if
// running on single processor
@ -564,8 +567,8 @@ void Foam::meshToMesh::mapTgtToSrc
forAll(cuttingPatches_, i)
{
label patchI = cuttingPatches_[i];
fvPatchField<Type>& pf = result.boundaryField()[patchI];
label patchi = cuttingPatches_[i];
fvPatchField<Type>& pf = result.boundaryField()[patchi];
pf == pf.patchInternalField();
}
}
@ -594,22 +597,22 @@ Foam::meshToMesh::mapTgtToSrc
// entries, but these values will need to be reset
forAll(srcPatchID_, i)
{
label srcPatchI = srcPatchID_[i];
label tgtPatchI = tgtPatchID_[i];
label srcPatchi = srcPatchID_[i];
label tgtPatchi = tgtPatchID_[i];
if (!srcPatchFields.set(tgtPatchI))
if (!srcPatchFields.set(tgtPatchi))
{
srcPatchFields.set
(
srcPatchI,
srcPatchi,
fvPatchField<Type>::New
(
tgtBfld[srcPatchI],
srcMesh.boundary()[tgtPatchI],
tgtBfld[srcPatchi],
srcMesh.boundary()[tgtPatchi],
DimensionedField<Type, volMesh>::null(),
directFvPatchFieldMapper
(
labelList(srcMesh.boundary()[srcPatchI].size(), -1)
labelList(srcMesh.boundary()[srcPatchi].size(), -1)
)
)
);
@ -617,19 +620,19 @@ Foam::meshToMesh::mapTgtToSrc
}
// Any unset srcPatchFields become calculated
forAll(srcPatchFields, srcPatchI)
forAll(srcPatchFields, srcPatchi)
{
if (!srcPatchFields.set(srcPatchI))
if (!srcPatchFields.set(srcPatchi))
{
// Note: use factory New method instead of direct generation of
// calculated so we keep constraints
srcPatchFields.set
(
srcPatchI,
srcPatchi,
fvPatchField<Type>::New
(
calculatedFvPatchField<Type>::typeName,
srcMesh.boundary()[srcPatchI],
srcMesh.boundary()[srcPatchi],
DimensionedField<Type, volMesh>::null()
)
);

View File

@ -253,6 +253,9 @@ void Foam::meshToMesh0::interpolate
{
interpolateInternalField(toVf, fromVf, ord, cop);
typename GeometricField<Type, fvPatchField, volMesh>::
GeometricBoundaryField& toVfBf = toVf.boundaryFieldRef();
forAll(toMesh_.boundaryMesh(), patchi)
{
const fvPatch& toPatch = toMesh_.boundary()[patchi];
@ -265,7 +268,7 @@ void Foam::meshToMesh0::interpolate
{
mapField
(
toVf.boundaryField()[patchi],
toVfBf[patchi],
fromVf,
boundaryAddressing_[patchi],
cop
@ -277,7 +280,7 @@ void Foam::meshToMesh0::interpolate
{
interpolateField
(
toVf.boundaryField()[patchi],
toVfBf[patchi],
fromVf,
boundaryAddressing_[patchi],
toPatch.Cf(),
@ -290,7 +293,7 @@ void Foam::meshToMesh0::interpolate
{
interpolateField
(
toVf.boundaryField()[patchi],
toVfBf[patchi],
fromVf,
boundaryAddressing_[patchi],
toPatch.Cf(),
@ -310,12 +313,12 @@ void Foam::meshToMesh0::interpolate
<< exit(FatalError);
}
if (isA<mixedFvPatchField<Type>>(toVf.boundaryField()[patchi]))
if (isA<mixedFvPatchField<Type>>(toVfBf[patchi]))
{
refCast<mixedFvPatchField<Type>>
(
toVf.boundaryField()[patchi]
).refValue() = toVf.boundaryField()[patchi];
toVfBf[patchi]
).refValue() = toVfBf[patchi];
}
}
else if
@ -324,20 +327,9 @@ void Foam::meshToMesh0::interpolate
&& fromMeshPatches_.found(patchMap_.find(toPatch.name())())
)
{
/*
toVf.boundaryField()[patchi].map
(
fromVf.boundaryField()
[
fromMeshPatches_.find(patchMap_.find(toPatch.name())())()
],
boundaryAddressing_[patchi]
);
*/
mapField
(
toVf.boundaryField()[patchi],
toVfBf[patchi],
fromVf.boundaryField()
[
fromMeshPatches_.find(patchMap_.find(toPatch.name())())()

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -128,12 +128,15 @@ void Foam::distanceSurface::createGeometry()
}
}
volScalarField::GeometricBoundaryField& cellDistanceBf =
cellDistance.boundaryFieldRef();
// Patch fields
{
forAll(fvm.C().boundaryField(), patchI)
forAll(fvm.C().boundaryField(), patchi)
{
const pointField& cc = fvm.C().boundaryField()[patchI];
fvPatchScalarField& fld = cellDistance.boundaryField()[patchI];
const pointField& cc = fvm.C().boundaryField()[patchi];
fvPatchScalarField& fld = cellDistanceBf[patchi];
List<pointIndexHit> nearest;
surfPtr_().findNearest

View File

@ -76,26 +76,29 @@ Foam::isoSurface::adaptPatchFields
const polyBoundaryMesh& patches = mesh.boundaryMesh();
forAll(patches, patchI)
typename FieldType::GeometricBoundaryField& sliceFldBf =
sliceFld.boundaryFieldRef();
forAll(patches, patchi)
{
const polyPatch& pp = patches[patchI];
const polyPatch& pp = patches[patchi];
if
(
isA<emptyPolyPatch>(pp)
&& pp.size() != sliceFld.boundaryField()[patchI].size()
&& pp.size() != sliceFldBf[patchi].size()
)
{
// Clear old value. Cannot resize it since is a slice.
sliceFld.boundaryField().set(patchI, NULL);
sliceFldBf.set(patchi, NULL);
// Set new value we can change
sliceFld.boundaryField().set
sliceFldBf.set
(
patchI,
patchi,
new calculatedFvPatchField<Type>
(
mesh.boundary()[patchI],
mesh.boundary()[patchi],
sliceFld
)
);
@ -103,9 +106,9 @@ Foam::isoSurface::adaptPatchFields
// Note: cannot use patchInternalField since uses emptyFvPatch::size
// Do our own internalField instead.
const labelUList& faceCells =
mesh.boundary()[patchI].patch().faceCells();
mesh.boundary()[patchi].patch().faceCells();
Field<Type>& pfld = sliceFld.boundaryField()[patchI];
Field<Type>& pfld = sliceFldBf[patchi];
pfld.setSize(faceCells.size());
forAll(faceCells, i)
{
@ -120,10 +123,10 @@ Foam::isoSurface::adaptPatchFields
{
fvPatchField<Type>& pfld = const_cast<fvPatchField<Type>&>
(
sliceFld.boundaryField()[patchI]
sliceFldBf[patchi]
);
const scalarField& w = mesh.weights().boundaryField()[patchI];
const scalarField& w = mesh.weights().boundaryField()[patchi];
tmp<Field<Type>> f =
w*pfld.patchInternalField()
@ -595,9 +598,9 @@ void Foam::isoSurface::generateTriPoints
// Determine neighbouring snap status
boolList neiSnapped(mesh_.nFaces()-mesh_.nInternalFaces(), false);
List<Type> neiSnappedPoint(neiSnapped.size(), Type(Zero));
forAll(patches, patchI)
forAll(patches, patchi)
{
const polyPatch& pp = patches[patchI];
const polyPatch& pp = patches[patchi];
if (pp.coupled())
{
@ -621,9 +624,9 @@ void Foam::isoSurface::generateTriPoints
forAll(patches, patchI)
forAll(patches, patchi)
{
const polyPatch& pp = patches[patchI];
const polyPatch& pp = patches[patchi];
if (isA<processorPolyPatch>(pp))
{
@ -653,8 +656,8 @@ void Foam::isoSurface::generateTriPoints
snappedPoint,
faceI,
cVals.boundaryField()[patchI][i],
cCoords.boundaryField()[patchI][i],
cVals.boundaryField()[patchi][i],
cCoords.boundaryField()[patchi][i],
neiSnapped[faceI-mesh_.nInternalFaces()],
neiSnappedPoint[faceI-mesh_.nInternalFaces()],
@ -677,8 +680,8 @@ void Foam::isoSurface::generateTriPoints
snappedPoint,
faceI,
cVals.boundaryField()[patchI][i],
cCoords.boundaryField()[patchI][i],
cVals.boundaryField()[patchi][i],
cCoords.boundaryField()[patchi][i],
false,
Type(Zero),
@ -710,8 +713,8 @@ void Foam::isoSurface::generateTriPoints
snappedPoint,
faceI,
cVals.boundaryField()[patchI][i],
cCoords.boundaryField()[patchI][i],
cVals.boundaryField()[patchi][i],
cCoords.boundaryField()[patchi][i],
false, // fc not snapped
Type(Zero),

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -134,32 +134,35 @@ void Foam::sampledCuttingPlane::createGeometry()
}
}
volScalarField::GeometricBoundaryField& cellDistanceBf =
cellDistance.boundaryFieldRef();
// Patch fields
{
forAll(cellDistance.boundaryField(), patchI)
forAll(cellDistanceBf, patchi)
{
if
(
isA<emptyFvPatchScalarField>
(
cellDistance.boundaryField()[patchI]
cellDistanceBf[patchi]
)
)
{
cellDistance.boundaryField().set
cellDistanceBf.set
(
patchI,
patchi,
new calculatedFvPatchScalarField
(
fvm.boundary()[patchI],
fvm.boundary()[patchi],
cellDistance
)
);
const polyPatch& pp = fvm.boundary()[patchI].patch();
const polyPatch& pp = fvm.boundary()[patchi].patch();
pointField::subField cc = pp.patchSlice(fvm.faceCentres());
fvPatchScalarField& fld = cellDistance.boundaryField()[patchI];
fvPatchScalarField& fld = cellDistanceBf[patchi];
fld.setSize(pp.size());
forAll(fld, i)
{
@ -168,8 +171,8 @@ void Foam::sampledCuttingPlane::createGeometry()
}
else
{
const pointField& cc = fvm.C().boundaryField()[patchI];
fvPatchScalarField& fld = cellDistance.boundaryField()[patchI];
const pointField& cc = fvm.C().boundaryField()[patchi];
fvPatchScalarField& fld = cellDistanceBf[patchi];
forAll(fld, i)
{