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

fix crash in octree for high-order model-based views

parent 375d5cd0
No related branches found
No related tags found
No related merge requests found
...@@ -99,9 +99,8 @@ static int connected_bounds(std::set<MEdge, Less_Edge> &edges, ...@@ -99,9 +99,8 @@ static int connected_bounds(std::set<MEdge, Less_Edge> &edges,
return boundaries.size(); return boundaries.size();
} }
//-------------------------------------------------------------- static int connectedRegions(std::vector<MElement*> &elements,
static int connectedRegions (std::vector<MElement*> &elements, std::vector<std::vector<MElement*> > &regions)
std::vector<std::vector<MElement*> > &regions)
{ {
std::multimap<MEdge,MElement*,Less_Edge> e2e; std::multimap<MEdge,MElement*,Less_Edge> e2e;
for (unsigned int i = 0; i < elements.size(); ++i){ for (unsigned int i = 0; i < elements.size(); ++i){
...@@ -122,11 +121,11 @@ static int connectedRegions (std::vector<MElement*> &elements, ...@@ -122,11 +121,11 @@ static int connectedRegions (std::vector<MElement*> &elements,
return regions.size(); return regions.size();
} }
//-----------------------------------------------------------------------------
GModel::GModel(std::string name) GModel::GModel(std::string name)
: _name(name), _visible(1), _octree(0), : _name(name), _visible(1), _octree(0),
_geo_internals(0), _occ_internals(0), _acis_internals(0), _fm_internals(0),_factory(0), _fields(0), _currentMeshEntity(0), normals(0) _geo_internals(0), _occ_internals(0), _acis_internals(0), _fm_internals(0),
_factory(0), _fields(0), _currentMeshEntity(0), normals(0)
{ {
partitionSize[0] = 0; partitionSize[1] = 0; partitionSize[0] = 0; partitionSize[1] = 0;
list.push_back(this); list.push_back(this);
......
...@@ -47,7 +47,7 @@ static int MElementInEle(void *a, double *x) ...@@ -47,7 +47,7 @@ static int MElementInEle(void *a, double *x)
return e->isInside(uvw[0], uvw[1], uvw[2]) ? 1 : 0; return e->isInside(uvw[0], uvw[1], uvw[2]) ? 1 : 0;
} }
Octree *buildMElementOctree (GModel *m) Octree *buildMElementOctree(GModel *m)
{ {
SBoundingBox3d bb = m->bounds(); SBoundingBox3d bb = m->bounds();
double min[3] = {bb.min().x(), bb.min().y(), bb.min().z()}; double min[3] = {bb.min().x(), bb.min().y(), bb.min().z()};
...@@ -69,8 +69,8 @@ Octree *buildMElementOctree (GModel *m) ...@@ -69,8 +69,8 @@ Octree *buildMElementOctree (GModel *m)
Octree *buildMElementOctree(std::vector<MElement*> &v) Octree *buildMElementOctree(std::vector<MElement*> &v)
{ {
SBoundingBox3d bb; SBoundingBox3d bb;
for (unsigned int i=0;i<v.size();i++){ for (unsigned int i = 0; i < v.size(); i++){
for(int j=0;j<v[i]->getNumVertices();j++){ for(int j = 0; j < v[i]->getNumVertices(); j++){
bb += SPoint3(v[i]->getVertex(j)->x(), bb += SPoint3(v[i]->getVertex(j)->x(),
v[i]->getVertex(j)->y(), v[i]->getVertex(j)->y(),
v[i]->getVertex(j)->z()); v[i]->getVertex(j)->z());
...@@ -88,4 +88,3 @@ Octree *buildMElementOctree(std::vector<MElement*> &v) ...@@ -88,4 +88,3 @@ Octree *buildMElementOctree(std::vector<MElement*> &v)
Octree_Arrange(_octree); Octree_Arrange(_octree);
return _octree; return _octree;
} }
...@@ -299,7 +299,7 @@ PView *GMSH_CutGridPlugin::GenerateView(PView *v1, int connect) ...@@ -299,7 +299,7 @@ PView *GMSH_CutGridPlugin::GenerateView(PView *v1, int connect)
if(getNbU() <= 0 || getNbV() <= 0) if(getNbU() <= 0 || getNbV() <= 0)
return v1; return v1;
PViewData *data1 = v1->getData(); PViewData *data1 = v1->getData(true); // get adaptive data if available
PView *v2 = new PView(); PView *v2 = new PView();
PViewDataList *data2 = getDataList(v2); PViewDataList *data2 = getDataList(v2);
......
...@@ -227,7 +227,7 @@ OctreePost::OctreePost(PView *v) ...@@ -227,7 +227,7 @@ OctreePost::OctreePost(PView *v)
PViewDataList *l = _theViewDataList; PViewDataList *l = _theViewDataList;
if(l->haveInterpolationMatrices() && !_theView->getData()->isAdaptive()){ if(l->haveInterpolationMatrices() && !_theView->getData()->isAdaptive()){
Msg::Error("Cannot create octree for non-adapted high-order view: you need"); Msg::Error("Cannot create octree for non-adapted high-order list-based view: you need");
Msg::Error("to select 'Adapt visualization grid' first"); Msg::Error("to select 'Adapt visualization grid' first");
return; return;
} }
...@@ -351,7 +351,7 @@ bool OctreePost::_getValue(void *in, int nbComp, double P[3], int timestep, ...@@ -351,7 +351,7 @@ bool OctreePost::_getValue(void *in, int nbComp, double P[3], int timestep,
MElement *e = (MElement*)in; MElement *e = (MElement*)in;
int dataIndex[8]; std::vector<int> dataIndex(e->getNumVertices());
if(_theViewDataGModel->getType() == PViewDataGModel::NodeData) if(_theViewDataGModel->getType() == PViewDataGModel::NodeData)
for(int i = 0; i < e->getNumVertices(); i++) for(int i = 0; i < e->getNumVertices(); i++)
dataIndex[i] = e->getVertex(i)->getNum(); dataIndex[i] = e->getVertex(i)->getNum();
...@@ -362,7 +362,7 @@ bool OctreePost::_getValue(void *in, int nbComp, double P[3], int timestep, ...@@ -362,7 +362,7 @@ bool OctreePost::_getValue(void *in, int nbComp, double P[3], int timestep,
double U[3]; double U[3];
e->xyz2uvw(P, U); e->xyz2uvw(P, U);
double nodeval[8 * 9]; std::vector<double> nodeval(e->getNumVertices() * 9);
for(int step = 0; step < _theViewDataGModel->getNumTimeSteps(); step++){ for(int step = 0; step < _theViewDataGModel->getNumTimeSteps(); step++){
if(timestep < 0 || step == timestep){ if(timestep < 0 || step == timestep){
for(int nod = 0; nod < e->getNumVertices(); nod++){ for(int nod = 0; nod < e->getNumVertices(); nod++){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment