mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-26 05:50:32 +05:00
GetEdgeVertices -> tuple
This commit is contained in:
parent
35660c2ef7
commit
227b269b5c
@ -1614,7 +1614,8 @@ int Ng_GetFace_Edges (int fnr, int * edge)
|
|||||||
void Ng_GetEdge_Vertices (int ednr, int * vert)
|
void Ng_GetEdge_Vertices (int ednr, int * vert)
|
||||||
{
|
{
|
||||||
const MeshTopology & topology = mesh->GetTopology();
|
const MeshTopology & topology = mesh->GetTopology();
|
||||||
topology.GetEdgeVertices (ednr, vert[0], vert[1]);
|
// topology.GetEdgeVertices (ednr, vert[0], vert[1]);
|
||||||
|
tie(vert[0], vert[1]) = topology.GetEdgeVertices(ednr-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -826,7 +826,8 @@ void WriteEdgeElementFormat (const Mesh & mesh,
|
|||||||
outfile << el.PNum(j);
|
outfile << el.PNum(j);
|
||||||
}
|
}
|
||||||
|
|
||||||
top->GetElementEdges(i,edges);
|
// top->GetElementEdges(i,edges);
|
||||||
|
auto eledges = top->GetEdges(ElementIndex(i-1));
|
||||||
outfile << endl << " ";
|
outfile << endl << " ";
|
||||||
outfile.width(8);
|
outfile.width(8);
|
||||||
outfile << edges.Size();
|
outfile << edges.Size();
|
||||||
@ -834,7 +835,7 @@ void WriteEdgeElementFormat (const Mesh & mesh,
|
|||||||
{
|
{
|
||||||
outfile << " ";
|
outfile << " ";
|
||||||
outfile.width(8);
|
outfile.width(8);
|
||||||
outfile << edges[j-1];
|
outfile << edges[j-1]+1;
|
||||||
}
|
}
|
||||||
outfile << "\n";
|
outfile << "\n";
|
||||||
|
|
||||||
@ -882,12 +883,13 @@ void WriteEdgeElementFormat (const Mesh & mesh,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int v1, v2;
|
// int v1, v2;
|
||||||
// edge - vertex - list
|
// edge - vertex - list
|
||||||
outfile << nedges << "\n";
|
outfile << nedges << "\n";
|
||||||
for (i=1; i <= nedges; i++)
|
for (i=1; i <= nedges; i++)
|
||||||
{
|
{
|
||||||
top->GetEdgeVertices(i,v1,v2);
|
// top->GetEdgeVertices(i,v1,v2);
|
||||||
|
auto [v1,v2] = top->GetEdgeVertices(i-1);
|
||||||
outfile.width(4);
|
outfile.width(4);
|
||||||
outfile << v1;
|
outfile << v1;
|
||||||
outfile << " ";
|
outfile << " ";
|
||||||
|
@ -801,8 +801,9 @@ namespace netgen
|
|||||||
if (surfnr[e] == -1) continue;
|
if (surfnr[e] == -1) continue;
|
||||||
SetThreadPercent(double(e)/surfnr.Size()*100.);
|
SetThreadPercent(double(e)/surfnr.Size()*100.);
|
||||||
|
|
||||||
PointIndex pi1, pi2;
|
// PointIndex pi1, pi2;
|
||||||
top.GetEdgeVertices (e+1, pi1, pi2);
|
// top.GetEdgeVertices (e+1, pi1, pi2);
|
||||||
|
auto [pi1,pi2] = top.GetEdgeVertices(e);
|
||||||
bool swap = (pi1 > pi2);
|
bool swap = (pi1 > pi2);
|
||||||
|
|
||||||
Point<3> p1 = mesh[pi1];
|
Point<3> p1 = mesh[pi1];
|
||||||
@ -1014,8 +1015,9 @@ namespace netgen
|
|||||||
|
|
||||||
SetThreadPercent(double(edgenr)/edge_surfnr1.Size()*100.);
|
SetThreadPercent(double(edgenr)/edge_surfnr1.Size()*100.);
|
||||||
|
|
||||||
PointIndex pi1, pi2;
|
// PointIndex pi1, pi2;
|
||||||
top.GetEdgeVertices (edgenr+1, pi1, pi2);
|
// top.GetEdgeVertices (edgenr+1, pi1, pi2);
|
||||||
|
auto [pi1,pi2] = top.GetEdgeVertices(edgenr);
|
||||||
|
|
||||||
bool swap = swap_edge[edgenr]; // (pi1 > pi2);
|
bool swap = swap_edge[edgenr]; // (pi1 > pi2);
|
||||||
if (swap) Swap (pi1, pi2);
|
if (swap) Swap (pi1, pi2);
|
||||||
@ -1239,8 +1241,9 @@ namespace netgen
|
|||||||
|
|
||||||
int first = edgecoeffsindex[edgenrs[k]];
|
int first = edgecoeffsindex[edgenrs[k]];
|
||||||
Vector eshape(eorder-1);
|
Vector eshape(eorder-1);
|
||||||
int vi1, vi2;
|
// int vi1, vi2;
|
||||||
top.GetEdgeVertices (edgenrs[k]+1, vi1, vi2);
|
// top.GetEdgeVertices (edgenrs[k]+1, vi1, vi2);
|
||||||
|
auto [vi1,vi2] = top.GetEdgeVertices(edgenrs[k]);
|
||||||
if (vi1 > vi2) swap (vi1, vi2);
|
if (vi1 > vi2) swap (vi1, vi2);
|
||||||
int v1 = -1, v2 = -1;
|
int v1 = -1, v2 = -1;
|
||||||
for (int j = 0; j < 3; j++)
|
for (int j = 0; j < 3; j++)
|
||||||
|
@ -6441,8 +6441,9 @@ namespace netgen
|
|||||||
// for(auto edgei : eledges)
|
// for(auto edgei : eledges)
|
||||||
for(auto edgei : topology.GetEdges(ElementIndex(ei)))
|
for(auto edgei : topology.GetEdges(ElementIndex(ei)))
|
||||||
{
|
{
|
||||||
int p1, p2;
|
// int p1, p2;
|
||||||
topology.GetEdgeVertices(edgei+1, p1, p2);
|
// topology.GetEdgeVertices(edgei+1, p1, p2);
|
||||||
|
auto [p1, p2] = topology.GetEdgeVertices(edgei);
|
||||||
auto c1 = inserted_points.count({p1, p2});
|
auto c1 = inserted_points.count({p1, p2});
|
||||||
auto c2 = inserted_points.count({p2, p1});
|
auto c2 = inserted_points.count({p2, p1});
|
||||||
if(c1 == 0 && c2 == 0)
|
if(c1 == 0 && c2 == 0)
|
||||||
|
@ -1879,10 +1879,11 @@ namespace netgen
|
|||||||
NgArray<int> cnt(nn+1);
|
NgArray<int> cnt(nn+1);
|
||||||
cnt = 0;
|
cnt = 0;
|
||||||
|
|
||||||
for ( int edge = 1; edge <= nedges; edge++ )
|
for ( int edge = 0; edge < nedges; edge++ )
|
||||||
{
|
{
|
||||||
int v1, v2;
|
// int v1, v2;
|
||||||
topology.GetEdgeVertices ( edge, v1, v2);
|
// topology.GetEdgeVertices ( edge, v1, v2);
|
||||||
|
auto [v1,v2] = topology.GetEdgeVertices(edge);
|
||||||
cnt[v1-1] ++;
|
cnt[v1-1] ++;
|
||||||
cnt[v2-1] ++;
|
cnt[v2-1] ++;
|
||||||
}
|
}
|
||||||
@ -1896,10 +1897,11 @@ namespace netgen
|
|||||||
adjacency = new idxtype[xadj[nn]];
|
adjacency = new idxtype[xadj[nn]];
|
||||||
cnt = 0;
|
cnt = 0;
|
||||||
|
|
||||||
for ( int edge = 1; edge <= nedges; edge++ )
|
for ( int edge = 0; edge < nedges; edge++ )
|
||||||
{
|
{
|
||||||
int v1, v2;
|
// int v1, v2;
|
||||||
topology.GetEdgeVertices ( edge, v1, v2);
|
// topology.GetEdgeVertices ( edge, v1, v2);
|
||||||
|
auto [v1,v2] = topology.GetEdgeVertices(edge);
|
||||||
adjacency[ xadj[v1-1] + cnt[v1-1] ] = v2-1;
|
adjacency[ xadj[v1-1] + cnt[v1-1] ] = v2-1;
|
||||||
adjacency[ xadj[v2-1] + cnt[v2-1] ] = v1-1;
|
adjacency[ xadj[v2-1] + cnt[v2-1] ] = v1-1;
|
||||||
cnt[v1-1]++;
|
cnt[v1-1]++;
|
||||||
@ -1973,7 +1975,7 @@ namespace netgen
|
|||||||
facevolels1 = -1;
|
facevolels1 = -1;
|
||||||
facevolels2 = -1;
|
facevolels2 = -1;
|
||||||
|
|
||||||
NgArray<int, 0> elfaces;
|
// NgArray<int, 0> elfaces;
|
||||||
xadj = new idxtype[ne+1];
|
xadj = new idxtype[ne+1];
|
||||||
part = new idxtype[ne];
|
part = new idxtype[ne];
|
||||||
|
|
||||||
@ -1983,16 +1985,17 @@ namespace netgen
|
|||||||
for ( int el=1; el <= ne; el++ )
|
for ( int el=1; el <= ne; el++ )
|
||||||
{
|
{
|
||||||
Element volel = VolumeElement(el);
|
Element volel = VolumeElement(el);
|
||||||
topology.GetElementFaces(el, elfaces);
|
// topology.GetElementFaces(el, elfaces);
|
||||||
|
auto elfaces = topology.GetFaces (ElementIndex(el-1));
|
||||||
for ( int i = 0; i < elfaces.Size(); i++ )
|
for ( int i = 0; i < elfaces.Size(); i++ )
|
||||||
{
|
{
|
||||||
if ( facevolels1[elfaces[i]-1] == -1 )
|
if ( facevolels1[elfaces[i]] == -1 )
|
||||||
facevolels1[elfaces[i]-1] = el;
|
facevolels1[elfaces[i]] = el;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
facevolels2[elfaces[i]-1] = el;
|
facevolels2[elfaces[i]] = el;
|
||||||
cnt[facevolels1[elfaces[i]-1]-1]++;
|
cnt[facevolels1[elfaces[i]]-1]++;
|
||||||
cnt[facevolels2[elfaces[i]-1]-1]++;
|
cnt[facevolels2[elfaces[i]]-1]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -639,10 +639,11 @@ namespace netgen
|
|||||||
|
|
||||||
// exchange edges
|
// exchange edges
|
||||||
cnt_send = 0;
|
cnt_send = 0;
|
||||||
int v1, v2;
|
// int v1, v2;
|
||||||
for (int edge = 1; edge <= ned; edge++)
|
for (int edge = 1; edge <= ned; edge++)
|
||||||
{
|
{
|
||||||
topology.GetEdgeVertices (edge, v1, v2);
|
// topology.GetEdgeVertices (edge, v1, v2);
|
||||||
|
auto [v1,v2] = topology.GetEdgeVertices(edge-1);
|
||||||
/*
|
/*
|
||||||
for (int dest = 1; dest < ntasks; dest++)
|
for (int dest = 1; dest < ntasks; dest++)
|
||||||
// if (IsExchangeVert (dest, v1) && IsExchangeVert (dest, v2))
|
// if (IsExchangeVert (dest, v1) && IsExchangeVert (dest, v2))
|
||||||
@ -662,7 +663,8 @@ namespace netgen
|
|||||||
|
|
||||||
for (int edge = 1; edge <= ned; edge++)
|
for (int edge = 1; edge <= ned; edge++)
|
||||||
{
|
{
|
||||||
topology.GetEdgeVertices (edge, v1, v2);
|
// topology.GetEdgeVertices (edge, v1, v2);
|
||||||
|
auto [v1,v2] = topology.GetEdgeVertices(edge-1);
|
||||||
for (int dest = 0; dest < ntasks; dest++)
|
for (int dest = 0; dest < ntasks; dest++)
|
||||||
// if (IsExchangeVert (dest, v1) && IsExchangeVert (dest, v2))
|
// if (IsExchangeVert (dest, v1) && IsExchangeVert (dest, v2))
|
||||||
if (GetDistantProcs(v1).Contains(dest) && GetDistantProcs(v2).Contains(dest))
|
if (GetDistantProcs(v1).Contains(dest) && GetDistantProcs(v2).Contains(dest))
|
||||||
@ -680,7 +682,8 @@ namespace netgen
|
|||||||
|
|
||||||
for (int edge : dest2edge[dest])
|
for (int edge : dest2edge[dest])
|
||||||
{
|
{
|
||||||
topology.GetEdgeVertices (edge, v1, v2);
|
// topology.GetEdgeVertices (edge, v1, v2);
|
||||||
|
auto [v1,v2] = topology.GetEdgeVertices(edge-1);
|
||||||
// if (IsExchangeVert (dest, v1) && IsExchangeVert (dest, v2))
|
// if (IsExchangeVert (dest, v1) && IsExchangeVert (dest, v2))
|
||||||
if (GetDistantProcs(v1).Contains(dest) && GetDistantProcs(v2).Contains(dest))
|
if (GetDistantProcs(v1).Contains(dest) && GetDistantProcs(v2).Contains(dest))
|
||||||
{
|
{
|
||||||
@ -705,7 +708,8 @@ namespace netgen
|
|||||||
INDEX_2_CLOSED_HASHTABLE<int> vert2edge(2*dest2edge[dest].Size()+10);
|
INDEX_2_CLOSED_HASHTABLE<int> vert2edge(2*dest2edge[dest].Size()+10);
|
||||||
for (int edge : dest2edge[dest])
|
for (int edge : dest2edge[dest])
|
||||||
{
|
{
|
||||||
topology.GetEdgeVertices (edge, v1, v2);
|
// topology.GetEdgeVertices (edge, v1, v2);
|
||||||
|
auto [v1,v2] = topology.GetEdgeVertices(edge-1);
|
||||||
vert2edge.Set(INDEX_2(v1,v2), edge);
|
vert2edge.Set(INDEX_2(v1,v2), edge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1616,8 +1616,9 @@ project_boundaries : Optional[str] = None
|
|||||||
ParallelForRange( n, [&](auto myrange) {
|
ParallelForRange( n, [&](auto myrange) {
|
||||||
for(auto i : myrange)
|
for(auto i : myrange)
|
||||||
{
|
{
|
||||||
PointIndex p0,p1;
|
// PointIndex p0,p1;
|
||||||
topo.GetEdgeVertices(i+1, p0, p1);
|
// topo.GetEdgeVertices(i+1, p0, p1);
|
||||||
|
auto [p0,p1] = topo.GetEdgeVertices(i);
|
||||||
output[2*i] = p0-PointIndex::BASE;
|
output[2*i] = p0-PointIndex::BASE;
|
||||||
output[2*i+1] = p1-PointIndex::BASE;
|
output[2*i+1] = p1-PointIndex::BASE;
|
||||||
} });
|
} });
|
||||||
|
@ -2284,8 +2284,9 @@ namespace netgen
|
|||||||
|
|
||||||
for (int j = 0; j < eledges.Size(); j++)
|
for (int j = 0; j < eledges.Size(); j++)
|
||||||
{
|
{
|
||||||
int vi1, vi2;
|
// int vi1, vi2;
|
||||||
GetEdgeVertices (eledges[j]+1, vi1, vi2);
|
// GetEdgeVertices (eledges[j]+1, vi1, vi2);
|
||||||
|
auto [vi1, vi2] = GetEdgeVertices(eledges[j]);
|
||||||
|
|
||||||
bool has1 = 0;
|
bool has1 = 0;
|
||||||
bool has2 = 0;
|
bool has2 = 0;
|
||||||
@ -2354,7 +2355,7 @@ namespace netgen
|
|||||||
// Array<ElementIndex> elements_v1;
|
// Array<ElementIndex> elements_v1;
|
||||||
// GetVertexElements ( v1, elements_v1);
|
// GetVertexElements ( v1, elements_v1);
|
||||||
auto elements_v1 = GetVertexElements ( v1 );
|
auto elements_v1 = GetVertexElements ( v1 );
|
||||||
int edv1, edv2;
|
// int edv1, edv2;
|
||||||
|
|
||||||
for ( int i = 0; i < elements_v1.Size(); i++ )
|
for ( int i = 0; i < elements_v1.Size(); i++ )
|
||||||
{
|
{
|
||||||
@ -2362,7 +2363,8 @@ namespace netgen
|
|||||||
auto elementedges = GetEdges(ElementIndex(elements_v1[i]));
|
auto elementedges = GetEdges(ElementIndex(elements_v1[i]));
|
||||||
for ( int ed = 0; ed < elementedges.Size(); ed ++)
|
for ( int ed = 0; ed < elementedges.Size(); ed ++)
|
||||||
{
|
{
|
||||||
GetEdgeVertices( elementedges[ed]+1, edv1, edv2 );
|
// GetEdgeVertices( elementedges[ed]+1, edv1, edv2 );
|
||||||
|
auto [edv1,edv2] = GetEdgeVertices (elementedges[ed]);
|
||||||
if ( ( edv1 == v1 && edv2 == v2 ) || ( edv1 == v2 && edv2 == v1 ) )
|
if ( ( edv1 == v1 && edv2 == v2 ) || ( edv1 == v2 && edv2 == v1 ) )
|
||||||
return elementedges[ed];
|
return elementedges[ed];
|
||||||
}
|
}
|
||||||
@ -2394,9 +2396,10 @@ namespace netgen
|
|||||||
void MeshTopology ::
|
void MeshTopology ::
|
||||||
GetSegmentSurfaceElements (int segnr, NgArray<SurfaceElementIndex> & els) const
|
GetSegmentSurfaceElements (int segnr, NgArray<SurfaceElementIndex> & els) const
|
||||||
{
|
{
|
||||||
int v1, v2;
|
// int v1, v2;
|
||||||
// GetEdgeVertices ( GetSegmentEdge (segnr), v1, v2 );
|
// GetEdgeVertices ( GetSegmentEdge (segnr), v1, v2 );
|
||||||
GetEdgeVertices ( GetEdge (segnr-1)+1, v1, v2 );
|
// GetEdgeVertices ( GetEdge (segnr-1)+1, v1, v2 );
|
||||||
|
auto [v1,v2] = GetEdgeVertices ( GetEdge (segnr-1) );
|
||||||
auto els1 = GetVertexSurfaceElements ( v1 );
|
auto els1 = GetVertexSurfaceElements ( v1 );
|
||||||
auto els2 = GetVertexSurfaceElements ( v2 );
|
auto els2 = GetVertexSurfaceElements ( v2 );
|
||||||
els.SetSize(0);
|
els.SetSize(0);
|
||||||
|
@ -137,7 +137,9 @@ public:
|
|||||||
|
|
||||||
DLL_HEADER void GetFaceVertices (int fnr, NgArray<int> & vertices) const;
|
DLL_HEADER void GetFaceVertices (int fnr, NgArray<int> & vertices) const;
|
||||||
DLL_HEADER void GetFaceVertices (int fnr, int * vertices) const;
|
DLL_HEADER void GetFaceVertices (int fnr, int * vertices) const;
|
||||||
|
[[deprecated("use GetEdgeVertices -> tupe(v0,v1) instead")]]
|
||||||
DLL_HEADER void GetEdgeVertices (int enr, int & v1, int & v2) const;
|
DLL_HEADER void GetEdgeVertices (int enr, int & v1, int & v2) const;
|
||||||
|
[[deprecated("use GetEdgeVertices -> tupe(v0,v1) instead")]]
|
||||||
DLL_HEADER void GetEdgeVertices (int enr, PointIndex & v1, PointIndex & v2) const;
|
DLL_HEADER void GetEdgeVertices (int enr, PointIndex & v1, PointIndex & v2) const;
|
||||||
auto GetEdgeVertices (int enr) const { return tuple(edge2vert[enr][0], edge2vert[enr][1]); }
|
auto GetEdgeVertices (int enr) const { return tuple(edge2vert[enr][0], edge2vert[enr][1]); }
|
||||||
auto GetEdgeVerticesPtr (int enr) const { return &edge2vert[enr][0]; }
|
auto GetEdgeVerticesPtr (int enr) const { return &edge2vert[enr][0]; }
|
||||||
|
@ -411,8 +411,9 @@ namespace netgen
|
|||||||
const MeshTopology & top = mesh->GetTopology();
|
const MeshTopology & top = mesh->GetTopology();
|
||||||
for (int i = 1; i <= top.GetNEdges(); i++)
|
for (int i = 1; i <= top.GetNEdges(); i++)
|
||||||
{
|
{
|
||||||
int v1, v2;
|
// int v1, v2;
|
||||||
top.GetEdgeVertices (i, v1, v2);
|
// top.GetEdgeVertices (i, v1, v2);
|
||||||
|
auto [v1,v2] = top.GetEdgeVertices(i-1);
|
||||||
const Point3d & p1 = mesh->Point(v1);
|
const Point3d & p1 = mesh->Point(v1);
|
||||||
const Point3d & p2 = mesh->Point(v2);
|
const Point3d & p2 = mesh->Point(v2);
|
||||||
const Point3d p = Center (p1, p2);
|
const Point3d p = Center (p1, p2);
|
||||||
|
Loading…
Reference in New Issue
Block a user