convert NgArrays

This commit is contained in:
Joachim Schoeberl 2024-12-29 18:57:47 +01:00
parent 100279be6c
commit bb37ae1987
6 changed files with 39 additions and 36 deletions

View File

@ -282,7 +282,7 @@ namespace netgen
NgArray<INDEX> & lindex, NgArray<INDEX> & lindex,
double xh) double xh)
{ {
static Timer timer("adfront2::GetLocals"); RegionTimer reg (timer); // static Timer timer("adfront2::GetLocals"); RegionTimer reg (timer);
int pstind; int pstind;
Point<3> midp, p0; Point<3> midp, p0;

View File

@ -171,21 +171,21 @@ class AdFront2
{ {
/// ///
NgArray<FrontPoint2> points; /// front points Array<FrontPoint2> points; /// front points
NgArray<FrontLine> lines; /// front lines Array<FrontLine> lines; /// front lines
Box3d boundingbox; Box3d boundingbox;
BoxTree<3> linesearchtree; /// search tree for lines BoxTree<3> linesearchtree; /// search tree for lines
Point3dTree pointsearchtree; /// search tree for points Point3dTree pointsearchtree; /// search tree for points
Point3dTree cpointsearchtree; /// search tree for cone points (not used ???) Point3dTree cpointsearchtree; /// search tree for cone points (not used ???)
NgArray<int> delpointl; /// list of deleted front points Array<int> delpointl; /// list of deleted front points
NgArray<int> dellinel; /// list of deleted front lines Array<int> dellinel; /// list of deleted front lines
int nfl; /// number of front lines; int nfl; /// number of front lines;
INDEX_2_HASHTABLE<int> * allflines; /// all front lines ever have been INDEX_2_HASHTABLE<int> * allflines; /// all front lines ever have been
NgArray<int> invpindex; Array<int> invpindex;
int minval; int minval;
int starti; int starti;

View File

@ -184,7 +184,8 @@ class AdFront3
{ {
/// ///
// NgArray<FrontPoint3, PointIndex::BASE, PointIndex> points; // NgArray<FrontPoint3, PointIndex::BASE, PointIndex> points;
Array<FrontPoint3, PointIndex> points; Array<FrontPoint3, PointIndex> points
;
/// ///
NgArray<FrontFace> faces; NgArray<FrontFace> faces;
/// ///

View File

@ -246,8 +246,8 @@ namespace netgen
{ {
static Timer timer("surface meshing"); RegionTimer reg(timer); static Timer timer("surface meshing"); RegionTimer reg(timer);
static int timer1 = NgProfiler::CreateTimer ("surface meshing1"); static Timer timer1("surface meshing1");
static int timer2 = NgProfiler::CreateTimer ("surface meshing2"); static Timer timer2("surface meshing2");
static int timer3 = NgProfiler::CreateTimer ("surface meshing3"); static int timer3 = NgProfiler::CreateTimer ("surface meshing3");
static int ts1 = NgProfiler::CreateTimer ("surface meshing start 1"); static int ts1 = NgProfiler::CreateTimer ("surface meshing start 1");
@ -408,7 +408,7 @@ namespace netgen
RegionTimer rloop(tloop); RegionTimer rloop(tloop);
while (!adfront.Empty() && !multithread.terminate) while (!adfront.Empty() && !multithread.terminate)
{ {
NgProfiler::RegionTimer reg1 (timer1); // RegionTimer reg1 (timer1);
if (multithread.terminate) if (multithread.terminate)
throw NgException ("Meshing stopped"); throw NgException ("Meshing stopped");
@ -487,8 +487,7 @@ namespace netgen
pindex, lindex, 2*hinner); pindex, lindex, 2*hinner);
// tgetlocals.Stop(); // tgetlocals.Stop();
NgProfiler::RegionTimer reg2 (timer2); // RegionTimer reg2 (timer2);
//(*testout) << "h for locals: " << 2*hinner << endl; //(*testout) << "h for locals: " << 2*hinner << endl;
@ -557,7 +556,7 @@ namespace netgen
oldnl = loclines.Size(); oldnl = loclines.Size();
UpdateVisSurfaceMeshData(oldnl); UpdateVisSurfaceMeshData(oldnl);
if (debugflag) if (debugflag)
(*testout) << "define new transformation" << endl; (*testout) << "define new transformation" << endl;
@ -574,15 +573,16 @@ namespace netgen
*testout << "3d points: " << endl << locpoints << endl; *testout << "3d points: " << endl << locpoints << endl;
} }
{
for (size_t i = 0; i < locpoints.Size(); i++) // RegionTimer reg2 (timer2);
{ for (size_t i = 0; i < locpoints.Size(); i++)
Point<2> pp; {
TransformToPlain (locpoints[i], mpgeominfo[i], Point<2> pp;
pp, h, plainzones[i]); TransformToPlain (locpoints[i], mpgeominfo[i],
plainpoints[i] = pp; pp, h, plainzones[i]);
} plainpoints[i] = pp;
}
}
/* /*
for (int i = 1; i <= locpoints.Size(); i++) for (int i = 1; i <= locpoints.Size(); i++)
{ {
@ -633,7 +633,6 @@ namespace netgen
// plainpoints.Elem(i) = Point2d (1e4, 1e4); // plainpoints.Elem(i) = Point2d (1e4, 1e4);
*/ */
for (int i = 2; i <= loclines.Size(); i++) // don't remove first line for (int i = 2; i <= loclines.Size(); i++) // don't remove first line
{ {

View File

@ -102,30 +102,30 @@ namespace netgen
[[deprecated("Use GetDistantPNums(locnum).Size() instead!")]] // [[deprecated("Use GetDistantPNums(locnum).Size() instead!")]]
int GetNDistantPNums (int locpnum) const { return loc2distvert[locpnum-1].Size(); } int GetNDistantPNums (int locpnum) const { return loc2distvert[locpnum-1].Size(); }
[[deprecated("Use GetDistantFaceNums(locnum).Size() instead!")]] // [[deprecated("Use GetDistantFaceNums(locnum).Size() instead!")]]
int GetNDistantFaceNums (int locfacenum) const { return loc2distface[locfacenum-1].Size(); } int GetNDistantFaceNums (int locfacenum) const { return loc2distface[locfacenum-1].Size(); }
[[deprecated("Use GetDistantEdgeNums(locnum).Size() instead!")]] // [[deprecated("Use GetDistantEdgeNums(locnum).Size() instead!")]]
int GetNDistantEdgeNums ( int locedgenum) const { return loc2distedge[locedgenum-1].Size(); } int GetNDistantEdgeNums ( int locedgenum) const { return loc2distedge[locedgenum-1].Size(); }
[[deprecated("Use GetDistantPNums(locnum) -> FlatArray instead!")]] // [[deprecated("Use GetDistantPNums(locnum) -> FlatArray instead!")]]
void GetDistantPNums (int locpnum, int * distpnums ) const void GetDistantPNums (int locpnum, int * distpnums ) const
{ {
for (int i = 0; i < loc2distvert[locpnum-1].Size(); i++ ) for (int i = 0; i < loc2distvert[locpnum-1].Size(); i++ )
distpnums[i] = loc2distvert[locpnum-1][i]; distpnums[i] = loc2distvert[locpnum-1][i];
} }
[[deprecated("Use GetDistantFaceNums(locnum) -> FlatArray instead!")]] // [[deprecated("Use GetDistantFaceNums(locnum) -> FlatArray instead!")]]
void GetDistantFaceNums (int locfacenum, int * distfacenums ) const void GetDistantFaceNums (int locfacenum, int * distfacenums ) const
{ {
for ( int i = 0; i < loc2distface[locfacenum-1].Size(); i++ ) for ( int i = 0; i < loc2distface[locfacenum-1].Size(); i++ )
distfacenums[i] = loc2distface[locfacenum-1][i]; distfacenums[i] = loc2distface[locfacenum-1][i];
} }
[[deprecated("Use GetDistantFaceNums(locnum) -> FlatArray instead!")]] // [[deprecated("Use GetDistantFaceNums(locnum) -> FlatArray instead!")]]
void GetDistantFaceNums (int locfacenum, NgArray<int> & distfacenums ) const void GetDistantFaceNums (int locfacenum, NgArray<int> & distfacenums ) const
{ {
// distfacenums = loc2distface[locfacenum-1]; // distfacenums = loc2distface[locfacenum-1];
@ -135,14 +135,14 @@ namespace netgen
distfacenums[i] = loc[i]; distfacenums[i] = loc[i];
} }
[[deprecated("Use GetDistantEdgeNums(locnum) -> FlatArray instead!")]] // [[deprecated("Use GetDistantEdgeNums(locnum) -> FlatArray instead!")]]
void GetDistantEdgeNums (int locedgenum, int * distedgenums ) const void GetDistantEdgeNums (int locedgenum, int * distedgenums ) const
{ {
for (int i = 0; i < loc2distedge[locedgenum-1].Size(); i++ ) for (int i = 0; i < loc2distedge[locedgenum-1].Size(); i++ )
distedgenums[i] = loc2distedge[locedgenum-1][i]; distedgenums[i] = loc2distedge[locedgenum-1][i];
} }
[[deprecated("Use GetDistantEdgeNums(locnum) -> FlatArray instead!")]] // [[deprecated("Use GetDistantEdgeNums(locnum) -> FlatArray instead!")]]
void GetDistantEdgeNums (int locedgenum, NgArray<int> & distedgenums ) const void GetDistantEdgeNums (int locedgenum, NgArray<int> & distedgenums ) const
{ {
// distedgenums = loc2distedge[locedgenum-1]; // distedgenums = loc2distedge[locedgenum-1];

View File

@ -296,6 +296,8 @@ namespace netgen
Point<2> & pplane, Point<2> & pplane,
double h, int & zone) const double h, int & zone) const
{ {
// static Timer t("ToPlane"); RegionTimer reg(t);
if (projecttype == PLANESPACE) if (projecttype == PLANESPACE)
{ {
Vec<3> p1p, n; Vec<3> p1p, n;
@ -338,7 +340,7 @@ namespace netgen
PointGeomInfo & gi, PointGeomInfo & gi,
double h) double h)
{ {
static Timer t("FromPlane"); RegionTimer reg(t); // static Timer t("FromPlane"); RegionTimer reg(t);
if (projecttype == PLANESPACE) if (projecttype == PLANESPACE)
{ {
@ -364,8 +366,8 @@ namespace netgen
void OCCSurface :: Project (Point<3> & ap, PointGeomInfo & gi) void OCCSurface :: Project (Point<3> & ap, PointGeomInfo & gi)
{ {
static Timer t("OccSurface::Project"); RegionTimer reg(t); // static Timer t("OccSurface::Project"); RegionTimer reg(t);
static Timer t2("OccSurface::Project actual"); // static Timer t2("OccSurface::Project actual");
// try Newton's method ... // try Newton's method ...
@ -470,13 +472,14 @@ namespace netgen
*/ */
// double u,v; // double u,v;
// JS : shouldn't we move these 2 lines to the constructor ?
Handle( ShapeAnalysis_Surface ) su = new ShapeAnalysis_Surface( occface ); Handle( ShapeAnalysis_Surface ) su = new ShapeAnalysis_Surface( occface );
auto toltool = BRep_Tool::Tolerance( topods_face ); auto toltool = BRep_Tool::Tolerance( topods_face );
// gp_Pnt2d suval = su->ValueOfUV ( pnt, toltool); // gp_Pnt2d suval = su->ValueOfUV ( pnt, toltool);
t2.Start(); // t2.Start();
gp_Pnt2d suval = su->NextValueOfUV (gp_Pnt2d(u,v), pnt, toltool); gp_Pnt2d suval = su->NextValueOfUV (gp_Pnt2d(u,v), pnt, toltool);
t2.Stop(); // t2.Stop();
suval.Coord( u, v); suval.Coord( u, v);
pnt = occface->Value( u, v ); pnt = occface->Value( u, v );