basegeometry, disable moveablemem

This commit is contained in:
Joachim Schoeberl 2009-08-24 00:03:40 +00:00
parent b455164dfb
commit f14a04a837
19 changed files with 212 additions and 270 deletions

View File

@ -85,7 +85,7 @@ public:
/** /**
CSGeometry has the whole geometric information CSGeometry has the whole geometric information
*/ */
class CSGeometry class CSGeometry : public NetgenGeometry
{ {
private: private:
/// all surfaces /// all surfaces

View File

@ -492,8 +492,8 @@ namespace netgen
if (multithread.terminate) return; if (multithread.terminate) return;
for (int i = oldnf+1; i <= mesh.GetNSE(); i++) for (SurfaceElementIndex sei = oldnf; sei < mesh.GetNSE(); sei++)
mesh.SurfaceElement(i).SetIndex (k); mesh[sei].SetIndex (k);
// mesh.CalcSurfacesOfNode(); // mesh.CalcSurfacesOfNode();
@ -621,8 +621,8 @@ namespace netgen
if (multithread.terminate) return; if (multithread.terminate) return;
for (int i = oldnf+1; i <= mesh.GetNSE(); i++) for (SurfaceElementIndex sei = oldnf; sei < mesh.GetNSE(); sei++)
mesh.SurfaceElement(i).SetIndex (k); mesh[sei].SetIndex (k);
if (!segments.Size()) if (!segments.Size())

View File

@ -451,9 +451,9 @@ BuildSurfaceElements (Array<Segment> & segs,
{ {
Array<int> copy_points; Array<int> 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()); INDEX_2 fpair (facei, sel.GetIndex());
fpair.Sort(); fpair.Sort();
if (identfaces.Used (fpair)) if (identfaces.Used (fpair))
@ -469,9 +469,9 @@ BuildSurfaceElements (Array<Segment> & 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()); INDEX_2 fpair (facei, sel.GetIndex());
fpair.Sort(); fpair.Sort();
if (identfaces.Used (fpair)) if (identfaces.Used (fpair))
@ -1341,9 +1341,9 @@ BuildSurfaceElements2 (Array<Segment> & segs,
{ {
// (*testout) << "surfaces found" << endl; // (*testout) << "surfaces found" << endl;
// copy surface // 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()); INDEX_2 fpair (facei, sel.GetIndex());
fpair.Sort(); fpair.Sort();
if (identfaces.Used (fpair)) if (identfaces.Used (fpair))

View File

@ -422,14 +422,13 @@ public:
/// ///
template <class T, int BASE = 0> template <class T, int BASE = 0>
class MoveableArray class MoveableArray
{ {
int size; int size;
int allocsize; int allocsize;
MoveableMem<T> data; DynamicMem<T> data;
public: public:
@ -578,6 +577,7 @@ inline ostream & operator<< (ostream & ost, MoveableArray<T> & a)
} }
/// bubble sort array /// bubble sort array
template <class T> template <class T>
inline void BubbleSort (const FlatArray<T> & data) inline void BubbleSort (const FlatArray<T> & data)

View File

@ -167,6 +167,7 @@ namespace netgen
{ {
/*
BaseMoveableMem * pm = BaseMoveableMem::first; BaseMoveableMem * pm = BaseMoveableMem::first;
while (pm) while (pm)
{ {
@ -186,6 +187,7 @@ namespace netgen
pm = pm->next; pm = pm->next;
} }
*/
} }

View File

@ -5,7 +5,8 @@
using namespace std; using namespace std;
namespace netgen namespace netgen
{ {
#ifdef OLD
NgMutex mem_mutex; NgMutex mem_mutex;
size_t BaseMoveableMem::totalsize = 0; // 500000000; size_t BaseMoveableMem::totalsize = 0; // 500000000;
@ -266,5 +267,6 @@ namespace netgen
cout << " used = " << used << endl; cout << " used = " << used << endl;
// cout << "******************************************************" << endl; // cout << "******************************************************" << endl;
} }
#endif
} }

View File

@ -9,8 +9,11 @@
namespace netgen namespace netgen
{ {
#ifdef OLD
extern NgMutex mem_mutex;
extern NgMutex mem_mutex;
class BaseMoveableMem class BaseMoveableMem
{ {
@ -98,6 +101,8 @@ protected:
MoveableMem & operator= (const MoveableMem & m) { ; } MoveableMem & operator= (const MoveableMem & m) { ; }
}; };
#endif
} }
#endif #endif

View File

@ -34,7 +34,7 @@ extern void PartitionBoundary (const Array < SplineSeg<2>* > & splines,
extern int printmessage_importance; extern int printmessage_importance;
template < int D > template < int D >
class SplineGeometry class SplineGeometry
{ {
Array < GeomPoint<D> > geompoints; Array < GeomPoint<D> > geompoints;
Array < SplineSeg<D>* > splines; Array < SplineSeg<D>* > splines;

View File

@ -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

View File

@ -731,15 +731,17 @@ HPREF_ELEMENT_TYPE ClassifyTrig(HPRefElement & el, INDEX_2_HASHTABLE<int> & edge
{ {
i2.Sort(); 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(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() ) {
{ if(face_edges.Get(i2)==-1 ||face_edges.Get(i2) == fd.DomainIn() || face_edges.Get(i2) == fd.DomainOut() )
edge_sing[k]=1; {
} edge_sing[k]=1;
else }
{ else
point_sing[ep1-1] = 0; // set to edge_point {
point_sing[ep2-1] = 0; // set to edge_point 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 ... " ; /* *testout << " pointsing NACH edges UND FACEEDGES UMSETZEN ... " ;

View File

@ -574,55 +574,46 @@ namespace netgen
void InitHPElements(Mesh & mesh, Array<HPRefElement> & elements) void InitHPElements(Mesh & mesh, Array<HPRefElement> & elements)
{ {
for(ElementIndex i=0;i<mesh.GetNE();i++) for(ElementIndex i = 0; i < mesh.GetNE(); i++)
{ {
HPRefElement hpel(mesh[i]); HPRefElement hpel(mesh[i]);
hpel.coarse_elnr=i; hpel.coarse_elnr = i;
switch (mesh[i].GetType()) switch (mesh[i].GetType())
{ {
case PRISM: case PRISM: hpel.type = HP_PRISM; break;
hpel.type = HP_PRISM; case HEX: hpel.type = HP_HEX; break;
break; case TET: hpel.type = HP_TET; break;
case HEX: case PYRAMID: hpel.type = HP_PYRAMID; break;
hpel.type = HP_HEX;
break;
case TET:
hpel.type = HP_TET;
break;
case PYRAMID:
hpel.type = HP_PYRAMID;
break;
default: default:
cerr << "HPRefElement: illegal elementtype (1) " << mesh[i].GetType() << endl; cerr << "HPRefElement: illegal elementtype (1) " << mesh[i].GetType() << endl;
throw NgException ("HPRefElement: illegal elementtype (1)"); throw NgException ("HPRefElement: illegal elementtype (1)");
} }
elements.Append(hpel); elements.Append(hpel);
} }
for(SurfaceElementIndex i=0;i<mesh.GetNSE();i++) for(SurfaceElementIndex i = 0; i < mesh.GetNSE(); i++)
{ {
HPRefElement hpel(mesh.SurfaceElement(i)); HPRefElement hpel(mesh[i]);
hpel.coarse_elnr = i; hpel.coarse_elnr = i;
switch(mesh.SurfaceElement(i).GetType()) switch(mesh[i].GetType())
{ {
case TRIG: case TRIG: hpel.type = HP_TRIG; break;
hpel.type = HP_TRIG; case QUAD: hpel.type = HP_QUAD; break;
break;
case QUAD: default:
hpel.type = HP_QUAD; cerr << "HPRefElement: illegal elementtype (1b) " << mesh[i].GetType() << endl;
break; throw NgException ("HPRefElement: illegal elementtype (1b)");
} }
elements.Append(hpel); elements.Append(hpel);
} }
for(int i=1;i<=mesh.GetNSeg();i++) for(SegmentIndex i = 0; i < mesh.GetNSeg(); i++)
{ {
Segment & seg = mesh.LineSegment(i); Segment & seg = mesh[i];
HPRefElement hpel(seg); HPRefElement hpel(mesh[i]);
hpel.coarse_elnr = i-1; hpel.coarse_elnr = i;
hpel.type = HP_SEGM; hpel.type = HP_SEGM;
hpel.index = seg.edgenr + 10000*seg.si; hpel.index = seg.edgenr + 10000*seg.si;
if(seg.edgenr >= 10000) if(seg.edgenr >= 10000)
@ -630,7 +621,6 @@ namespace netgen
throw NgException("assumption that seg.edgenr < 10000 is wrong"); throw NgException("assumption that seg.edgenr < 10000 is wrong");
} }
elements.Append(hpel); elements.Append(hpel);
} }
} }
@ -1323,15 +1313,15 @@ namespace netgen
PrintMessage (1, "HP Refinement called, levels = ", levels); 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 = new Mesh;
*mesh.coarsemesh = mesh; *mesh.coarsemesh = mesh;
#ifdef CURVEDELEMS_NEW // #ifdef CURVEDELEMS_NEW
const_cast<CurvedElements&> (mesh.coarsemesh->GetCurvedElements() ). const_cast<CurvedElements&> (mesh.coarsemesh->GetCurvedElements() ).
BuildCurvedElements (ref, mesh.GetCurvedElements().GetOrder()); BuildCurvedElements (ref, mesh.GetCurvedElements().GetOrder());
#endif // #endif
delete mesh.hpelements; delete mesh.hpelements;
@ -1345,7 +1335,7 @@ namespace netgen
nplevel.Append (mesh.GetNP()); nplevel.Append (mesh.GetNP());
int act_ref=1; 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 sing = true; // iterate at least once
while(sing) while(sing)
@ -1578,9 +1568,9 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HAS
BitArray & cornerpoint, BitArray & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges, BitArray & cornerpoint, BitArray & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
INDEX_2_HASHTABLE<int> & surf_edges, Array<int, PointIndex::BASE> & facepoint, int & levels, int & act_ref) INDEX_2_HASHTABLE<int> & surf_edges, Array<int, PointIndex::BASE> & facepoint, int & levels, int & act_ref)
{ {
bool sing=0; bool sing = 0;
if (mesh.GetDimension() == 3) if (mesh.GetDimension() == 3)
{ {
/* /*
// check, if point has as least 3 different surfs: // check, if point has as least 3 different surfs:
@ -1731,48 +1721,47 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HAS
for (int i = 1; i <= mesh.GetNP(); i++) for (int i = 1; i <= mesh.GetNP(); i++)
surfonpoint.Elem(i) = INDEX_3(0,0,0); surfonpoint.Elem(i) = INDEX_3(0,0,0);
for (int i = 1; i <= mesh.GetNSeg(); i++) for (int i = 1; i <= mesh.GetNSeg(); i++)
{ {
const Segment & seg = mesh.LineSegment(i); const Segment & seg = mesh.LineSegment(i);
int ind = seg.edgenr; int ind = seg.edgenr;
if (seg.singedge_left * levels >= act_ref)
if (seg.singedge_left * levels >= act_ref) {
{ INDEX_2 i2 (mesh.LineSegment(i)[0],
INDEX_2 i2 (mesh.LineSegment(i)[0], mesh.LineSegment(i)[1]);
mesh.LineSegment(i)[1]); edges.Set(i2,1);
edges.Set(i2,1); edgepoint.Set(i2.I1());
edgepoint.Set(i2.I1()); edgepoint.Set(i2.I2());
edgepoint.Set(i2.I2()); *testout << " singleft " << endl;
*testout << " singleft " << endl; *testout << " mesh.LineSegment(i).domout " << mesh.LineSegment(i).domout << endl;
*testout << " mesh.LineSegment(i).domout " << mesh.LineSegment(i).domout << endl; *testout << " mesh.LineSegment(i).domin " << mesh.LineSegment(i).domin << 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.I1()), 1); edgepoint_dom.Set (INDEX_2(mesh.LineSegment(i).domin, i2.I2()), 1);
edgepoint_dom.Set (INDEX_2(mesh.LineSegment(i).domin, i2.I2()), 1); sing = 1;
sing = 1;
}
if (seg.singedge_right * levels >= act_ref) }
{
INDEX_2 i2 (mesh.LineSegment(i)[1], if (seg.singedge_right * levels >= act_ref)
mesh.LineSegment(i)[0]); {
edges.Set (i2, 1); INDEX_2 i2 (mesh.LineSegment(i)[1],
edgepoint.Set(i2.I1()); mesh.LineSegment(i)[0]);
edgepoint.Set(i2.I2()); edges.Set (i2, 1);
edgepoint.Set(i2.I1());
*testout << " singright " << endl; edgepoint.Set(i2.I2());
*testout << " mesh.LineSegment(i).domout " << mesh.LineSegment(i).domout << endl;
*testout << " mesh.LineSegment(i).domin " << mesh.LineSegment(i).domin << endl; *testout << " singright " << endl;
*testout << " mesh.LineSegment(i).domout " << mesh.LineSegment(i).domout << endl;
edgepoint_dom.Set (INDEX_2(mesh.LineSegment(i).domout, i2.I1()), 1); *testout << " mesh.LineSegment(i).domin " << mesh.LineSegment(i).domin << endl;
edgepoint_dom.Set (INDEX_2(mesh.LineSegment(i).domout, i2.I2()), 1);
sing = 1; 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; // (*testout) << "seg = " << ind << ", " << seg[0] << "-" << seg[1] << endl;
if (seg.singedge_left * levels >= act_ref if (seg.singedge_left * levels >= act_ref
|| seg.singedge_right* levels >= act_ref) || seg.singedge_right* levels >= act_ref)
@ -1797,7 +1786,7 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HAS
// mark points for refinement that are in corners between two anisotropic edges // mark points for refinement that are in corners between two anisotropic edges
if (surfonpoint.Get(i).I1()) if (surfonpoint.Get(i).I1())
{ {
cornerpoint.Set(i); // cornerpoint.Set(i); // disabled by JS, Aug 2009
edgepoint.Set(i); edgepoint.Set(i);
} }
@ -1820,10 +1809,8 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HAS
} }
if (!sing) if (!sing)
{ cout << "PrepareElements no more to do for actual refinement " << act_ref << endl;
cout << "PrepareElements no more to do for actual refinement " << act_ref << endl;
return(sing);
}
return(sing); return(sing);
} }
@ -1831,7 +1818,6 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HAS
bool ClassifyHPElements (Mesh & mesh, Array<HPRefElement> & elements, int & act_ref, int & levels) bool ClassifyHPElements (Mesh & mesh, Array<HPRefElement> & elements, int & act_ref, int & levels)
{ {
INDEX_2_HASHTABLE<int> edges(mesh.GetNSeg()+1); INDEX_2_HASHTABLE<int> edges(mesh.GetNSeg()+1);
BitArray edgepoint(mesh.GetNP()); BitArray edgepoint(mesh.GetNP());
INDEX_2_HASHTABLE<int> edgepoint_dom(mesh.GetNSeg()+1); INDEX_2_HASHTABLE<int> edgepoint_dom(mesh.GetNSeg()+1);

View File

@ -271,11 +271,8 @@ public:
int GetNSE () const { return surfelements.Size(); } int GetNSE () const { return surfelements.Size(); }
Element2d & SurfaceElement(int i) { return surfelements.Elem(i); } Element2d & SurfaceElement(int i) { return surfelements.Elem(i); }
const Element2d & SurfaceElement(int i) const { return surfelements.Get(i); } const Element2d & SurfaceElement(int i) const { return surfelements.Get(i); }
Element2d & SurfaceElement(SurfaceElementIndex i) { return surfelements[i]; }
Element2d & SurfaceElement(SurfaceElementIndex i) const Element2d & SurfaceElement(SurfaceElementIndex i) const { return surfelements[i]; }
{ return surfelements[i]; }
const Element2d & SurfaceElement(SurfaceElementIndex i) const
{ return surfelements[i]; }
const Element2d & operator[] (SurfaceElementIndex ei) const const Element2d & operator[] (SurfaceElementIndex ei) const
{ return surfelements[ei]; } { return surfelements[ei]; }

View File

@ -32,6 +32,8 @@ namespace netgen
#include "meshing2.hpp" #include "meshing2.hpp"
#include "improve2.hpp" #include "improve2.hpp"
#include "basegeom.hpp"
#include "geomsearch.hpp" #include "geomsearch.hpp"
#include "adfront3.hpp" #include "adfront3.hpp"

View File

@ -88,7 +88,7 @@ namespace netgen
class STLGeometry : public STLTopology class STLGeometry : public STLTopology, public NetgenGeometry
{ {
// edges to be meshed: // edges to be meshed:
Array<STLEdge> edges; Array<STLEdge> edges;

View File

@ -23,6 +23,8 @@ Visualization
#include "mvdraw.hpp" #include "mvdraw.hpp"
#include "soldata.hpp" #include "soldata.hpp"
#include <complex>
namespace netgen namespace netgen
{ {
#include "vssolution.hpp" #include "vssolution.hpp"

View File

@ -14,9 +14,7 @@
namespace netgen namespace netgen
{ {
extern AutoPtr<Mesh> mesh; extern AutoPtr<Mesh> mesh;
extern VisualSceneMesh vsmesh; extern VisualSceneMesh vsmesh;
@ -52,7 +50,6 @@ namespace netgen
isolinelist = 0; isolinelist = 0;
clipplane_isolinelist = 0; clipplane_isolinelist = 0;
surface_vector_list = 0; surface_vector_list = 0;
// cone_list = 0;
isosurface_list = 0; isosurface_list = 0;
fieldlineslist = 0; fieldlineslist = 0;
@ -360,8 +357,8 @@ namespace netgen
return; return;
} }
static NgLock mem_lock(mem_mutex); // static NgLock mem_lock(mem_mutex);
mem_lock.Lock(); // mem_lock.Lock();
NgLock meshlock1 (mesh->MajorMutex(), true); NgLock meshlock1 (mesh->MajorMutex(), true);
NgLock meshlock (mesh->Mutex(), true); NgLock meshlock (mesh->Mutex(), true);
@ -511,7 +508,7 @@ namespace netgen
// delete lock; // delete lock;
mem_lock.UnLock(); // mem_lock.UnLock();
endtime = clock(); endtime = clock();
// cout << 1.0 / (double(endtime - starttime)/CLOCKS_PER_SEC) << " frames/sec" << endl; // cout << 1.0 / (double(endtime - starttime)/CLOCKS_PER_SEC) << " frames/sec" << endl;
@ -1087,7 +1084,7 @@ namespace netgen
Vec<3> nvs[1100]; Vec<3> nvs[1100];
double values[1100]; double values[1100];
double mvalues[11000]; double mvalues[11000];
double valuesc[1100][2]; complex<double> valuesc[11000];
int nse = mesh->GetNSE(); int nse = mesh->GetNSE();
@ -1127,7 +1124,7 @@ namespace netgen
if ( el.GetType() == QUAD || el.GetType() == QUAD6 ) if ( el.GetType() == QUAD || el.GetType() == QUAD6 )
{ {
bool curved = curv.IsSurfaceElementCurved(sei); bool curved = curv.IsSurfaceElementCurved (sei);
Point<3> lpi[4]; Point<3> lpi[4];
Vec<3> vx, vy, vtwist; Vec<3> vx, vy, vtwist;
@ -1146,8 +1143,6 @@ namespace netgen
// nv.Normalize(); // nv.Normalize();
// glNormal3dv (nv); // glNormal3dv (nv);
for (int iy = 0, ii = 0; iy <= n; iy++) for (int iy = 0, ii = 0; iy <= n; iy++)
for (int ix = 0; ix <= n; ix++, ii++) for (int ix = 0; ix <= n; ix++, ii++)
pref[ii] = Point<2> (double(ix)/n, double(iy)/n); pref[ii] = Point<2> (double(ix)/n, double(iy)/n);
@ -1185,7 +1180,7 @@ namespace netgen
{ {
if (usetexture == 2) if (usetexture == 2)
for (int ii = 0; ii < npt; ii++) 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 else
for (int ii = 0; ii < npt; ii++) for (int ii = 0; ii < npt; ii++)
drawelem = GetSurfValue (sol, sei, pref[ii](0), pref[ii](1), scalcomp, values[ii]); drawelem = GetSurfValue (sol, sei, pref[ii](0), pref[ii](1), scalcomp, values[ii]);
@ -1219,8 +1214,8 @@ namespace netgen
if (usetexture != 2) if (usetexture != 2)
SetOpenGlColor (values[index[j]]); SetOpenGlColor (values[index[j]]);
else else
glTexCoord2f ( valuesc[index[j]][0], glTexCoord2f ( valuesc[index[j]].real(),
valuesc[index[j]][1] ); valuesc[index[j]].imag() );
} }
else else
glColor3fv (col_grey); glColor3fv (col_grey);
@ -1253,75 +1248,26 @@ namespace netgen
{ {
const Element2d & el = (*mesh)[sei]; const Element2d & el = (*mesh)[sei];
#ifdef PARALLEL
// parallel visualization --> dont draw ghost elements
if ( el . IsGhost() ) continue; if ( el . IsGhost() ) continue;
#endif
// if ( mesh->GetFaceDescriptor(el.GetIndex()).BCProperty() != 1) continue; if(vispar.drawdomainsurf > 0)
{
if (mesh->GetDimension() == 3)
if(vispar.drawdomainsurf > 0 && {
((mesh->GetDimension() == 3 && if (vispar.drawdomainsurf != mesh->GetFaceDescriptor(el.GetIndex()).DomainIn() &&
vispar.drawdomainsurf != mesh->GetFaceDescriptor(el.GetIndex()).DomainIn() && vispar.drawdomainsurf != mesh->GetFaceDescriptor(el.GetIndex()).DomainOut())
vispar.drawdomainsurf != mesh->GetFaceDescriptor(el.GetIndex()).DomainOut()) || continue;
(mesh->GetDimension() == 2 && el.GetIndex() != vispar.drawdomainsurf))) continue; }
else
{
if (el.GetIndex() != vispar.drawdomainsurf)
continue;
}
}
if ( el.GetType() == TRIG || el.GetType() == TRIG6 ) if ( el.GetType() == TRIG || el.GetType() == TRIG6 )
{ {
bool curved = curv.IsHighOrder(); // && curv.IsSurfaceElementCurved(sei); bool curved = 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);
}
*/
for (int iy = 0, ii = 0; iy <= n; iy++) for (int iy = 0, ii = 0; iy <= n; iy++)
for (int ix = 0; ix <= n-iy; ix++, ii++) for (int ix = 0; ix <= n-iy; ix++, ii++)
@ -1338,14 +1284,15 @@ namespace netgen
} }
else else
{ {
Vec<3> vx = (p1-p3); Point<3> p1 = mesh->Point (el[0]);
Vec<3> vy = (p2-p3); 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++) for (int ii = 0; ii < npt; ii++)
{ {
double x = pref[ii](0); points[ii] = p3 + pref[ii](0) * vx + pref[ii](1) * vy;
double y = pref[ii](1);
points[ii] = p3 + x * vx + y * vy;
for (int j = 0; j < 3; j++) for (int j = 0; j < 3; j++)
{ {
dxdxis[ii](j,0) = vx(j); dxdxis[ii](j,0) = vx(j);
@ -1361,31 +1308,24 @@ namespace netgen
bool drawelem = false; bool drawelem = false;
if (sol && sol->draw_surface) 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) if (usetexture == 2)
for (int ii = 0; ii < npt; ii++) for (int ii = 0; ii < npt; ii++)
drawelem = GetSurfValueComplex (sol, sei, pref[ii](0), pref[ii](1), scalcomp, valuesc[ii][0], valuesc[ii][1]); valuesc[ii] = ExtractValueComplex(sol, scalcomp, mvalues+ii*sol->components);
else else
{ for (int ii = 0; ii < npt; ii++)
// for (int ii = 0; ii < npt; ii++) values[ii] = ExtractValue(sol, scalcomp, mvalues+ii*sol->components);
// 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);
}
} }
if (deform) if (deform)
for (int ii = 0; ii < npt; ii++) for (int ii = 0; ii < npt; ii++)
points[ii] += GetSurfDeformation (sei, pref[ii](0), pref[ii](1)); points[ii] += GetSurfDeformation (sei, pref[ii](0), pref[ii](1));
int save_usetexture = usetexture; int save_usetexture = usetexture;
if (!drawelem) if (!drawelem)
{ {
@ -1407,7 +1347,7 @@ namespace netgen
if (usetexture != 2) if (usetexture != 2)
SetOpenGlColor (values[hi]); SetOpenGlColor (values[hi]);
else else
glTexCoord2f ( valuesc[hi][0], valuesc[hi][1] ); glTexCoord2f ( valuesc[hi].real(), valuesc[hi].imag() );
} }
else else
glColor3fv (col_grey); glColor3fv (col_grey);
@ -1444,6 +1384,16 @@ namespace netgen
CurvedElements & curv = mesh->GetCurvedElements(); CurvedElements & curv = mesh->GetCurvedElements();
int n = 1 << subdivisions;
ArrayMem<Point<2>, 65> ptsloc(n+1);
ArrayMem<Point<3>, 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++) for (SurfaceElementIndex sei = 0; sei < nse; sei++)
{ {
Element2d & el = (*mesh)[sei]; Element2d & el = (*mesh)[sei];
@ -1463,56 +1413,25 @@ namespace netgen
if (nv == 4) p4 = (*mesh)[el[3]]; if (nv == 4) p4 = (*mesh)[el[3]];
} }
int n = 1 << subdivisions;
for (int k = 0; k < nv; k++) for (int k = 0; k < nv; k++)
{ {
Point<2> p0 = 0.0; Point<2> p0;
Vec<2> vtau = 0.0; Vec<2> vtau;
if (nv == 3) if (nv == 3)
switch (k) {
{ p0 = Point<2>(trigpts[k][0], trigpts[k][1]);
case 0: vtau = Vec<2>(trigvecs[k][0], trigvecs[k][1]);
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;
}
else else
switch (k) {
{ p0 = Point<2>(quadpts[k][0], quadpts[k][1]);
case 0: vtau = Vec<2>(quadvecs[k][0], quadvecs[k][1]);
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;
}
glBegin (GL_LINE_STRIP); glBegin (GL_LINE_STRIP);
if (curved) if (curved)
{ {
ArrayMem<Point<2>, 65> ptsloc(n+1);
ArrayMem<Point<3>, 65> ptsglob(n+1);
for (int ix = 0; ix <= n; ix++) for (int ix = 0; ix <= n; ix++)
ptsloc[ix] = p0 + (double(ix) / n) * vtau; ptsloc[ix] = p0 + (double(ix) / n) * vtau;
@ -1548,7 +1467,6 @@ namespace netgen
glEnd (); glEnd ();
} }
} }
} }
@ -2278,7 +2196,6 @@ namespace netgen
int ne = mesh->GetNE(); int ne = mesh->GetNE();
for (int i = 0; i < ne; i++) 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); considerElem = GetValue (sol, i, 0.333, 0.333, 0.333, comp, val);
if (considerElem) if (considerElem)
{ {
@ -2295,7 +2212,6 @@ namespace netgen
int nse = mesh->GetNSE(); int nse = mesh->GetNSE();
for (int i = 0; i < nse; i++) for (int i = 0; i < nse; i++)
{ {
// "considerElem": added 07.04.2004 (FB)
ELEMENT_TYPE type = mesh->SurfaceElement(i+1).GetType(); ELEMENT_TYPE type = mesh->SurfaceElement(i+1).GetType();
if (type == QUAD) if (type == QUAD)
considerElem = GetSurfValue (sol, i, 0.5, 0.5, comp, val); considerElem = GetSurfValue (sol, i, 0.5, 0.5, comp, val);
@ -3062,7 +2978,21 @@ namespace netgen
return values[comp-1]; return values[comp-1];
} }
complex<double> 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<double> (valr, vali);
}

View File

@ -243,7 +243,6 @@ private:
int comp, double & val) const; int comp, double & val) const;
bool GetSurfValueComplex (const SolData * data, SurfaceElementIndex elnr, bool GetSurfValueComplex (const SolData * data, SurfaceElementIndex elnr,
double lam1, double lam2, double lam1, double lam2,
int comp, double & valr, double & vali) const; int comp, double & valr, double & vali) const;
@ -263,6 +262,7 @@ private:
double * val, int sval) const; double * val, int sval) const;
double ExtractValue (const SolData * data, int comp, double * values) const; double ExtractValue (const SolData * data, int comp, double * values) const;
complex<double> ExtractValueComplex (const SolData * data, int comp, double * values) const;
Vec<3> GetDeformation (ElementIndex elnr, const Point<3> & p) const; Vec<3> GetDeformation (ElementIndex elnr, const Point<3> & p) const;

View File

@ -800,6 +800,8 @@ menu .ngmenu.special.colbndcond
##################################################### #####################################################
menu .ngmenu.help menu .ngmenu.help
# .ngmenu.help add command -label "Ng Help..." \ # .ngmenu.help add command -label "Ng Help..." \
\# -command { help_main } \# -command { help_main }
@ -883,7 +885,6 @@ tixOptionMenu .bubar.modesel \
set viewvals { geometry specpoints mesh solution} set viewvals { geometry specpoints mesh solution}
if { $userlevel == 3} { if { $userlevel == 3} {
set viewvals { geometry mesh specpoints surfmeshing modelview solution} set viewvals { geometry mesh specpoints surfmeshing modelview solution}
@ -909,6 +910,7 @@ foreach viewv $viewvals {
} }
.bubar.selview config -variable selectvisual .bubar.selview config -variable selectvisual
.bubar.selview config -command { Ng_SetVisParameters; redraw } .bubar.selview config -command { Ng_SetVisParameters; redraw }
@ -928,6 +930,8 @@ pack .bubar.center .bubar.zoomall .bubar.selview -side right
} }
##################################################### #####################################################
# # # #
# Status bar # # Status bar #
@ -996,8 +1000,8 @@ proc timer2 { } {
} }
} }
global mem_moveable # global mem_moveable
set mem_moveable [Ng_MemInfo 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)]]% .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} { if {[winfo exists .memuse_dlg] == 1} {
global memmark global memmark
@ -1082,11 +1085,6 @@ proc timer2 { } {
} }
} }
after 200 { timer2 } after 200 { timer2 }
} }
# after 1000 { timer2 } # after 1000 { timer2 }
@ -1095,7 +1093,6 @@ timer2
proc bgerror { error } { proc bgerror { error } {
global errorInfo userlevel global errorInfo userlevel
if { $userlevel == 3} { if { $userlevel == 3} {
@ -1139,7 +1136,6 @@ bind . <e><p> { editprimitivedialog }
bind . <e><s> { newsoliddialog } bind . <e><s> { newsoliddialog }
bind . <g><m> { .ngmenu.mesh invoke "Generate Mesh" } ; bind . <g><m> { .ngmenu.mesh invoke "Generate Mesh" } ;
# bind . <v><m> { .bubar.selview configure activate mesh } ;

View File

@ -179,7 +179,6 @@ namespace netgen
// geometry: either CSG, or, if an other is non-null, // geometry: either CSG, or, if an other is non-null,
// then the other // then the other
AutoPtr<CSGeometry> geometry (new CSGeometry("")); AutoPtr<CSGeometry> geometry (new CSGeometry(""));
STLGeometry * stlgeometry = NULL; STLGeometry * stlgeometry = NULL;
AutoPtr<SplineGeometry2d> geometry2d (0); AutoPtr<SplineGeometry2d> geometry2d (0);
@ -1344,13 +1343,14 @@ namespace netgen
{ {
static char buf[100]; static char buf[100];
if (argc < 2) return TCL_ERROR; if (argc < 2) return TCL_ERROR;
/*
if (strcmp (argv[1], "moveable") == 0) if (strcmp (argv[1], "moveable") == 0)
{ {
sprintf (buf, "%6.1f", double(BaseMoveableMem::used)/1048576); sprintf (buf, "%6.1f", double(BaseMoveableMem::used)/1048576);
Tcl_SetResult (interp, buf, TCL_STATIC); Tcl_SetResult (interp, buf, TCL_STATIC);
return TCL_OK; return TCL_OK;
} }
*/
if (strcmp (argv[1], "usedmb") == 0) if (strcmp (argv[1], "usedmb") == 0)
{ // returns string of 512 '0' or '1' { // returns string of 512 '0' or '1'
@ -2063,7 +2063,7 @@ namespace netgen
printmessage_importance = atoi (Tcl_GetVar (interp, "::options.printmsg", 0)); printmessage_importance = atoi (Tcl_GetVar (interp, "::options.printmsg", 0));
printdots = (printmessage_importance >= 4); printdots = (printmessage_importance >= 4);
BaseMoveableMem::totalsize = 0; //BaseMoveableMem::totalsize = 0;
// 1048576 * atoi (Tcl_GetVar (interp, "::options.memory", 0)); // 1048576 * atoi (Tcl_GetVar (interp, "::options.memory", 0));
if (mesh.Ptr()) if (mesh.Ptr())
{ {