GIT: Initial state after latest Foundation merge

This commit is contained in:
Andrew Heather
2016-09-20 14:49:08 +01:00
4571 changed files with 115696 additions and 74609 deletions

View File

@ -8,11 +8,10 @@ EXE_INC = \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-ldynamicMesh \
-ldecompose \
-lgenericPatchFields \
-ldecompositionMethods -L$(FOAM_LIBBIN)/dummy -lmetisDecomp -lscotchDecomp \
-llagrangian \
-ldynamicMesh \
-lmeshTools \
-lregionModels

View File

@ -32,46 +32,47 @@ Description
execution of OpenFOAM.
Usage
\b decomposePar [OPTION]
- decomposePar [OPTION]
Options:
- \par -cellDist
Write the cell distribution as a labelList, for use with 'manual'
decomposition method or as a volScalarField for post-processing.
\param -cellDist \n
Write the cell distribution as a labelList, for use with 'manual'
decomposition method or as a volScalarField for post-processing.
- \par -region \<regionName\> \n
Decompose named region. Does not check for existence of processor*.
\param -region regionName \n
Decompose named region. Does not check for existence of processor*.
- \par -allRegions \n
Decompose all regions in regionProperties. Does not check for
existence of processor*.
\param -allRegions \n
Decompose all regions in regionProperties. Does not check for
existence of processor*.
- \par -copyUniform \n
Copy any \a uniform directories too.
\param -copyUniform \n
Copy any \a uniform directories too.
- \par -constant
\param -constant \n
\param -time xxx:yyy \n
Override controlDict settings and decompose selected times. Does not
re-decompose the mesh i.e. does not handle moving mesh or changing
mesh cases.
- \par -time xxx:yyy \n
Override controlDict settings and decompose selected times. Does not
re-decompose the mesh i.e. does not handle moving mesh or changing
mesh cases.
\param -fields \n
Use existing geometry decomposition and convert fields only.
- \par -fields \n
Use existing geometry decomposition and convert fields only.
\param -noSets \n
Skip decomposing cellSets, faceSets, pointSets.
- \par -noSets \n
Skip decomposing cellSets, faceSets, pointSets.
\param -force \n
Remove any existing \a processor subdirectories before decomposing the
geometry.
- \par -force \n
Remove any existing \a processor subdirectories before decomposing the
geometry.
\param -ifRequired \n
Only decompose the geometry if the number of domains has changed from a
previous decomposition. No \a processor subdirectories will be removed
unless the \a -force option is also specified. This option can be used
to avoid redundant geometry decomposition (eg, in scripts), but should
be used with caution when the underlying (serial) geometry or the
decomposition method etc. have been changed between decompositions.
- \par -ifRequired \n
Only decompose the geometry if the number of domains has changed from a
previous decomposition. No \a processor subdirectories will be removed
unless the \a -force option is also specified. This option can be used
to avoid redundant geometry decomposition (eg, in scripts), but should
be used with caution when the underlying (serial) geometry or the
decomposition method etc. have been changed between decompositions.
\*---------------------------------------------------------------------------*/
@ -103,21 +104,24 @@ Usage
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
const labelIOList& procAddressing
(
const PtrList<fvMesh>& procMeshList,
const label procI,
const label proci,
const word& name,
PtrList<labelIOList>& procAddressingList
)
{
const fvMesh& procMesh = procMeshList[procI];
const fvMesh& procMesh = procMeshList[proci];
if (!procAddressingList.set(procI))
if (!procAddressingList.set(proci))
{
procAddressingList.set
(
procI,
proci,
new labelIOList
(
IOobject
@ -133,10 +137,65 @@ const labelIOList& procAddressing
)
);
}
return procAddressingList[procI];
return procAddressingList[proci];
}
void decomposeUniform
(
const bool copyUniform,
const domainDecomposition& mesh,
const Time& processorDb,
const word& regionDir = word::null
)
{
const Time& runTime = mesh.time();
// Any uniform data to copy/link?
const fileName uniformDir(regionDir/"uniform");
if (isDir(runTime.timePath()/uniformDir))
{
Info<< "Detected additional non-decomposed files in "
<< runTime.timePath()/uniformDir
<< endl;
const fileName timePath = processorDb.timePath();
if (copyUniform || mesh.distributed())
{
cp
(
runTime.timePath()/uniformDir,
timePath/uniformDir
);
}
else
{
// link with relative paths
string parentPath = string("..")/"..";
if (regionDir != word::null)
{
parentPath = parentPath/"..";
}
fileName currentDir(cwd());
chDir(timePath);
ln
(
parentPath/runTime.timeName()/uniformDir,
uniformDir
);
chDir(currentDir);
}
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
@ -256,10 +315,10 @@ int main(int argc, char *argv[])
forAll(regionNames, regionI)
forAll(regionNames, regioni)
{
const word& regionName = regionNames[regionI];
const word& regionDir = regionDirs[regionI];
const word& regionName = regionNames[regioni];
const word& regionDir = regionDirs[regioni];
Info<< "\n\nDecomposing mesh " << regionName << nl << endl;
@ -340,11 +399,11 @@ int main(int argc, char *argv[])
// remove existing processor dirs
// reverse order to avoid gaps if someone interrupts the process
for (label procI = nProcs-1; procI >= 0; --procI)
for (label proci = nProcs-1; proci >= 0; --proci)
{
fileName procDir
(
runTime.path()/(word("processor") + name(procI))
runTime.path()/(word("processor") + name(proci))
);
rmDir(procDir);
@ -648,7 +707,7 @@ int main(int argc, char *argv[])
new List<SLList<indexedParticle*>*>
(
mesh.nCells(),
static_cast<SLList<indexedParticle*>*>(NULL)
static_cast<SLList<indexedParticle*>*>(nullptr)
)
);
@ -805,55 +864,40 @@ int main(int argc, char *argv[])
lagrangianTensorFields.setSize(cloudI);
lagrangianTensorFieldFields.setSize(cloudI);
// Any uniform data to copy/link?
fileName uniformDir("uniform");
if (isDir(runTime.timePath()/uniformDir))
{
Info<< "Detected additional non-decomposed files in "
<< runTime.timePath()/uniformDir
<< endl;
}
else
{
uniformDir.clear();
}
Info<< endl;
// split the fields over processors
for (label procI = 0; procI < mesh.nProcs(); procI++)
for (label proci = 0; proci < mesh.nProcs(); proci++)
{
Info<< "Processor " << procI << ": field transfer" << endl;
Info<< "Processor " << proci << ": field transfer" << endl;
// open the database
if (!processorDbList.set(procI))
if (!processorDbList.set(proci))
{
processorDbList.set
(
procI,
proci,
new Time
(
Time::controlDictName,
args.rootPath(),
args.caseName()
/fileName(word("processor") + name(procI))
/fileName(word("processor") + name(proci))
)
);
}
Time& processorDb = processorDbList[procI];
Time& processorDb = processorDbList[proci];
processorDb.setTime(runTime);
// read the mesh
if (!procMeshList.set(procI))
if (!procMeshList.set(proci))
{
procMeshList.set
(
procI,
proci,
new fvMesh
(
IOobject
@ -865,12 +909,12 @@ int main(int argc, char *argv[])
)
);
}
const fvMesh& procMesh = procMeshList[procI];
const fvMesh& procMesh = procMeshList[proci];
const labelIOList& faceProcAddressing = procAddressing
(
procMeshList,
procI,
proci,
"faceProcAddressing",
faceProcAddressingList
);
@ -878,7 +922,7 @@ int main(int argc, char *argv[])
const labelIOList& cellProcAddressing = procAddressing
(
procMeshList,
procI,
proci,
"cellProcAddressing",
cellProcAddressingList
);
@ -886,7 +930,7 @@ int main(int argc, char *argv[])
const labelIOList& boundaryProcAddressing = procAddressing
(
procMeshList,
procI,
proci,
"boundaryProcAddressing",
boundaryProcAddressingList
);
@ -894,11 +938,11 @@ int main(int argc, char *argv[])
// FV fields
{
if (!fieldDecomposerList.set(procI))
if (!fieldDecomposerList.set(proci))
{
fieldDecomposerList.set
(
procI,
proci,
new fvFieldDecomposer
(
mesh,
@ -910,7 +954,7 @@ int main(int argc, char *argv[])
);
}
const fvFieldDecomposer& fieldDecomposer =
fieldDecomposerList[procI];
fieldDecomposerList[proci];
fieldDecomposer.decomposeFields(volScalarFields);
fieldDecomposer.decomposeFields(volVectorFields);
@ -930,17 +974,17 @@ int main(int argc, char *argv[])
if (times.size() == 1)
{
// Clear cached decomposer
fieldDecomposerList.set(procI, NULL);
fieldDecomposerList.set(proci, nullptr);
}
}
// Dimensioned fields
{
if (!dimFieldDecomposerList.set(procI))
if (!dimFieldDecomposerList.set(proci))
{
dimFieldDecomposerList.set
(
procI,
proci,
new dimFieldDecomposer
(
mesh,
@ -951,7 +995,7 @@ int main(int argc, char *argv[])
);
}
const dimFieldDecomposer& dimDecomposer =
dimFieldDecomposerList[procI];
dimFieldDecomposerList[proci];
dimDecomposer.decomposeFields(dimScalarFields);
dimDecomposer.decomposeFields(dimVectorFields);
@ -961,7 +1005,7 @@ int main(int argc, char *argv[])
if (times.size() == 1)
{
dimFieldDecomposerList.set(procI, NULL);
dimFieldDecomposerList.set(proci, nullptr);
}
}
@ -979,18 +1023,18 @@ int main(int argc, char *argv[])
const labelIOList& pointProcAddressing = procAddressing
(
procMeshList,
procI,
proci,
"pointProcAddressing",
pointProcAddressingList
);
const pointMesh& procPMesh = pointMesh::New(procMesh);
if (!pointFieldDecomposerList.set(procI))
if (!pointFieldDecomposerList.set(proci))
{
pointFieldDecomposerList.set
(
procI,
proci,
new pointFieldDecomposer
(
pMesh,
@ -1001,7 +1045,7 @@ int main(int argc, char *argv[])
);
}
const pointFieldDecomposer& pointDecomposer =
pointFieldDecomposerList[procI];
pointFieldDecomposerList[proci];
pointDecomposer.decomposeFields(pointScalarFields);
pointDecomposer.decomposeFields(pointVectorFields);
@ -1012,8 +1056,8 @@ int main(int argc, char *argv[])
if (times.size() == 1)
{
pointProcAddressingList.set(procI, NULL);
pointFieldDecomposerList.set(procI, NULL);
pointProcAddressingList.set(proci, nullptr);
pointFieldDecomposerList.set(proci, nullptr);
}
}
@ -1100,52 +1144,31 @@ int main(int argc, char *argv[])
}
}
// Decompose the "uniform" directory in the time region
// directory
decomposeUniform(copyUniform, mesh, processorDb, regionDir);
// Any non-decomposed data to copy?
if (uniformDir.size())
{
const fileName timePath = processorDb.timePath();
// For the first region of a multi-region case additionally
// decompose the "uniform" directory in the time directory
if (regionNames.size() > 1 && regioni == 0)
// If no fields have been decomposed the destination
// directory will not have been created so make sure.
mkDir(timePath);
if (copyUniform || mesh.distributed())
{
cp
(
runTime.timePath()/uniformDir,
timePath/uniformDir
);
}
else
{
// link with relative paths
const string parentPath = string("..")/"..";
fileName currentDir(cwd());
chDir(timePath);
ln
(
parentPath/runTime.timeName()/uniformDir,
uniformDir
);
chDir(currentDir);
}
{
decomposeUniform(copyUniform, mesh, processorDb);
}
// We have cached all the constant mesh data for the current
// processor. This is only important if running with multiple
// times, otherwise it is just extra storage.
if (times.size() == 1)
{
boundaryProcAddressingList.set(procI, NULL);
cellProcAddressingList.set(procI, NULL);
faceProcAddressingList.set(procI, NULL);
procMeshList.set(procI, NULL);
processorDbList.set(procI, NULL);
boundaryProcAddressingList.set(proci, nullptr);
cellProcAddressingList.set(proci, nullptr);
faceProcAddressingList.set(proci, nullptr);
procMeshList.set(proci, nullptr);
processorDbList.set(proci, nullptr);
}
}
}

View File

@ -65,9 +65,9 @@ void Foam::dimFieldDecomposer::decomposeFields
const PtrList<GeoField>& fields
) const
{
forAll(fields, fieldI)
forAll(fields, fieldi)
{
decomposeField(fields[fieldI])().write();
decomposeField(fields[fieldi])().write();
}
}

View File

@ -93,7 +93,7 @@ Foam::domainDecomposition::domainDecomposition
false
)
)
: NULL
: nullptr
),
decompDictFile_(decompDictFile),
nProcs_
@ -151,25 +151,25 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
// Point zones
labelList pointToZone(points().size(), -1);
forAll(pointZones(), zoneI)
forAll(pointZones(), zonei)
{
mark(pointZones()[zoneI], zoneI, pointToZone);
mark(pointZones()[zonei], zonei, pointToZone);
}
// Face zones
labelList faceToZone(faces().size(), -1);
forAll(faceZones(), zoneI)
forAll(faceZones(), zonei)
{
mark(faceZones()[zoneI], zoneI, faceToZone);
mark(faceZones()[zonei], zonei, faceToZone);
}
// Cell zones
labelList cellToZone(nCells(), -1);
forAll(cellZones(), zoneI)
forAll(cellZones(), zonei)
{
mark(cellZones()[zoneI], zoneI, cellToZone);
mark(cellZones()[zonei], zonei, cellToZone);
}
@ -229,10 +229,10 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
// Write out the meshes
for (label procI = 0; procI < nProcs_; procI++)
for (label proci = 0; proci < nProcs_; proci++)
{
// Create processor points
const labelList& curPointLabels = procPointAddressing_[procI];
const labelList& curPointLabels = procPointAddressing_[proci];
const pointField& meshPoints = points();
@ -248,7 +248,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
}
// Create processor faces
const labelList& curFaceLabels = procFaceAddressing_[procI];
const labelList& curFaceLabels = procFaceAddressing_[proci];
const faceList& meshFaces = faces();
@ -290,7 +290,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
}
// Create processor cells
const labelList& curCellLabels = procCellAddressing_[procI];
const labelList& curCellLabels = procCellAddressing_[proci];
const cellList& meshCells = cells();
@ -304,9 +304,9 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
curCell.setSize(origCellLabels.size());
forAll(origCellLabels, cellFaceI)
forAll(origCellLabels, cellFacei)
{
curCell[cellFaceI] = faceLookup[origCellLabels[cellFaceI]];
curCell[cellFacei] = faceLookup[origCellLabels[cellFacei]];
}
}
@ -314,7 +314,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
fileName processorCasePath
(
time().caseName()/fileName(word("processor") + Foam::name(procI))
time().caseName()/fileName(word("processor") + Foam::name(proci))
);
// make the processor directory
@ -390,33 +390,33 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
// Create processor boundary patches
const labelList& curPatchSizes = procPatchSize_[procI];
const labelList& curPatchSizes = procPatchSize_[proci];
const labelList& curPatchStarts = procPatchStartIndex_[procI];
const labelList& curPatchStarts = procPatchStartIndex_[proci];
const labelList& curNeighbourProcessors =
procNeighbourProcessors_[procI];
procNeighbourProcessors_[proci];
const labelList& curProcessorPatchSizes =
procProcessorPatchSize_[procI];
procProcessorPatchSize_[proci];
const labelList& curProcessorPatchStarts =
procProcessorPatchStartIndex_[procI];
procProcessorPatchStartIndex_[proci];
const labelListList& curSubPatchIDs =
procProcessorPatchSubPatchIDs_[procI];
procProcessorPatchSubPatchIDs_[proci];
const labelListList& curSubStarts =
procProcessorPatchSubPatchStarts_[procI];
procProcessorPatchSubPatchStarts_[proci];
const polyPatchList& meshPatches = boundaryMesh();
// Count the number of inter-proc patches
label nInterProcPatches = 0;
forAll(curSubPatchIDs, procPatchI)
forAll(curSubPatchIDs, procPatchi)
{
nInterProcPatches += curSubPatchIDs[procPatchI].size();
nInterProcPatches += curSubPatchIDs[procPatchi].size();
}
List<polyPatch*> procPatches
@ -456,12 +456,12 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
nPatches++;
}
forAll(curProcessorPatchSizes, procPatchI)
forAll(curProcessorPatchSizes, procPatchi)
{
const labelList& subPatchID = curSubPatchIDs[procPatchI];
const labelList& subStarts = curSubStarts[procPatchI];
const labelList& subPatchID = curSubPatchIDs[procPatchi];
const labelList& subStarts = curSubStarts[procPatchi];
label curStart = curProcessorPatchStarts[procPatchI];
label curStart = curProcessorPatchStarts[procPatchi];
forAll(subPatchID, i)
{
@ -469,7 +469,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
(
i < subPatchID.size()-1
? subStarts[i+1] - subStarts[i]
: curProcessorPatchSizes[procPatchI] - subStarts[i]
: curProcessorPatchSizes[procPatchi] - subStarts[i]
);
if (subPatchID[i] == -1)
@ -482,8 +482,8 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
curStart,
nPatches,
procMesh.boundaryMesh(),
procI,
curNeighbourProcessors[procPatchI]
proci,
curNeighbourProcessors[procPatchi]
);
}
else
@ -501,8 +501,8 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
curStart,
nPatches,
procMesh.boundaryMesh(),
procI,
curNeighbourProcessors[procPatchI],
proci,
curNeighbourProcessors[procPatchi],
pcPatch.name(),
pcPatch.transform()
);
@ -529,9 +529,9 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
List<DynamicList<label>> zonePoints(pz.size());
// Estimate size
forAll(zonePoints, zoneI)
forAll(zonePoints, zonei)
{
zonePoints[zoneI].setCapacity(pz[zoneI].size() / nProcs_);
zonePoints[zonei].setCapacity(pz[zonei].size()/nProcs_);
}
// Use the pointToZone map to find out the single zone (if any),
@ -540,23 +540,23 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
{
label curPoint = curPointLabels[pointi];
label zoneI = pointToZone[curPoint];
label zonei = pointToZone[curPoint];
if (zoneI >= 0)
if (zonei >= 0)
{
// Single zone.
zonePoints[zoneI].append(pointi);
zonePoints[zonei].append(pointi);
}
else if (zoneI == -2)
else if (zonei == -2)
{
// Multiple zones. Lookup.
forAll(pz, zoneI)
forAll(pz, zonei)
{
label index = pz[zoneI].whichPoint(curPoint);
label index = pz[zonei].whichPoint(curPoint);
if (index != -1)
{
zonePoints[zoneI].append(pointi);
zonePoints[zonei].append(pointi);
}
}
}
@ -564,16 +564,16 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
procMesh.pointZones().clearAddressing();
procMesh.pointZones().setSize(zonePoints.size());
forAll(zonePoints, zoneI)
forAll(zonePoints, zonei)
{
procMesh.pointZones().set
(
zoneI,
pz[zoneI].clone
zonei,
pz[zonei].clone
(
procMesh.pointZones(),
zoneI,
zonePoints[zoneI].shrink()
zonei,
zonePoints[zonei].shrink()
)
);
}
@ -596,12 +596,12 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
List<DynamicList<bool>> zoneFaceFlips(fz.size());
// Estimate size
forAll(zoneFaces, zoneI)
forAll(zoneFaces, zonei)
{
label procSize = fz[zoneI].size() / nProcs_;
label procSize = fz[zonei].size() / nProcs_;
zoneFaces[zoneI].setCapacity(procSize);
zoneFaceFlips[zoneI].setCapacity(procSize);
zoneFaces[zonei].setCapacity(procSize);
zoneFaceFlips[zonei].setCapacity(procSize);
}
// Go through all the zoned faces and find out if they
@ -613,43 +613,43 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
//
label curF = mag(curFaceLabels[facei]) - 1;
label zoneI = faceToZone[curF];
label zonei = faceToZone[curF];
if (zoneI >= 0)
{
// Single zone. Add the face
zoneFaces[zoneI].append(facei);
zoneFaces[zonei].append(facei);
label index = fz[zoneI].whichFace(curF);
label index = fz[zonei].whichFace(curF);
bool flip = fz[zoneI].flipMap()[index];
bool flip = fz[zonei].flipMap()[index];
if (curFaceLabels[facei] < 0)
{
flip = !flip;
}
zoneFaceFlips[zoneI].append(flip);
zoneFaceFlips[zonei].append(flip);
}
else if (zoneI == -2)
else if (zonei == -2)
{
// Multiple zones. Lookup.
forAll(fz, zoneI)
forAll(fz, zonei)
{
label index = fz[zoneI].whichFace(curF);
label index = fz[zonei].whichFace(curF);
if (index != -1)
{
zoneFaces[zoneI].append(facei);
zoneFaces[zonei].append(facei);
bool flip = fz[zoneI].flipMap()[index];
bool flip = fz[zonei].flipMap()[index];
if (curFaceLabels[facei] < 0)
{
flip = !flip;
}
zoneFaceFlips[zoneI].append(flip);
zoneFaceFlips[zonei].append(flip);
}
}
}
@ -657,16 +657,16 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
procMesh.faceZones().clearAddressing();
procMesh.faceZones().setSize(zoneFaces.size());
forAll(zoneFaces, zoneI)
forAll(zoneFaces, zonei)
{
procMesh.faceZones().set
(
zoneI,
fz[zoneI].clone
zonei,
fz[zonei].clone
(
zoneFaces[zoneI].shrink(), // addressing
zoneFaceFlips[zoneI].shrink(), // flipmap
zoneI,
zoneFaces[zonei].shrink(), // addressing
zoneFaceFlips[zonei].shrink(), // flipmap
zonei,
procMesh.faceZones()
)
);
@ -689,32 +689,32 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
List<DynamicList<label>> zoneCells(cz.size());
// Estimate size
forAll(zoneCells, zoneI)
forAll(zoneCells, zonei)
{
zoneCells[zoneI].setCapacity(cz[zoneI].size() / nProcs_);
zoneCells[zonei].setCapacity(cz[zonei].size()/nProcs_);
}
forAll(curCellLabels, celli)
{
label curCellI = curCellLabels[celli];
label curCelli = curCellLabels[celli];
label zoneI = cellToZone[curCellI];
label zonei = cellToZone[curCelli];
if (zoneI >= 0)
if (zonei >= 0)
{
// Single zone.
zoneCells[zoneI].append(celli);
zoneCells[zonei].append(celli);
}
else if (zoneI == -2)
else if (zonei == -2)
{
// Multiple zones. Lookup.
forAll(cz, zoneI)
forAll(cz, zonei)
{
label index = cz[zoneI].whichCell(curCellI);
label index = cz[zonei].whichCell(curCelli);
if (index != -1)
{
zoneCells[zoneI].append(celli);
zoneCells[zonei].append(celli);
}
}
}
@ -722,15 +722,15 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
procMesh.cellZones().clearAddressing();
procMesh.cellZones().setSize(zoneCells.size());
forAll(zoneCells, zoneI)
forAll(zoneCells, zonei)
{
procMesh.cellZones().set
(
zoneI,
cz[zoneI].clone
zonei,
cz[zonei].clone
(
zoneCells[zoneI].shrink(),
zoneI,
zoneCells[zonei].shrink(),
zonei,
procMesh.cellZones()
)
);
@ -828,15 +828,15 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
false
),
baseMeshData,
procCellAddressing_[procI],
procPointAddressing_[procI]
procCellAddressing_[proci],
procPointAddressing_[proci]
).write();
// Statistics
Info<< endl
<< "Processor " << procI << nl
<< "Processor " << proci << nl
<< " Number of cells = " << procMesh.nCells()
<< endl;
@ -889,7 +889,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
IOobject::NO_READ,
IOobject::NO_WRITE
),
procPointAddressing_[procI]
procPointAddressing_[proci]
);
pointProcAddressing.write();
@ -904,7 +904,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
IOobject::NO_READ,
IOobject::NO_WRITE
),
procFaceAddressing_[procI]
procFaceAddressing_[proci]
);
faceProcAddressing.write();
@ -919,7 +919,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
IOobject::NO_READ,
IOobject::NO_WRITE
),
procCellAddressing_[procI]
procCellAddressing_[proci]
);
cellProcAddressing.write();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -46,7 +46,6 @@ void Foam::domainDecomposition::distributeCells()
decompDictFile_
);
scalarField cellWeights;
if (method.found("weightField"))
{
@ -64,7 +63,7 @@ void Foam::domainDecomposition::distributeCells()
),
*this
);
cellWeights = weights.internalField();
cellWeights = weights.primitiveField();
}
cellToProc_ = method.decomposer().decompose(*this, cellWeights);

View File

@ -55,37 +55,37 @@ void Foam::domainDecomposition::addInterProcFace
List<DynamicList<DynamicList<label>>>& interPatchFaces
) const
{
Map<label>::iterator patchIter = nbrToInterPatch[ownerProc].find(nbrProc);
Map<label>::iterator patchiter = nbrToInterPatch[ownerProc].find(nbrProc);
// Introduce turning index only for internal faces (are duplicated).
label ownerIndex = facei+1;
label nbrIndex = -(facei+1);
if (patchIter != nbrToInterPatch[ownerProc].end())
if (patchiter != nbrToInterPatch[ownerProc].end())
{
// Existing interproc patch. Add to both sides.
label toNbrProcPatchI = patchIter();
interPatchFaces[ownerProc][toNbrProcPatchI].append(ownerIndex);
label toNbrProcPatchi = patchiter();
interPatchFaces[ownerProc][toNbrProcPatchi].append(ownerIndex);
if (isInternalFace(facei))
{
label toOwnerProcPatchI = nbrToInterPatch[nbrProc][ownerProc];
interPatchFaces[nbrProc][toOwnerProcPatchI].append(nbrIndex);
label toOwnerProcPatchi = nbrToInterPatch[nbrProc][ownerProc];
interPatchFaces[nbrProc][toOwnerProcPatchi].append(nbrIndex);
}
}
else
{
// Create new interproc patches.
label toNbrProcPatchI = nbrToInterPatch[ownerProc].size();
nbrToInterPatch[ownerProc].insert(nbrProc, toNbrProcPatchI);
label toNbrProcPatchi = nbrToInterPatch[ownerProc].size();
nbrToInterPatch[ownerProc].insert(nbrProc, toNbrProcPatchi);
DynamicList<label> oneFace;
oneFace.append(ownerIndex);
interPatchFaces[ownerProc].append(oneFace);
if (isInternalFace(facei))
{
label toOwnerProcPatchI = nbrToInterPatch[nbrProc].size();
nbrToInterPatch[nbrProc].insert(ownerProc, toOwnerProcPatchI);
label toOwnerProcPatchi = nbrToInterPatch[nbrProc].size();
nbrToInterPatch[nbrProc].insert(ownerProc, toOwnerProcPatchi);
oneFace.clear();
oneFace.append(nbrIndex);
interPatchFaces[nbrProc].append(oneFace);
@ -139,20 +139,20 @@ void Foam::domainDecomposition::decomposeMesh()
// for all processors, set the size of start index and patch size
// lists to the number of patches in the mesh
forAll(procPatchSize_, procI)
forAll(procPatchSize_, proci)
{
procPatchSize_[procI].setSize(patches.size());
procPatchStartIndex_[procI].setSize(patches.size());
procPatchSize_[proci].setSize(patches.size());
procPatchStartIndex_[proci].setSize(patches.size());
}
forAll(patches, patchi)
{
// Reset size and start index for all processors
forAll(procPatchSize_, procI)
forAll(procPatchSize_, proci)
{
procPatchSize_[procI][patchi] = 0;
procPatchStartIndex_[procI][patchi] =
procFaceAddressing_[procI].size();
procPatchSize_[proci][patchi] = 0;
procPatchStartIndex_[proci][patchi] =
procFaceAddressing_[proci].size();
}
const label patchStart = patches[patchi].start();
@ -239,12 +239,12 @@ void Foam::domainDecomposition::decomposeMesh()
// originating from internal faces this is always -1.
List<labelListList> subPatchIDs(nProcs_);
List<labelListList> subPatchStarts(nProcs_);
forAll(interPatchFaces, procI)
forAll(interPatchFaces, proci)
{
label nInterfaces = interPatchFaces[procI].size();
label nInterfaces = interPatchFaces[proci].size();
subPatchIDs[procI].setSize(nInterfaces, labelList(1, label(-1)));
subPatchStarts[procI].setSize(nInterfaces, labelList(1, label(0)));
subPatchIDs[proci].setSize(nInterfaces, labelList(1, label(-1)));
subPatchStarts[proci].setSize(nInterfaces, labelList(1, label(0)));
}
@ -318,63 +318,63 @@ void Foam::domainDecomposition::decomposeMesh()
// Sort inter-proc patch by neighbour
labelList order;
forAll(procNbrToInterPatch, procI)
forAll(procNbrToInterPatch, proci)
{
label nInterfaces = procNbrToInterPatch[procI].size();
label nInterfaces = procNbrToInterPatch[proci].size();
procNeighbourProcessors_[procI].setSize(nInterfaces);
procProcessorPatchSize_[procI].setSize(nInterfaces);
procProcessorPatchStartIndex_[procI].setSize(nInterfaces);
procProcessorPatchSubPatchIDs_[procI].setSize(nInterfaces);
procProcessorPatchSubPatchStarts_[procI].setSize(nInterfaces);
procNeighbourProcessors_[proci].setSize(nInterfaces);
procProcessorPatchSize_[proci].setSize(nInterfaces);
procProcessorPatchStartIndex_[proci].setSize(nInterfaces);
procProcessorPatchSubPatchIDs_[proci].setSize(nInterfaces);
procProcessorPatchSubPatchStarts_[proci].setSize(nInterfaces);
//Info<< "Processor " << procI << endl;
//Info<< "Processor " << proci << endl;
// Get sorted neighbour processors
const Map<label>& curNbrToInterPatch = procNbrToInterPatch[procI];
const Map<label>& curNbrToInterPatch = procNbrToInterPatch[proci];
labelList nbrs = curNbrToInterPatch.toc();
sortedOrder(nbrs, order);
DynamicList<DynamicList<label>>& curInterPatchFaces =
interPatchFaces[procI];
interPatchFaces[proci];
forAll(nbrs, i)
{
const label nbrProc = nbrs[i];
const label interPatch = curNbrToInterPatch[nbrProc];
procNeighbourProcessors_[procI][i] = nbrProc;
procProcessorPatchSize_[procI][i] =
procNeighbourProcessors_[proci][i] = nbrProc;
procProcessorPatchSize_[proci][i] =
curInterPatchFaces[interPatch].size();
procProcessorPatchStartIndex_[procI][i] =
procFaceAddressing_[procI].size();
procProcessorPatchStartIndex_[proci][i] =
procFaceAddressing_[proci].size();
// Add size as last element to substarts and transfer
append
(
subPatchStarts[procI][interPatch],
subPatchStarts[proci][interPatch],
curInterPatchFaces[interPatch].size()
);
procProcessorPatchSubPatchIDs_[procI][i].transfer
procProcessorPatchSubPatchIDs_[proci][i].transfer
(
subPatchIDs[procI][interPatch]
subPatchIDs[proci][interPatch]
);
procProcessorPatchSubPatchStarts_[procI][i].transfer
procProcessorPatchSubPatchStarts_[proci][i].transfer
(
subPatchStarts[procI][interPatch]
subPatchStarts[proci][interPatch]
);
//Info<< " nbr:" << nbrProc << endl;
//Info<< " interpatch:" << interPatch << endl;
//Info<< " size:" << procProcessorPatchSize_[procI][i] << endl;
//Info<< " start:" << procProcessorPatchStartIndex_[procI][i]
//Info<< " size:" << procProcessorPatchSize_[proci][i] << endl;
//Info<< " start:" << procProcessorPatchStartIndex_[proci][i]
// << endl;
//Info<< " subPatches:"
// << procProcessorPatchSubPatchIDs_[procI][i]
// << procProcessorPatchSubPatchIDs_[proci][i]
// << endl;
//Info<< " subStarts:"
// << procProcessorPatchSubPatchStarts_[procI][i] << endl;
// << procProcessorPatchSubPatchStarts_[proci][i] << endl;
// And add all the face labels for interPatch
DynamicList<label>& interPatchFaces =
@ -382,55 +382,55 @@ void Foam::domainDecomposition::decomposeMesh()
forAll(interPatchFaces, j)
{
procFaceAddressing_[procI].append(interPatchFaces[j]);
procFaceAddressing_[proci].append(interPatchFaces[j]);
}
interPatchFaces.clearStorage();
}
curInterPatchFaces.clearStorage();
procFaceAddressing_[procI].shrink();
procFaceAddressing_[proci].shrink();
}
////XXXXXXX
//// Print a bit
// forAll(procPatchStartIndex_, procI)
// forAll(procPatchStartIndex_, proci)
// {
// Info<< "Processor:" << procI << endl;
// Info<< "Processor:" << proci << endl;
//
// Info<< " total faces:" << procFaceAddressing_[procI].size()
// Info<< " total faces:" << procFaceAddressing_[proci].size()
// << endl;
//
// const labelList& curProcPatchStartIndex = procPatchStartIndex_[procI];
// const labelList& curProcPatchStartIndex = procPatchStartIndex_[proci];
//
// forAll(curProcPatchStartIndex, patchI)
// forAll(curProcPatchStartIndex, patchi)
// {
// Info<< " patch:" << patchI
// << "\tstart:" << curProcPatchStartIndex[patchI]
// << "\tsize:" << procPatchSize_[procI][patchI]
// Info<< " patch:" << patchi
// << "\tstart:" << curProcPatchStartIndex[patchi]
// << "\tsize:" << procPatchSize_[proci][patchi]
// << endl;
// }
// }
// Info<< endl;
//
// forAll(procNeighbourProcessors_, procI)
// forAll(procNeighbourProcessors_, proci)
// {
// Info<< "Processor " << procI << endl;
// Info<< "Processor " << proci << endl;
//
// forAll(procNeighbourProcessors_[procI], i)
// forAll(procNeighbourProcessors_[proci], i)
// {
// Info<< " nbr:" << procNeighbourProcessors_[procI][i] << endl;
// Info<< " size:" << procProcessorPatchSize_[procI][i] << endl;
// Info<< " start:" << procProcessorPatchStartIndex_[procI][i]
// Info<< " nbr:" << procNeighbourProcessors_[proci][i] << endl;
// Info<< " size:" << procProcessorPatchSize_[proci][i] << endl;
// Info<< " start:" << procProcessorPatchStartIndex_[proci][i]
// << endl;
// }
// }
// Info<< endl;
//
// forAll(procFaceAddressing_, procI)
// forAll(procFaceAddressing_, proci)
// {
// Info<< "Processor:" << procI << endl;
// Info<< "Processor:" << proci << endl;
//
// Info<< " faces:" << procFaceAddressing_[procI] << endl;
// Info<< " faces:" << procFaceAddressing_[proci] << endl;
// }
@ -441,12 +441,12 @@ void Foam::domainDecomposition::decomposeMesh()
// used for the processor. Collect the list of used points for the
// processor.
forAll(procPointAddressing_, procI)
forAll(procPointAddressing_, proci)
{
boolList pointLabels(nPoints(), false);
// Get reference to list of used faces
const labelList& procFaceLabels = procFaceAddressing_[procI];
const labelList& procFaceLabels = procFaceAddressing_[proci];
forAll(procFaceLabels, facei)
{
@ -461,7 +461,7 @@ void Foam::domainDecomposition::decomposeMesh()
}
// Collect the used points
labelList& procPointLabels = procPointAddressing_[procI];
labelList& procPointLabels = procPointAddressing_[proci];
procPointLabels.setSize(pointLabels.size());

View File

@ -62,15 +62,15 @@ void Foam::domainDecomposition::processInterCyclics
// Store old sizes. Used to detect which inter-proc patches
// have been added to.
labelListList oldInterfaceSizes(nProcs_);
forAll(oldInterfaceSizes, procI)
forAll(oldInterfaceSizes, proci)
{
labelList& curOldSizes = oldInterfaceSizes[procI];
labelList& curOldSizes = oldInterfaceSizes[proci];
curOldSizes.setSize(interPatchFaces[procI].size());
curOldSizes.setSize(interPatchFaces[proci].size());
forAll(curOldSizes, interI)
{
curOldSizes[interI] =
interPatchFaces[procI][interI].size();
interPatchFaces[proci][interI].size();
}
}
@ -94,28 +94,28 @@ void Foam::domainDecomposition::processInterCyclics
}
// 1. Check if any faces added to existing interfaces
forAll(oldInterfaceSizes, procI)
forAll(oldInterfaceSizes, proci)
{
const labelList& curOldSizes = oldInterfaceSizes[procI];
const labelList& curOldSizes = oldInterfaceSizes[proci];
forAll(curOldSizes, interI)
{
label oldSz = curOldSizes[interI];
if (interPatchFaces[procI][interI].size() > oldSz)
if (interPatchFaces[proci][interI].size() > oldSz)
{
// Added faces to this interface. Add an entry
append(subPatchIDs[procI][interI], patchi);
append(subPatchStarts[procI][interI], oldSz);
append(subPatchIDs[proci][interI], patchi);
append(subPatchStarts[proci][interI], oldSz);
}
}
}
// 2. Any new interfaces
forAll(subPatchIDs, procI)
forAll(subPatchIDs, proci)
{
label nIntfcs = interPatchFaces[procI].size();
subPatchIDs[procI].setSize(nIntfcs, labelList(1, patchi));
subPatchStarts[procI].setSize(nIntfcs, labelList(1, label(0)));
label nIntfcs = interPatchFaces[proci].size();
subPatchIDs[proci].setSize(nIntfcs, labelList(1, patchi));
subPatchStarts[proci].setSize(nIntfcs, labelList(1, label(0)));
}
}
}

View File

@ -190,9 +190,9 @@ void Foam::lagrangianFieldDecomposer::decomposeFields
{
if (particleIndices_.size())
{
forAll(fields, fieldI)
forAll(fields, fieldi)
{
decomposeField(cloudName, fields[fieldI])().write();
decomposeField(cloudName, fields[fieldi])().write();
}
}
}
@ -207,9 +207,9 @@ void Foam::lagrangianFieldDecomposer::decomposeFieldFields
{
if (particleIndices_.size())
{
forAll(fields, fieldI)
forAll(fields, fieldi)
{
decomposeFieldField(cloudName, fields[fieldI])().write();
decomposeFieldField(cloudName, fields[fieldi])().write();
}
}
}

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
@ -89,7 +89,7 @@ Foam::pointFieldDecomposer::pointFieldDecomposer
patchFieldDecomposerPtrs_
(
procMesh_.boundary().size(),
static_cast<patchFieldDecomposer*>(NULL)
static_cast<patchFieldDecomposer*>(nullptr)
)
{
forAll(boundaryAddressing_, patchi)

View File

@ -36,7 +36,7 @@ Foam::pointFieldDecomposer::decomposeField
) const
{
// Create and map the internal field values
Field<Type> internalField(field.internalField(), pointAddressing_);
Field<Type> internalField(field.primitiveField(), pointAddressing_);
// Create a list of pointers for the patchFields
PtrList<pointPatchField<Type>> patchFields(boundaryAddressing_.size());
@ -101,9 +101,9 @@ void Foam::pointFieldDecomposer::decomposeFields
const PtrList<GeoField>& fields
) const
{
forAll(fields, fieldI)
forAll(fields, fieldi)
{
decomposeField(fields[fieldI])().write();
decomposeField(fields[fieldi])().write();
}
}

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

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