WIP: Remove previous parallel decomp methods. Does not compile.

This commit is contained in:
graham
2011-05-18 15:29:21 +01:00
parent 5319c0696c
commit 1a56107dd8
6 changed files with 78 additions and 311 deletions

View File

@ -27,6 +27,7 @@ License
#include "initialPointsMethod.H"
#include "relaxationModel.H"
#include "faceAreaWeightModel.H"
#include "backgroundMeshDecomposition.H"
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
@ -1250,8 +1251,21 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
cvMeshDict.subDict("motionControl"),
*this
)
)
),
decomposition_()
{
if (Pstream::parRun())
{
decomposition_.reset
(
new backgroundMeshDecomposition
(
cvMeshDict.subDict("backgroundMeshDecomposition"),
*this
)
);
}
createFeaturePoints();
if (cvMeshControls().objOutput())

View File

@ -80,6 +80,8 @@ class relaxationModel;
class faceAreaWeightModel;
class backgroundMeshDecomposition;
/*---------------------------------------------------------------------------*\
Class conformalVoronoiMesh Declaration
@ -174,6 +176,9 @@ private:
//- Face area weight function. Runtime selectable.
autoPtr<faceAreaWeightModel> faceAreaWeightModel_;
//- Background mesh decomposition, only available in parallel.
autoPtr<backgroundMeshDecomposition> decomposition_;
// Private Member Functions

View File

@ -556,80 +556,80 @@ void Foam::conformalVoronoiMesh::buildParallelInterface
return;
}
{
// Update the processorMeshBounds
// {
// // Update the processorMeshBounds
DynamicList<Foam::point> parallelAllPoints;
DynamicList<label> targetProcessor;
DynamicList<label> parallelAllIndices;
// DynamicList<Foam::point> parallelAllPoints;
// DynamicList<label> targetProcessor;
// DynamicList<label> parallelAllIndices;
Foam::point minPt = geometryToConformTo_.bounds().min();
Foam::point maxPt = geometryToConformTo_.bounds().max();
// Foam::point minPt = geometryToConformTo_.bounds().min();
// Foam::point maxPt = geometryToConformTo_.bounds().max();
for
(
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
vit != finite_vertices_end();
vit++
)
{
if (vit->real())
{
Foam::point v = topoint(vit->point());
// for
// (
// Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
// vit != finite_vertices_end();
// vit++
// )
// {
// if (vit->real())
// {
// Foam::point v = topoint(vit->point());
minPt = Foam::min(minPt, v);
maxPt = Foam::max(maxPt, v);
}
}
// minPt = Foam::min(minPt, v);
// maxPt = Foam::max(maxPt, v);
// }
// }
treeBoundBox& procMeshBb =
geometryToConformTo_.processorMeshBounds()[Pstream::myProcNo()];
// treeBoundBox& procMeshBb =
// geometryToConformTo_.processorMeshBounds()[Pstream::myProcNo()];
if (cvMeshControls().objOutput())
{
Pout<< "Before processorMeshBounds update" << procMeshBb << endl;
}
// if (cvMeshControls().objOutput())
// {
// Pout<< "Before processorMeshBounds update" << procMeshBb << endl;
// }
procMeshBb = treeBoundBox(minPt, maxPt);
// procMeshBb = treeBoundBox(minPt, maxPt);
if (cvMeshControls().objOutput())
{
Pout<< "After processorMeshBounds update" << procMeshBb << endl;
// if (cvMeshControls().objOutput())
// {
// Pout<< "After processorMeshBounds update" << procMeshBb << endl;
OFstream str
(
runTime_.path()
/"processorMeshBoundsUpdated_"
+ name(Pstream::myProcNo())
+ "_bounds.obj"
);
// OFstream str
// (
// runTime_.path()
// /"processorMeshBoundsUpdated_"
// + name(Pstream::myProcNo())
// + "_bounds.obj"
// );
Pout<< "Writing " << str.name() << endl;
// Pout<< "Writing " << str.name() << endl;
pointField bbPoints(procMeshBb.points());
// pointField bbPoints(procMeshBb.points());
forAll(bbPoints, i)
{
meshTools::writeOBJ(str, bbPoints[i]);
}
// forAll(bbPoints, i)
// {
// meshTools::writeOBJ(str, bbPoints[i]);
// }
forAll(treeBoundBox::faces, i)
{
const face& f = treeBoundBox::faces[i];
// forAll(treeBoundBox::faces, i)
// {
// const face& f = treeBoundBox::faces[i];
str << "f"
<< ' ' << f[0] + 1
<< ' ' << f[1] + 1
<< ' ' << f[2] + 1
<< ' ' << f[3] + 1
<< nl;
}
}
// str << "f"
// << ' ' << f[0] + 1
// << ' ' << f[1] + 1
// << ' ' << f[2] + 1
// << ' ' << f[3] + 1
// << nl;
// }
// }
Pstream::gatherList(geometryToConformTo_.processorMeshBounds());
// Pstream::gatherList(geometryToConformTo_.processorMeshBounds());
Pstream::scatterList(geometryToConformTo_.processorMeshBounds());
}
// Pstream::scatterList(geometryToConformTo_.processorMeshBounds());
// }
boolList sendToProc(Pstream::nProcs(), false);
@ -1217,7 +1217,6 @@ void Foam::conformalVoronoiMesh::parallelInterfaceInfluence
if (procBb.overlaps(circumcentre, circumradiusSqr))
{
toProc[procI] = true;
}
}
}

View File

@ -44,12 +44,7 @@ Foam::conformationSurfaces::conformationSurfaces
baffleSurfaces_(),
patchNames_(0),
patchOffsets_(),
bounds_(),
globalBounds_(),
spanMag_(),
spanMagSqr_(),
processorDomains_(),
processorMeshBounds_(),
referenceVolumeTypes_(0)
{
const dictionary& surfacesDict
@ -226,116 +221,6 @@ Foam::conformationSurfaces::conformationSurfaces
// to be conformed to
globalBounds_ = globalBounds_.extend(cvMesh_.rndGen(), 1e-4);
if (Pstream::parRun())
{
processorDomains_.setSize(Pstream::nProcs());
processorMeshBounds_.setSize(Pstream::nProcs());
if (Pstream::nProcs() == 2)
{
processorDomains_[Pstream::myProcNo()] = treeBoundBoxList(4);
forAll(processorDomains_[Pstream::myProcNo()], pDI)
{
processorDomains_[Pstream::myProcNo()][pDI] =
globalBounds_.subBbox
(
direction(Pstream::myProcNo()*4 + pDI)
);
}
DynamicList<Foam::point> allBbPoints;
forAll(processorDomains_[Pstream::myProcNo()], pDI)
{
allBbPoints.append
(
processorDomains_[Pstream::myProcNo()][pDI].points()
);
}
bounds_ = treeBoundBox(allBbPoints);
}
else if (Pstream::nProcs() == 8)
{
bounds_ = globalBounds_.subBbox(direction(Pstream::myProcNo()));
processorDomains_[Pstream::myProcNo()] =
treeBoundBoxList(1, bounds_);
}
else
{
FatalErrorIn
(
"Foam::conformationSurfaces::conformationSurfaces"
"("
"const conformalVoronoiMesh& cvMesh, "
"const searchableSurfaces& allGeometry, "
"const dictionary& surfaceConformationDict"
")"
)
<< "Hard coded to " << "2 or 8" << " procs"
<< exit(FatalError);
}
processorMeshBounds_[Pstream::myProcNo()] = bounds_;
Pstream::gatherList(processorDomains_);
Pstream::scatterList(processorDomains_);
Pstream::gatherList(processorMeshBounds_);
Pstream::scatterList(processorMeshBounds_);
}
else
{
bounds_ = globalBounds_;
processorDomains_.setSize(0);
}
if (Pstream::parRun() && cvMesh_.cvMeshControls().objOutput())
{
Info<< "global bounds " << globalBounds_ << endl;
Pout<< "processor bounds " << bounds_ << endl;
OFstream str
(
cvMesh_.time().path()
/"proc_" + name(Pstream::myProcNo()) + "_bounds.obj"
);
Pout<< "Writing " << str.name() << endl;
pointField bbPoints(bounds_.points());
forAll(bbPoints, i)
{
meshTools::writeOBJ(str, bbPoints[i]);
}
forAll(treeBoundBox::faces, i)
{
const face& f = treeBoundBox::faces[i];
str << "f"
<< ' ' << f[0] + 1
<< ' ' << f[1] + 1
<< ' ' << f[2] + 1
<< ' ' << f[3] + 1
<< nl;
}
Info<< "processor domains " << processorDomains_ << endl;
}
spanMag_ = bounds_.mag();
spanMagSqr_ = sqr(spanMag_);
// Look at all surfaces at determine whether the locationInMesh point is
// inside or outside each, to establish a signature for the domain to be
// meshed.
@ -390,62 +275,6 @@ bool Foam::conformationSurfaces::overlaps(const treeBoundBox& bb) const
}
bool Foam::conformationSurfaces::positionOnThisProc(const point& pt) const
{
// This is likely to give problems when a point is on the boundary between
// two processors.
if (Pstream::parRun())
{
const treeBoundBoxList& procBbs =
processorDomains_[Pstream::myProcNo()];
forAll(procBbs, pBI)
{
const treeBoundBox& procBb = procBbs[pBI];
if (procBb.contains(pt))
{
return true;
}
}
}
else
{
return bounds_.contains(pt);
}
return false;
}
Foam::label Foam::conformationSurfaces::positionProc(const point& pt) const
{
// This is likely to give problems when a point is on the boundary between
// two processors.
if (Pstream::parRun())
{
forAll(processorDomains_, procI)
{
const treeBoundBoxList& procBbs = processorDomains_[procI];
forAll(procBbs, pBI)
{
const treeBoundBox& procBb = procBbs[pBI];
if (procBb.contains(pt))
{
return procI;
}
}
}
}
return -1;
}
Foam::Field<bool> Foam::conformationSurfaces::inside
(
const pointField& samplePts

View File

@ -48,7 +48,6 @@ namespace Foam
// Forward declaration of classes
class conformalVoronoiMesh;
/*---------------------------------------------------------------------------*\
Class conformationSurfaces Declaration
\*---------------------------------------------------------------------------*/
@ -90,26 +89,9 @@ class conformationSurfaces
// the entry in the overall patch list
labelList patchOffsets_;
//- The boundBox of volume to be conformed to on this processor
treeBoundBox bounds_;
//- The overall boundBox of all of the surfaces to be conformed to
treeBoundBox globalBounds_;
//- Magnitude of the span of the domain
scalar spanMag_;
//- Square of span_
scalar spanMagSqr_;
//- All of the treeBoundBoxes representing volumes held by all
// processors. A non-overlapping set of volumes.
List<treeBoundBoxList> processorDomains_;
//- The bounds of the mesh on each processor - can overlap as the mesh
// is generated, used to determine which vertices to refer.
treeBoundBoxList processorMeshBounds_;
//- The pattern/signature of volumeTypes representing a point in the
// domain to be meshed
List<searchableSurface::volumeType> referenceVolumeTypes_;
@ -158,27 +140,9 @@ public:
//- Return the patch names
inline const List<word>& patchNames() const;
//- Return the bounds
inline const treeBoundBox& bounds() const;
//- Return the global bounds
inline const treeBoundBox& globalBounds() const;
//- Return the spanMag
inline scalar spanMag() const;
//- Return spanSqr
inline scalar spanMagSqr() const;
//- Return the processorDomains
inline const List<treeBoundBoxList>& processorDomains() const;
//- Return the processorMeshBounds
inline const treeBoundBoxList& processorMeshBounds() const;
//- Return non-const access to the processorMeshBounds
inline treeBoundBoxList& processorMeshBounds();
// Query
@ -186,12 +150,6 @@ public:
// the surfaces
bool overlaps(const treeBoundBox& bb) const;
//- Check if the point is in the domain handled by this processor
bool positionOnThisProc(const point& pt) const;
//- Which processor's domain handles this point
label positionProc(const point& pt) const;
//- Check if points are inside surfaces to conform to
Field<bool> inside(const pointField& samplePts) const;

View File

@ -50,48 +50,10 @@ const Foam::List<Foam::word>& Foam::conformationSurfaces::patchNames() const
}
const Foam::treeBoundBox& Foam::conformationSurfaces::bounds() const
{
return bounds_;
}
const Foam::treeBoundBox& Foam::conformationSurfaces::globalBounds() const
{
return globalBounds_;
}
inline Foam::scalar Foam::conformationSurfaces::spanMag() const
{
return spanMag_;
}
inline Foam::scalar Foam::conformationSurfaces::spanMagSqr() const
{
return spanMagSqr_;
}
inline const Foam::List<Foam::treeBoundBoxList>&
Foam::conformationSurfaces::processorDomains() const
{
return processorDomains_;
}
inline const Foam::treeBoundBoxList&
Foam::conformationSurfaces::processorMeshBounds() const
{
return processorMeshBounds_;
}
inline Foam::treeBoundBoxList& Foam::conformationSurfaces::processorMeshBounds()
{
return processorMeshBounds_;
}
// ************************************************************************* //