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

fix crash if tfo is empty

parent 11d87647
No related branches found
No related tags found
No related merge requests found
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "BasisFactory.h" #include "BasisFactory.h"
#include "MVertexRTree.h" #include "MVertexRTree.h"
// --------- Functions that help optimizing placement of points on geometry ----------- // --------- Functions that help optimizing placement of points on geometry -----------
// The aim here is to build a polynomial representation that consist // The aim here is to build a polynomial representation that consist
...@@ -1324,6 +1323,7 @@ static void updatePeriodicEdgesAndFaces(GModel *m) ...@@ -1324,6 +1323,7 @@ static void updatePeriodicEdgesAndFaces(GModel *m)
std::vector<double> tfo = slave->affineTransform; std::vector<double> tfo = slave->affineTransform;
if(tfo.size() >= 16){
for (unsigned int i = 0; i < master->getNumMeshVertices(); ++i) { for (unsigned int i = 0; i < master->getNumMeshVertices(); ++i) {
MVertex *vs = master->getMeshVertex(i); MVertex *vs = master->getMeshVertex(i);
double ps[4] = {vs->x(), vs->y(), vs->z(), 1.}; double ps[4] = {vs->x(), vs->y(), vs->z(), 1.};
...@@ -1332,7 +1332,6 @@ static void updatePeriodicEdgesAndFaces(GModel *m) ...@@ -1332,7 +1332,6 @@ static void updatePeriodicEdgesAndFaces(GModel *m)
for(int i = 0; i < 4; i++) for(int i = 0; i < 4; i++)
for(int j = 0; j < 4; j++) for(int j = 0; j < 4; j++)
res[i] += tfo[idx++] * ps[j]; res[i] += tfo[idx++] * ps[j];
SPoint3 p3 (res[0], res[1], res[2]); SPoint3 p3 (res[0], res[1], res[2]);
double u = slave->parFromPoint(p3); double u = slave->parFromPoint(p3);
GPoint gp = slave->point(u); GPoint gp = slave->point(u);
...@@ -1341,6 +1340,7 @@ static void updatePeriodicEdgesAndFaces(GModel *m) ...@@ -1341,6 +1340,7 @@ static void updatePeriodicEdgesAndFaces(GModel *m)
else v2v[vt] = vs; else v2v[vt] = vs;
} }
} }
}
for(GModel::fiter it = m->firstFace(); it != m->lastFace(); ++it) { for(GModel::fiter it = m->firstFace(); it != m->lastFace(); ++it) {
GFace *slave = *it; GFace *slave = *it;
...@@ -1355,7 +1355,7 @@ static void updatePeriodicEdgesAndFaces(GModel *m) ...@@ -1355,7 +1355,7 @@ static void updatePeriodicEdgesAndFaces(GModel *m)
rtree.insert(slave->getMeshVertex(i)); rtree.insert(slave->getMeshVertex(i));
std::vector<double> tfo = slave->affineTransform; std::vector<double> tfo = slave->affineTransform;
if(tfo.size() >= 16){
for (unsigned int i = 0; i < master->getNumMeshVertices(); ++i) { for (unsigned int i = 0; i < master->getNumMeshVertices(); ++i) {
MVertex *vs = master->getMeshVertex(i); MVertex *vs = master->getMeshVertex(i);
double ps[4] = {vs->x(), vs->y(), vs->z(), 1.}; double ps[4] = {vs->x(), vs->y(), vs->z(), 1.};
...@@ -1364,7 +1364,6 @@ static void updatePeriodicEdgesAndFaces(GModel *m) ...@@ -1364,7 +1364,6 @@ static void updatePeriodicEdgesAndFaces(GModel *m)
for(int i = 0; i < 4; i++) for(int i = 0; i < 4; i++)
for(int j = 0; j < 4; j++) for(int j = 0; j < 4; j++)
res[i] += tfo[idx++] * ps[j]; res[i] += tfo[idx++] * ps[j];
SPoint3 p3 (res[0], res[1], res[2]); SPoint3 p3 (res[0], res[1], res[2]);
SPoint2 p2 = slave->parFromPoint(p3); SPoint2 p2 = slave->parFromPoint(p3);
GPoint gp = slave->point(p2); GPoint gp = slave->point(p2);
...@@ -1374,6 +1373,7 @@ static void updatePeriodicEdgesAndFaces(GModel *m) ...@@ -1374,6 +1373,7 @@ static void updatePeriodicEdgesAndFaces(GModel *m)
} }
} }
} }
}
void SetOrder1(GModel *m, bool onlyVisible) void SetOrder1(GModel *m, bool onlyVisible)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment