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:
parent
5c73c0a028
commit
ca834a93c8
@ -74,13 +74,16 @@ void writeProcStats
|
||||
|
||||
forAll(surfBb, procI)
|
||||
{
|
||||
const List<treeBoundBox>& bbs = meshBb[procI];
|
||||
Info<< "processor" << procI << nl;
|
||||
|
||||
Info<< "processor" << procI << nl
|
||||
<< "\tMesh bounds : " << bbs[0] << nl;
|
||||
for (label i = 1; i < bbs.size(); i++)
|
||||
const List<treeBoundBox>& bbs = meshBb[procI];
|
||||
if (bbs.size())
|
||||
{
|
||||
Info<< "\t " << bbs[i]<< nl;
|
||||
Info<< "\tMesh bounds : " << bbs[0] << nl;
|
||||
for (label i = 1; i < bbs.size(); i++)
|
||||
{
|
||||
Info<< "\t " << bbs[i]<< nl;
|
||||
}
|
||||
}
|
||||
Info<< "\tSurface bounding box : " << surfBb[procI] << nl
|
||||
<< "\tTriangles : " << nFaces[procI] << nl
|
||||
@ -112,12 +115,13 @@ int main(int argc, char *argv[])
|
||||
runTime.functionObjects().off();
|
||||
|
||||
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
|
||||
<< "Using distribution method "
|
||||
<< distributedTriSurfaceMesh::distributionTypeNames_[distType]
|
||||
<< " " << distType << nl << endl;
|
||||
<< distTypeName << nl << endl;
|
||||
|
||||
const bool keepNonMapped = args.options().found("keepNonMapped");
|
||||
|
||||
@ -141,13 +145,14 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
#include "createPolyMesh.H"
|
||||
|
||||
Random rndGen(653213);
|
||||
|
||||
// Determine mesh bounding boxes:
|
||||
List<List<treeBoundBox> > meshBb(Pstream::nProcs());
|
||||
if (distType == distributedTriSurfaceMesh::FOLLOW)
|
||||
{
|
||||
#include "createPolyMesh.H"
|
||||
|
||||
meshBb[Pstream::myProcNo()] = List<treeBoundBox>
|
||||
(
|
||||
1,
|
||||
@ -192,83 +197,48 @@ int main(int argc, char *argv[])
|
||||
fileName localPath(actualPath);
|
||||
localPath.replace(runTime.rootPath() + '/', "");
|
||||
|
||||
|
||||
autoPtr<distributedTriSurfaceMesh> surfMeshPtr;
|
||||
|
||||
if (actualPath == io.objectPath())
|
||||
{
|
||||
Info<< "Loading local (decomposed) surface " << localPath << nl <<endl;
|
||||
surfMeshPtr.reset(new distributedTriSurfaceMesh(io));
|
||||
}
|
||||
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;
|
||||
dict.add("bounds", meshBb[Pstream::myProcNo()]);
|
||||
dict.add("distributionType", distType);
|
||||
dict.add("distributionType", distTypeName);
|
||||
dict.add("mergeDistance", SMALL);
|
||||
dict.add("bounds", bbs);
|
||||
|
||||
IOdictionary ioDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
io.name() + "Dict",
|
||||
io.instance(),
|
||||
io.local(),
|
||||
io.db(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
dict
|
||||
);
|
||||
// Scatter patch information
|
||||
Pstream::scatter(s.patches());
|
||||
|
||||
Info<< "Writing dummy bounds dictionary to " << ioDict.name()
|
||||
<< nl << endl;
|
||||
|
||||
// Force writing in ascii
|
||||
ioDict.regIOobject::writeObject
|
||||
(
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
ioDict.time().writeCompression()
|
||||
);
|
||||
// Construct distributedTrisurfaceMesh from components
|
||||
IOobject notReadIO(io);
|
||||
notReadIO.readOpt() = IOobject::NO_READ;
|
||||
surfMeshPtr.reset(new distributedTriSurfaceMesh(notReadIO, s, dict));
|
||||
}
|
||||
|
||||
|
||||
// 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();
|
||||
}
|
||||
distributedTriSurfaceMesh& surfMesh = surfMeshPtr();
|
||||
|
||||
|
||||
// Write per-processor stats
|
||||
|
@ -243,7 +243,7 @@ Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const triSurface& s)
|
||||
{
|
||||
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();
|
||||
|
||||
bounds() = boundBox(pts);
|
||||
bounds() = boundBox(pts, false);
|
||||
}
|
||||
|
||||
|
||||
@ -355,7 +355,7 @@ Foam::triSurfaceMesh::triSurfaceMesh
|
||||
|
||||
const pointField& pts = triSurface::points();
|
||||
|
||||
bounds() = boundBox(pts);
|
||||
bounds() = boundBox(pts, false);
|
||||
|
||||
// Have optional minimum quality for normal calculation
|
||||
if (dict.readIfPresent("minQuality", minQuality_) && minQuality_ > 0)
|
||||
@ -463,7 +463,7 @@ void Foam::triSurfaceMesh::movePoints(const pointField& newPoints)
|
||||
edgeTree_.clear();
|
||||
triSurface::movePoints(newPoints);
|
||||
|
||||
bounds() = boundBox(triSurface::points());
|
||||
bounds() = boundBox(triSurface::points(), false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2376,10 +2376,8 @@ void Foam::distributedTriSurfaceMesh::distribute
|
||||
clearOut();
|
||||
|
||||
// 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
|
||||
// Volume type stays same.
|
||||
|
Loading…
Reference in New Issue
Block a user