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

@ -126,7 +126,7 @@ void subsetVolFields
(
const fvMeshSubset& subsetter,
const IOobjectList& objectsList,
const label patchI,
const label patchi,
const Type& exposedValue,
const word GeomVolType,
PtrList<GeometricField<Type, fvPatchField, volMesh>>& subFields
@ -152,15 +152,15 @@ void subsetVolFields
subFields.set(i, subsetter.interpolate(volField));
// Explicitly set exposed faces (in patchI) to exposedValue.
if (patchI >= 0)
// Explicitly set exposed faces (in patchi) to exposedValue.
if (patchi >= 0)
{
fvPatchField<Type>& fld =
subFields[i++].boundaryField()[patchI];
subFields[i++].boundaryFieldRef()[patchi];
label newStart = fld.patch().patch().start();
label oldPatchI = subsetter.patchMap()[patchI];
label oldPatchI = subsetter.patchMap()[patchi];
if (oldPatchI == -1)
{
@ -198,7 +198,7 @@ void subsetSurfaceFields
(
const fvMeshSubset& subsetter,
const IOobjectList& objectsList,
const label patchI,
const label patchi,
const Type& exposedValue,
const word GeomSurfType,
PtrList<GeometricField<Type, fvsPatchField, surfaceMesh>>& subFields
@ -225,15 +225,15 @@ void subsetSurfaceFields
subFields.set(i, subsetter.interpolate(volField));
// Explicitly set exposed faces (in patchI) to exposedValue.
if (patchI >= 0)
// Explicitly set exposed faces (in patchi) to exposedValue.
if (patchi >= 0)
{
fvsPatchField<Type>& fld =
subFields[i++].boundaryField()[patchI];
subFields[i++].boundaryFieldRef()[patchi];
label newStart = fld.patch().patch().start();
label oldPatchI = subsetter.patchMap()[patchI];
label oldPatchI = subsetter.patchMap()[patchi];
if (oldPatchI == -1)
{
@ -291,16 +291,19 @@ void initCreatedPatches
{
GeoField& field = const_cast<GeoField&>(*fieldIter());
forAll(field.boundaryField(), patchi)
typename GeoField::GeometricBoundaryField& fieldBf =
field.boundaryFieldRef();
forAll(fieldBf, patchi)
{
if (map.oldPatchSizes()[patchi] == 0)
{
// Not mapped.
field.boundaryField()[patchi] = initValue;
fieldBf[patchi] = initValue;
if (field.boundaryField()[patchi].fixesValue())
if (fieldBf[patchi].fixesValue())
{
field.boundaryField()[patchi] == initValue;
fieldBf[patchi] == initValue;
}
}
}
@ -526,9 +529,9 @@ void createBaffles
// Wrapper around find patch. Also makes sure same patch in parallel.
label findPatch(const polyBoundaryMesh& patches, const word& patchName)
{
label patchI = patches.findPatchID(patchName);
label patchi = patches.findPatchID(patchName);
if (patchI == -1)
if (patchi == -1)
{
FatalErrorInFunction
<< "Illegal patch " << patchName
@ -538,20 +541,20 @@ label findPatch(const polyBoundaryMesh& patches, const word& patchName)
// Check same patch for all procs
{
label newPatch = patchI;
label newPatch = patchi;
reduce(newPatch, minOp<label>());
if (newPatch != patchI)
if (newPatch != patchi)
{
FatalErrorInFunction
<< "Patch " << patchName
<< " should have the same patch index on all processors." << nl
<< "On my processor it has index " << patchI
<< "On my processor it has index " << patchi
<< " ; on some other processor it has index " << newPatch
<< exit(FatalError);
}
}
return patchI;
return patchi;
}
@ -641,7 +644,7 @@ int main(int argc, char *argv[])
{
faceSet fSet(mesh, setsAndPatches[setI][0]);
label patchI = findPatch
label patchi = findPatch
(
mesh.boundaryMesh(),
setsAndPatches[setI][1]
@ -658,7 +661,7 @@ int main(int argc, char *argv[])
<< " but also in patch " << wantedPatch[iter.key()]
<< exit(FatalError);
}
wantedPatch[iter.key()] = patchI;
wantedPatch[iter.key()] = patchi;
}
}
@ -683,7 +686,7 @@ int main(int argc, char *argv[])
);
faceSet fSet(mesh, coupledAndPatches[setI][0]);
label patchI = findPatch(patches, coupledAndPatches[setI][1]);
label patchi = findPatch(patches, coupledAndPatches[setI][1]);
forAllConstIter(faceSet, fSet, iter)
{
@ -696,7 +699,7 @@ int main(int argc, char *argv[])
<< " but also in patch " << coupledWantedPatch[iter.key()]
<< exit(FatalError);
}
coupledWantedPatch[iter.key()] = patchI;
coupledWantedPatch[iter.key()] = patchi;
cyclicWantedPatch_half0[iter.key()] = cyclicId;
cyclicWantedPatch_half1[iter.key()] = cyclicSlaveId;
}

View File

@ -193,24 +193,24 @@ scalar getEdgeStats(const primitiveMesh& mesh, const direction excludeCmpt)
// Adds empty patch if not yet there. Returns patchID.
label addPatch(polyMesh& mesh, const word& patchName)
{
label patchI = mesh.boundaryMesh().findPatchID(patchName);
label patchi = mesh.boundaryMesh().findPatchID(patchName);
if (patchI == -1)
if (patchi == -1)
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
List<polyPatch*> newPatches(patches.size() + 1);
// Add empty patch as 0th entry (Note: only since subsetMesh wants this)
patchI = 0;
patchi = 0;
newPatches[patchI] =
newPatches[patchi] =
new emptyPolyPatch
(
Foam::word(patchName),
0,
mesh.nInternalFaces(),
patchI,
patchi,
patches,
emptyPolyPatch::typeName
);
@ -232,15 +232,15 @@ label addPatch(polyMesh& mesh, const word& patchName)
mesh.removeBoundary();
mesh.addPatches(newPatches);
Info<< "Created patch oldInternalFaces at " << patchI << endl;
Info<< "Created patch oldInternalFaces at " << patchi << endl;
}
else
{
Info<< "Reusing patch oldInternalFaces at " << patchI << endl;
Info<< "Reusing patch oldInternalFaces at " << patchi << endl;
}
return patchI;
return patchi;
}
@ -482,7 +482,7 @@ void subsetMesh
(
polyMesh& mesh,
const label writeMesh,
const label patchI, // patchID for exposed faces
const label patchi, // patchID for exposed faces
const labelHashSet& cellsToRemove,
cellSet& cutCells,
labelIOList& refLevel
@ -503,7 +503,7 @@ void subsetMesh
(
cellLabels,
exposedFaces,
labelList(exposedFaces.size(), patchI),
labelList(exposedFaces.size(), patchi),
meshMod
);

View File

@ -221,9 +221,9 @@ int main(int argc, char *argv[])
List<polyPatch*> p(patches.size());
forAll(p, patchI)
forAll(p, patchi)
{
p[patchI] = patches[patchI].clone(fMesh.boundaryMesh()).ptr();
p[patchi] = patches[patchi].clone(fMesh.boundaryMesh()).ptr();
}
fMesh.addFvPatches(p);
@ -294,15 +294,17 @@ int main(int argc, char *argv[])
}
}
volScalarField::GeometricBoundaryField& postRefLevelBf =
postRefLevel.boundaryFieldRef();
// For volScalarField: set boundary values to same as cell.
// Note: could also put
// zeroGradient b.c. on postRefLevel and do evaluate.
forAll(postRefLevel.boundaryField(), patchI)
forAll(postRefLevel.boundaryField(), patchi)
{
const polyPatch& pp = patches[patchI];
const polyPatch& pp = patches[patchi];
fvPatchScalarField& bField = postRefLevel.boundaryField()[patchI];
fvPatchScalarField& bField = postRefLevelBf[patchi];
Info<< "Setting field for patch "<< endl;