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

*** empty log message ***

parent baafca15
No related branches found
No related tags found
No related merge requests found
......@@ -92,13 +92,24 @@ void GModel::getPhysicalGroups(std::map<int, std::vector<GEntity*> > groups[4])
addInGroup(*it, groups[3]);
}
SBoundingBox3d GModel::recomputeBounds()
SBoundingBox3d GModel::bounds()
{
SBoundingBox3d bb;
for(viter it = firstVertex(); it != lastVertex(); ++it)
bb += (*it)->bounds();
boundingBox = bb;
return boundingBox;
// use the mesh instead of the geometry for now
for(eiter it = firstEdge(); it != lastEdge(); ++it)
for(unsigned int i = 0; i < (*it)->mesh_vertices.size(); i++)
bb += (*it)->mesh_vertices[i]->point();
for(fiter it = firstFace(); it != lastFace(); ++it)
for(unsigned int i = 0; i < (*it)->mesh_vertices.size(); i++)
bb += (*it)->mesh_vertices[i]->point();
for(riter it = firstRegion(); it != lastRegion(); ++it)
for(unsigned int i = 0; i < (*it)->mesh_vertices.size(); i++)
bb += (*it)->mesh_vertices[i]->point();
return bb;
}
int GModel::getMeshStatus()
......
......@@ -79,8 +79,7 @@ class GModel
void getPhysicalGroups(std::map<int, std::vector<GEntity*> > groups[4]);
// The bounding box
virtual SBoundingBox3d getBounds() { return boundingBox; }
virtual SBoundingBox3d recomputeBounds();
virtual SBoundingBox3d bounds();
// Returns the mesh status for the entire model.
virtual int getMeshStatus();
......
......@@ -162,7 +162,6 @@ int GModel::readMSH(const std::string &name)
int elementTypes[7] = {LGN1, TRI1, QUA1, TET1, HEX1, PRI1, PYR1};
double version = 1.0;
char str[256];
SBoundingBox3d bbox;
std::map<int, MVertex*> vertices;
std::map<int, std::vector<MVertex*> > points;
std::map<int, std::vector<MElement*> > elements[7];
......@@ -195,7 +194,6 @@ int GModel::readMSH(const std::string &name)
int num;
double x, y, z;
fscanf(fp, "%d %lf %lf %lf", &num, &x, &y, &z);
bbox += SPoint3(x, y, z);
if(vertices.count(num))
Msg(WARNING, "Skipping duplicate vertex %d", num);
else
......@@ -356,8 +354,6 @@ int GModel::readMSH(const std::string &name)
for(int i = 0; i < 4; i++)
storePhysicalTagsInEntities(this, i, physicals[i]);
boundingBox += bbox;
fclose(fp);
return 1;
}
......@@ -656,8 +652,6 @@ int GModel::readSTL(const std::string &name, double tolerance)
face->triangles.push_back(new MTriangle(v[0], v[1], v[2]));
}
boundingBox += bbox;
fclose(fp);
return 1;
}
......@@ -881,7 +875,6 @@ int GModel::readMESH(const std::string &name)
std::map<int, MVertex*> vertices;
int elementTypes[2] = {TRI1, QUA1};
std::map<int, std::vector<MElement*> > elements[2];
SBoundingBox3d bbox;
while(!feof(fp)) {
fgets(buffer, sizeof(buffer), fp);
......@@ -900,7 +893,6 @@ int GModel::readMESH(const std::string &name)
int cl;
double x, y, z;
sscanf(buffer, "%lf %lf %lf %d", &x, &y, &z, &cl);
bbox += SPoint3(x, y, z);
vertices[i + 1] = new MVertex(x, y, z);
}
}
......@@ -944,8 +936,6 @@ int GModel::readMESH(const std::string &name)
// store the vertices in their associated geometrical entity
storeVerticesInEntities(vertices);
boundingBox += bbox;
fclose(fp);
return 1;
}
......
......@@ -3,6 +3,7 @@
#include <stdio.h>
#include <algorithm>
#include "SPoint3.h"
class GEntity;
......@@ -39,6 +40,7 @@ class MVertex{
inline double & x() {return _x;}
inline double & y() {return _y;}
inline double & z() {return _z;}
inline SPoint3 point() { return SPoint3(_x, _y, _z); }
// get/set the parent entity
inline GEntity* onWhat() const {return _ge;}
......
// $Id: OpenFile.cpp,v 1.108 2006-08-12 18:10:25 geuzaine Exp $
// $Id: OpenFile.cpp,v 1.109 2006-08-12 18:27:47 geuzaine Exp $
//
// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
//
......@@ -142,10 +142,7 @@ void SetBoundingBox(void)
SBoundingBox3d bb;
bb = GMODEL->getBounds();
if(bb.empty())
bb = GMODEL->recomputeBounds();
bb = GMODEL->bounds();
if(bb.empty() && List_Nbr(CTX.post.list)) {
for(int i = 0; i < List_Nbr(CTX.post.list); i++){
......@@ -208,7 +205,6 @@ int ParseFile(char *f, int close, int warn_if_missing)
fclose(yyin);
GMODEL->import();
GMODEL->recomputeBounds();
strncpy(yyname, yyname_old, 255);
yyin = yyin_old;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment