less copying

This commit is contained in:
Joachim Schoeberl 2022-04-21 17:16:26 +02:00
parent 054386388e
commit 1afcb30102
8 changed files with 66 additions and 41 deletions

View File

@ -219,11 +219,13 @@ extern "C" {
DLL_HEADER int Ng_GetNEdges(); DLL_HEADER int Ng_GetNEdges();
DLL_HEADER int Ng_GetNFaces(); DLL_HEADER int Ng_GetNFaces();
[[deprecated("orientation is not supported anymore")]]
DLL_HEADER int Ng_GetElement_Edges (int elnr, int * edges, int * orient = 0); DLL_HEADER int Ng_GetElement_Edges (int elnr, int * edges, int * orient = 0);
[[deprecated("orientation is not supported anymore")]]
DLL_HEADER int Ng_GetElement_Faces (int elnr, int * faces, int * orient = 0); DLL_HEADER int Ng_GetElement_Faces (int elnr, int * faces, int * orient = 0);
[[deprecated("orientation is not supported anymore")]]
DLL_HEADER int Ng_GetSurfaceElement_Edges (int selnr, int * edges, int * orient = 0); DLL_HEADER int Ng_GetSurfaceElement_Edges (int selnr, int * edges, int * orient = 0);
[[deprecated("orientation is not supported anymore")]]
DLL_HEADER int Ng_GetSurfaceElement_Face (int selnr, int * orient = 0); DLL_HEADER int Ng_GetSurfaceElement_Face (int selnr, int * orient = 0);
DLL_HEADER void Ng_GetSurfaceElementNeighbouringDomains(const int selnr, int & in, int & out); DLL_HEADER void Ng_GetSurfaceElementNeighbouringDomains(const int selnr, int & in, int & out);

View File

@ -1878,8 +1878,10 @@ void Ng_GetPeriodicEdges (int idnr, int * pairs)
if (other1 && other2 && mesh->IsSegment (other1, other2)) if (other1 && other2 && mesh->IsSegment (other1, other2))
{ {
SegmentIndex otherseg = mesh->SegmentNr (other1, other2); SegmentIndex otherseg = mesh->SegmentNr (other1, other2);
pairs[cnt++] = top.GetSegmentEdge (si+1); // pairs[cnt++] = top.GetSegmentEdge (si+1);
pairs[cnt++] = top.GetSegmentEdge (otherseg+1); // pairs[cnt++] = top.GetSegmentEdge (otherseg+1);
pairs[cnt++] = top.GetEdge (si)+1;
pairs[cnt++] = top.GetEdge (otherseg)+1;
} }
} }
} }

View File

@ -15,7 +15,7 @@ namespace netgen
{ {
; ;
} }
void AnisotropicClusters :: Update() void AnisotropicClusters :: Update()
{ {
static Timer timer("clusters"); static Timer timer("clusters");

View File

@ -1458,6 +1458,7 @@ namespace netgen
return; return;
} }
if (info.order > 1) if (info.order > 1)
{ {
const MeshTopology & top = mesh.GetTopology(); const MeshTopology & top = mesh.GetTopology();
@ -2452,19 +2453,12 @@ namespace netgen
if (info.order > 1) if (info.order > 1)
{ {
const MeshTopology & top = mesh.GetTopology(); const MeshTopology & top = mesh.GetTopology();
info.nedges = top.GetElementEdges (elnr+1, info.edgenrs, 0);
for (int i = 0; i < info.nedges; i++)
info.edgenrs[i]--;
info.nfaces = top.GetElementFaces (elnr+1, info.facenrs, 0); for (auto e : top.GetEdges(elnr))
for (int i = 0; i < info.nfaces; i++) info.ndof += edgecoeffsindex[e+1] - edgecoeffsindex[e];
info.facenrs[i]--;
for (auto f : top.GetFaces(elnr))
for (int i = 0; i < info.nedges; i++) info.ndof += facecoeffsindex[f+1] - facecoeffsindex[f];
info.ndof += edgecoeffsindex[info.edgenrs[i]+1] - edgecoeffsindex[info.edgenrs[i]];
for (int i = 0; i < info.nfaces; i++)
info.ndof += facecoeffsindex[info.facenrs[i]+1] - facecoeffsindex[info.facenrs[i]];
} }
return (info.ndof > info.nv); return (info.ndof > info.nv);
@ -2491,17 +2485,13 @@ namespace netgen
if (info.order > 1) if (info.order > 1)
{ {
const MeshTopology & top = mesh.GetTopology(); const MeshTopology & top = mesh.GetTopology();
info.nedges = top.GetElementEdges (elnr+1, info.edgenrs, 0);
for (int i = 0; i < info.nedges; i++) info.edgenrs[i]--;
info.nfaces = top.GetElementFaces (elnr+1, info.facenrs, 0); for (auto e : top.GetEdges(elnr))
for (int i = 0; i < info.nfaces; i++) info.facenrs[i]--; if (edgecoeffsindex[e+1] > edgecoeffsindex[e]) return true;
for (auto f : top.GetFaces(elnr))
if (facecoeffsindex[f+1] > facecoeffsindex[f]) return true;
for (int i = 0; i < info.nedges; i++)
if (edgecoeffsindex[info.edgenrs[i]+1] > edgecoeffsindex[info.edgenrs[i]]) return true;
for (int i = 0; i < info.nfaces; i++)
if (facecoeffsindex[info.facenrs[i]+1] > facecoeffsindex[info.facenrs[i]]) return true;
} }
return false; return false;
} }
@ -2570,7 +2560,8 @@ namespace netgen
if (info.order > 1) if (info.order > 1)
{ {
const MeshTopology & top = mesh.GetTopology(); const MeshTopology & top = mesh.GetTopology();
/*
info.nedges = top.GetElementEdges (elnr+1, info.edgenrs, 0); info.nedges = top.GetElementEdges (elnr+1, info.edgenrs, 0);
for (int i = 0; i < info.nedges; i++) for (int i = 0; i < info.nedges; i++)
info.edgenrs[i]--; info.edgenrs[i]--;
@ -2578,11 +2569,22 @@ namespace netgen
info.nfaces = top.GetElementFaces (elnr+1, info.facenrs, 0); info.nfaces = top.GetElementFaces (elnr+1, info.facenrs, 0);
for (int i = 0; i < info.nfaces; i++) for (int i = 0; i < info.nfaces; i++)
info.facenrs[i]--; info.facenrs[i]--;
*/
info.SetEdges (top.GetEdges(elnr));
info.SetFaces (top.GetFaces(elnr));
/*
for (int i = 0; i < info.nedges; i++) for (int i = 0; i < info.nedges; i++)
info.ndof += edgecoeffsindex[info.edgenrs[i]+1] - edgecoeffsindex[info.edgenrs[i]]; info.ndof += edgecoeffsindex[info.edgenrs[i]+1] - edgecoeffsindex[info.edgenrs[i]];
for (int i = 0; i < info.nfaces; i++) for (int i = 0; i < info.nfaces; i++)
info.ndof += facecoeffsindex[info.facenrs[i]+1] - facecoeffsindex[info.facenrs[i]]; info.ndof += facecoeffsindex[info.facenrs[i]+1] - facecoeffsindex[info.facenrs[i]];
*/
for (auto e : info.GetEdges())
info.ndof += edgecoeffsindex[e+1] - edgecoeffsindex[e];
for (auto f : info.GetFaces())
info.ndof += facecoeffsindex[f+1] - facecoeffsindex[f];
} }
} }
@ -4603,20 +4605,15 @@ namespace netgen
if (info.order > 1) if (info.order > 1)
{ {
const MeshTopology & top = mesh.GetTopology(); const MeshTopology & top = mesh.GetTopology();
info.nedges = top.GetElementEdges (elnr+1, info.edgenrs, 0);
for (int i = 0; i < info.nedges; i++)
info.edgenrs[i]--;
info.nfaces = top.GetElementFaces (elnr+1, info.facenrs, 0); info.SetEdges (top.GetEdges(elnr));
for (int i = 0; i < info.nfaces; i++) info.SetFaces (top.GetFaces(elnr));
info.facenrs[i]--;
for (int i = 0; i < info.nedges; i++) for (auto e : info.GetEdges())
info.ndof += edgecoeffsindex[info.edgenrs[i]+1] - edgecoeffsindex[info.edgenrs[i]]; info.ndof += edgecoeffsindex[e+1] - edgecoeffsindex[e];
for (int i = 0; i < info.nfaces; i++)
info.ndof += facecoeffsindex[info.facenrs[i]+1] - facecoeffsindex[info.facenrs[i]]; for (auto f : info.GetFaces())
// info.ndof += facecoeffsindex[info.facenr+1] - facecoeffsindex[info.facenr]; info.ndof += facecoeffsindex[f+1] - facecoeffsindex[f];
} }
// NgProfiler::StopTimer (timer2); // NgProfiler::StopTimer (timer2);

