ENH: Removed the -filterPatches option.

Option was not used anymore. Cleans up the code a bit.
This commit is contained in:
mattijs
2010-02-05 10:32:47 +00:00
parent 07418fe086
commit d7d97f1f36
4 changed files with 23 additions and 88 deletions

View File

@ -46,9 +46,6 @@ Usage
@param -fields \n @param -fields \n
Use existing geometry decomposition and convert fields only. Use existing geometry decomposition and convert fields only.
@param -filterPatches \n
Remove empty patches when decomposing the geometry.
@param -force \n @param -force \n
Remove any existing @a processor subdirectories before decomposing the Remove any existing @a processor subdirectories before decomposing the
geometry. geometry.
@ -99,11 +96,6 @@ int main(int argc, char *argv[])
"use existing geometry decomposition and convert fields only" "use existing geometry decomposition and convert fields only"
); );
argList::addBoolOption argList::addBoolOption
(
"filterPatches",
"remove empty patches when decomposing the geometry"
);
argList::addBoolOption
( (
"force", "force",
"remove existing processor*/ subdirs before decomposing the geometry" "remove existing processor*/ subdirs before decomposing the geometry"
@ -128,7 +120,6 @@ int main(int argc, char *argv[])
bool writeCellDist = args.optionFound("cellDist"); bool writeCellDist = args.optionFound("cellDist");
bool copyUniform = args.optionFound("copyUniform"); bool copyUniform = args.optionFound("copyUniform");
bool decomposeFieldsOnly = args.optionFound("fields"); bool decomposeFieldsOnly = args.optionFound("fields");
bool filterPatches = args.optionFound("filterPatches");
bool forceOverwrite = args.optionFound("force"); bool forceOverwrite = args.optionFound("force");
bool ifRequiredDecomposition = args.optionFound("ifRequired"); bool ifRequiredDecomposition = args.optionFound("ifRequired");
@ -249,7 +240,7 @@ int main(int argc, char *argv[])
// Decompose the mesh // Decompose the mesh
if (!decomposeFieldsOnly) if (!decomposeFieldsOnly)
{ {
mesh.decomposeMesh(filterPatches); mesh.decomposeMesh();
mesh.writeDecomposition(); mesh.writeDecomposition();

View File

@ -86,7 +86,6 @@ Foam::domainDecomposition::domainDecomposition(const IOobject& io)
procPointAddressing_(nProcs_), procPointAddressing_(nProcs_),
procFaceAddressing_(nProcs_), procFaceAddressing_(nProcs_),
procCellAddressing_(nProcs_), procCellAddressing_(nProcs_),
procBoundaryAddressing_(nProcs_),
procPatchSize_(nProcs_), procPatchSize_(nProcs_),
procPatchStartIndex_(nProcs_), procPatchStartIndex_(nProcs_),
procNeighbourProcessors_(nProcs_), procNeighbourProcessors_(nProcs_),
@ -279,8 +278,6 @@ bool Foam::domainDecomposition::writeDecomposition()
); );
// Create processor boundary patches // Create processor boundary patches
const labelList& curBoundaryAddressing = procBoundaryAddressing_[procI];
const labelList& curPatchSizes = procPatchSize_[procI]; const labelList& curPatchSizes = procPatchSize_[procI];
const labelList& curPatchStarts = procPatchStartIndex_[procI]; const labelList& curPatchStarts = procPatchStartIndex_[procI];
@ -309,8 +306,7 @@ bool Foam::domainDecomposition::writeDecomposition()
{ {
// Get the face labels consistent with the field mapping // Get the face labels consistent with the field mapping
// (reuse the patch field mappers) // (reuse the patch field mappers)
const polyPatch& meshPatch = const polyPatch& meshPatch = meshPatches[patchi];
meshPatches[curBoundaryAddressing[patchi]];
fvFieldDecomposer::patchFieldDecomposer patchMapper fvFieldDecomposer::patchFieldDecomposer patchMapper
( (
@ -324,14 +320,13 @@ bool Foam::domainDecomposition::writeDecomposition()
); );
// Map existing patches // Map existing patches
procPatches[nPatches] = procPatches[nPatches] = meshPatch.clone
meshPatches[curBoundaryAddressing[patchi]].clone (
( procMesh.boundaryMesh(),
procMesh.boundaryMesh(), nPatches,
nPatches, patchMapper.directAddressing(),
patchMapper.directAddressing(), curPatchStarts[patchi]
curPatchStarts[patchi] ).ptr();
).ptr();
nPatches++; nPatches++;
} }
@ -678,6 +673,16 @@ bool Foam::domainDecomposition::writeDecomposition()
); );
cellProcAddressing.write(); cellProcAddressing.write();
// Write patch map for backwards compatibility.
// (= identity map for original patches, -1 for processor patches)
label nMeshPatches = curPatchSizes.size();
labelList procBoundaryAddressing(identity(nMeshPatches));
procBoundaryAddressing.setSize
(
nMeshPatches+curProcessorPatchSizes.size(),
-1
);
labelIOList boundaryProcAddressing labelIOList boundaryProcAddressing
( (
IOobject IOobject
@ -689,7 +694,7 @@ bool Foam::domainDecomposition::writeDecomposition()
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
procBoundaryAddressing_[procI] procBoundaryAddressing
); );
boundaryProcAddressing.write(); boundaryProcAddressing.write();
} }

