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

tests

parent 4d6d41c7
No related branches found
No related tags found
No related merge requests found
...@@ -837,7 +837,9 @@ void GetOptions(int argc, char *argv[]) ...@@ -837,7 +837,9 @@ void GetOptions(int argc, char *argv[])
CTX::instance()->mesh.algo2d = ALGO_2D_FRONTAL; CTX::instance()->mesh.algo2d = ALGO_2D_FRONTAL;
else if(!strncmp(argv[i], "bamg",4)) else if(!strncmp(argv[i], "bamg",4))
CTX::instance()->mesh.algo2d = ALGO_2D_BAMG; CTX::instance()->mesh.algo2d = ALGO_2D_BAMG;
else if(!strncmp(argv[i], "del3d", 5) || !strncmp(argv[i], "tetgen", 6)) else if(!strncmp(argv[i], "del3d", 5))
CTX::instance()->mesh.algo3d = ALGO_3D_DELAUNAY_NEW;
else if(!strncmp(argv[i], "tetgen", 6))
CTX::instance()->mesh.algo3d = ALGO_3D_DELAUNAY; CTX::instance()->mesh.algo3d = ALGO_3D_DELAUNAY;
else if(!strncmp(argv[i], "front3d", 7) || !strncmp(argv[i], "netgen", 6)) else if(!strncmp(argv[i], "front3d", 7) || !strncmp(argv[i], "netgen", 6))
CTX::instance()->mesh.algo3d = ALGO_3D_FRONTAL; CTX::instance()->mesh.algo3d = ALGO_3D_FRONTAL;
......
...@@ -144,7 +144,8 @@ void getBoundingInfoAndSplitQuads(GRegion *gr, ...@@ -144,7 +144,8 @@ void getBoundingInfoAndSplitQuads(GRegion *gr,
for (unsigned int i=0;i<gr->getNumMeshElements();i++){ for (unsigned int i=0;i<gr->getNumMeshElements();i++){
MElement *e = gr->getMeshElement(i); MElement *e = gr->getMeshElement(i);
for (int j = 0; j < e->getNumFaces(); j++){ for (int j = 0; j < e->getNumFaces(); j++){
std::map<MFace, GEntity*, Less_Face>::iterator it = allBoundingFaces_temp.find(e->getFace(j)); std::map<MFace, GEntity*, Less_Face>::iterator it =
allBoundingFaces_temp.find(e->getFace(j));
if (it == allBoundingFaces_temp.end()) allBoundingFaces_temp[e->getFace(j)] = gr; if (it == allBoundingFaces_temp.end()) allBoundingFaces_temp[e->getFace(j)] = gr;
else allBoundingFaces_temp.erase(it); else allBoundingFaces_temp.erase(it);
} }
...@@ -162,7 +163,8 @@ void getBoundingInfoAndSplitQuads(GRegion *gr, ...@@ -162,7 +163,8 @@ void getBoundingInfoAndSplitQuads(GRegion *gr,
MVertex *v3 = f.getVertex(3); MVertex *v3 = f.getVertex(3);
MVertex *newv = new MVertex((v0->x() + v1->x() + v2->x() + v3->x())*0.25, MVertex *newv = new MVertex((v0->x() + v1->x() + v2->x() + v3->x())*0.25,
(v0->y() + v1->y() + v2->y() + v3->y())*0.25, (v0->y() + v1->y() + v2->y() + v3->y())*0.25,
(v0->z() + v1->z() + v2->z() + v3->z())*0.25,itx->second); (v0->z() + v1->z() + v2->z() + v3->z())*0.25,
itx->second);
sqr.add(f,newv,itx->second); sqr.add(f,newv,itx->second);
sqr._invmap[f] = newv; sqr._invmap[f] = newv;
allBoundingFaces[MFace(v0,v1,newv)] = itx->second; allBoundingFaces[MFace(v0,v1,newv)] = itx->second;
...@@ -539,7 +541,8 @@ void MeshDelaunayVolumeTetgen(std::vector<GRegion*> &regions) ...@@ -539,7 +541,8 @@ void MeshDelaunayVolumeTetgen(std::vector<GRegion*> &regions)
refineMeshMMG(gr); refineMeshMMG(gr);
} }
else{ else{
int nbvertices_filler = (old_algo_hexa()) ? Filler::get_nbr_new_vertices() : Filler3D::get_nbr_new_vertices(); int nbvertices_filler = (old_algo_hexa()) ?
Filler::get_nbr_new_vertices() : Filler3D::get_nbr_new_vertices();
if(!nbvertices_filler && !LpSmoother::get_nbr_interior_vertices()){ if(!nbvertices_filler && !LpSmoother::get_nbr_interior_vertices()){
insertVerticesInRegion(gr,2000000000,true); insertVerticesInRegion(gr,2000000000,true);
} }
...@@ -580,8 +583,13 @@ static void MeshDelaunayVolumeNewCode(std::vector<GRegion*> &regions) ...@@ -580,8 +583,13 @@ static void MeshDelaunayVolumeNewCode(std::vector<GRegion*> &regions)
meshGRegionBoundaryRecovery(gr); meshGRegionBoundaryRecovery(gr);
} }
catch(int err){ catch(int err){
if(err == 3){
Msg::Warning("Self-intersecting surface mesh: TODO!");
}
else{
Msg::Error("Could not recover boundary: error %d", err); Msg::Error("Could not recover boundary: error %d", err);
} }
}
// sort triangles in all model faces in order to be able to search in vectors // sort triangles in all model faces in order to be able to search in vectors
std::list<GFace*>::iterator itf = allFaces.begin(); std::list<GFace*>::iterator itf = allFaces.begin();
...@@ -594,6 +602,10 @@ static void MeshDelaunayVolumeNewCode(std::vector<GRegion*> &regions) ...@@ -594,6 +602,10 @@ static void MeshDelaunayVolumeNewCode(std::vector<GRegion*> &regions)
// restore the initial set of faces // restore the initial set of faces
gr->set(faces); gr->set(faces);
// now do insertion of points
#if 0
insertVerticesInRegion(gr, 2000000000, true);
#else
void edgeBasedRefinement(const int numThreads, void edgeBasedRefinement(const int numThreads,
const int nptsatonce, const int nptsatonce,
GRegion *gr); GRegion *gr);
...@@ -604,9 +616,9 @@ static void MeshDelaunayVolumeNewCode(std::vector<GRegion*> &regions) ...@@ -604,9 +616,9 @@ static void MeshDelaunayVolumeNewCode(std::vector<GRegion*> &regions)
edgeBasedRefinement(1, 1, regions[i]); edgeBasedRefinement(1, 1, regions[i]);
} }
// RelocateVertices (regions,-1); // RelocateVertices (regions,-1);
#endif
} }
void MeshDelaunayVolume(std::vector<GRegion*> &regions) void MeshDelaunayVolume(std::vector<GRegion*> &regions)
{ {
if(regions.empty()) return; if(regions.empty()) return;
......
...@@ -212,7 +212,8 @@ bool tetgenmesh::reconstructmesh(void *p) ...@@ -212,7 +212,8 @@ bool tetgenmesh::reconstructmesh(void *p)
if (ori > 0.0) { if (ori > 0.0) {
// Swap the first two vertices. // Swap the first two vertices.
q[0] = p[0]; p[0] = p[1]; p[1] = q[0]; q[0] = p[0]; p[0] = p[1]; p[1] = q[0];
} else if (ori == 0.0) { }
else if (ori == 0.0) {
if (!b->quiet) { if (!b->quiet) {
printf("Warning: Tet #%d is degenerate.\n", i + in->firstnumber); printf("Warning: Tet #%d is degenerate.\n", i + in->firstnumber);
} }
...@@ -419,7 +420,8 @@ bool tetgenmesh::reconstructmesh(void *p) ...@@ -419,7 +420,8 @@ bool tetgenmesh::reconstructmesh(void *p)
if (checkpt == p[1]) { if (checkpt == p[1]) {
searchsh = shperverlist[j]; searchsh = shperverlist[j];
break; // Found. break; // Found.
} else { }
else {
checkpt = sapex(shperverlist[j]); checkpt = sapex(shperverlist[j]);
if (checkpt == p[1]) { if (checkpt == p[1]) {
senext2(shperverlist[j], searchsh); senext2(shperverlist[j], searchsh);
...@@ -434,7 +436,8 @@ bool tetgenmesh::reconstructmesh(void *p) ...@@ -434,7 +436,8 @@ bool tetgenmesh::reconstructmesh(void *p)
if (checkseg.sh != NULL) { if (checkseg.sh != NULL) {
// This segment already exist. // This segment already exist.
newseg = checkseg; newseg = checkseg;
} else { }
else {
// Create a new segment at this edge. // Create a new segment at this edge.
makeshellface(subsegs, &newseg); makeshellface(subsegs, &newseg);
setshvertices(newseg, p[0], p[1], NULL); setshvertices(newseg, p[0], p[1], NULL);
...@@ -444,7 +447,8 @@ bool tetgenmesh::reconstructmesh(void *p) ...@@ -444,7 +447,8 @@ bool tetgenmesh::reconstructmesh(void *p)
ssbond(neighsh, newseg); ssbond(neighsh, newseg);
} }
} }
} else { }
else {
// It is a dangling segment (not belong to any facets). // It is a dangling segment (not belong to any facets).
// Check if segment [p[0],p[1]] already exists. // Check if segment [p[0],p[1]] already exists.
// TODO: Change the brute-force search. Slow! // TODO: Change the brute-force search. Slow!
...@@ -661,7 +665,8 @@ bool tetgenmesh::reconstructmesh(void *p) ...@@ -661,7 +665,8 @@ bool tetgenmesh::reconstructmesh(void *p)
_gr->mesh_vertices.push_back(v); _gr->mesh_vertices.push_back(v);
_vertices.push_back(v); _vertices.push_back(v);
} }
} else if (pointtype(pointloop) == FREEFACETVERTEX) { }
else if (pointtype(pointloop) == FREEFACETVERTEX) {
sdecode(point2sh(pointloop), parentsh); sdecode(point2sh(pointloop), parentsh);
assert(parentsh.sh != NULL); assert(parentsh.sh != NULL);
l_faces.insert(shellmark(parentsh)); l_faces.insert(shellmark(parentsh));
...@@ -686,14 +691,16 @@ bool tetgenmesh::reconstructmesh(void *p) ...@@ -686,14 +691,16 @@ bool tetgenmesh::reconstructmesh(void *p)
v->setIndex(pointmark(pointloop)); v->setIndex(pointmark(pointloop));
_gr->mesh_vertices.push_back(v); _gr->mesh_vertices.push_back(v);
_vertices.push_back(v); _vertices.push_back(v);
} else { }
else {
// Create a mesh vertex. // Create a mesh vertex.
MVertex *v = new MVertex(pointloop[0], pointloop[1], pointloop[2], _gr); MVertex *v = new MVertex(pointloop[0], pointloop[1], pointloop[2], _gr);
v->setIndex(pointmark(pointloop)); v->setIndex(pointmark(pointloop));
_gr->mesh_vertices.push_back(v); _gr->mesh_vertices.push_back(v);
_vertices.push_back(v); _vertices.push_back(v);
} }
} else { }
else {
MVertex *v = new MVertex(pointloop[0], pointloop[1], pointloop[2], _gr); MVertex *v = new MVertex(pointloop[0], pointloop[1], pointloop[2], _gr);
v->setIndex(pointmark(pointloop)); v->setIndex(pointmark(pointloop));
_gr->mesh_vertices.push_back(v); _gr->mesh_vertices.push_back(v);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment