mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -95,24 +95,56 @@ int main(int argc, char *argv[])
|
||||
const bool collapseFaces = args.optionFound("collapseFaces");
|
||||
const bool collapseFaceZone = args.optionFound("collapseFaceZone");
|
||||
|
||||
if (collapseFaces && collapseFaceZone)
|
||||
{
|
||||
FatalErrorIn("main(int, char*[])")
|
||||
<< "Both face zone collapsing and face collapsing have been"
|
||||
<< "selected. Choose only one of:" << nl
|
||||
<< " -collapseFaces" << nl
|
||||
<< " -collapseFaceZone <faceZoneName>"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
labelIOList pointPriority
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pointPriority",
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
labelList(mesh.nPoints(), labelMin)
|
||||
);
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
polyMeshFilter meshFilter(mesh);
|
||||
autoPtr<polyMeshFilter> meshFilterPtr;
|
||||
|
||||
// newMesh will be empty until it is filtered
|
||||
const autoPtr<fvMesh>& newMesh = meshFilter.filteredMesh();
|
||||
label nBadFaces = 0;
|
||||
|
||||
// Filter small edges only. This reduces the number of faces so that
|
||||
// the face filtering is sped up.
|
||||
label nBadFaces = meshFilter.filterEdges(0);
|
||||
{
|
||||
polyTopoChange meshMod(newMesh);
|
||||
meshFilterPtr.set(new polyMeshFilter(mesh, pointPriority));
|
||||
polyMeshFilter& meshFilter = meshFilterPtr();
|
||||
|
||||
meshMod.changeMesh(mesh, false);
|
||||
// newMesh will be empty until it is filtered
|
||||
const autoPtr<fvMesh>& newMesh = meshFilter.filteredMesh();
|
||||
|
||||
// Filter small edges only. This reduces the number of faces so that
|
||||
// the face filtering is sped up.
|
||||
nBadFaces = meshFilter.filterEdges(0);
|
||||
{
|
||||
polyTopoChange meshMod(newMesh);
|
||||
|
||||
meshMod.changeMesh(mesh, false);
|
||||
}
|
||||
|
||||
pointPriority = meshFilter.pointPriority();
|
||||
}
|
||||
|
||||
if (collapseFaceZone)
|
||||
@ -121,18 +153,30 @@ int main(int argc, char *argv[])
|
||||
|
||||
const faceZone& fZone = mesh.faceZones()[faceZoneName];
|
||||
|
||||
meshFilterPtr.reset(new polyMeshFilter(mesh, pointPriority));
|
||||
polyMeshFilter& meshFilter = meshFilterPtr();
|
||||
|
||||
const autoPtr<fvMesh>& newMesh = meshFilter.filteredMesh();
|
||||
|
||||
// Filter faces. Pass in the number of bad faces that are present
|
||||
// from the previous edge filtering to use as a stopping criterion.
|
||||
meshFilter.filterFaceZone(fZone);
|
||||
meshFilter.filter(fZone);
|
||||
{
|
||||
polyTopoChange meshMod(newMesh);
|
||||
|
||||
meshMod.changeMesh(mesh, false);
|
||||
}
|
||||
|
||||
pointPriority = meshFilter.pointPriority();
|
||||
}
|
||||
|
||||
if (collapseFaces)
|
||||
{
|
||||
meshFilterPtr.reset(new polyMeshFilter(mesh, pointPriority));
|
||||
polyMeshFilter& meshFilter = meshFilterPtr();
|
||||
|
||||
const autoPtr<fvMesh>& newMesh = meshFilter.filteredMesh();
|
||||
|
||||
// Filter faces. Pass in the number of bad faces that are present
|
||||
// from the previous edge filtering to use as a stopping criterion.
|
||||
meshFilter.filter(nBadFaces);
|
||||
@ -141,6 +185,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
meshMod.changeMesh(mesh, false);
|
||||
}
|
||||
|
||||
pointPriority = meshFilter.pointPriority();
|
||||
}
|
||||
|
||||
// Write resulting mesh
|
||||
@ -157,6 +203,7 @@ int main(int argc, char *argv[])
|
||||
<< runTime.timeName() << nl << endl;
|
||||
|
||||
mesh.write();
|
||||
pointPriority.write();
|
||||
}
|
||||
|
||||
Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
|
||||
@ -966,6 +966,15 @@ Foam::DistributedDelaunayMesh<Triangulation>::rangeInsertReferredWithInfo
|
||||
) << "Point is outside affine hull! pt = " << pointToInsert
|
||||
<< endl;
|
||||
}
|
||||
else if (lt == Triangulation::OUTSIDE_CONVEX_HULL)
|
||||
{
|
||||
// @todo Can this be optimised?
|
||||
//
|
||||
// Only want to insert if a connection is formed between
|
||||
// pointToInsert and an internal or internal boundary point.
|
||||
hint = Triangulation::insert(pointToInsert, c);
|
||||
inserted = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the cells that conflict with p in a vector V,
|
||||
|
||||
@ -41,9 +41,26 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(conformalVoronoiMesh, 0);
|
||||
defineTypeNameAndDebug(conformalVoronoiMesh, 0);
|
||||
|
||||
template<>
|
||||
const char* NamedEnum
|
||||
<
|
||||
conformalVoronoiMesh::dualMeshPointType,
|
||||
5
|
||||
>::names[] =
|
||||
{
|
||||
"internal",
|
||||
"surface",
|
||||
"featureEdge",
|
||||
"featurePoint",
|
||||
"constrained"
|
||||
};
|
||||
}
|
||||
|
||||
const Foam::NamedEnum<Foam::conformalVoronoiMesh::dualMeshPointType, 5>
|
||||
Foam::conformalVoronoiMesh::dualMeshPointTypeNames_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
@ -1600,7 +1617,6 @@ void Foam::conformalVoronoiMesh::move()
|
||||
printVertexInfo(Info);
|
||||
}
|
||||
|
||||
// Write the intermediate mesh, do not filter the dual faces.
|
||||
if (time().outputTime())
|
||||
{
|
||||
writeMesh(time().timeName());
|
||||
|
||||
@ -115,6 +115,19 @@ public:
|
||||
typedef List<pointIndexHitAndFeature> pointIndexHitAndFeatureList;
|
||||
typedef DynamicList<pointIndexHitAndFeature> pointIndexHitAndFeatureDynList;
|
||||
|
||||
// Static data
|
||||
|
||||
enum dualMeshPointType
|
||||
{
|
||||
internal = 0,
|
||||
surface = 1,
|
||||
featureEdge = 2,
|
||||
featurePoint = 3,
|
||||
constrained = 4
|
||||
};
|
||||
|
||||
static const NamedEnum<dualMeshPointType, 5> dualMeshPointTypeNames_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -682,14 +695,12 @@ private:
|
||||
//- Merge vertices that are identical
|
||||
void mergeIdenticalDualVertices
|
||||
(
|
||||
const pointField& pts,
|
||||
const labelList& boundaryPts
|
||||
const pointField& pts
|
||||
);
|
||||
|
||||
label mergeIdenticalDualVertices
|
||||
(
|
||||
const pointField& pts,
|
||||
const labelList& boundaryPts,
|
||||
Map<label>& dualPtIndexMap
|
||||
) const;
|
||||
|
||||
|
||||
@ -207,209 +207,216 @@ void Foam::conformalVoronoiMesh::checkCells()
|
||||
}
|
||||
|
||||
|
||||
void Foam::conformalVoronoiMesh::checkDuals()
|
||||
{
|
||||
List<List<Point> > pointFieldList(Pstream::nProcs());
|
||||
|
||||
List<Point> duals(number_of_finite_cells());
|
||||
|
||||
// PackedBoolList bPoints(number_of_finite_cells());
|
||||
|
||||
// indexDualVertices(duals, bPoints);
|
||||
|
||||
label count = 0;//duals.size();
|
||||
|
||||
duals.setSize(number_of_finite_cells());
|
||||
|
||||
globalIndex gIndex(number_of_vertices());
|
||||
|
||||
for
|
||||
(
|
||||
Delaunay::Finite_cells_iterator cit = finite_cells_begin();
|
||||
cit != finite_cells_end();
|
||||
++cit
|
||||
)
|
||||
{
|
||||
if (cit->hasFarPoint())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
duals[count++] = cit->circumcenter();
|
||||
|
||||
// List<labelPair> cellVerticesPair(4);
|
||||
// List<Point> cellVertices(4);
|
||||
//void Foam::conformalVoronoiMesh::checkDuals()
|
||||
//{
|
||||
// List<List<Point> > pointFieldList(Pstream::nProcs());
|
||||
//
|
||||
// for (label vI = 0; vI < 4; ++vI)
|
||||
// List<Point> duals(number_of_finite_cells());
|
||||
//
|
||||
// typedef CGAL::Exact_predicates_exact_constructions_kernel EK2;
|
||||
// typedef CGAL::Regular_triangulation_euclidean_traits_3<EK2> EK;
|
||||
// typedef CGAL::Cartesian_converter<baseK::Kernel, EK2> To_exact;
|
||||
// typedef CGAL::Cartesian_converter<EK2, baseK::Kernel> Back_from_exact;
|
||||
//
|
||||
//// PackedBoolList bPoints(number_of_finite_cells());
|
||||
//
|
||||
//// indexDualVertices(duals, bPoints);
|
||||
//
|
||||
// label count = 0;//duals.size();
|
||||
//
|
||||
// duals.setSize(number_of_finite_cells());
|
||||
//
|
||||
// globalIndex gIndex(number_of_vertices());
|
||||
//
|
||||
// for
|
||||
// (
|
||||
// Delaunay::Finite_cells_iterator cit = finite_cells_begin();
|
||||
// cit != finite_cells_end();
|
||||
// ++cit
|
||||
// )
|
||||
// {
|
||||
// if (cit->hasFarPoint())
|
||||
// {
|
||||
// cellVerticesPair[vI] = labelPair
|
||||
// (
|
||||
// cit->vertex(vI)->procIndex(),
|
||||
// cit->vertex(vI)->index()
|
||||
// );
|
||||
// cellVertices[vI] = cit->vertex(vI)->point();
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// labelList oldToNew;
|
||||
// sortedOrder(cellVerticesPair, oldToNew);
|
||||
// oldToNew = invert(oldToNew.size(), oldToNew);
|
||||
// inplaceReorder(oldToNew, cellVerticesPair);
|
||||
// inplaceReorder(oldToNew, cellVertices);
|
||||
// duals[count++] = cit->circumcenter();
|
||||
//
|
||||
// duals[count++] = CGAL::circumcenter
|
||||
// (
|
||||
// cellVertices[0],
|
||||
// cellVertices[1],
|
||||
// cellVertices[2],
|
||||
// cellVertices[3]
|
||||
// );
|
||||
|
||||
// To_exact to_exact;
|
||||
// Back_from_exact back_from_exact;
|
||||
// EK::Construct_circumcenter_3 exact_circumcenter =
|
||||
// EK().construct_circumcenter_3_object();
|
||||
//// List<labelPair> cellVerticesPair(4);
|
||||
//// List<Point> cellVertices(4);
|
||||
////
|
||||
//// for (label vI = 0; vI < 4; ++vI)
|
||||
//// {
|
||||
//// cellVerticesPair[vI] = labelPair
|
||||
//// (
|
||||
//// cit->vertex(vI)->procIndex(),
|
||||
//// cit->vertex(vI)->index()
|
||||
//// );
|
||||
//// cellVertices[vI] = cit->vertex(vI)->point();
|
||||
//// }
|
||||
////
|
||||
//// labelList oldToNew;
|
||||
//// sortedOrder(cellVerticesPair, oldToNew);
|
||||
//// oldToNew = invert(oldToNew.size(), oldToNew);
|
||||
//// inplaceReorder(oldToNew, cellVerticesPair);
|
||||
//// inplaceReorder(oldToNew, cellVertices);
|
||||
////
|
||||
//// duals[count++] = CGAL::circumcenter
|
||||
//// (
|
||||
//// cellVertices[0],
|
||||
//// cellVertices[1],
|
||||
//// cellVertices[2],
|
||||
//// cellVertices[3]
|
||||
//// );
|
||||
//
|
||||
// duals[count++] = topoint
|
||||
// (
|
||||
// back_from_exact
|
||||
// (
|
||||
// exact_circumcenter
|
||||
// (
|
||||
// to_exact(cit->vertex(0)->point()),
|
||||
// to_exact(cit->vertex(1)->point()),
|
||||
// to_exact(cit->vertex(2)->point()),
|
||||
// to_exact(cit->vertex(3)->point())
|
||||
// )
|
||||
// )
|
||||
// );
|
||||
}
|
||||
|
||||
Pout<< "Duals Calculated " << count << endl;
|
||||
|
||||
duals.setSize(count);
|
||||
|
||||
pointFieldList[Pstream::myProcNo()] = duals;
|
||||
|
||||
Pstream::gatherList(pointFieldList);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
Info<< "Checking on master processor the dual locations of each " << nl
|
||||
<< "processor point list against the master dual list." << nl
|
||||
<< "There are " << pointFieldList.size() << " processors" << nl
|
||||
<< "The size of each processor's dual list is:" << endl;
|
||||
|
||||
forAll(pointFieldList, pfI)
|
||||
{
|
||||
Info<< " Proc " << pfI << " has " << pointFieldList[pfI].size()
|
||||
<< " duals" << endl;
|
||||
}
|
||||
|
||||
label nNonMatches = 0;
|
||||
label nNearMatches = 0;
|
||||
label nExactMatches = 0;
|
||||
|
||||
forAll(pointFieldList[0], pI)
|
||||
{
|
||||
const Point& masterPoint = pointFieldList[0][pI];
|
||||
|
||||
bool foundMatch = false;
|
||||
bool foundNearMatch = false;
|
||||
|
||||
scalar minCloseness = GREAT;
|
||||
Point closestPoint(0, 0, 0);
|
||||
|
||||
forAll(pointFieldList, pfI)
|
||||
{
|
||||
if (pfI == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// label pfI = 1;
|
||||
|
||||
forAll(pointFieldList[pfI], pISlave)
|
||||
{
|
||||
const Point& slavePoint
|
||||
= pointFieldList[pfI][pISlave];
|
||||
|
||||
if (masterPoint == slavePoint)
|
||||
{
|
||||
foundMatch = true;
|
||||
break;
|
||||
}
|
||||
|
||||
const scalar closeness = mag
|
||||
(
|
||||
topoint(masterPoint) - topoint(slavePoint)
|
||||
);
|
||||
|
||||
if (closeness < 1e-12)
|
||||
{
|
||||
foundNearMatch = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (closeness < minCloseness)
|
||||
{
|
||||
minCloseness = closeness;
|
||||
closestPoint = slavePoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundMatch)
|
||||
{
|
||||
if (foundNearMatch)
|
||||
{
|
||||
CGAL::Gmpq x(CGAL::to_double(masterPoint.x()));
|
||||
CGAL::Gmpq y(CGAL::to_double(masterPoint.y()));
|
||||
CGAL::Gmpq z(CGAL::to_double(masterPoint.z()));
|
||||
|
||||
std::cout<< "master = " << x << " " << y << " " << z
|
||||
<< std::endl;
|
||||
|
||||
CGAL::Gmpq xs(CGAL::to_double(closestPoint.x()));
|
||||
CGAL::Gmpq ys(CGAL::to_double(closestPoint.y()));
|
||||
CGAL::Gmpq zs(CGAL::to_double(closestPoint.z()));
|
||||
std::cout<< "slave = " << xs << " " << ys << " " << zs
|
||||
<< std::endl;
|
||||
|
||||
nNearMatches++;
|
||||
}
|
||||
else
|
||||
{
|
||||
nNonMatches++;
|
||||
Info<< " Closest point to " << masterPoint << " is "
|
||||
<< closestPoint << nl
|
||||
<< " Separation is " << minCloseness << endl;
|
||||
|
||||
CGAL::Gmpq x(CGAL::to_double(masterPoint.x()));
|
||||
CGAL::Gmpq y(CGAL::to_double(masterPoint.y()));
|
||||
CGAL::Gmpq z(CGAL::to_double(masterPoint.z()));
|
||||
|
||||
std::cout<< "master = " << x << " " << y << " " << z
|
||||
<< std::endl;
|
||||
|
||||
CGAL::Gmpq xs(CGAL::to_double(closestPoint.x()));
|
||||
CGAL::Gmpq ys(CGAL::to_double(closestPoint.y()));
|
||||
CGAL::Gmpq zs(CGAL::to_double(closestPoint.z()));
|
||||
std::cout<< "slave = " << xs << " " << ys << " " << zs
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nExactMatches++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Found " << nNonMatches << " non-matching duals" << nl
|
||||
<< " and " << nNearMatches << " near matches"
|
||||
<< " and " << nExactMatches << " exact matches" << endl;
|
||||
}
|
||||
}
|
||||
//// To_exact to_exact;
|
||||
//// Back_from_exact back_from_exact;
|
||||
//// EK::Construct_circumcenter_3 exact_circumcenter =
|
||||
//// EK().construct_circumcenter_3_object();
|
||||
////
|
||||
//// duals[count++] = topoint
|
||||
//// (
|
||||
//// back_from_exact
|
||||
//// (
|
||||
//// exact_circumcenter
|
||||
//// (
|
||||
//// to_exact(cit->vertex(0)->point()),
|
||||
//// to_exact(cit->vertex(1)->point()),
|
||||
//// to_exact(cit->vertex(2)->point()),
|
||||
//// to_exact(cit->vertex(3)->point())
|
||||
//// )
|
||||
//// )
|
||||
//// );
|
||||
// }
|
||||
//
|
||||
// Pout<< "Duals Calculated " << count << endl;
|
||||
//
|
||||
// duals.setSize(count);
|
||||
//
|
||||
// pointFieldList[Pstream::myProcNo()] = duals;
|
||||
//
|
||||
// Pstream::gatherList(pointFieldList);
|
||||
//
|
||||
// if (Pstream::master())
|
||||
// {
|
||||
// Info<< "Checking on master processor the dual locations of each" << nl
|
||||
// << " processor point list against the master dual list." << nl
|
||||
// << "There are " << pointFieldList.size() << " processors" << nl
|
||||
// << "The size of each processor's dual list is:" << endl;
|
||||
//
|
||||
// forAll(pointFieldList, pfI)
|
||||
// {
|
||||
// Info<< " Proc " << pfI << " has " << pointFieldList[pfI].size()
|
||||
// << " duals" << endl;
|
||||
// }
|
||||
//
|
||||
// label nNonMatches = 0;
|
||||
// label nNearMatches = 0;
|
||||
// label nExactMatches = 0;
|
||||
//
|
||||
// forAll(pointFieldList[0], pI)
|
||||
// {
|
||||
// const Point& masterPoint = pointFieldList[0][pI];
|
||||
//
|
||||
// bool foundMatch = false;
|
||||
// bool foundNearMatch = false;
|
||||
//
|
||||
// scalar minCloseness = GREAT;
|
||||
// Point closestPoint(0, 0, 0);
|
||||
//
|
||||
// forAll(pointFieldList, pfI)
|
||||
// {
|
||||
// if (pfI == 0)
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
//// label pfI = 1;
|
||||
//
|
||||
// forAll(pointFieldList[pfI], pISlave)
|
||||
// {
|
||||
// const Point& slavePoint
|
||||
// = pointFieldList[pfI][pISlave];
|
||||
//
|
||||
// if (masterPoint == slavePoint)
|
||||
// {
|
||||
// foundMatch = true;
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// const scalar closeness = mag
|
||||
// (
|
||||
// topoint(masterPoint) - topoint(slavePoint)
|
||||
// );
|
||||
//
|
||||
// if (closeness < 1e-12)
|
||||
// {
|
||||
// foundNearMatch = true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (closeness < minCloseness)
|
||||
// {
|
||||
// minCloseness = closeness;
|
||||
// closestPoint = slavePoint;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (!foundMatch)
|
||||
// {
|
||||
// if (foundNearMatch)
|
||||
// {
|
||||
// CGAL::Gmpq x(CGAL::to_double(masterPoint.x()));
|
||||
// CGAL::Gmpq y(CGAL::to_double(masterPoint.y()));
|
||||
// CGAL::Gmpq z(CGAL::to_double(masterPoint.z()));
|
||||
//
|
||||
// std::cout<< "master = " << x << " " << y << " " << z
|
||||
// << std::endl;
|
||||
//
|
||||
// CGAL::Gmpq xs(CGAL::to_double(closestPoint.x()));
|
||||
// CGAL::Gmpq ys(CGAL::to_double(closestPoint.y()));
|
||||
// CGAL::Gmpq zs(CGAL::to_double(closestPoint.z()));
|
||||
// std::cout<< "slave = " << xs << " " << ys << " "
|
||||
// << zs
|
||||
// << std::endl;
|
||||
//
|
||||
// nNearMatches++;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// nNonMatches++;
|
||||
// Info<< "Closest point to " << masterPoint << " is "
|
||||
// << closestPoint << nl
|
||||
// << " Separation is " << minCloseness << endl;
|
||||
//
|
||||
// CGAL::Gmpq x(CGAL::to_double(masterPoint.x()));
|
||||
// CGAL::Gmpq y(CGAL::to_double(masterPoint.y()));
|
||||
// CGAL::Gmpq z(CGAL::to_double(masterPoint.z()));
|
||||
//
|
||||
// std::cout<< "master = " << x << " " << y << " " << z
|
||||
// << std::endl;
|
||||
//
|
||||
// CGAL::Gmpq xs(CGAL::to_double(closestPoint.x()));
|
||||
// CGAL::Gmpq ys(CGAL::to_double(closestPoint.y()));
|
||||
// CGAL::Gmpq zs(CGAL::to_double(closestPoint.z()));
|
||||
// std::cout<< "slave = " << xs << " " << ys << " "
|
||||
// << zs
|
||||
// << std::endl;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// nExactMatches++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Info<< "Found " << nNonMatches << " non-matching duals" << nl
|
||||
// << " and " << nNearMatches << " near matches"
|
||||
// << " and " << nExactMatches << " exact matches" << endl;
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
void Foam::conformalVoronoiMesh::checkVertices()
|
||||
@ -578,7 +585,7 @@ void Foam::conformalVoronoiMesh::calcDualMesh
|
||||
Info<< nl << "Merging identical points" << endl;
|
||||
|
||||
// There is no guarantee that a merge of close points is no-risk
|
||||
mergeIdenticalDualVertices(points, boundaryPts);
|
||||
mergeIdenticalDualVertices(points);
|
||||
}
|
||||
|
||||
// Final dual face and owner neighbour construction
|
||||
@ -813,8 +820,7 @@ void Foam::conformalVoronoiMesh::calcTetMesh
|
||||
|
||||
void Foam::conformalVoronoiMesh::mergeIdenticalDualVertices
|
||||
(
|
||||
const pointField& pts,
|
||||
const labelList& boundaryPts
|
||||
const pointField& pts
|
||||
)
|
||||
{
|
||||
// Assess close points to be merged
|
||||
@ -829,7 +835,6 @@ void Foam::conformalVoronoiMesh::mergeIdenticalDualVertices
|
||||
nPtsMerged = mergeIdenticalDualVertices
|
||||
(
|
||||
pts,
|
||||
boundaryPts,
|
||||
dualPtIndexMap
|
||||
);
|
||||
|
||||
@ -851,7 +856,6 @@ void Foam::conformalVoronoiMesh::mergeIdenticalDualVertices
|
||||
Foam::label Foam::conformalVoronoiMesh::mergeIdenticalDualVertices
|
||||
(
|
||||
const pointField& pts,
|
||||
const labelList& boundaryPts,
|
||||
Map<label>& dualPtIndexMap
|
||||
) const
|
||||
{
|
||||
@ -883,6 +887,19 @@ Foam::label Foam::conformalVoronoiMesh::mergeIdenticalDualVertices
|
||||
|
||||
if (p1 == p2)
|
||||
{
|
||||
// if (c1->parallelDualVertex() || c2->parallelDualVertex())
|
||||
// {
|
||||
// if (c1->vertexLowestProc() < c2->vertexLowestProc())
|
||||
// {
|
||||
// dualPtIndexMap.insert(c1I, c1I);
|
||||
// dualPtIndexMap.insert(c2I, c1I);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// dualPtIndexMap.insert(c1I, c2I);
|
||||
// dualPtIndexMap.insert(c2I, c2I);
|
||||
// }
|
||||
// }
|
||||
if (c1I < c2I)
|
||||
{
|
||||
dualPtIndexMap.insert(c1I, c1I);
|
||||
@ -1338,13 +1355,13 @@ void Foam::conformalVoronoiMesh::checkCellSizing()
|
||||
|
||||
timeCheck("Start of Cell Sizing");
|
||||
|
||||
labelList boundaryPts(number_of_finite_cells(), -1);
|
||||
labelList boundaryPts(number_of_finite_cells(), internal);
|
||||
pointField ptsField;
|
||||
|
||||
indexDualVertices(ptsField, boundaryPts);
|
||||
|
||||
// Merge close dual vertices.
|
||||
mergeIdenticalDualVertices(ptsField, boundaryPts);
|
||||
mergeIdenticalDualVertices(ptsField);
|
||||
|
||||
autoPtr<polyMesh> meshPtr = createPolyMeshFromPoints(ptsField);
|
||||
const polyMesh& pMesh = meshPtr();
|
||||
@ -1755,7 +1772,7 @@ void Foam::conformalVoronoiMesh::indexDualVertices
|
||||
boundaryPts.setSize
|
||||
(
|
||||
number_of_finite_cells() + nConstrainedVertices,
|
||||
-1
|
||||
internal
|
||||
);
|
||||
|
||||
if (foamyHexMeshControls().guardFeaturePoints())
|
||||
@ -1774,7 +1791,7 @@ void Foam::conformalVoronoiMesh::indexDualVertices
|
||||
topoint(vit->point());
|
||||
|
||||
boundaryPts[number_of_finite_cells() + nConstrainedVertices] =
|
||||
1;
|
||||
constrained;
|
||||
|
||||
nConstrainedVertices++;
|
||||
}
|
||||
@ -1974,15 +1991,40 @@ void Foam::conformalVoronoiMesh::indexDualVertices
|
||||
|
||||
if (cit->boundaryDualVertex())
|
||||
{
|
||||
if (cit->featureEdgeDualVertex())
|
||||
if (cit->featurePointDualVertex())
|
||||
{
|
||||
boundaryPts[cit->cellIndex()] = 1;
|
||||
boundaryPts[cit->cellIndex()] = featurePoint;
|
||||
}
|
||||
else if (cit->featureEdgeDualVertex())
|
||||
{
|
||||
boundaryPts[cit->cellIndex()] = featureEdge;
|
||||
}
|
||||
else
|
||||
{
|
||||
boundaryPts[cit->cellIndex()] = 0;
|
||||
boundaryPts[cit->cellIndex()] = surface;
|
||||
}
|
||||
}
|
||||
else if
|
||||
(
|
||||
cit->baffleBoundaryDualVertex()
|
||||
)
|
||||
{
|
||||
boundaryPts[cit->cellIndex()] = surface;
|
||||
}
|
||||
else if
|
||||
(
|
||||
cit->vertex(0)->featureEdgePoint()
|
||||
&& cit->vertex(1)->featureEdgePoint()
|
||||
&& cit->vertex(2)->featureEdgePoint()
|
||||
&& cit->vertex(3)->featureEdgePoint()
|
||||
)
|
||||
{
|
||||
boundaryPts[cit->cellIndex()] = featureEdge;
|
||||
}
|
||||
else
|
||||
{
|
||||
boundaryPts[cit->cellIndex()] = internal;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -958,7 +958,7 @@ void Foam::conformalVoronoiMesh::writeMesh
|
||||
{
|
||||
Info<< nl << "Filtering edges on polyMesh" << nl << endl;
|
||||
|
||||
meshFilter.reset(new polyMeshFilter(mesh));
|
||||
meshFilter.reset(new polyMeshFilter(mesh, boundaryPts));
|
||||
|
||||
// Filter small edges only. This reduces the number of faces so that
|
||||
// the face filtering is sped up.
|
||||
@ -974,9 +974,28 @@ void Foam::conformalVoronoiMesh::writeMesh
|
||||
|
||||
if (foamyHexMeshControls().filterFaces())
|
||||
{
|
||||
labelIOList boundaryPtsIO
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pointPriority",
|
||||
instance,
|
||||
time(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
labelList(mesh.nPoints(), labelMin)
|
||||
);
|
||||
|
||||
forAll(mesh.points(), ptI)
|
||||
{
|
||||
boundaryPtsIO[ptI] = mesh.pointZones().whichZone(ptI);
|
||||
}
|
||||
|
||||
|
||||
Info<< nl << "Filtering faces on polyMesh" << nl << endl;
|
||||
|
||||
meshFilter.reset(new polyMeshFilter(mesh));
|
||||
meshFilter.reset(new polyMeshFilter(mesh, boundaryPtsIO));
|
||||
|
||||
meshFilter().filter(nInitialBadFaces);
|
||||
{
|
||||
@ -1005,159 +1024,44 @@ void Foam::conformalVoronoiMesh::writeMesh
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
// volTensorField alignments
|
||||
// (
|
||||
// IOobject
|
||||
// (
|
||||
// "alignmentsField",
|
||||
// runTime_.timeName(),
|
||||
// runTime_,
|
||||
// IOobject::NO_READ,
|
||||
// IOobject::AUTO_WRITE
|
||||
// ),
|
||||
// mesh,
|
||||
// tensor::zero
|
||||
// );
|
||||
//
|
||||
// forAll(mesh.cellCentres(), pI)
|
||||
// {
|
||||
// Vertex_handle nearV =
|
||||
// nearest_vertex
|
||||
// (
|
||||
// toPoint<Point>(mesh.cellCentres()[pI])
|
||||
// );
|
||||
// alignments[pI] = nearV->alignment();
|
||||
// }
|
||||
// alignments.write();
|
||||
//
|
||||
// {
|
||||
// volVectorField alignmentx
|
||||
// (
|
||||
// IOobject
|
||||
// (
|
||||
// "alignmentsx",
|
||||
// runTime_.timeName(),
|
||||
// runTime_,
|
||||
// IOobject::NO_READ,
|
||||
// IOobject::AUTO_WRITE
|
||||
// ),
|
||||
// mesh,
|
||||
// vector::zero
|
||||
// );
|
||||
// forAll(alignmentx, aI)
|
||||
// {
|
||||
// alignmentx[aI] = alignments[aI].x();
|
||||
// }
|
||||
// alignmentx.write();
|
||||
// }
|
||||
// {
|
||||
// volVectorField alignmenty
|
||||
// (
|
||||
// IOobject
|
||||
// (
|
||||
// "alignmentsy",
|
||||
// runTime_.timeName(),
|
||||
// runTime_,
|
||||
// IOobject::NO_READ,
|
||||
// IOobject::AUTO_WRITE
|
||||
// ),
|
||||
// mesh,
|
||||
// vector::zero
|
||||
// );
|
||||
// forAll(alignmenty, aI)
|
||||
// {
|
||||
// alignmenty[aI] = alignments[aI].y();
|
||||
// }
|
||||
// alignmenty.write();
|
||||
// }
|
||||
// {
|
||||
// volVectorField alignmentz
|
||||
// (
|
||||
// IOobject
|
||||
// (
|
||||
// "alignmentsz",
|
||||
// runTime_.timeName(),
|
||||
// runTime_,
|
||||
// IOobject::NO_READ,
|
||||
// IOobject::AUTO_WRITE
|
||||
// ),
|
||||
// mesh,
|
||||
// vector::zero
|
||||
// );
|
||||
// forAll(alignmentz, aI)
|
||||
// {
|
||||
// alignmentz[aI] = alignments[aI].z();
|
||||
// }
|
||||
// alignmentz.write();
|
||||
// }
|
||||
|
||||
|
||||
labelIOList boundaryIOPts
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"boundaryPoints",
|
||||
instance,
|
||||
runTime_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
boundaryPts
|
||||
);
|
||||
|
||||
// Dump list of boundary points
|
||||
forAll(mesh.boundaryMesh(), patchI)
|
||||
{
|
||||
const polyPatch& pp = mesh.boundaryMesh()[patchI];
|
||||
pointScalarField boundaryPtsScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"boundaryPoints_collapsed",
|
||||
instance,
|
||||
time(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
pointMesh::New(mesh),
|
||||
scalar(labelMin)
|
||||
);
|
||||
|
||||
if (!isA<coupledPolyPatch>(pp))
|
||||
labelIOList boundaryPtsIO
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pointPriority",
|
||||
instance,
|
||||
time(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
labelList(mesh.nPoints(), labelMin)
|
||||
);
|
||||
|
||||
forAll(mesh.points(), ptI)
|
||||
{
|
||||
forAll(pp, fI)
|
||||
{
|
||||
const face& boundaryFace = pp[fI];
|
||||
|
||||
forAll(boundaryFace, pI)
|
||||
{
|
||||
const label boundaryPointI = boundaryFace[pI];
|
||||
|
||||
boundaryIOPts[boundaryPointI] = boundaryPts[boundaryPointI];
|
||||
}
|
||||
}
|
||||
boundaryPtsScalarField[ptI] = mesh.pointZones().whichZone(ptI);
|
||||
boundaryPtsIO[ptI] = mesh.pointZones().whichZone(ptI);
|
||||
}
|
||||
|
||||
boundaryPtsScalarField.write();
|
||||
boundaryPtsIO.write();
|
||||
}
|
||||
|
||||
boundaryIOPts.write();
|
||||
|
||||
// forAllConstIter(labelHashSet, pointsInPatch, pI)
|
||||
// {
|
||||
// const Foam::point& ptMaster = mesh.points()[pI.key()];
|
||||
//
|
||||
// forAllConstIter(labelHashSet, pointsInPatch, ptI)
|
||||
// {
|
||||
// if (ptI.key() != pI.key())
|
||||
// {
|
||||
// const Foam::point& ptSlave = mesh.points()[ptI.key()];
|
||||
//
|
||||
// const scalar dist = mag(ptMaster - ptSlave);
|
||||
// if (ptMaster == ptSlave)
|
||||
// {
|
||||
// Pout<< "Point(" << pI.key() << ") " << ptMaster
|
||||
// << " == "
|
||||
// << "(" << ptI.key() << ") " << ptSlave
|
||||
// << endl;
|
||||
// }
|
||||
// else if (dist == 0)
|
||||
// {
|
||||
// Pout<< "Point(" << pI.key() << ") " << ptMaster
|
||||
// << " ~= "
|
||||
// << "(" << ptI.key() << ") " << ptSlave
|
||||
// << endl;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// writeCellSizes(mesh);
|
||||
|
||||
// writeCellAlignments(mesh);
|
||||
|
||||
@ -176,6 +176,9 @@ public:
|
||||
//- Does the Delaunay cell have a far point
|
||||
inline bool hasFarPoint() const;
|
||||
|
||||
//- Does the Delaunay cell have a referred point
|
||||
inline bool hasReferredPoint() const;
|
||||
|
||||
//- Does the Delaunay cell have a feature point
|
||||
inline bool hasFeaturePoint() const;
|
||||
|
||||
@ -216,6 +219,8 @@ public:
|
||||
// least one Delaunay vertex outside and at least one inside
|
||||
inline bool boundaryDualVertex() const;
|
||||
|
||||
inline bool baffleBoundaryDualVertex() const;
|
||||
|
||||
//- A dual vertex on a feature edge will result from this Delaunay cell
|
||||
inline bool featureEdgeDualVertex() const;
|
||||
|
||||
|
||||
@ -189,6 +189,19 @@ inline bool CGAL::indexedCell<Gt, Cb>::hasFarPoint() const
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Cb>
|
||||
inline bool CGAL::indexedCell<Gt, Cb>::hasReferredPoint() const
|
||||
{
|
||||
return
|
||||
(
|
||||
this->vertex(0)->referred()
|
||||
|| this->vertex(1)->referred()
|
||||
|| this->vertex(2)->referred()
|
||||
|| this->vertex(3)->referred()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Cb>
|
||||
inline bool CGAL::indexedCell<Gt, Cb>::hasFeaturePoint() const
|
||||
{
|
||||
@ -372,6 +385,14 @@ inline bool CGAL::indexedCell<Gt, Cb>::anyInternalOrBoundaryDualVertex() const
|
||||
template<class Gt, class Cb>
|
||||
inline bool CGAL::indexedCell<Gt, Cb>::boundaryDualVertex() const
|
||||
{
|
||||
// return
|
||||
// (
|
||||
// this->vertex(0)->boundaryPoint()
|
||||
// && this->vertex(1)->boundaryPoint()
|
||||
// && this->vertex(2)->boundaryPoint()
|
||||
// && this->vertex(3)->boundaryPoint()
|
||||
// );
|
||||
|
||||
return
|
||||
(
|
||||
(
|
||||
@ -387,6 +408,41 @@ inline bool CGAL::indexedCell<Gt, Cb>::boundaryDualVertex() const
|
||||
|| this->vertex(3)->externalBoundaryPoint()
|
||||
)
|
||||
);
|
||||
|
||||
// Foam::label nBoundaryPoints = 0;
|
||||
//
|
||||
// for (Foam::label i = 0; i < 4; ++i)
|
||||
// {
|
||||
// Vertex_handle v = this->vertex(i);
|
||||
//
|
||||
// if (v->boundaryPoint())
|
||||
// {
|
||||
// nBoundaryPoints++;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return (nBoundaryPoints > 1);
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Cb>
|
||||
inline bool CGAL::indexedCell<Gt, Cb>::baffleBoundaryDualVertex() const
|
||||
{
|
||||
return
|
||||
(
|
||||
(
|
||||
this->vertex(0)->internalBafflePoint()
|
||||
|| this->vertex(1)->internalBafflePoint()
|
||||
|| this->vertex(2)->internalBafflePoint()
|
||||
|| this->vertex(3)->internalBafflePoint()
|
||||
)
|
||||
&& (
|
||||
this->vertex(0)->externalBafflePoint()
|
||||
|| this->vertex(1)->externalBafflePoint()
|
||||
|| this->vertex(2)->externalBafflePoint()
|
||||
|| this->vertex(3)->externalBafflePoint()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -400,6 +456,31 @@ inline bool CGAL::indexedCell<Gt, Cb>::featureEdgeDualVertex() const
|
||||
&& this->vertex(2)->featureEdgePoint()
|
||||
&& this->vertex(3)->featureEdgePoint()
|
||||
);
|
||||
// (
|
||||
// this->vertex(0)->featureEdgePoint()
|
||||
// || this->vertex(1)->featureEdgePoint()
|
||||
// || this->vertex(2)->featureEdgePoint()
|
||||
// || this->vertex(3)->featureEdgePoint()
|
||||
// )
|
||||
// && (
|
||||
// (
|
||||
// this->vertex(0)->featureEdgePoint()
|
||||
// || this->vertex(0)->featurePoint()
|
||||
// )
|
||||
// && (
|
||||
// this->vertex(1)->featureEdgePoint()
|
||||
// || this->vertex(1)->featurePoint()
|
||||
// )
|
||||
// && (
|
||||
// this->vertex(2)->featureEdgePoint()
|
||||
// || this->vertex(2)->featurePoint()
|
||||
// )
|
||||
// && (
|
||||
// this->vertex(3)->featureEdgePoint()
|
||||
// || this->vertex(3)->featurePoint()
|
||||
// )
|
||||
// )
|
||||
// );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -243,8 +243,10 @@ public:
|
||||
inline bool surfacePoint() const;
|
||||
|
||||
inline bool internalBoundaryPoint() const;
|
||||
inline bool internalBafflePoint() const;
|
||||
|
||||
inline bool externalBoundaryPoint() const;
|
||||
inline bool externalBafflePoint() const;
|
||||
|
||||
inline bool constrained() const;
|
||||
|
||||
|
||||
@ -30,13 +30,17 @@ License
|
||||
|
||||
template<>
|
||||
const char*
|
||||
Foam::NamedEnum<Foam::indexedVertexEnum::vertexType, 11>::names[] =
|
||||
Foam::NamedEnum<Foam::indexedVertexEnum::vertexType, 15>::names[] =
|
||||
{
|
||||
"Unassigned",
|
||||
"Internal",
|
||||
"InternalNearBoundary",
|
||||
"InternalSurface",
|
||||
"InternalSurfaceBaffle",
|
||||
"ExternalSurfaceBaffle",
|
||||
"InternalFeatureEdge",
|
||||
"InternalFeatureEdgeBaffle",
|
||||
"ExternalFeatureEdgeBaffle",
|
||||
"InternalFeaturePoint",
|
||||
"ExternalSurface",
|
||||
"ExternalFeatureEdge",
|
||||
@ -45,7 +49,7 @@ Foam::NamedEnum<Foam::indexedVertexEnum::vertexType, 11>::names[] =
|
||||
"Constrained"
|
||||
};
|
||||
|
||||
const Foam::NamedEnum<Foam::indexedVertexEnum::vertexType, 11>
|
||||
const Foam::NamedEnum<Foam::indexedVertexEnum::vertexType, 15>
|
||||
Foam::indexedVertexEnum::vertexTypeNames_;
|
||||
|
||||
|
||||
|
||||
@ -49,17 +49,21 @@ public:
|
||||
|
||||
enum vertexType
|
||||
{
|
||||
vtUnassigned = 0,
|
||||
vtInternal = 1,
|
||||
vtInternalNearBoundary = 2,
|
||||
vtInternalSurface = 3,
|
||||
vtInternalFeatureEdge = 4,
|
||||
vtInternalFeaturePoint = 5,
|
||||
vtExternalSurface = 6,
|
||||
vtExternalFeatureEdge = 7,
|
||||
vtExternalFeaturePoint = 8,
|
||||
vtFar = 9,
|
||||
vtConstrained = 10
|
||||
vtUnassigned = 0,
|
||||
vtInternal = 1,
|
||||
vtInternalNearBoundary = 2,
|
||||
vtInternalSurface = 3,
|
||||
vtInternalSurfaceBaffle = 4,
|
||||
vtExternalSurfaceBaffle = 5,
|
||||
vtInternalFeatureEdge = 6,
|
||||
vtInternalFeatureEdgeBaffle = 7,
|
||||
vtExternalFeatureEdgeBaffle = 8,
|
||||
vtInternalFeaturePoint = 9,
|
||||
vtExternalSurface = 10,
|
||||
vtExternalFeatureEdge = 11,
|
||||
vtExternalFeaturePoint = 12,
|
||||
vtFar = 13,
|
||||
vtConstrained = 14
|
||||
};
|
||||
|
||||
enum vertexMotion
|
||||
@ -68,7 +72,7 @@ public:
|
||||
movable = 1
|
||||
};
|
||||
|
||||
static const Foam::NamedEnum<vertexType, 11> vertexTypeNames_;
|
||||
static const Foam::NamedEnum<vertexType, 15> vertexTypeNames_;
|
||||
|
||||
static const Foam::NamedEnum<vertexMotion, 2> vertexMotionNames_;
|
||||
|
||||
|
||||
@ -307,6 +307,16 @@ inline bool CGAL::indexedVertex<Gt, Vb>::internalBoundaryPoint() const
|
||||
return type_ >= vtInternalSurface && type_ <= vtInternalFeaturePoint;
|
||||
}
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline bool CGAL::indexedVertex<Gt, Vb>::internalBafflePoint() const
|
||||
{
|
||||
return
|
||||
(
|
||||
type_ == vtInternalSurfaceBaffle
|
||||
|| type_ == vtInternalFeatureEdgeBaffle
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline bool CGAL::indexedVertex<Gt, Vb>::externalBoundaryPoint() const
|
||||
@ -314,6 +324,16 @@ inline bool CGAL::indexedVertex<Gt, Vb>::externalBoundaryPoint() const
|
||||
return type_ >= vtExternalSurface && type_ <= vtExternalFeaturePoint;
|
||||
}
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline bool CGAL::indexedVertex<Gt, Vb>::externalBafflePoint() const
|
||||
{
|
||||
return
|
||||
(
|
||||
type_ == vtExternalSurfaceBaffle
|
||||
|| type_ == vtExternalFeatureEdgeBaffle
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline bool CGAL::indexedVertex<Gt, Vb>::constrained() const
|
||||
|
||||
@ -49,7 +49,6 @@ void rayShooting::splitLine
|
||||
{
|
||||
Foam::point midPoint(l.centre());
|
||||
const scalar localCellSize(cellShapeControls().cellSize(midPoint));
|
||||
const scalar lineLength(l.mag());
|
||||
|
||||
const scalar minDistFromSurfaceSqr
|
||||
(
|
||||
@ -64,6 +63,8 @@ void rayShooting::splitLine
|
||||
)
|
||||
{
|
||||
// Add extra points if line length is much bigger than local cell size
|
||||
// const scalar lineLength(l.mag());
|
||||
//
|
||||
// if (lineLength > 4.0*localCellSize)
|
||||
// {
|
||||
// splitLine
|
||||
|
||||
Reference in New Issue
Block a user