Topology: use non-copying access functions, take care of 0/1 - based indexing

This commit is contained in:
Joachim Schoeberl 2022-04-21 12:28:56 +02:00
parent 6fd99a5a29
commit 0605097bdc
2 changed files with 28 additions and 2 deletions

View File

@ -1483,6 +1483,7 @@ namespace netgen
(ne,
[&] (IntRange r)
{
/*
NgArray<int> hfaces;
for (ElementIndex ei : r)
{
@ -1490,6 +1491,11 @@ namespace netgen
for (auto f : hfaces)
AsAtomic(face_els[f-1])++;
}
*/
for (ElementIndex ei : r)
for (auto f : GetFaces(ei))
AsAtomic(face_els[f])++;
}, TasksPerThread(4));
for (int i = 1; i <= nse; i++)
face_surfels[GetSurfaceElementFace (i)-1]++;
@ -2166,6 +2172,17 @@ namespace netgen
return FlatArray<T_EDGE>(GetNEdges ( (*mesh)[elnr].GetType()), &surfedges[elnr][0]);
}
FlatArray<T_EDGE> MeshTopology :: GetEdges (ElementIndex elnr) const
{
return FlatArray<T_EDGE>(GetNEdges ( (*mesh)[elnr].GetType()), &edges[elnr][0]);
}
FlatArray<T_FACE> MeshTopology :: GetFaces (ElementIndex elnr) const
{
return FlatArray<T_FACE>(GetNFaces ( (*mesh)[elnr].GetType()), &faces[elnr][0]);
}
int MeshTopology :: GetSurfaceElementFace (int elnr) const
{

View File

@ -103,15 +103,24 @@ public:
orient = GetSegmentEdgeOrientation(segnr);
}
[[deprecated("use GetEdges (ElementIndex) -> FlatArray")]]
void GetElementEdges (int elnr, NgArray<int> & edges) const;
[[deprecated("use GetFaces (ElementIndex) -> FlatArray")]]
void GetElementFaces (int elnr, NgArray<int> & faces, bool withorientation = false) const;
FlatArray<T_EDGE> GetEdges (ElementIndex elnr) const;
FlatArray<T_FACE> GetFaces (ElementIndex elnr) const;
[[deprecated("use GetElementEdge instead")]]
void GetElementEdgeOrientations (int elnr, NgArray<int> & eorient) const;
[[deprecated("use GetElementEdge instead")]]
void GetElementFaceOrientations (int elnr, NgArray<int> & forient) const;
[[deprecated("use GetEdges (ElementIndex) -> FlatArray")]]
int GetElementEdges (int elnr, int * edges, int * orient) const;
[[deprecated("use GetFaces (ElementIndex) -> FlatArray")]]
int GetElementFaces (int elnr, int * faces, int * orient) const;
[[deprecated("use GetElementEdge instead")]]