From 09f471e5fc5547cb441ffa6032573e6c8cb02e79 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Thu, 18 Nov 2004 23:42:19 +0000 Subject: [PATCH] New "fast" routine to create simplices used only for visualization. This speeds up the load time of large tetrahedral (volume) meshes by roughly 50%, and brings Read_Mesh.cpp pretty close to mshsort.cpp performance-wise. Since Read_Mesh does many more things (all the Tree/List queries to create elementary/physical entites + partitions), this is actually pretty good. Loading a 1.4 million tets mesh file on my 1.5 GHz Linux machine now takes about 17 seconds. --- Mesh/Read_Mesh.cpp | 8 ++++---- Mesh/Simplex.cpp | 15 ++++++++++++--- Mesh/Simplex.h | 1 + 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Mesh/Read_Mesh.cpp b/Mesh/Read_Mesh.cpp index b89df5350d..4f83b8617b 100644 --- a/Mesh/Read_Mesh.cpp +++ b/Mesh/Read_Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: Read_Mesh.cpp,v 1.78 2004-10-08 02:41:20 geuzaine Exp $ +// $Id: Read_Mesh.cpp,v 1.79 2004-11-18 23:42:19 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -306,7 +306,7 @@ void Read_Mesh_MSH(Mesh * M, FILE * fp) case LGN2: c = addElementaryCurve(M, abs(Elementary)); addPhysicalGroup(M, MSH_PHYSICAL_LINE, Physical, abs(Elementary)); - simp = Create_Simplex(vertsp[0], vertsp[1], NULL, NULL); + simp = Create_Simplex_Fast(vertsp[0], vertsp[1], NULL, NULL); simp->Num = Num; simp->iEnt = Elementary; simp->iPart = Add_MeshPartition(Partition, M); @@ -324,7 +324,7 @@ void Read_Mesh_MSH(Mesh * M, FILE * fp) case TRI2: s = addElementarySurface(M, Elementary); addPhysicalGroup(M, MSH_PHYSICAL_SURFACE, Physical, Elementary); - simp = Create_Simplex(vertsp[0], vertsp[1], vertsp[2], NULL); + simp = Create_Simplex_Fast(vertsp[0], vertsp[1], vertsp[2], NULL); simp->Num = Num; simp->iEnt = Elementary; simp->iPart = Add_MeshPartition(Partition, M); @@ -364,7 +364,7 @@ void Read_Mesh_MSH(Mesh * M, FILE * fp) case TET2: v = addElementaryVolume(M, Elementary); addPhysicalGroup(M, MSH_PHYSICAL_VOLUME, Physical, Elementary); - simp = Create_Simplex(vertsp[0], vertsp[1], vertsp[2], vertsp[3]); + simp = Create_Simplex_Fast(vertsp[0], vertsp[1], vertsp[2], vertsp[3]); simp->Num = Num; simp->iEnt = Elementary; simp->iPart = Add_MeshPartition(Partition, M); diff --git a/Mesh/Simplex.cpp b/Mesh/Simplex.cpp index f819d0dfa0..8d8c578342 100644 --- a/Mesh/Simplex.cpp +++ b/Mesh/Simplex.cpp @@ -1,4 +1,4 @@ -// $Id: Simplex.cpp,v 1.34 2004-07-21 22:19:56 geuzaine Exp $ +// $Id: Simplex.cpp,v 1.35 2004-11-18 23:42:19 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -357,9 +357,18 @@ void Simplex::Fourre_Simplexe(Vertex * v1, Vertex * v2, Vertex * v3, Simplex *Create_Simplex(Vertex * v1, Vertex * v2, Vertex * v3, Vertex * v4) { - Simplex *s; + return new Simplex(v1, v2, v3, v4); +} - s = new Simplex(v1, v2, v3, v4); +Simplex *Create_Simplex_Fast(Vertex * v1, Vertex * v2, Vertex * v3, Vertex * v4) +{ + // bypasses Fourre_Simplex (use for visualization only!) + Simplex *s = new Simplex(); + s->V[0] = v1; + s->V[1] = v2; + s->V[2] = v3; + s->V[3] = v4; + s->VSUP = NULL; return s; } diff --git a/Mesh/Simplex.h b/Mesh/Simplex.h index 167e4ba814..bc7baa00dc 100644 --- a/Mesh/Simplex.h +++ b/Mesh/Simplex.h @@ -68,6 +68,7 @@ int compareSimplex(const void *a, const void *b); int compareFace (const void *a, const void *b); Simplex *Create_Simplex (Vertex *v1, Vertex *v2, Vertex *v3, Vertex *v4); +Simplex *Create_Simplex_Fast (Vertex *v1, Vertex *v2, Vertex *v3, Vertex *v4); void Free_Simplex (void *a, void *b); -- GitLab