Commit a9fe0b2b authored by Christophe Geuzaine's avatar Christophe Geuzaine

pp

parent fa27a98c
Pipeline #1378 failed with stage
in 21 minutes and 50 seconds
......@@ -664,8 +664,6 @@ void GEdge::discretize(double tol, std::vector<SPoint3> &dpts, std::vector<doubl
}
}
#if defined(HAVE_MESH)
static void meshCompound(GEdge* ge)
{
......@@ -673,16 +671,14 @@ static void meshCompound(GEdge* ge)
for (unsigned int i = 0; i < ge->_compound.size(); i++){
GEdge *c = (GEdge*)ge->_compound[i];
for (unsigned int j = 0; j<c->lines.size(); j++){
lines.push_back(new MLine(c->lines[j]->getVertex(0),c->lines[j]->getVertex(1)));
lines.push_back(new MLine(c->lines[j]->getVertex(0),
c->lines[j]->getVertex(1)));
}
}
// printf("%d lines %d curves in compound\n",lines.size(),ge->_compound.size());
discreteEdge *de = new discreteEdge(ge->model(), ge->tag() + 100000, NULL, NULL);
}
discreteEdge *de = new discreteEdge(ge->model(), ge->tag() + 100000, NULL, NULL);
ge->model()->add(de);
de->lines = lines;
de->createGeometry();
// printf("geometry done\n");
de->mesh(false);
ge->compound_edge = de;
}
......@@ -694,7 +690,7 @@ void GEdge::mesh(bool verbose)
meshGEdge mesher;
mesher(this);
if(_compound.size()){ // Some faces are meshed together
if(_compound[0] == this){ // I'm the one that makes the compound job
if(_compound[0] == this){ // I'm the one that makes the compound job
bool ok = true;
for(unsigned int i = 0; i < _compound.size(); i++){
GEdge *ge = (GEdge*)_compound[i];
......@@ -704,7 +700,6 @@ void GEdge::mesh(bool verbose)
meshStatistics.status = GEdge::PENDING;
}
else{
// printf("meshing compound\n");
meshCompound(this);
meshStatistics.status = GEdge::DONE;
return;
......
......@@ -215,11 +215,10 @@ class GEdge : public GEntity {
} meshStatistics;
std::vector<MLine*> lines;
/************************************************************************/
// when a compound of edges is created, both meshes should be kept alive
// this is due to Gmsh's flow and it only applies to model edges
// when a compound of edges is created, both meshes should be kept alive this
// is due to Gmsh's flow and it only applies to model edges
GEdge *compound_edge;
/************************************************************************/
void addLine(MLine *line){ lines.push_back(line); }
void addElement(int type, MElement *e);
......
......@@ -118,7 +118,7 @@ int GFace::delEdge(GEdge* edge)
pos++;
}
l_edges.erase(it);
std::list<int>::iterator itOri;
int posOri = 0;
int orientation = 0;
......@@ -130,7 +130,7 @@ int GFace::delEdge(GEdge* edge)
posOri++;
}
l_dirs.erase(itOri);
return orientation;
}
......@@ -1370,39 +1370,38 @@ static void meshCompound(GFace* gf, bool verbose)
c->mesh_vertices.end());
for (unsigned int j=0;j<c->triangles.size();j++){
triangles_tag.push_back(c);
for (int k=0;k<3;k++){
for (int k = 0; k < 3; k++){
SPoint2 param;
reparamMeshVertexOnFace(c->triangles[j]->getVertex(k), c, param);
triangles_uv.push_back (param);
triangles_uv.push_back(param);
}
}
c->triangles.clear();
c->mesh_vertices.clear();
}
df->createGeometry();
df->mesh(verbose);
for (int i=0;i<df->mesh_vertices.size();i++){
for (int i = 0; i < df->mesh_vertices.size(); i++){
double u,v;
df->mesh_vertices[i]->getParameter(0,u);
df->mesh_vertices[i]->getParameter(1,v);
df->mesh_vertices[i]->getParameter(0, u);
df->mesh_vertices[i]->getParameter(1, v);
double U,V;
int position = df->trianglePosition(u,v,U,V);
if (position != -1) {
int position = df->trianglePosition(u, v, U, V);
if(position != -1) {
triangles_tag[position]->mesh_vertices.push_back(df->mesh_vertices[i]);
df->mesh_vertices[i]->setEntity(triangles_tag[position]);
if (0 && triangles_tag[position]->geomType() != GEntity::DiscreteSurface){
SPoint2 p0 = triangles_uv[3*position + 0];
SPoint2 p1 = triangles_uv[3*position + 1];
SPoint2 p2 = triangles_uv[3*position + 2];
SPoint2 p = p0 *(1-U-V) + p1 * U + p2 * V;
SPoint2 p = p0 *(1-U-V) + p1 * U + p2 * V;
GPoint gp = triangles_tag[position]->point(p);
df->mesh_vertices[i]->setParameter(0,p.x());
df->mesh_vertices[i]->setParameter(1,p.y());
df->mesh_vertices[i]->x() = gp.x();
df->mesh_vertices[i]->y() = gp.y();
df->mesh_vertices[i]->x() = gp.x();
df->mesh_vertices[i]->y() = gp.y();
df->mesh_vertices[i]->z() = gp.z();
}
}
......@@ -1412,14 +1411,17 @@ static void meshCompound(GFace* gf, bool verbose)
}
}
for (int i=0;i<df->triangles.size();i++){
for (int i = 0; i < df->triangles.size(); i++){
MTriangle *t = df->triangles[i];
if (t->getVertex(0)->onWhat()->dim() == 2)((GFace*)t->getVertex(0)->onWhat())->triangles.push_back(t);
else if (t->getVertex(1)->onWhat()->dim() == 2)((GFace*)t->getVertex(1)->onWhat())->triangles.push_back(t);
else if (t->getVertex(2)->onWhat()->dim() == 2)((GFace*)t->getVertex(2)->onWhat())->triangles.push_back(t);
else gf->triangles.push_back(t); /// FIXME COULD BE BETTER !
}
// gf->triangles = df->triangles;
if (t->getVertex(0)->onWhat()->dim() == 2)
((GFace*)t->getVertex(0)->onWhat())->triangles.push_back(t);
else if (t->getVertex(1)->onWhat()->dim() == 2)
((GFace*)t->getVertex(1)->onWhat())->triangles.push_back(t);
else if (t->getVertex(2)->onWhat()->dim() == 2)
((GFace*)t->getVertex(2)->onWhat())->triangles.push_back(t);
else gf->triangles.push_back(t); // FIXME could be better!
}
// gf->triangles = df->triangles;
df->triangles.clear();
df->mesh_vertices.clear();
delete df;
......@@ -1432,7 +1434,7 @@ void GFace::mesh(bool verbose)
meshGFace mesher;
mesher(this, verbose);
if(_compound.size()){ // Some faces are meshed together
if(_compound[0] == this){ // I'm the one that makes the compound job
if(_compound[0] == this){ // I'm the one that makes the compound job
bool ok = true;
for(unsigned int i = 0; i < _compound.size(); i++){
GFace *gf = (GFace*)_compound[i];
......@@ -1479,10 +1481,7 @@ void GFace::replaceEdges(std::list<GEdge*> &new_edges)
void GFace::moveToValidRange(SPoint2 &pt) const
{
// printf("coucou %8d %12.5E %12.5E %d %d\n",
// tag(),pt.x(),pt.y(),
// periodic(0),periodic(1));
for(int i=0; i < 2; i++){
for(int i = 0; i < 2; i++){
if(periodic(i)){
Range<double> range = parBounds(i);
double tol = 1e-6*(range.high()-range.low());
......@@ -1622,7 +1621,8 @@ void GFace::setMeshMaster(GFace* master, const std::vector<double>& tfo)
"for periodic connection of surface %d to %d "
"using the specified transformation"
"Minimum distance is %g with a tolerance of %g",
m_vertex->tag(),master->tag(),tag(),dist_min, CTX::instance()->geom.tolerance * CTX::instance()->lc);
m_vertex->tag(), master->tag(), tag(), dist_min,
CTX::instance()->geom.tolerance * CTX::instance()->lc);
return;
}
gVertexCounterparts[l_vertex] = m_vertex;
......@@ -1647,7 +1647,7 @@ void GFace::setMeshMaster(GFace* master, const std::vector<double>& tfo)
std::pair<GVertex*,GVertex*> mPair(gVertexCounterparts[lPair.first],
gVertexCounterparts[lPair.second]);
int sign = 1;
int sign = 1;
std::map<std::pair<GVertex*,GVertex*>,GEdge*>::iterator mv2eIter = m_vtxToEdge.find(mPair);
if (mv2eIter == m_vtxToEdge.end()) {
sign *= -1;
......@@ -1702,6 +1702,7 @@ struct myPlane {
return n.x() * x + n.y() * y + n.z() * z + a;
}
};
struct myLine {
SPoint3 p;
SVector3 t;
......
......@@ -7,7 +7,7 @@
#include "MEdge.h"
#include "Numeric.h"
// FIXME
// FIXME
// remove that when MElementCut is removed
bool MEdge::isInside(MVertex *v) const
{
......@@ -64,15 +64,11 @@ bool MEdge::isInside(MVertex *v) const
return true;
}
bool SortEdgeConsecutive (const std::vector<MEdge> &e,
std::vector<std::vector<MVertex*> >&vs)
bool SortEdgeConsecutive(const std::vector<MEdge> &e,
std::vector<std::vector<MVertex*> >&vs)
{
// for (int i=0;i<e.size();i++)printf("%d %d -- ", e[i].getVertex(0)->getNum(),e[i].getVertex(1)->getNum());
// printf("\n");
if (e.empty())return true;
std::map<MVertex*, std::pair<MVertex*,MVertex*> > c;
if(e.empty()) return true;
std::map<MVertex*, std::pair<MVertex*, MVertex*> > c;
for (size_t i = 0; i<e.size();i++){
MVertex *v0 = e[i].getVertex(0);
MVertex *v1 = e[i].getVertex(1);
......@@ -85,7 +81,6 @@ bool SortEdgeConsecutive (const std::vector<MEdge> &e,
}
while (!c.empty()){
// printf("size of c is %d\n",c.size());
std::vector<MVertex*> v;
MVertex *start = NULL;
{
......@@ -95,16 +90,14 @@ bool SortEdgeConsecutive (const std::vector<MEdge> &e,
if (it->second.second == NULL){
start = it->first;
break;
}
}
}
}
std::map<MVertex*, std::pair<MVertex*,MVertex*> >::iterator it = c.find(start);
MVertex *prev = (it->second.second == start) ? it->second.first : it->second.second;
MVertex *current = start;
do {
// printf("%d %d\n",prev?prev->getNum():-1,current->getNum());
v.push_back(current);
// if (v.size() == e.size() + 1)break;
std::map<MVertex*, std::pair<MVertex*,MVertex*> >::iterator it = c.find(current);
c.erase(it);
MVertex *v1 = it->second.first;
......@@ -119,10 +112,9 @@ bool SortEdgeConsecutive (const std::vector<MEdge> &e,
if (current == start) {
v.push_back(current);
}
}while (current != start && current != NULL);
//printf("something discovered of size %d\n",v.size());
} while (current != start && current != NULL);
vs.push_back(v);
}
// printf("barlouf\n");
return true;
return true;
}
......@@ -39,7 +39,7 @@ class MEdge {
inline MVertex *getSortedVertex(const int i) const { return _v[int(_si[i])]; }
inline MVertex *getMinVertex() const { return _v[int(_si[0])]; }
inline MVertex *getMaxVertex() const { return _v[int(_si[1])]; }
inline int computeCorrespondence(MEdge& other) {
if (other.getVertex(0) == _v[0] && other.getVertex(1) == _v[1]) return 1;
else if (other.getVertex(0) == _v[1] && other.getVertex(1) == _v[0]) return -1;
......@@ -124,6 +124,7 @@ struct Less_Edge : public std::binary_function<MEdge, MEdge, bool> {
};
// assume a set of MEdge, give consecutive list of vertices
bool SortEdgeConsecutive (const std::vector<MEdge> &,
std::vector<std::vector<MVertex*> >&vs);
bool SortEdgeConsecutive(const std::vector<MEdge> &,
std::vector<std::vector<MVertex*> >&vs);
#endif
......@@ -25,14 +25,14 @@ discreteEdge::discreteEdge(GModel *model, int num, GVertex *_v0, GVertex *_v1)
CreateReversedCurve(c);
}
discreteEdge::~discreteEdge() {
discreteEdge::~discreteEdge()
{
for (unsigned int i=0 ; i<discrete_lines.size(); i++)delete discrete_lines[i];
for (unsigned int i=0 ; i<discrete_vertices.size(); i++)delete discrete_vertices[i];
discrete_lines.clear();
discrete_vertices.clear();
}
void discreteEdge::orderMLines()
{
size_t ss = lines.size();
......@@ -169,7 +169,7 @@ void discreteEdge::createGeometry()
}
}
}
std::vector<MLine*> _temp;
discrete_lines.resize(lines.size());
for (unsigned int i = 0; i < lines.size(); i++){
......
......@@ -32,7 +32,6 @@ class discreteEdge : public GEdge {
virtual void mesh(bool verbose) ;
void writeGEO(FILE *fp);
int minimumDrawSegments() const {return 2*_pars.size();}
// MVertex * getGeometricalVertex (MVertex *v);
};
#endif
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment