Skip to content
Snippets Groups Projects
Commit 816efb60 authored by Célestin Marot's avatar Célestin Marot
Browse files

add single thread method

parent 30f8db29
No related branches found
No related tags found
No related merge requests found
...@@ -248,10 +248,12 @@ static HXTStatus Hxt2Gmsh(std::vector<GRegion *> &regions, HXTMesh *m, ...@@ -248,10 +248,12 @@ static HXTStatus Hxt2Gmsh(std::vector<GRegion *> &regions, HXTMesh *m,
HXT_CHECK( hxtAlignedFree(&m->triangles.node) ); HXT_CHECK( hxtAlignedFree(&m->triangles.node) );
HXT_CHECK( hxtAlignedFree(&m->triangles.color) ); HXT_CHECK( hxtAlignedFree(&m->triangles.color) );
#if defined(_OPENMP)
int nthreads = omp_get_max_threads();
if(nthreads > 1) {
const uint32_t nR = regions.size(); const uint32_t nR = regions.size();
const uint32_t nV = m->vertices.num; const uint32_t nV = m->vertices.num;
int nthreads = omp_get_max_threads();
size_t* ht_all, *ht_tot; // histograms for tets size_t* ht_all, *ht_tot; // histograms for tets
HXT_CHECK( hxtCalloc(&ht_all, nR * (nthreads + 1), sizeof(size_t)) ); HXT_CHECK( hxtCalloc(&ht_all, nR * (nthreads + 1), sizeof(size_t)) );
uint32_t* hp_all, *hp_tot; // histograms for points uint32_t* hp_all, *hp_tot; // histograms for points
...@@ -354,6 +356,34 @@ static HXTStatus Hxt2Gmsh(std::vector<GRegion *> &regions, HXTMesh *m, ...@@ -354,6 +356,34 @@ static HXTStatus Hxt2Gmsh(std::vector<GRegion *> &regions, HXTMesh *m,
HXT_CHECK( hxtFree(&ht_all) ); HXT_CHECK( hxtFree(&ht_all) );
HXT_CHECK( hxtFree(&hp_all) ); HXT_CHECK( hxtFree(&hp_all) );
}
else
#endif
{
for(size_t i = 0; i < m->tetrahedra.num; i++) {
uint16_t c = m->tetrahedra.color[i];
if(c >= regions.size())
continue;
GRegion *gr = regions[c];
MVertex *vv[4];
uint32_t *nodes = &m->tetrahedra.node[4 * i];
for(int j = 0; j < 4; j++) {
if(c2v[nodes[j]]){
vv[j] = c2v[nodes[j]];
continue;
}
double *x = &m->vertices.coord[4 * nodes[j]];
vv[j] = new MVertex(x[0], x[1], x[2], gr);
gr->mesh_vertices.push_back(vv[j]);
c2v[nodes[j]] = vv[j];
}
gr->tetrahedra.push_back(new MTetrahedron(vv[0], vv[1], vv[2], vv[3]));
}
}
Msg::Debug("End Hxt2Gmsh"); Msg::Debug("End Hxt2Gmsh");
return HXT_STATUS_OK; return HXT_STATUS_OK;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment