Skip to content
Snippets Groups Projects
Commit af111dd8 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

don't crash if initial mesh is empty

parent 6392d84b
No related branches found
No related tags found
No related merge requests found
......@@ -663,13 +663,18 @@ void bowyerWatson(GFace *gf)
std::vector<SMetric3> vMetricsBGM;
buildMeshGenerationDataStructures
(gf, AllTris, vSizes, vSizesBGM, vMetricsBGM,Us, Vs);
(gf, AllTris, vSizes, vSizesBGM, vMetricsBGM, Us, Vs);
// _printTris ("before.pos", AllTris, Us,Vs);
int nbSwaps = edgeSwapPass(gf, AllTris, SWCR_DEL, Us, Vs, vSizes, vSizesBGM);
// _printTris ("after2.pos", AllTris, Us,Vs);
Msg::Debug("Delaunization of the initial mesh done (%d swaps)", nbSwaps);
if(AllTris.empty()){
Msg::Error("No triangles in initial mesh");
return;
}
int ITER = 0;
while (1){
MTri3 *worst = *AllTris.begin();
......
......@@ -789,12 +789,13 @@ void DocRecord::Voronoi()
ConvertDListToVoronoiData();
}
void DocRecord::setPoints(fullMatrix<double> *p){
void DocRecord::setPoints(fullMatrix<double> *p)
{
if (numPoints != p->size1())throw;
for (int i=0;i<p->size1();i++){
x(i) = (*p)(i,0);
y(i) = (*p)(i,1);
data(i) = (*p)(i,2) < 0 ? (void *) 1 : NULL;
for (int i = 0; i < p->size1(); i++){
x(i) = (*p)(i, 0);
y(i) = (*p)(i, 1);
data(i) = (*p)(i, 2) < 0 ? (void *) 1 : NULL;
}
}
......@@ -803,7 +804,8 @@ void DocRecord::setPoints(fullMatrix<double> *p){
void DocRecord::registerBindings(binding *b)
{
classBinding *cb = b->addClass<DocRecord>("Triangulator");
cb->setDescription("A class that does 2D delaunay triangulation (JF's SANDBOX for the moment)");
cb->setDescription("A class that does 2D delaunay triangulation "
"(JF's SANDBOX for the moment)");
methodBinding *cm;
cm = cb->addMethod("setPoints", &DocRecord::setPoints);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment