mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
optional merging of sub-regions
This commit is contained in:
@ -36,7 +36,12 @@ namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(searchableSurfaceCollection, 0);
|
||||
addToRunTimeSelectionTable(searchableSurface, searchableSurfaceCollection, dict);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
searchableSurface,
|
||||
searchableSurfaceCollection,
|
||||
dict
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@ -63,15 +68,17 @@ void Foam::searchableSurfaceCollection::findNearest
|
||||
|
||||
forAll(subGeom_, surfI)
|
||||
{
|
||||
// Transform then divide
|
||||
tmp<pointField> localSamples = cmptDivide
|
||||
subGeom_[surfI].findNearest
|
||||
(
|
||||
cmptDivide // Transform then divide
|
||||
(
|
||||
transform_[surfI].localPosition(samples),
|
||||
scale_[surfI]
|
||||
),
|
||||
localMinDistSqr,
|
||||
hitInfo
|
||||
);
|
||||
|
||||
subGeom_[surfI].findNearest(localSamples, localMinDistSqr, hitInfo);
|
||||
|
||||
forAll(hitInfo, pointI)
|
||||
{
|
||||
if (hitInfo[pointI].hit())
|
||||
@ -115,7 +122,8 @@ Foam::searchableSurfaceCollection::searchableSurfaceCollection
|
||||
instance_(dict.size()),
|
||||
scale_(dict.size()),
|
||||
transform_(dict.size()),
|
||||
subGeom_(dict.size())
|
||||
subGeom_(dict.size()),
|
||||
mergeSubRegions_(dict.lookup("mergeSubRegions"))
|
||||
{
|
||||
Info<< "SearchableCollection : " << name() << endl;
|
||||
|
||||
@ -181,14 +189,21 @@ const Foam::wordList& Foam::searchableSurfaceCollection::regions() const
|
||||
{
|
||||
regionOffset_[surfI] = allRegions.size();
|
||||
|
||||
if (mergeSubRegions_)
|
||||
{
|
||||
// Single name regardless how many regions subsurface has
|
||||
allRegions.append(instance_[surfI] + "_" + Foam::name(surfI));
|
||||
}
|
||||
else
|
||||
{
|
||||
const wordList& subRegions = subGeom_[surfI].regions();
|
||||
|
||||
forAll(subRegions, i)
|
||||
{
|
||||
//allRegions.append(subRegions[i] + "_" + Foam::name(surfI));
|
||||
allRegions.append(instance_[surfI] + "_" + subRegions[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
regions_.transfer(allRegions.shrink());
|
||||
}
|
||||
return regions_;
|
||||
@ -369,9 +384,17 @@ void Foam::searchableSurfaceCollection::getRegion
|
||||
if (subGeom_.size() == 0)
|
||||
{}
|
||||
else if (subGeom_.size() == 1)
|
||||
{
|
||||
if (mergeSubRegions_)
|
||||
{
|
||||
region.setSize(info.size());
|
||||
region = regionOffset_[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
subGeom_[0].getRegion(info, region);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
region.setSize(info.size());
|
||||
@ -429,6 +452,15 @@ void Foam::searchableSurfaceCollection::getRegion
|
||||
// Collect points from my surface
|
||||
labelList indices(findIndices(nearestSurf, surfI));
|
||||
|
||||
if (mergeSubRegions_)
|
||||
{
|
||||
forAll(indices, i)
|
||||
{
|
||||
region[indices[i]] = regionOffset_[surfI];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
labelList surfRegion;
|
||||
subGeom_[surfI].getRegion
|
||||
(
|
||||
@ -441,6 +473,7 @@ void Foam::searchableSurfaceCollection::getRegion
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -40,6 +40,7 @@ SourceFiles
|
||||
#include "treeBoundBox.H"
|
||||
#include "coordinateSystem.H"
|
||||
#include "UPtrList.H"
|
||||
#include "Switch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -73,6 +74,8 @@ private:
|
||||
|
||||
UPtrList<searchableSurface> subGeom_;
|
||||
|
||||
Switch mergeSubRegions_;
|
||||
|
||||
//- Region names
|
||||
mutable wordList regions_;
|
||||
//- From individual regions to collection regions
|
||||
|
||||
Reference in New Issue
Block a user