View File

@ -206,6 +206,26 @@ private:
int facenrs[6]; int facenrs[6];
Mat<3> hdxdxi; Mat<3> hdxdxi;
Vec<3> hcoefs[10]; // enough for second order tets Vec<3> hcoefs[10]; // enough for second order tets
void SetEdges (FlatArray<int> edges)
{
nedges = edges.Size();
for (int i = 0; i < edges.Size(); i++)
edgenrs[i] = edges[i];
}
auto GetEdges() const
{ return FlatArray(nedges, edgenrs); }
void SetFaces (FlatArray<int> faces)
{
nfaces = faces.Size();
for (int i = 0; i < faces.Size(); i++)
facenrs[i] = faces[i];
}
auto GetFaces() const
{ return FlatArray(nfaces, facenrs); }
}; };
template <typename T> template <typename T>

View File

@ -307,7 +307,7 @@ namespace netgen
const MeshTopology & topology = mesh.GetTopology(); const MeshTopology & topology = mesh.GetTopology();
auto comm = mesh.GetCommunicator(); auto comm = mesh.GetCommunicator();
if ( id == 0 ) if ( id == 0 )
{ {
NgArray<NgArray<int>*> sendarrays(ntasks); NgArray<NgArray<int>*> sendarrays(ntasks);

View File

@ -34,7 +34,9 @@ namespace netgen
void Reset (); void Reset ();
void Print() const; void Print() const;
void UpdateCoarseGrid(); void UpdateCoarseGrid();
[[deprecated("should not need it anymore")]]
void UpdateCoarseGridGlobal(); void UpdateCoarseGridGlobal();
void IdentifyVerticesAfterRefinement(); void IdentifyVerticesAfterRefinement();
void EnumeratePointsGlobally (); void EnumeratePointsGlobally ();

View File

@ -149,7 +149,9 @@ public:
void GetSurfaceElementEdges (int elnr, NgArray<int> & edges) const; void GetSurfaceElementEdges (int elnr, NgArray<int> & edges) const;
int GetSurfaceElementFace (int elnr) const; int GetSurfaceElementFace (int elnr) const;
[[deprecated("orientation is outdated")]]
void GetSurfaceElementEdgeOrientations (int elnr, NgArray<int> & eorient) const; void GetSurfaceElementEdgeOrientations (int elnr, NgArray<int> & eorient) const;
[[deprecated("orientation is outdated")]]
int GetSurfaceElementFaceOrientation (int elnr) const; int GetSurfaceElementFaceOrientation (int elnr) const;
[[deprecated("use GetEdge -> FlatArray instead")]] [[deprecated("use GetEdge -> FlatArray instead")]]