BUG: When distributing mesh vertices check return values for locate

This commit is contained in:
laurence
2013-05-17 09:56:12 +01:00
parent 6d12b2d4f0
commit f925f93eab

View File

@ -843,6 +843,8 @@ Foam::DistributedDelaunayMesh<Triangulation>::rangeInsertReferredWithInfo
// Locate the point // Locate the point
Cell_handle c = Triangulation::locate(pointToInsert, lt, li, lj, hint); Cell_handle c = Triangulation::locate(pointToInsert, lt, li, lj, hint);
bool inserted = false;
if (lt == Triangulation::VERTEX) if (lt == Triangulation::VERTEX)
{ {
if (printErrors) if (printErrors)
@ -854,47 +856,59 @@ Foam::DistributedDelaunayMesh<Triangulation>::rangeInsertReferredWithInfo
<< "Failed insertion : " << vert.info() << "Failed insertion : " << vert.info()
<< " nearest : " << nearV->info(); << " nearest : " << nearV->info();
} }
uninserted.insert(labelPair(vert.procIndex(), vert.index()));
nNotInserted++;
continue;
} }
else if (lt == Triangulation::OUTSIDE_CONVEX_HULL)
// Get the cells that conflict with p in a vector V,
// and a facet on the boundary of this hole in f.
std::vector<Cell_handle> V;
typename Triangulation::Facet f;
Triangulation::find_conflicts
(
pointToInsert,
c,
CGAL::Oneset_iterator<typename Triangulation::Facet>(f),
std::back_inserter(V)
);
bool insert = false;
for (size_t i = 0; i < V.size(); ++i)
{ {
if (V[i]->real() || V[i]->hasFarPoint()) hint = this->insert(pointToInsert, hint);
inserted = true;
}
else if (lt == Triangulation::OUTSIDE_AFFINE_HULL)
{
WarningIn
(
"Foam::DistributedDelaunayMesh<Triangulation>"
"::rangeInsertReferredWithInfo"
) << "Point is outside affine hull! pt = " << pointToInsert
<< endl;
}
else
{
// Get the cells that conflict with p in a vector V,
// and a facet on the boundary of this hole in f.
std::vector<Cell_handle> V;
typename Triangulation::Facet f;
Triangulation::find_conflicts
(
pointToInsert,
c,
CGAL::Oneset_iterator<typename Triangulation::Facet>(f),
std::back_inserter(V)
);
for (size_t i = 0; i < V.size(); ++i)
{ {
insert = true; if (V[i]->real() || V[i]->hasFarPoint())
break; {
hint = Triangulation::insert_in_hole
(
pointToInsert,
V.begin(),
V.end(),
f.first,
f.second
);
inserted = true;
break;
}
} }
} }
if (insert) if (inserted)
{ {
hint = Triangulation::insert_in_hole
(
pointToInsert,
V.begin(),
V.end(),
f.first,
f.second
);
if (checkInsertion != Triangulation::number_of_vertices() - 1) if (checkInsertion != Triangulation::number_of_vertices() - 1)
{ {
if (printErrors) if (printErrors)