mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: triSurfaceMesh: operate non-parallel so not do a reduction of points
Also redistributePar: - recognise going from undecomposed to many - read on master only
This commit is contained in:
@ -74,14 +74,17 @@ void writeProcStats
|
|||||||
|
|
||||||
forAll(surfBb, procI)
|
forAll(surfBb, procI)
|
||||||
{
|
{
|
||||||
const List<treeBoundBox>& bbs = meshBb[procI];
|
Info<< "processor" << procI << nl;
|
||||||
|
|
||||||
Info<< "processor" << procI << nl
|
const List<treeBoundBox>& bbs = meshBb[procI];
|
||||||
<< "\tMesh bounds : " << bbs[0] << nl;
|
if (bbs.size())
|
||||||
|
{
|
||||||
|
Info<< "\tMesh bounds : " << bbs[0] << nl;
|
||||||
for (label i = 1; i < bbs.size(); i++)
|
for (label i = 1; i < bbs.size(); i++)
|
||||||
{
|
{
|
||||||
Info<< "\t " << bbs[i]<< nl;
|
Info<< "\t " << bbs[i]<< nl;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Info<< "\tSurface bounding box : " << surfBb[procI] << nl
|
Info<< "\tSurface bounding box : " << surfBb[procI] << nl
|
||||||
<< "\tTriangles : " << nFaces[procI] << nl
|
<< "\tTriangles : " << nFaces[procI] << nl
|
||||||
<< "\tVertices : " << nPoints[procI]
|
<< "\tVertices : " << nPoints[procI]
|
||||||
@ -112,12 +115,13 @@ int main(int argc, char *argv[])
|
|||||||
runTime.functionObjects().off();
|
runTime.functionObjects().off();
|
||||||
|
|
||||||
const fileName surfFileName = args[1];
|
const fileName surfFileName = args[1];
|
||||||
const word distType = args[2];
|
const word distTypeName = args[2];
|
||||||
|
const label distType =
|
||||||
|
distributedTriSurfaceMesh::distributionTypeNames_[distTypeName];
|
||||||
|
|
||||||
Info<< "Reading surface from " << surfFileName << nl << nl
|
Info<< "Reading surface from " << surfFileName << nl << nl
|
||||||
<< "Using distribution method "
|
<< "Using distribution method "
|
||||||
<< distributedTriSurfaceMesh::distributionTypeNames_[distType]
|
<< distTypeName << nl << endl;
|
||||||
<< " " << distType << nl << endl;
|
|
||||||
|
|
||||||
const bool keepNonMapped = args.options().found("keepNonMapped");
|
const bool keepNonMapped = args.options().found("keepNonMapped");
|
||||||
|
|
||||||
@ -141,13 +145,14 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "createPolyMesh.H"
|
|
||||||
|
|
||||||
Random rndGen(653213);
|
Random rndGen(653213);
|
||||||
|
|
||||||
// Determine mesh bounding boxes:
|
// Determine mesh bounding boxes:
|
||||||
List<List<treeBoundBox> > meshBb(Pstream::nProcs());
|
List<List<treeBoundBox> > meshBb(Pstream::nProcs());
|
||||||
|
if (distType == distributedTriSurfaceMesh::FOLLOW)
|
||||||
{
|
{
|
||||||
|
#include "createPolyMesh.H"
|
||||||
|
|
||||||
meshBb[Pstream::myProcNo()] = List<treeBoundBox>
|
meshBb[Pstream::myProcNo()] = List<treeBoundBox>
|
||||||
(
|
(
|
||||||
1,
|
1,
|
||||||
@ -192,83 +197,48 @@ int main(int argc, char *argv[])
|
|||||||
fileName localPath(actualPath);
|
fileName localPath(actualPath);
|
||||||
localPath.replace(runTime.rootPath() + '/', "");
|
localPath.replace(runTime.rootPath() + '/', "");
|
||||||
|
|
||||||
|
|
||||||
|
autoPtr<distributedTriSurfaceMesh> surfMeshPtr;
|
||||||
|
|
||||||
if (actualPath == io.objectPath())
|
if (actualPath == io.objectPath())
|
||||||
{
|
{
|
||||||
Info<< "Loading local (decomposed) surface " << localPath << nl <<endl;
|
Info<< "Loading local (decomposed) surface " << localPath << nl <<endl;
|
||||||
|
surfMeshPtr.reset(new distributedTriSurfaceMesh(io));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info<< "Loading undecomposed surface " << localPath << nl << endl;
|
Info<< "Loading undecomposed surface " << localPath
|
||||||
|
<< " on master only" << endl;
|
||||||
|
|
||||||
|
triSurface s;
|
||||||
|
List<treeBoundBox> bbs;
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
// Actually load the surface
|
||||||
|
triSurfaceMesh surf(io);
|
||||||
|
s = surf;
|
||||||
|
bbs = List<treeBoundBox>(1, treeBoundBox(boundBox::greatBox));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bbs = List<treeBoundBox>(1, treeBoundBox(boundBox::invertedBox));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Create dummy dictionary for bounding boxes if does not exist.
|
|
||||||
if (!isFile(actualPath / "Dict"))
|
|
||||||
{
|
|
||||||
dictionary dict;
|
dictionary dict;
|
||||||
dict.add("bounds", meshBb[Pstream::myProcNo()]);
|
dict.add("distributionType", distTypeName);
|
||||||
dict.add("distributionType", distType);
|
|
||||||
dict.add("mergeDistance", SMALL);
|
dict.add("mergeDistance", SMALL);
|
||||||
|
dict.add("bounds", bbs);
|
||||||
|
|
||||||
IOdictionary ioDict
|
// Scatter patch information
|
||||||
(
|
Pstream::scatter(s.patches());
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
io.name() + "Dict",
|
|
||||||
io.instance(),
|
|
||||||
io.local(),
|
|
||||||
io.db(),
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
dict
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< "Writing dummy bounds dictionary to " << ioDict.name()
|
// Construct distributedTrisurfaceMesh from components
|
||||||
<< nl << endl;
|
IOobject notReadIO(io);
|
||||||
|
notReadIO.readOpt() = IOobject::NO_READ;
|
||||||
// Force writing in ascii
|
surfMeshPtr.reset(new distributedTriSurfaceMesh(notReadIO, s, dict));
|
||||||
ioDict.regIOobject::writeObject
|
|
||||||
(
|
|
||||||
IOstream::ASCII,
|
|
||||||
IOstream::currentVersion,
|
|
||||||
ioDict.time().writeCompression()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
distributedTriSurfaceMesh& surfMesh = surfMeshPtr();
|
||||||
// Load surface
|
|
||||||
distributedTriSurfaceMesh surfMesh(io);
|
|
||||||
Info<< "Loaded surface" << nl << endl;
|
|
||||||
|
|
||||||
|
|
||||||
// Generate a test field
|
|
||||||
{
|
|
||||||
const triSurface& s = static_cast<const triSurface&>(surfMesh);
|
|
||||||
|
|
||||||
autoPtr<triSurfaceVectorField> fcPtr
|
|
||||||
(
|
|
||||||
new triSurfaceVectorField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"faceCentres", // name
|
|
||||||
surfMesh.searchableSurface::time().timeName(), // instance
|
|
||||||
surfMesh.searchableSurface::local(), // local
|
|
||||||
surfMesh,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
surfMesh,
|
|
||||||
dimLength,
|
|
||||||
s.faceCentres()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Steal pointer and store object on surfMesh
|
|
||||||
fcPtr.ptr()->store();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Write per-processor stats
|
// Write per-processor stats
|
||||||
|
|||||||
@ -243,7 +243,7 @@ Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const triSurface& s)
|
|||||||
{
|
{
|
||||||
const pointField& pts = triSurface::points();
|
const pointField& pts = triSurface::points();
|
||||||
|
|
||||||
bounds() = boundBox(pts);
|
bounds() = boundBox(pts, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io)
|
|||||||
{
|
{
|
||||||
const pointField& pts = triSurface::points();
|
const pointField& pts = triSurface::points();
|
||||||
|
|
||||||
bounds() = boundBox(pts);
|
bounds() = boundBox(pts, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -355,7 +355,7 @@ Foam::triSurfaceMesh::triSurfaceMesh
|
|||||||
|
|
||||||
const pointField& pts = triSurface::points();
|
const pointField& pts = triSurface::points();
|
||||||
|
|
||||||
bounds() = boundBox(pts);
|
bounds() = boundBox(pts, false);
|
||||||
|
|
||||||
// Have optional minimum quality for normal calculation
|
// Have optional minimum quality for normal calculation
|
||||||
if (dict.readIfPresent("minQuality", minQuality_) && minQuality_ > 0)
|
if (dict.readIfPresent("minQuality", minQuality_) && minQuality_ > 0)
|
||||||
@ -463,7 +463,7 @@ void Foam::triSurfaceMesh::movePoints(const pointField& newPoints)
|
|||||||
edgeTree_.clear();
|
edgeTree_.clear();
|
||||||
triSurface::movePoints(newPoints);
|
triSurface::movePoints(newPoints);
|
||||||
|
|
||||||
bounds() = boundBox(triSurface::points());
|
bounds() = boundBox(triSurface::points(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2376,10 +2376,8 @@ void Foam::distributedTriSurfaceMesh::distribute
|
|||||||
clearOut();
|
clearOut();
|
||||||
|
|
||||||
// Set the bounds() value to the boundBox of the undecomposed surface
|
// Set the bounds() value to the boundBox of the undecomposed surface
|
||||||
triSurfaceMesh::bounds() = boundBox(points());
|
bounds() = boundBox(points(), true);
|
||||||
|
|
||||||
reduce(bounds().min(), minOp<point>());
|
|
||||||
reduce(bounds().max(), maxOp<point>());
|
|
||||||
|
|
||||||
// Regions stays same
|
// Regions stays same
|
||||||
// Volume type stays same.
|
// Volume type stays same.
|
||||||
|
|||||||
Reference in New Issue
Block a user