View File

@ -83,9 +83,6 @@ class domainDecomposition
//- Labels of cells for each processor //- Labels of cells for each processor
labelListList procCellAddressing_; labelListList procCellAddressing_;
//- Original patch index for every processor patch
labelListList procBoundaryAddressing_;
//- Sizes for processor mesh patches //- Sizes for processor mesh patches
// Excludes inter-processor boundaries // Excludes inter-processor boundaries
labelListList procPatchSize_; labelListList procPatchSize_;
@ -149,8 +146,8 @@ public:
return distributed_; return distributed_;
} }
//- Decompose mesh. Optionally remove zero-sized patches. //- Decompose mesh.
void decomposeMesh(const bool filterEmptyPatches); void decomposeMesh();
//- Write decomposition //- Write decomposition
bool writeDecomposition(); bool writeDecomposition();

View File

@ -40,7 +40,7 @@ Description
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches) void Foam::domainDecomposition::decomposeMesh()
{ {
// Decide which cell goes to which processor // Decide which cell goes to which processor
distributeCells(); distributeCells();
@ -598,64 +598,6 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
} }
} }
Info<< "\nCalculating processor boundary addressing" << endl;
// For every patch of processor boundary, find the index of the original
// patch. Mis-alignment is caused by the fact that patches with zero size
// are omitted. For processor patches, set index to -1.
// At the same time, filter the procPatchSize_ and procPatchStartIndex_
// lists to exclude zero-size patches
forAll(procPatchSize_, procI)
{
// Make a local copy of old lists
const labelList oldPatchSizes = procPatchSize_[procI];
const labelList oldPatchStarts = procPatchStartIndex_[procI];
labelList& curPatchSizes = procPatchSize_[procI];
labelList& curPatchStarts = procPatchStartIndex_[procI];
const labelList& curProcessorPatchSizes =
procProcessorPatchSize_[procI];
labelList& curBoundaryAddressing = procBoundaryAddressing_[procI];
curBoundaryAddressing.setSize
(
oldPatchSizes.size()
+ curProcessorPatchSizes.size()
);
label nPatches = 0;
forAll(oldPatchSizes, patchi)
{
if (!filterEmptyPatches || oldPatchSizes[patchi] > 0)
{
curBoundaryAddressing[nPatches] = patchi;
curPatchSizes[nPatches] = oldPatchSizes[patchi];
curPatchStarts[nPatches] = oldPatchStarts[patchi];
nPatches++;
}
}
// reset to the size of live patches
curPatchSizes.setSize(nPatches);
curPatchStarts.setSize(nPatches);
forAll(curProcessorPatchSizes, procPatchI)
{
curBoundaryAddressing[nPatches] = -1;
nPatches++;
}
curBoundaryAddressing.setSize(nPatches);
}
Info<< "\nDistributing points to processors" << endl; Info<< "\nDistributing points to processors" << endl;
// For every processor, loop through the list of faces for the processor. // For every processor, loop through the list of faces for the processor.
// For every face, loop through the list of points and mark the point as // For every face, loop through the list of points and mark the point as