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);
|
defineTypeNameAndDebug(searchableSurfaceCollection, 0);
|
||||||
addToRunTimeSelectionTable(searchableSurface, searchableSurfaceCollection, dict);
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
searchableSurface,
|
||||||
|
searchableSurfaceCollection,
|
||||||
|
dict
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,15 +68,17 @@ void Foam::searchableSurfaceCollection::findNearest
|
|||||||
|
|
||||||
forAll(subGeom_, surfI)
|
forAll(subGeom_, surfI)
|
||||||
{
|
{
|
||||||
// Transform then divide
|
subGeom_[surfI].findNearest
|
||||||
tmp<pointField> localSamples = cmptDivide
|
(
|
||||||
|
cmptDivide // Transform then divide
|
||||||
(
|
(
|
||||||
transform_[surfI].localPosition(samples),
|
transform_[surfI].localPosition(samples),
|
||||||
scale_[surfI]
|
scale_[surfI]
|
||||||
|
),
|
||||||
|
localMinDistSqr,
|
||||||
|
hitInfo
|
||||||
);
|
);
|
||||||
|
|
||||||
subGeom_[surfI].findNearest(localSamples, localMinDistSqr, hitInfo);
|
|
||||||
|
|
||||||
forAll(hitInfo, pointI)
|
forAll(hitInfo, pointI)
|
||||||
{
|
{
|
||||||
if (hitInfo[pointI].hit())
|
if (hitInfo[pointI].hit())
|
||||||
@ -115,7 +122,8 @@ Foam::searchableSurfaceCollection::searchableSurfaceCollection
|
|||||||
instance_(dict.size()),
|
instance_(dict.size()),
|
||||||
scale_(dict.size()),
|
scale_(dict.size()),
|
||||||
transform_(dict.size()),
|
transform_(dict.size()),
|
||||||
subGeom_(dict.size())
|
subGeom_(dict.size()),
|
||||||
|
mergeSubRegions_(dict.lookup("mergeSubRegions"))
|
||||||
{
|
{
|
||||||
Info<< "SearchableCollection : " << name() << endl;
|
Info<< "SearchableCollection : " << name() << endl;
|
||||||
|
|
||||||
@ -181,14 +189,21 @@ const Foam::wordList& Foam::searchableSurfaceCollection::regions() const
|
|||||||
{
|
{
|
||||||
regionOffset_[surfI] = allRegions.size();
|
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();
|
const wordList& subRegions = subGeom_[surfI].regions();
|
||||||
|
|
||||||
forAll(subRegions, i)
|
forAll(subRegions, i)
|
||||||
{
|
{
|
||||||
//allRegions.append(subRegions[i] + "_" + Foam::name(surfI));
|
|
||||||
allRegions.append(instance_[surfI] + "_" + subRegions[i]);
|
allRegions.append(instance_[surfI] + "_" + subRegions[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
regions_.transfer(allRegions.shrink());
|
regions_.transfer(allRegions.shrink());
|
||||||
}
|
}
|
||||||
return regions_;
|
return regions_;
|
||||||
@ -369,9 +384,17 @@ void Foam::searchableSurfaceCollection::getRegion
|
|||||||
if (subGeom_.size() == 0)
|
if (subGeom_.size() == 0)
|
||||||
{}
|
{}
|
||||||
else if (subGeom_.size() == 1)
|
else if (subGeom_.size() == 1)
|
||||||
|
{
|
||||||
|
if (mergeSubRegions_)
|
||||||
|
{
|
||||||
|
region.setSize(info.size());
|
||||||
|
region = regionOffset_[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
subGeom_[0].getRegion(info, region);
|
subGeom_[0].getRegion(info, region);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
region.setSize(info.size());
|
region.setSize(info.size());
|
||||||
@ -429,6 +452,15 @@ void Foam::searchableSurfaceCollection::getRegion
|
|||||||
// Collect points from my surface
|
// Collect points from my surface
|
||||||
labelList indices(findIndices(nearestSurf, surfI));
|
labelList indices(findIndices(nearestSurf, surfI));
|
||||||
|
|
||||||
|
if (mergeSubRegions_)
|
||||||
|
{
|
||||||
|
forAll(indices, i)
|
||||||
|
{
|
||||||
|
region[indices[i]] = regionOffset_[surfI];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
labelList surfRegion;
|
labelList surfRegion;
|
||||||
subGeom_[surfI].getRegion
|
subGeom_[surfI].getRegion
|
||||||
(
|
(
|
||||||
@ -442,6 +474,7 @@ void Foam::searchableSurfaceCollection::getRegion
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::searchableSurfaceCollection::getNormal
|
void Foam::searchableSurfaceCollection::getNormal
|
||||||
|
|||||||
@ -40,6 +40,7 @@ SourceFiles
|
|||||||
#include "treeBoundBox.H"
|
#include "treeBoundBox.H"
|
||||||
#include "coordinateSystem.H"
|
#include "coordinateSystem.H"
|
||||||
#include "UPtrList.H"
|
#include "UPtrList.H"
|
||||||
|
#include "Switch.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -73,6 +74,8 @@ private:
|
|||||||
|
|
||||||
UPtrList<searchableSurface> subGeom_;
|
UPtrList<searchableSurface> subGeom_;
|
||||||
|
|
||||||
|
Switch mergeSubRegions_;
|
||||||
|
|
||||||
//- Region names
|
//- Region names
|
||||||
mutable wordList regions_;
|
mutable wordList regions_;
|
||||||
//- From individual regions to collection regions
|
//- From individual regions to collection regions
|
||||||
|
|||||||
Reference in New Issue
Block a user