mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
surface patch handling improvements
This commit is contained in:
@ -158,45 +158,33 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
label trianglei = 0;
|
||||
label maxRegion1 = labelMin;
|
||||
|
||||
// Copy triangles1 into trianglesAll
|
||||
// Determine max region.
|
||||
|
||||
forAll(surface1, faceI)
|
||||
{
|
||||
facesAll[trianglei] = surface1[faceI];
|
||||
|
||||
maxRegion1 = max(maxRegion1, facesAll[trianglei].region());
|
||||
|
||||
trianglei++;
|
||||
facesAll[trianglei++] = surface1[faceI];
|
||||
}
|
||||
label nRegions1 = surface1.patches().size();
|
||||
|
||||
label nRegions1 = maxRegion1 + 1;
|
||||
|
||||
if (!mergeRegions)
|
||||
{
|
||||
Info<< "Surface " << inFileName1 << " has " << nRegions1 << " regions"
|
||||
Info<< "Surface " << inFileName1 << " has " << nRegions1
|
||||
<< " regions"
|
||||
<< nl
|
||||
<< "All region numbers in " << inFileName2 << " will be offset"
|
||||
<< " by this amount" << nl << endl;
|
||||
}
|
||||
|
||||
// Add (renumbered) surface2 triangles
|
||||
label maxRegion2 = labelMin;
|
||||
|
||||
forAll(surface2, faceI)
|
||||
{
|
||||
const labelledTri& tri = surface2[faceI];
|
||||
|
||||
labelledTri& destTri = facesAll[trianglei++];
|
||||
|
||||
destTri[0] = tri[0] + points1.size();
|
||||
destTri[1] = tri[1] + points1.size();
|
||||
destTri[2] = tri[2] + points1.size();
|
||||
|
||||
maxRegion2 = max(maxRegion2, tri.region());
|
||||
|
||||
if (mergeRegions)
|
||||
{
|
||||
destTri.region() = tri.region();
|
||||
@ -207,7 +195,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
label nRegions2 = maxRegion2 + 1;
|
||||
label nRegions2 = surface2.patches().size();
|
||||
|
||||
geometricSurfacePatchList newPatches;
|
||||
|
||||
@ -218,11 +206,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
forAll(surface1.patches(), patchI)
|
||||
{
|
||||
newPatches[patchI] = surface1.patches()[ patchI];
|
||||
newPatches[patchI] = surface1.patches()[patchI];
|
||||
}
|
||||
forAll(surface2.patches(), patchI)
|
||||
{
|
||||
newPatches[patchI] = surface2.patches()[ patchI];
|
||||
newPatches[patchI] = surface2.patches()[patchI];
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -244,12 +232,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
forAll(surface1.patches(), patchI)
|
||||
{
|
||||
newPatches[newPatchI++] = surface1.patches()[ patchI];
|
||||
newPatches[newPatchI++] = surface1.patches()[patchI];
|
||||
}
|
||||
|
||||
forAll(surface2.patches(), patchI)
|
||||
{
|
||||
newPatches[newPatchI++] = surface2.patches()[ patchI];
|
||||
newPatches[newPatchI++] = surface2.patches()[patchI];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -128,6 +128,12 @@ public:
|
||||
return index_;
|
||||
}
|
||||
|
||||
//- Return the index of this patch in the boundaryMesh
|
||||
label& index()
|
||||
{
|
||||
return index_;
|
||||
}
|
||||
|
||||
//- Write
|
||||
void write(Ostream&) const;
|
||||
|
||||
|
||||
@ -544,6 +544,8 @@ Foam::surfacePatchList Foam::triSurface::calcPatches(labelList& faceMap) const
|
||||
{
|
||||
surfacePatch& newPatch = newPatches[newPatchI];
|
||||
|
||||
newPatch.index() = newPatchI;
|
||||
|
||||
label oldPatchI = newPatchI;
|
||||
|
||||
// start of patch
|
||||
@ -592,6 +594,7 @@ void Foam::triSurface::setDefaultPatches()
|
||||
|
||||
forAll(newPatches, patchI)
|
||||
{
|
||||
patches_[patchI].index() = patchI;
|
||||
patches_[patchI].name() = newPatches[patchI].name();
|
||||
patches_[patchI].geometricType() = newPatches[patchI].geometricType();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user