mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-26 05:50:32 +05:00
more ParallelFor in update topology
This commit is contained in:
parent
e009a8b687
commit
a7b413944d
@ -282,7 +282,7 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MeshTopology :: Update(TaskManager tm)
|
void MeshTopology :: Update (TaskManager tm)
|
||||||
{
|
{
|
||||||
static int timer = NgProfiler::CreateTimer ("topology");
|
static int timer = NgProfiler::CreateTimer ("topology");
|
||||||
NgProfiler::RegionTimer reg (timer);
|
NgProfiler::RegionTimer reg (timer);
|
||||||
@ -546,10 +546,6 @@ namespace netgen
|
|||||||
if (edge.I1() != i) continue;
|
if (edge.I1() != i) continue;
|
||||||
|
|
||||||
int edgenum = edgenr[edge.I2()];
|
int edgenum = edgenr[edge.I2()];
|
||||||
/*
|
|
||||||
if (edgedir) edgenum *= -1;
|
|
||||||
edges[elnr][k] = edgenum;
|
|
||||||
*/
|
|
||||||
edges[elnr][k].nr = edgenum-1;
|
edges[elnr][k].nr = edgenum-1;
|
||||||
edges[elnr][k].orient = edgedir;
|
edges[elnr][k].orient = edgedir;
|
||||||
}
|
}
|
||||||
@ -573,8 +569,6 @@ namespace netgen
|
|||||||
if (edge.I1() != i) continue;
|
if (edge.I1() != i) continue;
|
||||||
|
|
||||||
int edgenum = edgenr[edge.I2()];
|
int edgenum = edgenr[edge.I2()];
|
||||||
// if (edgedir) edgenum *= -1;
|
|
||||||
// surfedges.Elem(elnr)[k] = edgenum;
|
|
||||||
surfedges[elnr][k].nr = edgenum-1;
|
surfedges[elnr][k].nr = edgenum-1;
|
||||||
surfedges[elnr][k].orient = edgedir;
|
surfedges[elnr][k].orient = edgedir;
|
||||||
}
|
}
|
||||||
@ -593,10 +587,6 @@ namespace netgen
|
|||||||
if (edge.I1() != i) continue;
|
if (edge.I1() != i) continue;
|
||||||
|
|
||||||
int edgenum = edgenr[edge.I2()];
|
int edgenum = edgenr[edge.I2()];
|
||||||
/*
|
|
||||||
if (edgedir) edgenum *= -1;
|
|
||||||
segedges.Elem(elnr) = edgenum;
|
|
||||||
*/
|
|
||||||
segedges[elnr].nr = edgenum-1;
|
segedges[elnr].nr = edgenum-1;
|
||||||
segedges[elnr].orient = edgedir;
|
segedges[elnr].orient = edgedir;
|
||||||
}
|
}
|
||||||
@ -690,7 +680,6 @@ namespace netgen
|
|||||||
});
|
});
|
||||||
cnt[v] = cnti;
|
cnt[v] = cnti;
|
||||||
}
|
}
|
||||||
cout << "myrange = " << begin << " - " << end << endl;
|
|
||||||
} );
|
} );
|
||||||
NgProfiler::StopTimer (timer2b1);
|
NgProfiler::StopTimer (timer2b1);
|
||||||
|
|
||||||
@ -704,70 +693,78 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
face2vert.SetSize(nfa);
|
face2vert.SetSize(nfa);
|
||||||
|
|
||||||
for (auto v : mesh.Points().Range())
|
// for (auto v : mesh.Points().Range())
|
||||||
{
|
|
||||||
int first_fa = cnt[v];
|
|
||||||
int nfa = first_fa;
|
|
||||||
vert2face.DeleteData();
|
|
||||||
|
|
||||||
for (int j = 0; j < vert2oldface[v].Size(); j++)
|
|
||||||
{
|
|
||||||
int fnr = vert2oldface[v][j];
|
|
||||||
INDEX_3 face (face2vert[fnr].I1(),
|
|
||||||
face2vert[fnr].I2(),
|
|
||||||
face2vert[fnr].I3());
|
|
||||||
vert2face.Set (face, fnr);
|
|
||||||
}
|
|
||||||
|
|
||||||
LoopOverFaces (mesh, *this, v,
|
|
||||||
[&] (INDEX_4 i4, int elnr, int j, bool volume, int facedir)
|
|
||||||
{
|
|
||||||
INDEX_3 face(i4.I1(), i4.I2(), i4.I3());
|
|
||||||
if (!vert2face.Used (face))
|
|
||||||
{
|
|
||||||
face2vert[nfa] = i4;
|
|
||||||
vert2face.Set (face, nfa);
|
|
||||||
nfa++;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
ParallelForRange
|
||||||
QuickSort (face2vert.Range(first_fa, nfa));
|
(tm, mesh.Points().Size(),
|
||||||
|
[&] (size_t begin, size_t end)
|
||||||
for (int j = first_fa; j < nfa; j++)
|
{
|
||||||
{
|
INDEX_3_CLOSED_HASHTABLE<int> vert2face(2*max_face_on_vertex+10);
|
||||||
if (face2vert[j][0] == v)
|
for (PointIndex v = begin+PointIndex::BASE;
|
||||||
{
|
v < end+PointIndex::BASE; v++)
|
||||||
INDEX_3 face (face2vert[j].I1(),
|
{
|
||||||
face2vert[j].I2(),
|
int first_fa = cnt[v];
|
||||||
face2vert[j].I3());
|
int nfa = first_fa;
|
||||||
vert2face.Set (face, j);
|
vert2face.DeleteData();
|
||||||
}
|
|
||||||
else
|
for (int j = 0; j < vert2oldface[v].Size(); j++)
|
||||||
break;
|
{
|
||||||
}
|
int fnr = vert2oldface[v][j];
|
||||||
|
INDEX_3 face (face2vert[fnr].I1(),
|
||||||
|
face2vert[fnr].I2(),
|
||||||
LoopOverFaces (mesh, *this, v,
|
face2vert[fnr].I3());
|
||||||
[&] (INDEX_4 i4, int elnr, int j, bool volume, int facedir)
|
vert2face.Set (face, fnr);
|
||||||
{
|
}
|
||||||
INDEX_3 face(i4.I1(), i4.I2(), i4.I3());
|
|
||||||
int facenum = vert2face.Get(face);
|
LoopOverFaces (mesh, *this, v,
|
||||||
if (volume)
|
[&] (INDEX_4 i4, int elnr, int j, bool volume, int facedir)
|
||||||
{
|
{
|
||||||
faces[elnr][j].fnr = facenum;
|
INDEX_3 face(i4.I1(), i4.I2(), i4.I3());
|
||||||
faces[elnr][j].forient = facedir;
|
if (!vert2face.Used (face))
|
||||||
}
|
{
|
||||||
else
|
face2vert[nfa] = i4;
|
||||||
{
|
vert2face.Set (face, nfa);
|
||||||
surffaces[elnr].fnr = facenum;
|
nfa++;
|
||||||
surffaces[elnr].forient = facedir;
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
QuickSort (face2vert.Range(first_fa, nfa));
|
||||||
/*
|
|
||||||
int oldnfa = face2vert.Size();
|
for (int j = first_fa; j < nfa; j++)
|
||||||
|
{
|
||||||
|
if (face2vert[j][0] == v)
|
||||||
|
{
|
||||||
|
INDEX_3 face (face2vert[j].I1(),
|
||||||
|
face2vert[j].I2(),
|
||||||
|
face2vert[j].I3());
|
||||||
|
vert2face.Set (face, j);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LoopOverFaces (mesh, *this, v,
|
||||||
|
[&] (INDEX_4 i4, int elnr, int j, bool volume, int facedir)
|
||||||
|
{
|
||||||
|
INDEX_3 face(i4.I1(), i4.I2(), i4.I3());
|
||||||
|
int facenum = vert2face.Get(face);
|
||||||
|
if (volume)
|
||||||
|
{
|
||||||
|
faces[elnr][j].fnr = facenum;
|
||||||
|
faces[elnr][j].forient = facedir;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
surffaces[elnr].fnr = facenum;
|
||||||
|
surffaces[elnr].forient = facedir;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/*
|
||||||
|
int oldnfa = face2vert.Size();
|
||||||
int nfa = oldnfa;
|
int nfa = oldnfa;
|
||||||
INDEX_3_CLOSED_HASHTABLE<int> vert2face(2*max_face_on_vertex+10);
|
INDEX_3_CLOSED_HASHTABLE<int> vert2face(2*max_face_on_vertex+10);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user