TABLE -> Table

This commit is contained in:
Matthias Hochsteger 2021-05-11 18:21:40 +02:00
parent 0cc25359c2
commit 99e001fc4c
4 changed files with 22 additions and 36 deletions

View File

@ -271,18 +271,18 @@ template <> NGX_INLINE DLL_HEADER const Ng_Node<0> Ngx_Mesh :: GetNode<0> (int v
node.elements.ne = ia.Size(); node.elements.ne = ia.Size();
node.elements.ptr = (int*)&ia[0]; node.elements.ptr = (int*)&ia[0];
NgFlatArray<SegmentIndex> bia = mesh->GetTopology().GetVertexSegments(vnr); auto bia = mesh->GetTopology().GetVertexSegments(vnr);
node.bnd_elements.ne = bia.Size(); node.bnd_elements.ne = bia.Size();
node.bnd_elements.ptr = (int*)&bia[0]; node.bnd_elements.ptr = (int*)&bia[0];
break; break;
} }
case 1: case 1:
{ {
NgFlatArray<SegmentIndex> ia = mesh->GetTopology().GetVertexSegments(vnr); auto ia = mesh->GetTopology().GetVertexSegments(vnr);
node.elements.ne = ia.Size(); node.elements.ne = ia.Size();
node.elements.ptr = (int*)&ia[0]; node.elements.ptr = (int*)&ia[0];
NgFlatArray<int> bia = mesh->GetTopology().GetVertexPointElements(vnr); auto bia = mesh->GetTopology().GetVertexPointElements(vnr);
node.bnd_elements.ne = bia.Size(); node.bnd_elements.ne = bia.Size();
node.bnd_elements.ptr = (int*)&bia[0]; node.bnd_elements.ptr = (int*)&bia[0];
break; break;

View File

@ -1653,7 +1653,7 @@ void Ng_GetVertexElements (int vnr, int * els)
} }
case 1: case 1:
{ {
NgFlatArray<SegmentIndex> ia = mesh->GetTopology().GetVertexSegments(vnr); auto ia = mesh->GetTopology().GetVertexSegments(vnr);
for (int i = 0; i < ia.Size(); i++) els[i] = ia[i]+1; for (int i = 0; i < ia.Size(); i++) els[i] = ia[i]+1;
break; break;
/* /*

View File

@ -408,36 +408,22 @@ namespace netgen
vert2element = mesh->CreatePoint2ElementTable(); vert2element = mesh->CreatePoint2ElementTable();
vert2surfelement = mesh->CreatePoint2SurfaceElementTable(0); vert2surfelement = mesh->CreatePoint2SurfaceElementTable(0);
cnt = 0; vert2segment = ngcore::CreateSortedTable<SegmentIndex, PointIndex>( mesh->LineSegments().Range(),
for (SegmentIndex si = 0; si < nseg; si++) [&](auto & table, SegmentIndex segi)
{ {
const Segment & seg = mesh->LineSegment(si); const Segment & seg = (*mesh)[segi];
cnt[seg[0]]++; table.Add (seg[0], segi);
cnt[seg[1]]++; table.Add (seg[1], segi);
} }, np);
vert2segment = TABLE<SegmentIndex,PointIndex::BASE> (cnt); vert2pointelement = ngcore::CreateSortedTable<int, PointIndex>( mesh->pointelements.Range(),
for (SegmentIndex si = 0; si < nseg; si++) [&](auto & table, int pei)
{ {
const Segment & seg = mesh->LineSegment(si); const Element0d & pointel = mesh->pointelements[pei];
vert2segment.AddSave (seg[0], si); table.Add(pointel.pnum, pei);
vert2segment.AddSave (seg[1], si); }, np);
}
cnt = 0;
for (int pei = 0; pei < mesh->pointelements.Size(); pei++)
{
const Element0d & pointel = mesh->pointelements[pei];
cnt[pointel.pnum]++;
}
vert2pointelement = TABLE<int,PointIndex::BASE> (cnt);
for (int pei = 0; pei < mesh->pointelements.Size(); pei++)
{
const Element0d & pointel = mesh->pointelements[pei];
vert2pointelement.AddSave (pointel.pnum, pei);
}
(*tracer) ("Topology::Update setup tables", true); (*tracer) ("Topology::Update setup tables", true);

View File

@ -67,8 +67,8 @@ class MeshTopology
Array<SegmentIndex> edge2segment; Array<SegmentIndex> edge2segment;
Table<ElementIndex, PointIndex> vert2element; Table<ElementIndex, PointIndex> vert2element;
Table<SurfaceElementIndex, PointIndex> vert2surfelement; Table<SurfaceElementIndex, PointIndex> vert2surfelement;
TABLE<SegmentIndex,PointIndex::BASE> vert2segment; Table<SegmentIndex,PointIndex> vert2segment;
TABLE<int,PointIndex::BASE> vert2pointelement; Table<int,PointIndex> vert2pointelement;
int timestamp; int timestamp;
public: public:
int GetNSurfedges() const {return surfedges.Size();} int GetNSurfedges() const {return surfedges.Size();}
@ -183,10 +183,10 @@ public:
FlatArray<SurfaceElementIndex> GetVertexSurfaceElements(PointIndex vnr) const FlatArray<SurfaceElementIndex> GetVertexSurfaceElements(PointIndex vnr) const
{ return vert2surfelement[vnr]; } { return vert2surfelement[vnr]; }
NgFlatArray<SegmentIndex> GetVertexSegments (int vnr) const FlatArray<SegmentIndex> GetVertexSegments (int vnr) const
{ return vert2segment[vnr]; } { return vert2segment[vnr]; }
NgFlatArray<int> GetVertexPointElements (int vnr) const FlatArray<int> GetVertexPointElements (int vnr) const
{ return vert2pointelement[vnr]; } { return vert2pointelement[vnr]; }
int GetVerticesEdge ( int v1, int v2) const; int GetVerticesEdge ( int v1, int v2) const;