idmap using PointIndex

This commit is contained in:
Joachim Schoeberl 2024-12-22 21:38:50 +01:00
parent 34c3d971b0
commit bcc9f43f76
18 changed files with 106 additions and 88 deletions

View File

@ -65,10 +65,10 @@ ShortEdge (const SpecialPoint & sp1, const SpecialPoint & sp2) const
return 0; return 0;
} }
int Identification :: GetIdentifiedPoint (class Mesh & mesh, int pi) PointIndex Identification :: GetIdentifiedPoint (class Mesh & mesh, PointIndex pi)
{ {
cout << "Identification::GetIdentifiedPoint called for base-class" << endl; cout << "Identification::GetIdentifiedPoint called for base-class" << endl;
return -1; return PointIndex::INVALID;
} }
void Identification :: IdentifyPoints (Mesh & mesh) void Identification :: IdentifyPoints (Mesh & mesh)
@ -261,8 +261,8 @@ Identifiable (const Point<3> & p1, const Point<3> & p2) const
int PeriodicIdentification :: PointIndex PeriodicIdentification ::
GetIdentifiedPoint (class Mesh & mesh, int pi) GetIdentifiedPoint (class Mesh & mesh, PointIndex pi)
{ {
const Surface *snew; const Surface *snew;
const Point<3> & p = mesh.Point (pi); const Point<3> & p = mesh.Point (pi);
@ -885,17 +885,21 @@ ShortEdge (const SpecialPoint & sp1, const SpecialPoint & sp2) const
int CloseSurfaceIdentification :: PointIndex CloseSurfaceIdentification ::
GetIdentifiedPoint (class Mesh & mesh, int pi) GetIdentifiedPoint (class Mesh & mesh, PointIndex pi)
{ {
const Surface *snew; const Surface *snew;
const Point<3> & p = mesh.Point (pi); const Point<3> & p = mesh.Point (pi);
NgArray<int,PointIndex::BASE> identmap(mesh.GetNP()); idmap_type identmap(mesh.GetNP());
mesh.GetIdentifications().GetMap (nr, identmap); mesh.GetIdentifications().GetMap (nr, identmap);
/*
if (identmap.Get(pi)) if (identmap.Get(pi))
return identmap.Get(pi); return identmap.Get(pi);
*/
if (identmap[pi].IsValid())
return identmap[pi];
if (s1->PointOnSurface (p)) if (s1->PointOnSurface (p))
snew = s2; snew = s2;
@ -1229,7 +1233,7 @@ BuildSurfaceElements (NgArray<Segment> & segs,
bool found = 0; bool found = 0;
int cntquads = 0; int cntquads = 0;
NgArray<int,PointIndex::BASE> identmap; idmap_type identmap;
identmap = 0; identmap = 0;
mesh.GetIdentifications().GetMap (nr, identmap); mesh.GetIdentifications().GetMap (nr, identmap);

View File

@ -56,7 +56,7 @@ namespace netgen
virtual void IdentifyFaces (class Mesh & mesh); virtual void IdentifyFaces (class Mesh & mesh);
/// get point on other surface, add entry in mesh identifications /// get point on other surface, add entry in mesh identifications
virtual int GetIdentifiedPoint (class Mesh & mesh, int pi1); virtual PointIndex GetIdentifiedPoint (class Mesh & mesh, PointIndex pi1);
/// copy surfaces, or fill rectangles /// copy surfaces, or fill rectangles
virtual void BuildSurfaceElements (NgArray<class Segment> & segs, virtual void BuildSurfaceElements (NgArray<class Segment> & segs,
@ -97,7 +97,7 @@ namespace netgen
const TABLE<int> & specpoint2surface) const override; const TABLE<int> & specpoint2surface) const override;
virtual int Identifiable (const Point<3> & p1, const Point<3> & sp2) const override; virtual int Identifiable (const Point<3> & p1, const Point<3> & sp2) const override;
virtual int GetIdentifiedPoint (class Mesh & mesh, int pi1) override; virtual PointIndex GetIdentifiedPoint (class Mesh & mesh, PointIndex pi1) override;
virtual void IdentifyPoints (class Mesh & mesh) override; virtual void IdentifyPoints (class Mesh & mesh) override;
virtual void IdentifyFaces (class Mesh & mesh) override; virtual void IdentifyFaces (class Mesh & mesh) override;
virtual void BuildSurfaceElements (NgArray<class Segment> & segs, virtual void BuildSurfaceElements (NgArray<class Segment> & segs,
@ -153,7 +153,7 @@ namespace netgen
virtual int Identifiable (const Point<3> & p1, const Point<3> & sp2) const; virtual int Identifiable (const Point<3> & p1, const Point<3> & sp2) const;
virtual int IdentifiableCandidate (const SpecialPoint & sp1) const; virtual int IdentifiableCandidate (const SpecialPoint & sp1) const;
virtual int ShortEdge (const SpecialPoint & sp1, const SpecialPoint & sp2) const; virtual int ShortEdge (const SpecialPoint & sp1, const SpecialPoint & sp2) const;
virtual int GetIdentifiedPoint (class Mesh & mesh, int pi1); virtual PointIndex GetIdentifiedPoint (class Mesh & mesh, PointIndex pi1);
const Array<double> & GetSlices () const { return slices; } const Array<double> & GetSlices () const { return slices; }
virtual void IdentifyPoints (class Mesh & mesh); virtual void IdentifyPoints (class Mesh & mesh);
virtual void IdentifyFaces (class Mesh & mesh); virtual void IdentifyFaces (class Mesh & mesh);

View File

@ -1827,7 +1827,7 @@ void Ng_GetPeriodicVertices (int idnr, int * pairs)
int Ng_GetNPeriodicEdges (int idnr) int Ng_GetNPeriodicEdges (int idnr)
{ {
NgArray<int,PointIndex::BASE> map; idmap_type map;
//const MeshTopology & top = mesh->GetTopology(); //const MeshTopology & top = mesh->GetTopology();
int nse = mesh->GetNSeg(); int nse = mesh->GetNSeg();
@ -1854,7 +1854,7 @@ int Ng_GetNPeriodicEdges (int idnr)
void Ng_GetPeriodicEdges (int idnr, int * pairs) void Ng_GetPeriodicEdges (int idnr, int * pairs)
{ {
NgArray<int,PointIndex::BASE> map; idmap_type map;
const MeshTopology & top = mesh->GetTopology(); const MeshTopology & top = mesh->GetTopology();
int nse = mesh->GetNSeg(); int nse = mesh->GetNSeg();

View File

@ -1361,7 +1361,7 @@ size_t Ngx_Mesh :: GetGlobalVertexNum (int locnum) const
FlatArray<int> Ngx_Mesh :: GetDistantProcs (int nodetype, int locnum) const FlatArray<int> Ngx_Mesh :: GetDistantProcs (int nodetype, int locnum) const
{ {
#ifdef PARALLEL // #ifdef PARALLEL
if (mesh->GetCommunicator().Size() == 1) if (mesh->GetCommunicator().Size() == 1)
return FlatArray<int>(0,nullptr); return FlatArray<int>(0,nullptr);
@ -1379,9 +1379,9 @@ FlatArray<int> Ngx_Mesh :: GetDistantProcs (int nodetype, int locnum) const
default: default:
return FlatArray<int>(0, nullptr); return FlatArray<int>(0, nullptr);
} }
#else // #else
return FlatArray<int>(0,nullptr); // return FlatArray<int>(0,nullptr);
#endif // #endif
} }
} }

View File

@ -33,7 +33,7 @@ void WriteJCMFormat (const Mesh & mesh,
int np = mesh.GetNP(); int np = mesh.GetNP();
// Identic points // Identic points
NgArray<int,PointIndex::BASE> identmap1, identmap2, identmap3; idmap_type identmap1, identmap2, identmap3;
mesh.GetIdentifications().GetMap(1, identmap1); mesh.GetIdentifications().GetMap(1, identmap1);
mesh.GetIdentifications().GetMap(2, identmap2); mesh.GetIdentifications().GetMap(2, identmap2);
mesh.GetIdentifications().GetMap(3, identmap3); mesh.GetIdentifications().GetMap(3, identmap3);
@ -52,19 +52,21 @@ void WriteJCMFormat (const Mesh & mesh,
for (j = 1; j <= 4; j++) for (j = 1; j <= 4; j++)
for (jj = 1; jj <=4; jj++) for (jj = 1; jj <=4; jj++)
{ {
if (identmap1.Elem(el.PNum(j)) == el.PNum(jj)) // if (identmap1.Elem(el.PNum(j)) == el.PNum(jj))
if (identmap1[el.PNum(j)] == el.PNum(jj))
{ {
cout << "\n Error: two points on a tetrahedron identified (1) with each other" cout << "\n Error: two points on a tetrahedron identified (1) with each other"
<< "\n REFINE MESH !" << endl; << "\n REFINE MESH !" << endl;
return; return;
} }
if (identmap2.Elem(el.PNum(j)) == el.PNum(jj)) // if (identmap2.Elem(el.PNum(j)) == el.PNum(jj))
if (identmap2[el.PNum(j)] == el.PNum(jj))
{ {
cout << "\n Error: two points on a tetrahedron identified (2) with each other" cout << "\n Error: two points on a tetrahedron identified (2) with each other"
<< "\n REFINE MESH !" << endl; << "\n REFINE MESH !" << endl;
return; return;
} }
if (identmap3.Elem(el.PNum(j)) == el.PNum(jj)) if (identmap3[el.PNum(j)] == el.PNum(jj))
{ {
cout << "\n Error: two points on a tetrahedron identified (3) with each other" cout << "\n Error: two points on a tetrahedron identified (3) with each other"
<< "\n REFINE MESH !" << endl; << "\n REFINE MESH !" << endl;
@ -271,6 +273,7 @@ void WriteJCMFormat (const Mesh & mesh,
int npid1 = 0; int npid1 = 0;
int npid2 = 0; int npid2 = 0;
int npid3 = 0; int npid3 = 0;
/*
for (i=1; i<=np; i++) for (i=1; i<=np; i++)
{ {
if (identmap1.Elem(i)) if (identmap1.Elem(i))
@ -280,6 +283,10 @@ void WriteJCMFormat (const Mesh & mesh,
if (identmap3.Elem(i)) if (identmap3.Elem(i))
npid3++; npid3++;
} }
*/
for (auto pi : identmap1) if (pi.IsValid()) npid1++;
for (auto pi : identmap2) if (pi.IsValid()) npid1++;
for (auto pi : identmap3) if (pi.IsValid()) npid1++;
outfile << "\n"; outfile << "\n";
outfile << "# Boundary triangles\n"; outfile << "# Boundary triangles\n";
@ -302,31 +309,31 @@ void WriteJCMFormat (const Mesh & mesh,
outfile << mesh.GetFaceDescriptor (el.GetIndex()).BCProperty() << "\n"; outfile << mesh.GetFaceDescriptor (el.GetIndex()).BCProperty() << "\n";
if (mesh.GetFaceDescriptor (el.GetIndex()).BCProperty() == bc_at_infinity) if (mesh.GetFaceDescriptor (el.GetIndex()).BCProperty() == bc_at_infinity)
outfile << "-2\n\n"; outfile << "-2\n\n";
else if (identmap1.Elem(el.PNum(1)) else if (identmap1[el.PNum(1)].IsValid()
&&identmap1.Elem(el.PNum(2)) &&identmap1[el.PNum(2)].IsValid()
&&identmap1.Elem(el.PNum(3))) &&identmap1[el.PNum(3)].IsValid())
{ {
outfile << "-1\n"; outfile << "-1\n";
for (j = 1; j <= 3; j++) for (j = 1; j <= 3; j++)
outfile << identmap1.Elem(el.PNum(j))<<"\n"; outfile << identmap1[el.PNum(j)]<<"\n";
outfile << "\n"; outfile << "\n";
} }
else if (identmap2.Elem(el.PNum(1)) else if (identmap2[el.PNum(1)].IsValid()
&&identmap2.Elem(el.PNum(2)) &&identmap2[el.PNum(2)].IsValid()
&&identmap2.Elem(el.PNum(3))) &&identmap2[el.PNum(3)].IsValid())
{ {
outfile << "-1\n"; outfile << "-1\n";
for (j = 1; j <= 3; j++) for (j = 1; j <= 3; j++)
outfile << identmap2.Elem(el.PNum(j))<<"\n"; outfile << identmap2[el.PNum(j)]<<"\n";
outfile << "\n"; outfile << "\n";
} }
else if (identmap3.Elem(el.PNum(1)) else if (identmap3[el.PNum(1)].IsValid()
&&identmap3.Elem(el.PNum(2)) &&identmap3[el.PNum(2)].IsValid()
&&identmap3.Elem(el.PNum(3))) &&identmap3[el.PNum(3)].IsValid())
{ {
outfile << "-1\n"; outfile << "-1\n";
for (j = 1; j <= 3; j++) for (j = 1; j <= 3; j++)
outfile << identmap3.Elem(el.PNum(j))<<"\n"; outfile << identmap3[el.PNum(j)]<<"\n";
outfile << "\n"; outfile << "\n";
} }
else else
@ -373,10 +380,10 @@ void WriteJCMFormat (const Mesh & mesh,
outfile << "-2\n\n"; outfile << "-2\n\n";
cout << "\nWarning: Quadrilateral at infinity found (this should not occur)!"<<endl; cout << "\nWarning: Quadrilateral at infinity found (this should not occur)!"<<endl;
} }
else if ( identmap1.Elem(el.PNum(1)) && else if ( identmap1[el.PNum(1)].IsValid() &&
identmap1.Elem(el.PNum(2)) && identmap1[el.PNum(2)].IsValid() &&
identmap1.Elem(el.PNum(3)) && identmap1[el.PNum(3)].IsValid() &&
identmap1.Elem(el.PNum(4)) ) identmap1[el.PNum(4)].IsValid())
{ {
outfile << "-1\n"; outfile << "-1\n";
for (j = 1; j <= 4; j++) for (j = 1; j <= 4; j++)
@ -384,14 +391,14 @@ void WriteJCMFormat (const Mesh & mesh,
jj = j + ct; jj = j + ct;
if ( jj >= 5 ) if ( jj >= 5 )
jj = jj - 4; jj = jj - 4;
outfile << identmap1.Elem(el.PNum(jj))<<"\n"; outfile << identmap1[el.PNum(jj)]<<"\n";
} }
outfile << "\n"; outfile << "\n";
} }
else if ( identmap2.Elem(el.PNum(1)) && else if ( identmap2[el.PNum(1)].IsValid() &&
identmap2.Elem(el.PNum(2)) && identmap2[el.PNum(2)].IsValid() &&
identmap2.Elem(el.PNum(3)) && identmap2[el.PNum(3)].IsValid() &&
identmap2.Elem(el.PNum(4)) ) identmap2[el.PNum(4)].IsValid() )
{ {
outfile << "-1\n"; outfile << "-1\n";
for (j = 1; j <= 4; j++) for (j = 1; j <= 4; j++)
@ -399,14 +406,14 @@ void WriteJCMFormat (const Mesh & mesh,
jj = j + ct; jj = j + ct;
if ( jj >= 5 ) if ( jj >= 5 )
jj = jj - 4; jj = jj - 4;
outfile << identmap2.Elem(el.PNum(jj))<<"\n"; outfile << identmap2[el.PNum(jj)] <<"\n";
} }
outfile << "\n"; outfile << "\n";
} }
else if ( identmap3.Elem(el.PNum(1)) && else if ( identmap3[el.PNum(1)].IsValid() &&
identmap3.Elem(el.PNum(2)) && identmap3[el.PNum(2)].IsValid() &&
identmap3.Elem(el.PNum(3)) && identmap3[el.PNum(3)].IsValid() &&
identmap3.Elem(el.PNum(4)) ) identmap3[el.PNum(4)].IsValid() )
{ {
outfile << "-1\n"; outfile << "-1\n";
for (j = 1; j <= 4; j++) for (j = 1; j <= 4; j++)
@ -414,7 +421,7 @@ void WriteJCMFormat (const Mesh & mesh,
jj = j + ct; jj = j + ct;
if ( jj >= 5 ) if ( jj >= 5 )
jj = jj - 4; jj = jj - 4;
outfile << identmap3.Elem(el.PNum(jj))<<"\n"; outfile << identmap3[el.PNum(jj)]<<"\n";
} }
outfile << "\n"; outfile << "\n";
} }

View File

@ -366,12 +366,12 @@ namespace netgen
uidpid = "UID"; uidpid = "UID";
NgArray< NgArray<int,PointIndex::BASE>* > idmaps; NgArray< idmap_type* > idmaps;
for(int i=1; i<=mesh.GetIdentifications().GetMaxNr(); i++) for(int i=1; i<=mesh.GetIdentifications().GetMaxNr(); i++)
{ {
if(mesh.GetIdentifications().GetType(i) == Identifications::PERIODIC) if(mesh.GetIdentifications().GetType(i) == Identifications::PERIODIC)
{ {
idmaps.Append(new NgArray<int,PointIndex::BASE>); idmaps.Append(new idmap_type);
mesh.GetIdentifications().GetMap(i,*idmaps.Last(),true); mesh.GetIdentifications().GetMap(i,*idmaps.Last(),true);
} }
} }

View File

@ -296,7 +296,7 @@ namespace netgen
int BTSortEdges (const Mesh & mesh, int BTSortEdges (const Mesh & mesh,
const NgArray< NgArray<int,PointIndex::BASE>* > & idmaps, const NgArray<idmap_type*> & idmaps,
INDEX_2_CLOSED_HASHTABLE<int> & edgenumber) INDEX_2_CLOSED_HASHTABLE<int> & edgenumber)
{ {
PrintMessage(4,"sorting ... "); PrintMessage(4,"sorting ... ");
@ -981,7 +981,7 @@ namespace netgen
bool BTDefineMarkedId(const Element2d & el, bool BTDefineMarkedId(const Element2d & el,
INDEX_2_CLOSED_HASHTABLE<int> & edgenumber, INDEX_2_CLOSED_HASHTABLE<int> & edgenumber,
const NgArray<int,PointIndex::BASE> & idmap, const idmap_type & idmap,
MarkedIdentification & mi) MarkedIdentification & mi)
{ {
@ -1983,7 +1983,7 @@ namespace netgen
void BisectTetsCopyMesh (Mesh & mesh, const NetgenGeometry *, void BisectTetsCopyMesh (Mesh & mesh, const NetgenGeometry *,
BisectionOptions & opt, BisectionOptions & opt,
const NgArray< NgArray<int,PointIndex::BASE>* > & idmaps, const NgArray<idmap_type*> & idmaps,
const string & refinfofile) const string & refinfofile)
{ {
auto& mtets = *mesh.bisectioninfo.mtets; auto& mtets = *mesh.bisectioninfo.mtets;
@ -2192,7 +2192,7 @@ namespace netgen
auto seg = mesh[j]; auto seg = mesh[j];
for (auto map : idmaps) for (auto map : idmaps)
{ {
if (seg[0].IsValid() && seg[1].IsValid() && (*map)[seg[0]] && (*map)[seg[1]]) if (seg[0].IsValid() && seg[1].IsValid() && (*map)[seg[0]].IsValid() && (*map)[seg[1]].IsValid())
{ {
MarkedIdentification mi; MarkedIdentification mi;
mi.np = 2; mi.np = 2;
@ -2491,7 +2491,7 @@ namespace netgen
void UpdateEdgeMarks (Mesh & mesh, void UpdateEdgeMarks (Mesh & mesh,
const NgArray< NgArray<int,PointIndex::BASE>* > & idmaps) const NgArray< idmap_type* > & idmaps)
//const NgArray < NgArray<Element>* > & elements_before, //const NgArray < NgArray<Element>* > & elements_before,
//const NgArray < NgArray<int>* > & markedelts_num, //const NgArray < NgArray<int>* > & markedelts_num,
// const NgArray < NgArray<Element2d>* > & surfelements_before, // const NgArray < NgArray<Element2d>* > & surfelements_before,
@ -2769,12 +2769,12 @@ namespace netgen
LocalizeEdgePoints(mesh); LocalizeEdgePoints(mesh);
delete loct; delete loct;
NgArray< NgArray<int,PointIndex::BASE>* > idmaps; NgArray< idmap_type* > idmaps;
for(int i=1; i<=mesh.GetIdentifications().GetMaxNr(); i++) for(int i=1; i<=mesh.GetIdentifications().GetMaxNr(); i++)
{ {
if(mesh.GetIdentifications().GetType(i) == Identifications::PERIODIC) if(mesh.GetIdentifications().GetType(i) == Identifications::PERIODIC)
{ {
idmaps.Append(new NgArray<int,PointIndex::BASE>); idmaps.Append(new idmap_type);
mesh.GetIdentifications().GetMap(i,*idmaps.Last(),true); mesh.GetIdentifications().GetMap(i,*idmaps.Last(),true);
} }
} }
@ -2873,7 +2873,8 @@ namespace netgen
#ifndef SABINE //Nachbarelemente mit ordx,ordy,ordz #ifndef SABINE //Nachbarelemente mit ordx,ordy,ordz
NgArray<int,PointIndex::BASE> v_order (mesh.GetNP()); // NgArray<int,PointIndex::BASE> v_order (mesh.GetNP());
Array<int,PointIndex> v_order (mesh.GetNP());
v_order = 0; v_order = 0;
// for (ElementIndex ei = 0; ei < ne; ei++) // for (ElementIndex ei = 0; ei < ne; ei++)
@ -3978,7 +3979,7 @@ namespace netgen
// update identification tables // update identification tables
for (int i = 1; i <= mesh.GetIdentifications().GetMaxNr(); i++) for (int i = 1; i <= mesh.GetIdentifications().GetMaxNr(); i++)
{ {
NgArray<int,PointIndex::BASE> identmap; idmap_type identmap;
mesh.GetIdentifications().GetMap (i, identmap); mesh.GetIdentifications().GetMap (i, identmap);
@ -4004,11 +4005,11 @@ namespace netgen
for (int j = 0; j < cutedges.Size(); j++) for (int j = 0; j < cutedges.Size(); j++)
if (cutedges.UsedPos0(j)) if (cutedges.UsedPos0(j))
{ {
INDEX_2 i2; PointIndices<2> i2;
PointIndex newpi; PointIndex newpi;
cutedges.GetData0 (j, i2, newpi); cutedges.GetData0 (j, i2, newpi);
INDEX_2 oi2(identmap.Get(i2.I1()), PointIndices<2> oi2(identmap[i2[0]],
identmap.Get(i2.I2())); identmap[i2[1]]);
oi2.Sort(); oi2.Sort();
if (cutedges.Used (oi2)) if (cutedges.Used (oi2))
{ {

View File

@ -1467,10 +1467,10 @@ void MeshOptimize3d :: SwapImprove (const NgBitArray * working_elements)
void MeshOptimize3d :: SwapImproveSurface ( void MeshOptimize3d :: SwapImproveSurface (
const NgBitArray * working_elements, const NgBitArray * working_elements,
const NgArray< NgArray<int,PointIndex::BASE>* > * idmaps) const NgArray< idmap_type* > * idmaps)
{ {
NgArray< NgArray<int,PointIndex::BASE>* > locidmaps; NgArray< idmap_type* > locidmaps;
const NgArray< NgArray<int,PointIndex::BASE>* > * used_idmaps; const NgArray< idmap_type* > * used_idmaps;
if(idmaps) if(idmaps)
used_idmaps = idmaps; used_idmaps = idmaps;
@ -1482,7 +1482,7 @@ void MeshOptimize3d :: SwapImproveSurface (
{ {
if(mesh.GetIdentifications().GetType(i) == Identifications::PERIODIC) if(mesh.GetIdentifications().GetType(i) == Identifications::PERIODIC)
{ {
locidmaps.Append(new NgArray<int,PointIndex::BASE>); locidmaps.Append(new idmap_type);
mesh.GetIdentifications().GetMap(i,*locidmaps.Last(),true); mesh.GetIdentifications().GetMap(i,*locidmaps.Last(),true);
} }
} }

View File

@ -44,7 +44,7 @@ public:
double SwapImproveEdge (const NgBitArray * working_elements, Table<ElementIndex,PointIndex> & elementsonnode, INDEX_3_HASHTABLE<int> & faces, PointIndex pi1, PointIndex pi2, bool check_only=false); double SwapImproveEdge (const NgBitArray * working_elements, Table<ElementIndex,PointIndex> & elementsonnode, INDEX_3_HASHTABLE<int> & faces, PointIndex pi1, PointIndex pi2, bool check_only=false);
void SwapImprove (const NgBitArray * working_elements = NULL); void SwapImprove (const NgBitArray * working_elements = NULL);
void SwapImproveSurface (const NgBitArray * working_elements = NULL, void SwapImproveSurface (const NgBitArray * working_elements = NULL,
const NgArray< NgArray<int,PointIndex::BASE>* > * idmaps = NULL); const NgArray< idmap_type* > * idmaps = NULL);
void SwapImprove2 (); void SwapImprove2 ();
double SwapImprove2 (ElementIndex eli1, int face, Table<ElementIndex, PointIndex> & elementsonnode, TABLE<SurfaceElementIndex, PointIndex::BASE> & belementsonnode, bool check_only=false ); double SwapImprove2 (ElementIndex eli1, int face, Table<ElementIndex, PointIndex> & elementsonnode, TABLE<SurfaceElementIndex, PointIndex::BASE> & belementsonnode, bool check_only=false );

View File

@ -612,7 +612,7 @@ namespace netgen
const NgBitArray & usepoint, const NgBitArray & usepoint,
const NgArray< Vec<3>* > & nv, const NgArray< Vec<3>* > & nv,
OPTIMIZEGOAL goal = OPT_QUALITY, OPTIMIZEGOAL goal = OPT_QUALITY,
const NgArray< NgArray<int,PointIndex::BASE>* > * idmaps = NULL); const NgArray< idmap_type* > * idmaps = NULL);
/** /**
free nodes in environment of openelements free nodes in environment of openelements
for optimiztion for optimiztion

View File

@ -210,7 +210,7 @@ namespace netgen
if(!have_closesurfaces) if(!have_closesurfaces)
return; return;
NgArray<int, PointIndex::BASE> map; idmap_type map;
std::set<std::tuple<int,int,int>> hex_faces; std::set<std::tuple<int,int,int>> hex_faces;
for(auto identnr : Range(1,nmax+1)) for(auto identnr : Range(1,nmax+1))
{ {

View File

@ -2785,7 +2785,7 @@ namespace netgen
} }
void Identifications :: GetMap (int identnr, NgArray<int,PointIndex::BASE> & identmap, bool symmetric) const void Identifications :: GetMap (int identnr, idmap_type & identmap, bool symmetric) const
{ {
identmap.SetSize (mesh.GetNP()); identmap.SetSize (mesh.GetNP());
identmap = 0; identmap = 0;
@ -2812,9 +2812,14 @@ namespace netgen
if (i3.I3() == identnr || !identnr) if (i3.I3() == identnr || !identnr)
{ {
/*
identmap.Elem(i3.I1()) = i3.I2(); identmap.Elem(i3.I1()) = i3.I2();
if(symmetric) if(symmetric)
identmap.Elem(i3.I2()) = i3.I1(); identmap.Elem(i3.I2()) = i3.I1();
*/
identmap[i3.I1()] = i3.I2();
if(symmetric)
identmap[i3.I2()] = i3.I1();
} }
} }
} }

View File

@ -1653,8 +1653,9 @@ namespace netgen
// typedef NgArray<PointIndex,PointIndex::BASE> idmap_type;
typedef Array<PointIndex,PointIndex> idmap_type;
/** /**
@ -1731,7 +1732,7 @@ namespace netgen
} }
/// ///
void GetMap (int identnr, NgArray<int,PointIndex::BASE> & identmap, bool symmetric = false) const; void GetMap (int identnr, idmap_type & identmap, bool symmetric = false) const;
/// ///
ID_TYPE GetType(int identnr) const ID_TYPE GetType(int identnr) const
{ {

View File

@ -749,17 +749,17 @@ namespace netgen
// update identification tables // update identification tables
for (int i = 1; i <= mesh.GetIdentifications().GetMaxNr(); i++) for (int i = 1; i <= mesh.GetIdentifications().GetMaxNr(); i++)
{ {
NgArray<int,PointIndex::BASE> identmap; idmap_type identmap;
mesh.GetIdentifications().GetMap (i, identmap); mesh.GetIdentifications().GetMap (i, identmap);
for (int j = 1; j <= between.GetNBags(); j++) for (int j = 1; j <= between.GetNBags(); j++)
for (int k = 1; k <= between.GetBagSize(j); k++) for (int k = 1; k <= between.GetBagSize(j); k++)
{ {
INDEX_2 i2; PointIndices<2> i2;
PointIndex newpi; PointIndex newpi;
between.GetData (j, k, i2, newpi); between.GetData (j, k, i2, newpi);
INDEX_2 oi2(identmap.Get(i2.I1()), PointIndices<2> oi2(identmap[i2[0]],
identmap.Get(i2.I2())); identmap[i2[1]]);
oi2.Sort(); oi2.Sort();
if (between.Used (oi2)) if (between.Used (oi2))
{ {

View File

@ -351,17 +351,17 @@ namespace netgen
// update identification tables // update identification tables
for (int i = 1; i <= mesh.GetIdentifications().GetMaxNr(); i++) for (int i = 1; i <= mesh.GetIdentifications().GetMaxNr(); i++)
{ {
NgArray<int,PointIndex::BASE> identmap; idmap_type identmap;
mesh.GetIdentifications().GetMap (i, identmap); mesh.GetIdentifications().GetMap (i, identmap);
for (INDEX_2_HASHTABLE<PointIndex>::Iterator it = between.Begin(); for (INDEX_2_HASHTABLE<PointIndex>::Iterator it = between.Begin();
it != between.End(); it++) it != between.End(); it++)
{ {
INDEX_2 i2; PointIndices<2> i2;
PointIndex newpi; PointIndex newpi;
between.GetData (it, i2, newpi); between.GetData (it, i2, newpi);
INDEX_2 oi2(identmap.Get(i2.I1()), PointIndices<2> oi2(identmap[i2[0]],
identmap.Get(i2.I2())); identmap[i2[1]]);
oi2.Sort(); oi2.Sort();
if (between.Used (oi2)) if (between.Used (oi2))
{ {

View File

@ -1611,7 +1611,7 @@ void Mesh :: ImproveMeshJacobianOnSurface (const MeshingParameters & mp,
const NgBitArray & usepoint, const NgBitArray & usepoint,
const NgArray< Vec<3>* > & nv, const NgArray< Vec<3>* > & nv,
OPTIMIZEGOAL goal, OPTIMIZEGOAL goal,
const NgArray< NgArray<int,PointIndex::BASE>* > * idmaps) const NgArray< idmap_type* > * idmaps)
{ {
// int i, j; // int i, j;
@ -1628,8 +1628,8 @@ void Mesh :: ImproveMeshJacobianOnSurface (const MeshingParameters & mp,
JacobianPointFunction pf(points, volelements); JacobianPointFunction pf(points, volelements);
NgArray< NgArray<int,PointIndex::BASE>* > locidmaps; NgArray< idmap_type* > locidmaps;
const NgArray< NgArray<int,PointIndex::BASE>* > * used_idmaps; const NgArray< idmap_type* > * used_idmaps;
if(idmaps) if(idmaps)
used_idmaps = idmaps; used_idmaps = idmaps;
@ -1641,7 +1641,7 @@ void Mesh :: ImproveMeshJacobianOnSurface (const MeshingParameters & mp,
{ {
if(GetIdentifications().GetType(i) == Identifications::PERIODIC) if(GetIdentifications().GetType(i) == Identifications::PERIODIC)
{ {
locidmaps.Append(new NgArray<int,PointIndex::BASE>); locidmaps.Append(new idmap_type);
GetIdentifications().GetMap(i,*locidmaps.Last(),true); GetIdentifications().GetMap(i,*locidmaps.Last(),true);
} }
} }

View File

@ -155,7 +155,7 @@ namespace netgen
const NgBitArray & isnewpoint, const Refinement & refinement, const NgBitArray & isnewpoint, const Refinement & refinement,
const NgArray<double> & pure_badness, const NgArray<double> & pure_badness,
double max_worsening, const bool uselocalworsening, double max_worsening, const bool uselocalworsening,
const NgArray< NgArray<int,PointIndex::BASE>* > & idmaps) const NgArray< idmap_type* > & idmaps)
{ {
ostringstream ostrstr; ostringstream ostrstr;

View File

@ -14,7 +14,7 @@ namespace netgen
const NgBitArray & isnewpoint, const Refinement & refinement, const NgBitArray & isnewpoint, const Refinement & refinement,
const NgArray<double> & pure_badness, const NgArray<double> & pure_badness,
double max_worsening, const bool uselocalworsening, double max_worsening, const bool uselocalworsening,
const NgArray< NgArray<int,PointIndex::BASE>* > & idmaps); const NgArray< idmap_type* > & idmaps);
} }