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

small fixes

parent c0321a5d
Branches
Tags
No related merge requests found
...@@ -77,18 +77,3 @@ std::string GEntity::getInfoString() ...@@ -77,18 +77,3 @@ std::string GEntity::getInfoString()
return out; return out;
} }
void GEntity::recomputeMeshPartitions()
{
for(unsigned int i = 0; i < getNumMeshElements(); i++) {
int part = getMeshElement(i)->getPartition();
if(part) model()->getMeshPartitions().insert(part);
}
}
void GEntity::deleteMeshPartitions()
{
for(unsigned int i = 0; i < getNumMeshElements(); i++)
getMeshElement(i)->setPartition(0);
}
...@@ -245,12 +245,6 @@ class GEntity { ...@@ -245,12 +245,6 @@ class GEntity {
// get the mesh vertex at the given index // get the mesh vertex at the given index
MVertex *getMeshVertex(unsigned int index) { return mesh_vertices[index]; } MVertex *getMeshVertex(unsigned int index) { return mesh_vertices[index]; }
// recompute the mesh partitions defined on this entity
void recomputeMeshPartitions();
// delete the mesh partitions defined on this entity
void deleteMeshPartitions();
}; };
class GEntityLessThan { class GEntityLessThan {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// See the LICENSE.txt file for license information. Please report all // See the LICENSE.txt file for license information. Please report all
// bugs and problems to <gmsh@geuz.org>. // bugs and problems to <gmsh@geuz.org>.
#include <string.h> #include <sstream>
#include "GModel.h" #include "GModel.h"
#include "MElement.h" #include "MElement.h"
#include "discreteRegion.h" #include "discreteRegion.h"
...@@ -463,6 +463,7 @@ MVertex *GModel::getMeshVertexByTag(int n) ...@@ -463,6 +463,7 @@ MVertex *GModel::getMeshVertexByTag(int n)
std::vector<GEntity*> entities; std::vector<GEntity*> entities;
getEntities(entities); getEntities(entities);
if(dense){ if(dense){
Msg::Debug("Good: we have a dense vertex numbering in the cache");
// numbering starts at 1 // numbering starts at 1
_vertexVectorCache.resize(MVertex::getGlobalNumber() + 1); _vertexVectorCache.resize(MVertex::getGlobalNumber() + 1);
for(unsigned int i = 0; i < entities.size(); i++) for(unsigned int i = 0; i < entities.size(); i++)
...@@ -593,8 +594,12 @@ void GModel::recomputeMeshPartitions() ...@@ -593,8 +594,12 @@ void GModel::recomputeMeshPartitions()
meshPartitions.clear(); meshPartitions.clear();
std::vector<GEntity*> entities; std::vector<GEntity*> entities;
getEntities(entities); getEntities(entities);
for(unsigned int i = 0; i < entities.size(); i++) for(unsigned int i = 0; i < entities.size(); i++){
entities[i]->recomputeMeshPartitions(); for(unsigned int j = 0; j < entities[i]->getNumMeshElements(); j++){
int part = entities[i]->getMeshElement(j)->getPartition();
if(part) meshPartitions.insert(part);
}
}
} }
void GModel::deleteMeshPartitions() void GModel::deleteMeshPartitions()
...@@ -602,7 +607,8 @@ void GModel::deleteMeshPartitions() ...@@ -602,7 +607,8 @@ void GModel::deleteMeshPartitions()
std::vector<GEntity*> entities; std::vector<GEntity*> entities;
getEntities(entities); getEntities(entities);
for(unsigned int i = 0; i < entities.size(); i++) for(unsigned int i = 0; i < entities.size(); i++)
entities[i]->deleteMeshPartitions(); for(unsigned int j = 0; j < entities[i]->getNumMeshElements(); j++)
entities[i]->getMeshElement(j)->setPartition(0);
meshPartitions.clear(); meshPartitions.clear();
} }
...@@ -658,22 +664,17 @@ void GModel::checkMeshCoherence() ...@@ -658,22 +664,17 @@ void GModel::checkMeshCoherence()
pos.insert(e); pos.insert(e);
} }
else{ else{
char temp[256], temp2[256]; std::ostringstream sstream;
sprintf(temp, "Element %d ( ", (*it)->getNum()); sstream << "Element " << e->getNum() << " [ ";
for (int k = 0; k < (*it)->getNumVertices(); k++){ for (int k = 0; k < e->getNumVertices(); k++)
sprintf(temp2, "%d ", (*it)->getVertex(k)->getNum()); sstream << e->getVertex(k)->getNum() << " ";
strcat(temp, temp2); sstream << "] on entity " << entities[i]->tag()
} << " has same barycenter as element " << (*it)->getNum()
sprintf(temp2, ") on entity %d has same barycenter as element %d ( ", << " [ ";
entities[i]->tag(), e->getNum()); for (int k = 0; k < (*it)->getNumVertices(); k++)
strcat(temp, temp2); sstream << (*it)->getVertex(k)->getNum() << " ";
for (int k = 0; k < e->getNumVertices(); k++){ sstream << "]";
sprintf(temp2, "%d ", e->getVertex(k)->getNum()); Msg::Info("%s", sstream.str().c_str());
strcat(temp, temp2);
}
sprintf(temp2, ")");
strcat(temp, temp2);
Msg::Info("%s", temp);
num++; num++;
} }
} }
......
...@@ -76,7 +76,7 @@ static bool getVertices(int num, int *indices, std::vector<MVertex*> &vec, ...@@ -76,7 +76,7 @@ static bool getVertices(int num, int *indices, std::vector<MVertex*> &vec,
static void createElementMSH(GModel *m, int num, int type, int physical, static void createElementMSH(GModel *m, int num, int type, int physical,
int reg, int part, std::vector<MVertex*> &v, int reg, int part, std::vector<MVertex*> &v,
std::map<int, std::vector<MElement*> > elements[7], std::map<int, std::vector<MElement*> > elements[8],
std::map<int, std::map<int, std::string> > physicals[4]) std::map<int, std::map<int, std::string> > physicals[4])
{ {
MElementFactory factory; MElementFactory factory;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment