boundaryField() -> boundaryFieldRef()

This commit is contained in:
Henry Weller
2016-04-24 22:07:37 +01:00
parent 6005258c10
commit 6a27f7af46
155 changed files with 1650 additions and 1466 deletions

View File

@ -55,9 +55,9 @@ void processField
const typename fieldType::GeometricBoundaryField& bf =
vtf.boundaryField();
forAll(bf, patchI)
forAll(bf, patchi)
{
if (isA<externalCoupledMixedFvPatchField<Type>>(bf[patchI]))
if (isA<externalCoupledMixedFvPatchField<Type>>(bf[patchi]))
{
Info<< "Generating external coupled geometry for field "
<< fieldName << endl;
@ -65,7 +65,7 @@ void processField
const externalCoupledMixedFvPatchField<Type>& pf =
refCast<const externalCoupledMixedFvPatchField<Type>>
(
bf[patchI]
bf[patchi]
);
pf.writeGeometry();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -84,11 +84,11 @@ int main(int argc, char *argv[])
forAllConstIter(dictionary, agglomDict, iter)
{
labelList patchIds = boundary.findIndices(iter().keyword());
forAll(patchIds, i)
labelList patchids = boundary.findIndices(iter().keyword());
forAll(patchids, i)
{
label patchI = patchIds[i];
const polyPatch& pp = boundary[patchI];
label patchi = patchids[i];
const polyPatch& pp = boundary[patchi];
if (!pp.coupled())
{
Info << "\nAgglomerating patch : " << pp.name() << endl;
@ -98,12 +98,12 @@ int main(int argc, char *argv[])
agglomDict.subDict(pp.name())
);
agglomObject.agglomerate();
finalAgglom[patchI] =
finalAgglom[patchi] =
agglomObject.restrictTopBottomAddressing();
if (finalAgglom[patchI].size())
if (finalAgglom[patchi].size())
{
nCoarseFaces += max(finalAgglom[patchI] + 1);
nCoarseFaces += max(finalAgglom[patchi] + 1);
}
}
}
@ -111,40 +111,40 @@ int main(int argc, char *argv[])
// - All patches which are not agglomarated are identity for finalAgglom
forAll(boundary, patchId)
forAll(boundary, patchid)
{
if (finalAgglom[patchId].size() == 0)
if (finalAgglom[patchid].size() == 0)
{
finalAgglom[patchId] = identity(boundary[patchId].size());
finalAgglom[patchid] = identity(boundary[patchid].size());
}
}
// Sync agglomeration across coupled patches
labelList nbrAgglom(mesh.nFaces() - mesh.nInternalFaces(), -1);
forAll(boundary, patchId)
forAll(boundary, patchid)
{
const polyPatch& pp = boundary[patchId];
const polyPatch& pp = boundary[patchid];
if (pp.coupled())
{
finalAgglom[patchId] = identity(pp.size());
finalAgglom[patchid] = identity(pp.size());
forAll(pp, i)
{
nbrAgglom[pp.start() - mesh.nInternalFaces() + i] =
finalAgglom[patchId][i];
finalAgglom[patchid][i];
}
}
}
syncTools::swapBoundaryFaceList(mesh, nbrAgglom);
forAll(boundary, patchId)
forAll(boundary, patchid)
{
const polyPatch& pp = boundary[patchId];
const polyPatch& pp = boundary[patchid];
if (pp.coupled() && !refCast<const coupledPolyPatch>(pp).owner())
{
forAll(pp, i)
{
finalAgglom[patchId][i] =
finalAgglom[patchid][i] =
nbrAgglom[pp.start() - mesh.nInternalFaces() + i];
}
}
@ -169,14 +169,17 @@ int main(int argc, char *argv[])
dimensionedScalar("facesAgglomeration", dimless, 0)
);
volScalarField::GeometricBoundaryField& facesAgglomerationBf =
facesAgglomeration.boundaryFieldRef();
label coarsePatchIndex = 0;
forAll(boundary, patchId)
forAll(boundary, patchid)
{
const polyPatch& pp = boundary[patchId];
const polyPatch& pp = boundary[patchid];
if (pp.size() > 0)
{
fvPatchScalarField& bFacesAgglomeration =
facesAgglomeration.boundaryField()[patchId];
facesAgglomerationBf[patchid];
forAll(bFacesAgglomeration, j)
{
@ -184,11 +187,11 @@ int main(int argc, char *argv[])
index.toGlobal
(
Pstream::myProcNo(),
finalAgglom[patchId][j] + coarsePatchIndex
finalAgglom[patchid][j] + coarsePatchIndex
);
}
coarsePatchIndex += max(finalAgglom[patchId]) + 1;
coarsePatchIndex += max(finalAgglom[patchid]) + 1;
}
}

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
@ -87,15 +87,15 @@ void rewriteBoundary
// Replace any 'cyclic'
label nOldCyclics = 0;
forAll(patches, patchI)
forAll(patches, patchi)
{
const dictionary& patchDict = patches[patchI].dict();
const dictionary& patchDict = patches[patchi].dict();
if (word(patchDict["type"]) == cyclicPolyPatch::typeName)
{
if (!patchDict.found("neighbourPatch"))
{
Info<< "Patch " << patches[patchI].keyword()
Info<< "Patch " << patches[patchi].keyword()
<< " does not have 'neighbourPatch' entry; assuming it"
<< " is of the old type." << endl;
nOldCyclics++;
@ -120,21 +120,21 @@ void rewriteBoundary
// Add new entries
label addedPatchI = nOldPatches;
label newPatchI = 0;
forAll(oldPatches, patchI)
forAll(oldPatches, patchi)
{
const dictionary& patchDict = oldPatches[patchI].dict();
const dictionary& patchDict = oldPatches[patchi].dict();
if
(
word(patchDict["type"]) == cyclicPolyPatch::typeName
)
{
const word& name = oldPatches[patchI].keyword();
const word& name = oldPatches[patchi].keyword();
if (patchDict.found("neighbourPatch"))
{
patches.set(patchI, oldPatches.set(patchI, NULL));
oldToNew[patchI] = newPatchI++;
patches.set(patchi, oldPatches.set(patchi, NULL));
oldToNew[patchi] = newPatchI++;
// Check if patches come from automatic conversion
word oldName;
@ -178,15 +178,15 @@ void rewriteBoundary
nbrNames.insert(name, nbrName);
// Save current dictionary
const dictionary patchDict(patches[patchI].dict());
const dictionary patchDict(patches[patchi].dict());
// Change entry on this side
patches.set(patchI, oldPatches.set(patchI, NULL));
oldToNew[patchI] = newPatchI++;
dictionary& thisPatchDict = patches[patchI].dict();
patches.set(patchi, oldPatches.set(patchi, NULL));
oldToNew[patchi] = newPatchI++;
dictionary& thisPatchDict = patches[patchi].dict();
thisPatchDict.add("neighbourPatch", nbrName);
thisPatchDict.set("nFaces", nFaces/2);
patches[patchI].keyword() = thisName;
patches[patchi].keyword() = thisName;
// Add entry on other side
patches.set
@ -207,7 +207,7 @@ void rewriteBoundary
patches[addedPatchI].keyword() = nbrName;
Info<< "Replaced with patches" << nl
<< patches[patchI].keyword() << " with" << nl
<< patches[patchi].keyword() << " with" << nl
<< " nFaces : "
<< readLabel(thisPatchDict.lookup("nFaces"))
<< nl
@ -226,8 +226,8 @@ void rewriteBoundary
}
else
{
patches.set(patchI, oldPatches.set(patchI, NULL));
oldToNew[patchI] = newPatchI++;
patches.set(patchi, oldPatches.set(patchi, NULL));
oldToNew[patchi] = newPatchI++;
}
}

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
@ -133,11 +133,11 @@ wordList addProcessorPatches
const polyBoundaryMesh& pbm = meshTarget.boundaryMesh();
forAll(pbm, patchI)
forAll(pbm, patchi)
{
if (isA<processorPolyPatch>(pbm[patchI]))
if (isA<processorPolyPatch>(pbm[patchi]))
{
const word& patchName = pbm[patchI].name();
const word& patchName = pbm[patchi].name();
cuttingPatchTable.insert(patchName);
}
}

View File

@ -98,10 +98,12 @@ bool setCellFieldType
}
}
typename GeometricField<Type, fvPatchField, volMesh>::
GeometricBoundaryField& fieldBf = field.boundaryFieldRef();
forAll(field.boundaryField(), patchi)
{
field.boundaryField()[patchi] =
field.boundaryField()[patchi].patchInternalField();
fieldBf[patchi] = fieldBf[patchi].patchInternalField();
}
if (!field.write())
@ -274,6 +276,9 @@ bool setFaceFieldType
Pstream::listCombineGather(nChanged, plusEqOp<label>());
Pstream::listCombineScatter(nChanged);
typename GeometricField<Type, fvPatchField, volMesh>::
GeometricBoundaryField& fieldBf = field.boundaryFieldRef();
// Reassign.
forAll(field.boundaryField(), patchi)
{
@ -282,11 +287,11 @@ bool setFaceFieldType
Info<< " On patch "
<< field.boundaryField()[patchi].patch().name()
<< " set " << nChanged[patchi] << " values" << endl;
field.boundaryField()[patchi] == SubField<Type>
fieldBf[patchi] == SubField<Type>
(
allBoundaryValues,
field.boundaryField()[patchi].size(),
field.boundaryField()[patchi].patch().start()
fieldBf[patchi].size(),
fieldBf[patchi].patch().start()
- mesh.nInternalFaces()
);
}

View File

@ -24,9 +24,9 @@ dict.add
dict.add("mergeDistance", SMALL);
labelHashSet includePatches;
forAll(patches, patchI)
forAll(patches, patchi)
{
const polyPatch& pp = patches[patchI];
const polyPatch& pp = patches[patchi];
if
(
!pp.coupled()
@ -34,7 +34,7 @@ forAll(patches, patchI)
&& !isA<emptyPolyPatch>(pp)
)
{
includePatches.insert(patchI);
includePatches.insert(patchi);
}
}

View File

@ -80,8 +80,8 @@ triSurface triangulate
forAllConstIter(labelHashSet, includePatches, iter)
{
const label patchI = iter.key();
const polyPatch& patch = bMesh[patchI];
const label patchi = iter.key();
const polyPatch& patch = bMesh[patchi];
const pointField& points = patch.points();
label nTriTotal = 0;
@ -107,8 +107,8 @@ triSurface triangulate
triSurfaceToAgglom[localTriFaceI++] = globalNumbering.toGlobal
(
Pstream::myProcNo(),
finalAgglom[patchI][patchFaceI]
+ coarsePatches[patchI].start()
finalAgglom[patchi][patchFaceI]
+ coarsePatches[patchi].start()
);
}
}
@ -137,10 +137,10 @@ triSurface triangulate
forAllConstIter(labelHashSet, includePatches, iter)
{
const label patchI = iter.key();
const polyPatch& patch = bMesh[patchI];
const label patchi = iter.key();
const polyPatch& patch = bMesh[patchi];
surface.patches()[newPatchI].index() = patchI;
surface.patches()[newPatchI].index() = patchi;
surface.patches()[newPatchI].name() = patch.name();
surface.patches()[newPatchI].geometricType() = patch.type();
@ -341,16 +341,16 @@ int main(int argc, char *argv[])
const volScalarField::GeometricBoundaryField& Qrb = Qr.boundaryField();
label count = 0;
forAll(Qrb, patchI)
forAll(Qrb, patchi)
{
const polyPatch& pp = patches[patchI];
const fvPatchScalarField& QrpI = Qrb[patchI];
const polyPatch& pp = patches[patchi];
const fvPatchScalarField& QrpI = Qrb[patchi];
if ((isA<fixedValueFvPatchScalarField>(QrpI)) && (pp.size() > 0))
{
viewFactorsPatches[count] = QrpI.patch().index();
nCoarseFaces += coarsePatches[patchI].size();
nFineFaces += patches[patchI].size();
nCoarseFaces += coarsePatches[patchi].size();
nFineFaces += patches[patchi].size();
count ++;
}
}
@ -803,12 +803,12 @@ int main(int argc, char *argv[])
{
forAll(viewFactorsPatches, i)
{
label patchI = viewFactorsPatches[i];
label patchi = viewFactorsPatches[i];
forAll(viewFactorsPatches, i)
{
label patchJ = viewFactorsPatches[i];
Info << "F" << patchI << patchJ << ": "
<< sumViewFactorPatch[patchI][patchJ]/patchArea[patchI]
Info << "F" << patchi << patchJ << ": "
<< sumViewFactorPatch[patchi][patchJ]/patchArea[patchi]
<< endl;
}
}
@ -831,6 +831,9 @@ int main(int argc, char *argv[])
dimensionedScalar("viewFactorField", dimless, 0)
);
volScalarField::GeometricBoundaryField& viewFactorFieldBf =
viewFactorField.boundaryFieldRef();
label compactI = 0;
forAll(viewFactorsPatches, i)
{
@ -849,7 +852,7 @@ int main(int argc, char *argv[])
forAll(fineFaces, fineId)
{
const label faceID = fineFaces[fineId];
viewFactorField.boundaryField()[patchID][faceID] = Fij;
viewFactorFieldBf[patchID][faceID] = Fij;
}
compactI++;
}