From f14a04a837342e64c44c962cc9fbdb82a9741462 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Mon, 24 Aug 2009 00:03:40 +0000 Subject: [PATCH] basegeometry, disable moveablemem --- libsrc/csg/csgeom.hpp | 2 +- libsrc/csg/genmesh.cpp | 8 +- libsrc/csg/identify.cpp | 12 +- libsrc/general/array.hpp | 4 +- libsrc/general/dynamicmem.cpp | 2 + libsrc/general/moveablemem.cpp | 4 +- libsrc/general/moveablemem.hpp | 7 +- libsrc/geom2d/splinegeometry.hpp | 2 +- libsrc/meshing/basegeom.hpp | 18 +++ libsrc/meshing/classifyhpel.hpp | 20 +-- libsrc/meshing/hprefinement.cpp | 140 ++++++++--------- libsrc/meshing/meshclass.hpp | 7 +- libsrc/meshing/meshing.hpp | 2 + libsrc/stlgeom/stlgeom.hpp | 2 +- libsrc/visualization/visual.hpp | 2 + libsrc/visualization/vssolution.cpp | 224 ++++++++++------------------ libsrc/visualization/vssolution.hpp | 2 +- ng/menustat.tcl | 18 +-- ng/ngpkg.cpp | 6 +- 19 files changed, 212 insertions(+), 270 deletions(-) create mode 100644 libsrc/meshing/basegeom.hpp diff --git a/libsrc/csg/csgeom.hpp b/libsrc/csg/csgeom.hpp index a1927cb3..658a7472 100644 --- a/libsrc/csg/csgeom.hpp +++ b/libsrc/csg/csgeom.hpp @@ -85,7 +85,7 @@ public: /** CSGeometry has the whole geometric information */ -class CSGeometry +class CSGeometry : public NetgenGeometry { private: /// all surfaces diff --git a/libsrc/csg/genmesh.cpp b/libsrc/csg/genmesh.cpp index ff93c2ce..dbae83a9 100644 --- a/libsrc/csg/genmesh.cpp +++ b/libsrc/csg/genmesh.cpp @@ -492,8 +492,8 @@ namespace netgen if (multithread.terminate) return; - for (int i = oldnf+1; i <= mesh.GetNSE(); i++) - mesh.SurfaceElement(i).SetIndex (k); + for (SurfaceElementIndex sei = oldnf; sei < mesh.GetNSE(); sei++) + mesh[sei].SetIndex (k); // mesh.CalcSurfacesOfNode(); @@ -621,8 +621,8 @@ namespace netgen if (multithread.terminate) return; - for (int i = oldnf+1; i <= mesh.GetNSE(); i++) - mesh.SurfaceElement(i).SetIndex (k); + for (SurfaceElementIndex sei = oldnf; sei < mesh.GetNSE(); sei++) + mesh[sei].SetIndex (k); if (!segments.Size()) diff --git a/libsrc/csg/identify.cpp b/libsrc/csg/identify.cpp index d43c423c..e3086a3b 100644 --- a/libsrc/csg/identify.cpp +++ b/libsrc/csg/identify.cpp @@ -451,9 +451,9 @@ BuildSurfaceElements (Array & segs, { Array copy_points; - for (int i = 1; i <= mesh.GetNSE(); i++) + for (SurfaceElementIndex sei = 0; sei < mesh.GetNSE(); sei++) { - const Element2d & sel = mesh.SurfaceElement(i); + const Element2d & sel = mesh[sei]; INDEX_2 fpair (facei, sel.GetIndex()); fpair.Sort(); if (identfaces.Used (fpair)) @@ -469,9 +469,9 @@ BuildSurfaceElements (Array & segs, - for (int i = 1; i <= mesh.GetNSE(); i++) + for (SurfaceElementIndex sei = 0; sei < mesh.GetNSE(); sei++) { - const Element2d & sel = mesh.SurfaceElement(i); + const Element2d & sel = mesh[sei]; INDEX_2 fpair (facei, sel.GetIndex()); fpair.Sort(); if (identfaces.Used (fpair)) @@ -1341,9 +1341,9 @@ BuildSurfaceElements2 (Array & segs, { // (*testout) << "surfaces found" << endl; // copy surface - for (int i = 1; i <= mesh.GetNSE(); i++) + for (SurfaceElementIndex sei = 0; sei < mesh.GetNSE(); sei++) { - const Element2d & sel = mesh.SurfaceElement(i); + const Element2d & sel = mesh[sei]; INDEX_2 fpair (facei, sel.GetIndex()); fpair.Sort(); if (identfaces.Used (fpair)) diff --git a/libsrc/general/array.hpp b/libsrc/general/array.hpp index c0f2ca68..520f4b73 100644 --- a/libsrc/general/array.hpp +++ b/libsrc/general/array.hpp @@ -422,14 +422,13 @@ public: - /// template class MoveableArray { int size; int allocsize; - MoveableMem data; + DynamicMem data; public: @@ -578,6 +577,7 @@ inline ostream & operator<< (ostream & ost, MoveableArray & a) } + /// bubble sort array template inline void BubbleSort (const FlatArray & data) diff --git a/libsrc/general/dynamicmem.cpp b/libsrc/general/dynamicmem.cpp index bda91e27..56fb1182 100644 --- a/libsrc/general/dynamicmem.cpp +++ b/libsrc/general/dynamicmem.cpp @@ -167,6 +167,7 @@ namespace netgen { + /* BaseMoveableMem * pm = BaseMoveableMem::first; while (pm) { @@ -186,6 +187,7 @@ namespace netgen pm = pm->next; } + */ } diff --git a/libsrc/general/moveablemem.cpp b/libsrc/general/moveablemem.cpp index 8129dfeb..51f538be 100644 --- a/libsrc/general/moveablemem.cpp +++ b/libsrc/general/moveablemem.cpp @@ -5,7 +5,8 @@ using namespace std; namespace netgen { - + +#ifdef OLD NgMutex mem_mutex; size_t BaseMoveableMem::totalsize = 0; // 500000000; @@ -266,5 +267,6 @@ namespace netgen cout << " used = " << used << endl; // cout << "******************************************************" << endl; } +#endif } diff --git a/libsrc/general/moveablemem.hpp b/libsrc/general/moveablemem.hpp index 5b639c85..956b973d 100644 --- a/libsrc/general/moveablemem.hpp +++ b/libsrc/general/moveablemem.hpp @@ -9,8 +9,11 @@ namespace netgen { +#ifdef OLD + + extern NgMutex mem_mutex; + -extern NgMutex mem_mutex; class BaseMoveableMem { @@ -98,6 +101,8 @@ protected: MoveableMem & operator= (const MoveableMem & m) { ; } }; +#endif + } #endif diff --git a/libsrc/geom2d/splinegeometry.hpp b/libsrc/geom2d/splinegeometry.hpp index b04dd366..578d2d41 100644 --- a/libsrc/geom2d/splinegeometry.hpp +++ b/libsrc/geom2d/splinegeometry.hpp @@ -34,7 +34,7 @@ extern void PartitionBoundary (const Array < SplineSeg<2>* > & splines, extern int printmessage_importance; template < int D > -class SplineGeometry +class SplineGeometry { Array < GeomPoint > geompoints; Array < SplineSeg* > splines; diff --git a/libsrc/meshing/basegeom.hpp b/libsrc/meshing/basegeom.hpp new file mode 100644 index 00000000..66d370c1 --- /dev/null +++ b/libsrc/meshing/basegeom.hpp @@ -0,0 +1,18 @@ +#ifndef FILE_BASEGEOM +#define FILE_BASEGEOM + +/**************************************************************************/ +/* File: basegeom.hpp */ +/* Author: Joachim Schoeberl */ +/* Date: 23. Aug. 09 */ +/**************************************************************************/ + + +class NetgenGeometry +{ +public: + virtual ~NetgenGeometry () { ; } +}; + + +#endif diff --git a/libsrc/meshing/classifyhpel.hpp b/libsrc/meshing/classifyhpel.hpp index 80ab10d6..69656ffc 100644 --- a/libsrc/meshing/classifyhpel.hpp +++ b/libsrc/meshing/classifyhpel.hpp @@ -731,15 +731,17 @@ HPREF_ELEMENT_TYPE ClassifyTrig(HPRefElement & el, INDEX_2_HASHTABLE & edge { i2.Sort(); if(surf_edges.Used(i2) && surf_edges.Get(i2) != fd.SurfNr()+1) // edge not face_edge acc. to surface in which trig lies - if(face_edges.Get(i2)==-1 ||face_edges.Get(i2) == fd.DomainIn() || face_edges.Get(i2) == fd.DomainOut() ) - { - edge_sing[k]=1; - } - else - { - point_sing[ep1-1] = 0; // set to edge_point - point_sing[ep2-1] = 0; // set to edge_point - } + { + if(face_edges.Get(i2)==-1 ||face_edges.Get(i2) == fd.DomainIn() || face_edges.Get(i2) == fd.DomainOut() ) + { + edge_sing[k]=1; + } + else + { + point_sing[ep1-1] = 0; // set to edge_point + point_sing[ep2-1] = 0; // set to edge_point + } + } } /* *testout << " pointsing NACH edges UND FACEEDGES UMSETZEN ... " ; diff --git a/libsrc/meshing/hprefinement.cpp b/libsrc/meshing/hprefinement.cpp index cc22d1bf..7a693da1 100644 --- a/libsrc/meshing/hprefinement.cpp +++ b/libsrc/meshing/hprefinement.cpp @@ -574,55 +574,46 @@ namespace netgen void InitHPElements(Mesh & mesh, Array & elements) { - for(ElementIndex i=0;i= 10000) @@ -630,7 +621,6 @@ namespace netgen throw NgException("assumption that seg.edgenr < 10000 is wrong"); } elements.Append(hpel); - } } @@ -1323,15 +1313,15 @@ namespace netgen PrintMessage (1, "HP Refinement called, levels = ", levels); - NgLock mem_lock (mem_mutex,1); + // NgLock mem_lock (mem_mutex,1); mesh.coarsemesh = new Mesh; *mesh.coarsemesh = mesh; -#ifdef CURVEDELEMS_NEW + // #ifdef CURVEDELEMS_NEW const_cast (mesh.coarsemesh->GetCurvedElements() ). BuildCurvedElements (ref, mesh.GetCurvedElements().GetOrder()); -#endif + // #endif delete mesh.hpelements; @@ -1345,7 +1335,7 @@ namespace netgen nplevel.Append (mesh.GetNP()); int act_ref=1; - bool sing = ClassifyHPElements(mesh,hpelements, act_ref, levels); + bool sing = ClassifyHPElements (mesh,hpelements, act_ref, levels); sing = true; // iterate at least once while(sing) @@ -1578,9 +1568,9 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE & edges, INDEX_2_HAS BitArray & cornerpoint, BitArray & edgepoint, INDEX_3_HASHTABLE & faces, INDEX_2_HASHTABLE & face_edges, INDEX_2_HASHTABLE & surf_edges, Array & facepoint, int & levels, int & act_ref) { - bool sing=0; + bool sing = 0; if (mesh.GetDimension() == 3) - { + { /* // check, if point has as least 3 different surfs: @@ -1731,48 +1721,47 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE & edges, INDEX_2_HAS for (int i = 1; i <= mesh.GetNP(); i++) surfonpoint.Elem(i) = INDEX_3(0,0,0); - + for (int i = 1; i <= mesh.GetNSeg(); i++) { const Segment & seg = mesh.LineSegment(i); int ind = seg.edgenr; - - - if (seg.singedge_left * levels >= act_ref) - { - INDEX_2 i2 (mesh.LineSegment(i)[0], - mesh.LineSegment(i)[1]); - edges.Set(i2,1); - edgepoint.Set(i2.I1()); - edgepoint.Set(i2.I2()); - *testout << " singleft " << endl; - *testout << " mesh.LineSegment(i).domout " << mesh.LineSegment(i).domout << endl; - *testout << " mesh.LineSegment(i).domin " << mesh.LineSegment(i).domin << endl; - edgepoint_dom.Set (INDEX_2(mesh.LineSegment(i).domin, i2.I1()), 1); - edgepoint_dom.Set (INDEX_2(mesh.LineSegment(i).domin, i2.I2()), 1); - sing = 1; - - } + + if (seg.singedge_left * levels >= act_ref) + { + INDEX_2 i2 (mesh.LineSegment(i)[0], + mesh.LineSegment(i)[1]); + edges.Set(i2,1); + edgepoint.Set(i2.I1()); + edgepoint.Set(i2.I2()); + *testout << " singleft " << endl; + *testout << " mesh.LineSegment(i).domout " << mesh.LineSegment(i).domout << endl; + *testout << " mesh.LineSegment(i).domin " << mesh.LineSegment(i).domin << endl; + edgepoint_dom.Set (INDEX_2(mesh.LineSegment(i).domin, i2.I1()), 1); + edgepoint_dom.Set (INDEX_2(mesh.LineSegment(i).domin, i2.I2()), 1); + sing = 1; - if (seg.singedge_right * levels >= act_ref) - { - INDEX_2 i2 (mesh.LineSegment(i)[1], - mesh.LineSegment(i)[0]); - edges.Set (i2, 1); - edgepoint.Set(i2.I1()); - edgepoint.Set(i2.I2()); - - *testout << " singright " << endl; - *testout << " mesh.LineSegment(i).domout " << mesh.LineSegment(i).domout << endl; - *testout << " mesh.LineSegment(i).domin " << mesh.LineSegment(i).domin << endl; - - edgepoint_dom.Set (INDEX_2(mesh.LineSegment(i).domout, i2.I1()), 1); - edgepoint_dom.Set (INDEX_2(mesh.LineSegment(i).domout, i2.I2()), 1); - sing = 1; - } - + } + + if (seg.singedge_right * levels >= act_ref) + { + INDEX_2 i2 (mesh.LineSegment(i)[1], + mesh.LineSegment(i)[0]); + edges.Set (i2, 1); + edgepoint.Set(i2.I1()); + edgepoint.Set(i2.I2()); + + *testout << " singright " << endl; + *testout << " mesh.LineSegment(i).domout " << mesh.LineSegment(i).domout << endl; + *testout << " mesh.LineSegment(i).domin " << mesh.LineSegment(i).domin << endl; + + edgepoint_dom.Set (INDEX_2(mesh.LineSegment(i).domout, i2.I1()), 1); + edgepoint_dom.Set (INDEX_2(mesh.LineSegment(i).domout, i2.I2()), 1); + sing = 1; + } + // (*testout) << "seg = " << ind << ", " << seg[0] << "-" << seg[1] << endl; - + if (seg.singedge_left * levels >= act_ref || seg.singedge_right* levels >= act_ref) @@ -1797,7 +1786,7 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE & edges, INDEX_2_HAS // mark points for refinement that are in corners between two anisotropic edges if (surfonpoint.Get(i).I1()) { - cornerpoint.Set(i); + // cornerpoint.Set(i); // disabled by JS, Aug 2009 edgepoint.Set(i); } @@ -1820,10 +1809,8 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE & edges, INDEX_2_HAS } if (!sing) - { - cout << "PrepareElements no more to do for actual refinement " << act_ref << endl; - return(sing); - } + cout << "PrepareElements no more to do for actual refinement " << act_ref << endl; + return(sing); } @@ -1831,7 +1818,6 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE & edges, INDEX_2_HAS bool ClassifyHPElements (Mesh & mesh, Array & elements, int & act_ref, int & levels) { - INDEX_2_HASHTABLE edges(mesh.GetNSeg()+1); BitArray edgepoint(mesh.GetNP()); INDEX_2_HASHTABLE edgepoint_dom(mesh.GetNSeg()+1); diff --git a/libsrc/meshing/meshclass.hpp b/libsrc/meshing/meshclass.hpp index 67d3e2a4..fe8916ca 100644 --- a/libsrc/meshing/meshclass.hpp +++ b/libsrc/meshing/meshclass.hpp @@ -271,11 +271,8 @@ public: int GetNSE () const { return surfelements.Size(); } Element2d & SurfaceElement(int i) { return surfelements.Elem(i); } const Element2d & SurfaceElement(int i) const { return surfelements.Get(i); } - - Element2d & SurfaceElement(SurfaceElementIndex i) - { return surfelements[i]; } - const Element2d & SurfaceElement(SurfaceElementIndex i) const - { return surfelements[i]; } + Element2d & SurfaceElement(SurfaceElementIndex i) { return surfelements[i]; } + const Element2d & SurfaceElement(SurfaceElementIndex i) const { return surfelements[i]; } const Element2d & operator[] (SurfaceElementIndex ei) const { return surfelements[ei]; } diff --git a/libsrc/meshing/meshing.hpp b/libsrc/meshing/meshing.hpp index cfaf33a3..83f25dd4 100644 --- a/libsrc/meshing/meshing.hpp +++ b/libsrc/meshing/meshing.hpp @@ -32,6 +32,8 @@ namespace netgen #include "meshing2.hpp" #include "improve2.hpp" +#include "basegeom.hpp" + #include "geomsearch.hpp" #include "adfront3.hpp" diff --git a/libsrc/stlgeom/stlgeom.hpp b/libsrc/stlgeom/stlgeom.hpp index 9f9cc857..2da96329 100644 --- a/libsrc/stlgeom/stlgeom.hpp +++ b/libsrc/stlgeom/stlgeom.hpp @@ -88,7 +88,7 @@ namespace netgen - class STLGeometry : public STLTopology + class STLGeometry : public STLTopology, public NetgenGeometry { // edges to be meshed: Array edges; diff --git a/libsrc/visualization/visual.hpp b/libsrc/visualization/visual.hpp index d2fe5028..405c5b6b 100644 --- a/libsrc/visualization/visual.hpp +++ b/libsrc/visualization/visual.hpp @@ -23,6 +23,8 @@ Visualization #include "mvdraw.hpp" #include "soldata.hpp" +#include + namespace netgen { #include "vssolution.hpp" diff --git a/libsrc/visualization/vssolution.cpp b/libsrc/visualization/vssolution.cpp index 850c479c..c786a9c5 100644 --- a/libsrc/visualization/vssolution.cpp +++ b/libsrc/visualization/vssolution.cpp @@ -14,9 +14,7 @@ namespace netgen { - extern AutoPtr mesh; - extern VisualSceneMesh vsmesh; @@ -52,7 +50,6 @@ namespace netgen isolinelist = 0; clipplane_isolinelist = 0; surface_vector_list = 0; - // cone_list = 0; isosurface_list = 0; fieldlineslist = 0; @@ -360,8 +357,8 @@ namespace netgen return; } - static NgLock mem_lock(mem_mutex); - mem_lock.Lock(); + // static NgLock mem_lock(mem_mutex); + // mem_lock.Lock(); NgLock meshlock1 (mesh->MajorMutex(), true); NgLock meshlock (mesh->Mutex(), true); @@ -511,7 +508,7 @@ namespace netgen // delete lock; - mem_lock.UnLock(); + // mem_lock.UnLock(); endtime = clock(); // cout << 1.0 / (double(endtime - starttime)/CLOCKS_PER_SEC) << " frames/sec" << endl; @@ -1087,7 +1084,7 @@ namespace netgen Vec<3> nvs[1100]; double values[1100]; double mvalues[11000]; - double valuesc[1100][2]; + complex valuesc[11000]; int nse = mesh->GetNSE(); @@ -1127,7 +1124,7 @@ namespace netgen if ( el.GetType() == QUAD || el.GetType() == QUAD6 ) { - bool curved = curv.IsSurfaceElementCurved(sei); + bool curved = curv.IsSurfaceElementCurved (sei); Point<3> lpi[4]; Vec<3> vx, vy, vtwist; @@ -1146,8 +1143,6 @@ namespace netgen // nv.Normalize(); // glNormal3dv (nv); - - for (int iy = 0, ii = 0; iy <= n; iy++) for (int ix = 0; ix <= n; ix++, ii++) pref[ii] = Point<2> (double(ix)/n, double(iy)/n); @@ -1185,7 +1180,7 @@ namespace netgen { if (usetexture == 2) for (int ii = 0; ii < npt; ii++) - drawelem = GetSurfValueComplex (sol, sei, pref[ii](0), pref[ii](1), scalcomp, valuesc[ii][0], valuesc[ii][1]); + drawelem = GetSurfValueComplex (sol, sei, pref[ii](0), pref[ii](1), scalcomp, valuesc[ii].real(), valuesc[ii].imag()); else for (int ii = 0; ii < npt; ii++) drawelem = GetSurfValue (sol, sei, pref[ii](0), pref[ii](1), scalcomp, values[ii]); @@ -1219,8 +1214,8 @@ namespace netgen if (usetexture != 2) SetOpenGlColor (values[index[j]]); else - glTexCoord2f ( valuesc[index[j]][0], - valuesc[index[j]][1] ); + glTexCoord2f ( valuesc[index[j]].real(), + valuesc[index[j]].imag() ); } else glColor3fv (col_grey); @@ -1253,75 +1248,26 @@ namespace netgen { const Element2d & el = (*mesh)[sei]; -#ifdef PARALLEL - // parallel visualization --> dont draw ghost elements if ( el . IsGhost() ) continue; -#endif - // if ( mesh->GetFaceDescriptor(el.GetIndex()).BCProperty() != 1) continue; - - - if(vispar.drawdomainsurf > 0 && - ((mesh->GetDimension() == 3 && - vispar.drawdomainsurf != mesh->GetFaceDescriptor(el.GetIndex()).DomainIn() && - vispar.drawdomainsurf != mesh->GetFaceDescriptor(el.GetIndex()).DomainOut()) || - (mesh->GetDimension() == 2 && el.GetIndex() != vispar.drawdomainsurf))) continue; - + if(vispar.drawdomainsurf > 0) + { + if (mesh->GetDimension() == 3) + { + if (vispar.drawdomainsurf != mesh->GetFaceDescriptor(el.GetIndex()).DomainIn() && + vispar.drawdomainsurf != mesh->GetFaceDescriptor(el.GetIndex()).DomainOut()) + continue; + } + else + { + if (el.GetIndex() != vispar.drawdomainsurf) + continue; + } + } if ( el.GetType() == TRIG || el.GetType() == TRIG6 ) { - bool curved = curv.IsHighOrder(); // && curv.IsSurfaceElementCurved(sei); - // if (el.GetType() == TRIG6) curved = true; - - Point<3> p1, p2, p3; - Mat<3,2> dxdxi; - - if (! curved) - { - GetPointDeformation (el[0]-1, p1, sei); - GetPointDeformation (el[1]-1, p2, sei); - GetPointDeformation (el[2]-1, p3, sei); - - for (int i = 0; i < 3; i++) - { - dxdxi(i, 0) = p1(i)-p3(i); - dxdxi(i, 1) = p2(i)-p3(i); - } - } - - - /* - for (int iy = 0, ii = 0; iy <= n; iy++) - for (int ix = 0; ix <= n-iy; ix++, ii++) - { - Point<2> pref(ix*invn,iy*invn); - if (curved) - { - mesh->GetCurvedElements(). - CalcSurfaceTransformation (pref, sei, points[ii], dxdxi); - } - else - { - points[ii] = p3 + (invn*ix) * (p1-p3) + (invn*iy) * (p2-p3); - } - - nvs[ii] = Cross (dxdxi.Col(0), dxdxi.Col(1)); - nvs[ii].Normalize(); - - if (sol && sol->draw_surface) - { - if (usetexture == 2) - drawelem = GetSurfValueComplex (sol, sei, ix*invn, iy*invn, scalcomp, - valuesc[ii][0], valuesc[ii][1]); - else - drawelem = GetSurfValue (sol, sei, pref, points[ii], &dxdxi(0,0), scalcomp, values[ii]); - } - - if (deform) - points[ii] += GetSurfDeformation (sei, invn*ix, invn*iy); - } - */ - + bool curved = curv.IsSurfaceElementCurved(sei); for (int iy = 0, ii = 0; iy <= n; iy++) for (int ix = 0; ix <= n-iy; ix++, ii++) @@ -1338,14 +1284,15 @@ namespace netgen } else { - Vec<3> vx = (p1-p3); - Vec<3> vy = (p2-p3); + Point<3> p1 = mesh->Point (el[0]); + Point<3> p2 = mesh->Point (el[1]); + Point<3> p3 = mesh->Point (el[2]); + + Vec<3> vx = p1-p3; + Vec<3> vy = p2-p3; for (int ii = 0; ii < npt; ii++) { - double x = pref[ii](0); - double y = pref[ii](1); - points[ii] = p3 + x * vx + y * vy; - + points[ii] = p3 + pref[ii](0) * vx + pref[ii](1) * vy; for (int j = 0; j < 3; j++) { dxdxis[ii](j,0) = vx(j); @@ -1361,31 +1308,24 @@ namespace netgen bool drawelem = false; if (sol && sol->draw_surface) { + drawelem = GetMultiSurfValues (sol, sei, npt, + &pref[0](0), &pref[1](0)-&pref[0](0), + &points[0](0), &points[1](0)-&points[0](0), + &dxdxis[0](0), &dxdxis[1](0)-&dxdxis[0](0), + &mvalues[0], sol->components); + if (usetexture == 2) - for (int ii = 0; ii < npt; ii++) - drawelem = GetSurfValueComplex (sol, sei, pref[ii](0), pref[ii](1), scalcomp, valuesc[ii][0], valuesc[ii][1]); + for (int ii = 0; ii < npt; ii++) + valuesc[ii] = ExtractValueComplex(sol, scalcomp, mvalues+ii*sol->components); else - { - // for (int ii = 0; ii < npt; ii++) - // drawelem = GetSurfValue (sol, sei, &pref[ii](0), &points[ii](0), &dxdxis[ii](0), scalcomp, values[ii]); - - drawelem = GetMultiSurfValues (sol, sei, npt, - &pref[0](0), &pref[1](0)-&pref[0](0), - &points[0](0), &points[1](0)-&points[0](0), - &dxdxis[0](0), &dxdxis[1](0)-&dxdxis[0](0), - &mvalues[0], sol->components); - - for (int ii = 0; ii < npt; ii++) - values[ii] = ExtractValue(sol, scalcomp, mvalues+ii*sol->components); - } + for (int ii = 0; ii < npt; ii++) + values[ii] = ExtractValue(sol, scalcomp, mvalues+ii*sol->components); } if (deform) for (int ii = 0; ii < npt; ii++) points[ii] += GetSurfDeformation (sei, pref[ii](0), pref[ii](1)); - - int save_usetexture = usetexture; if (!drawelem) { @@ -1407,7 +1347,7 @@ namespace netgen if (usetexture != 2) SetOpenGlColor (values[hi]); else - glTexCoord2f ( valuesc[hi][0], valuesc[hi][1] ); + glTexCoord2f ( valuesc[hi].real(), valuesc[hi].imag() ); } else glColor3fv (col_grey); @@ -1444,6 +1384,16 @@ namespace netgen CurvedElements & curv = mesh->GetCurvedElements(); + int n = 1 << subdivisions; + ArrayMem, 65> ptsloc(n+1); + ArrayMem, 65> ptsglob(n+1); + + double trigpts[3][2] = { { 0, 0 }, { 1, 0 }, { 0, 1} }; + double trigvecs[3][2] = { { 1, 0 }, { -1,1 }, { 0, -1} }; + + double quadpts[4][2] = { { 0, 0 }, { 1, 0 }, { 1, 1 }, { 0, 1} }; + double quadvecs[4][2] = { { 1, 0 }, { 0, 1 }, { -1, 0}, { 0, -1} }; + for (SurfaceElementIndex sei = 0; sei < nse; sei++) { Element2d & el = (*mesh)[sei]; @@ -1463,56 +1413,25 @@ namespace netgen if (nv == 4) p4 = (*mesh)[el[3]]; } - int n = 1 << subdivisions; - for (int k = 0; k < nv; k++) { - Point<2> p0 = 0.0; - Vec<2> vtau = 0.0; + Point<2> p0; + Vec<2> vtau; if (nv == 3) - switch (k) - { - case 0: - p0 = Point<2> (0,0); - vtau = Vec<2> (1,0); - break; - case 1: - p0 = Point<2> (1,0); - vtau = Vec<2> (-1,1); - break; - case 2: - p0 = Point<2> (0,1); - vtau = Vec<2> (0,-1); - break; - } + { + p0 = Point<2>(trigpts[k][0], trigpts[k][1]); + vtau = Vec<2>(trigvecs[k][0], trigvecs[k][1]); + } else - switch (k) - { - case 0: - p0 = Point<2> (0,0); - vtau = Vec<2> (1,0); - break; - case 1: - p0 = Point<2> (1,0); - vtau = Vec<2> (0,1); - break; - case 2: - p0 = Point<2> (1,1); - vtau = Vec<2> (-1,0); - break; - case 3: - p0 = Point<2> (0,1); - vtau = Vec<2> (0,-1); - break; - } - + { + p0 = Point<2>(quadpts[k][0], quadpts[k][1]); + vtau = Vec<2>(quadvecs[k][0], quadvecs[k][1]); + } + glBegin (GL_LINE_STRIP); if (curved) { - ArrayMem, 65> ptsloc(n+1); - ArrayMem, 65> ptsglob(n+1); - for (int ix = 0; ix <= n; ix++) ptsloc[ix] = p0 + (double(ix) / n) * vtau; @@ -1548,7 +1467,6 @@ namespace netgen glEnd (); } } - } @@ -2278,7 +2196,6 @@ namespace netgen int ne = mesh->GetNE(); for (int i = 0; i < ne; i++) { - // "considerElem": added 07.04.2004 (FB) considerElem = GetValue (sol, i, 0.333, 0.333, 0.333, comp, val); if (considerElem) { @@ -2295,7 +2212,6 @@ namespace netgen int nse = mesh->GetNSE(); for (int i = 0; i < nse; i++) { - // "considerElem": added 07.04.2004 (FB) ELEMENT_TYPE type = mesh->SurfaceElement(i+1).GetType(); if (type == QUAD) considerElem = GetSurfValue (sol, i, 0.5, 0.5, comp, val); @@ -3062,7 +2978,21 @@ namespace netgen return values[comp-1]; } - + complex VisualSceneSolution :: ExtractValueComplex (const SolData * data, int comp, double * values) const + { + double valr, vali; + if (!data->iscomplex) + { + valr = values[comp-1]; + vali = 0; + } + else + { + valr = values[comp-1]; + vali = values[comp]; + } + return complex (valr, vali); + } diff --git a/libsrc/visualization/vssolution.hpp b/libsrc/visualization/vssolution.hpp index 71d93ef6..db3d45a0 100644 --- a/libsrc/visualization/vssolution.hpp +++ b/libsrc/visualization/vssolution.hpp @@ -243,7 +243,6 @@ private: int comp, double & val) const; - bool GetSurfValueComplex (const SolData * data, SurfaceElementIndex elnr, double lam1, double lam2, int comp, double & valr, double & vali) const; @@ -263,6 +262,7 @@ private: double * val, int sval) const; double ExtractValue (const SolData * data, int comp, double * values) const; + complex ExtractValueComplex (const SolData * data, int comp, double * values) const; Vec<3> GetDeformation (ElementIndex elnr, const Point<3> & p) const; diff --git a/ng/menustat.tcl b/ng/menustat.tcl index 807ec2d5..fcee4697 100644 --- a/ng/menustat.tcl +++ b/ng/menustat.tcl @@ -800,6 +800,8 @@ menu .ngmenu.special.colbndcond ##################################################### + + menu .ngmenu.help # .ngmenu.help add command -label "Ng Help..." \ \# -command { help_main } @@ -883,7 +885,6 @@ tixOptionMenu .bubar.modesel \ - set viewvals { geometry specpoints mesh solution} if { $userlevel == 3} { set viewvals { geometry mesh specpoints surfmeshing modelview solution} @@ -909,6 +910,7 @@ foreach viewv $viewvals { } + .bubar.selview config -variable selectvisual .bubar.selview config -command { Ng_SetVisParameters; redraw } @@ -928,6 +930,8 @@ pack .bubar.center .bubar.zoomall .bubar.selview -side right } + + ##################################################### # # # Status bar # @@ -996,8 +1000,8 @@ proc timer2 { } { } } - global mem_moveable - set mem_moveable [Ng_MemInfo moveable] + # global mem_moveable + # set mem_moveable [Ng_MemInfo moveable] .statbar.per config -value [expr $status_percent/100] -text [format %2.1f [expr 0.1*int(10*$status_percent)]]% @@ -1068,7 +1072,6 @@ proc timer2 { } { } - if {[winfo exists .memuse_dlg] == 1} { global memmark @@ -1082,11 +1085,6 @@ proc timer2 { } { } } - - - - - after 200 { timer2 } } # after 1000 { timer2 } @@ -1095,7 +1093,6 @@ timer2 - proc bgerror { error } { global errorInfo userlevel if { $userlevel == 3} { @@ -1139,7 +1136,6 @@ bind .

{ editprimitivedialog } bind . { newsoliddialog } bind . { .ngmenu.mesh invoke "Generate Mesh" } ; -# bind . { .bubar.selview configure activate mesh } ; diff --git a/ng/ngpkg.cpp b/ng/ngpkg.cpp index b4311c4f..56df9014 100644 --- a/ng/ngpkg.cpp +++ b/ng/ngpkg.cpp @@ -179,7 +179,6 @@ namespace netgen // geometry: either CSG, or, if an other is non-null, // then the other AutoPtr geometry (new CSGeometry("")); - STLGeometry * stlgeometry = NULL; AutoPtr geometry2d (0); @@ -1344,13 +1343,14 @@ namespace netgen { static char buf[100]; if (argc < 2) return TCL_ERROR; + /* if (strcmp (argv[1], "moveable") == 0) { sprintf (buf, "%6.1f", double(BaseMoveableMem::used)/1048576); Tcl_SetResult (interp, buf, TCL_STATIC); return TCL_OK; } - + */ if (strcmp (argv[1], "usedmb") == 0) { // returns string of 512 '0' or '1' @@ -2063,7 +2063,7 @@ namespace netgen printmessage_importance = atoi (Tcl_GetVar (interp, "::options.printmsg", 0)); printdots = (printmessage_importance >= 4); - BaseMoveableMem::totalsize = 0; + //BaseMoveableMem::totalsize = 0; // 1048576 * atoi (Tcl_GetVar (interp, "::options.memory", 0)); if (mesh.Ptr()) {