improvement in visualization

This commit is contained in:
Joachim Schoeberl 2009-07-20 08:36:36 +00:00
parent 54341e5c53
commit f3043d2df9
42 changed files with 922 additions and 593 deletions

View File

@ -8,7 +8,8 @@
/**************************************************************************/ /**************************************************************************/
namespace netgen
{
// template <class T, int B1, int B2> class IndirectArray; // template <class T, int B1, int B2> class IndirectArray;
@ -632,7 +633,7 @@ void Intersection (const FlatArray<T> & in1, const FlatArray<T> & in2, const Fla
} }
}
#endif #endif

View File

@ -7,6 +7,9 @@
/* Date: 29. Dec. 02 */ /* Date: 29. Dec. 02 */
/**************************************************************************/ /**************************************************************************/
namespace netgen
{
template <typename T> template <typename T>
class AutoPtr class AutoPtr
{ {
@ -28,4 +31,6 @@ private:
AutoPtr & operator= (AutoPtr &) { ; } AutoPtr & operator= (AutoPtr &) { ; }
}; };
}
#endif #endif

View File

@ -9,6 +9,10 @@
#include <limits.h> #include <limits.h>
namespace netgen
{
/** /**
data type BitArray data type BitArray
@ -218,5 +222,6 @@ inline ostream & operator<< (ostream & s, const BitArrayChar<BASE> & a)
return s; return s;
} }
}
#endif #endif

View File

@ -7,7 +7,8 @@
/* Date: 12. Feb. 2003 */ /* Date: 12. Feb. 2003 */
/**************************************************************************/ /**************************************************************************/
namespace netgen
{
class BaseDynamicMem class BaseDynamicMem
@ -92,4 +93,6 @@ protected:
DynamicMem & operator= (const DynamicMem & m); DynamicMem & operator= (const DynamicMem & m);
}; };
}
#endif #endif

View File

@ -8,6 +8,9 @@
/* Date: 10. Oct. 96 */ /* Date: 10. Oct. 96 */
/**************************************************************************/ /**************************************************************************/
namespace netgen
{
/** /**
Flag - Table. Flag - Table.
A flag table maintains string variables, numerical A flag table maintains string variables, numerical
@ -79,5 +82,7 @@ public:
bool NumListFlagDefined (const char * name) const; bool NumListFlagDefined (const char * name) const;
}; };
}
#endif #endif

View File

@ -7,6 +7,9 @@
/* Date: 01. Jun. 95 */ /* Date: 01. Jun. 95 */
/**************************************************************************/ /**************************************************************************/
namespace netgen
{
/** /**
Abstract data type HASHTABLE. Abstract data type HASHTABLE.
Hash is done by one INDEX Hash is done by one INDEX
@ -1304,19 +1307,7 @@ PrintMemInfo (ostream & ost) const
*/ */
}
#endif #endif

View File

@ -7,6 +7,8 @@
/* Date: 12. Feb. 2003 */ /* Date: 12. Feb. 2003 */
/**************************************************************************/ /**************************************************************************/
namespace netgen
{
extern NgMutex mem_mutex; extern NgMutex mem_mutex;
@ -96,4 +98,6 @@ protected:
MoveableMem & operator= (const MoveableMem & m) { ; } MoveableMem & operator= (const MoveableMem & m) { ; }
}; };
}
#endif #endif

View File

@ -11,6 +11,10 @@
#define VT_TRACER(n) #define VT_TRACER(n)
#endif #endif
namespace netgen
{
#ifndef PARALLEL #ifndef PARALLEL
@ -272,4 +276,6 @@ extern MPI_Comm MPI_HIGHORDER_COMM;
#endif // PARALLEL #endif // PARALLEL
}
#endif #endif

View File

@ -17,8 +17,6 @@
#include "../include/mydefs.hpp" #include "../include/mydefs.hpp"
namespace netgen
{
#include "ngexception.hpp" #include "ngexception.hpp"
#include "parthreads.hpp" #include "parthreads.hpp"
#include "moveablemem.hpp" #include "moveablemem.hpp"
@ -28,10 +26,13 @@ namespace netgen
#include "array.hpp" #include "array.hpp"
#include "table.hpp" #include "table.hpp"
#include "hashtabl.hpp" #include "hashtabl.hpp"
#include "symbolta.hpp" #include "symbolta.hpp"
#include "bitarray.hpp" #include "bitarray.hpp"
#include "flags.hpp" #include "flags.hpp"
#include "spbita2d.hpp" #include "spbita2d.hpp"
#include "seti.hpp" #include "seti.hpp"
#include "optmem.hpp" #include "optmem.hpp"
#include "autoptr.hpp" #include "autoptr.hpp"
@ -42,6 +43,6 @@ namespace netgen
#include "mpi_interface.hpp" #include "mpi_interface.hpp"
#include "netgenout.hpp" #include "netgenout.hpp"
}
#endif #endif

View File

@ -19,6 +19,9 @@
#ifndef MYSTRING__H #ifndef MYSTRING__H
#define MYSTRING__H #define MYSTRING__H
namespace netgen
{
class Point3d; class Point3d;
class Vec3d; class Vec3d;
@ -211,6 +214,7 @@ inline void MyStr::SetToErrHandler(void (*Handler)())
ErrHandler = Handler; ErrHandler = Handler;
}; };
}
#endif #endif

View File

@ -5,6 +5,9 @@
// #include <mystdlib.h> // #include <mystdlib.h>
// #include <meshing.hpp> // #include <meshing.hpp>
namespace netgen
{
#ifdef PARALLEL #ifdef PARALLEL
extern int id; extern int id;
extern int ntasks; extern int ntasks;
@ -178,7 +181,7 @@ NetgenOutStream operator<< ( ostream & ost, Procs & procs );
// } // }
}
#endif #endif

View File

@ -7,6 +7,8 @@
/* Date: 16. Jan. 2002 */ /* Date: 16. Jan. 2002 */
/**************************************************************************/ /**************************************************************************/
namespace netgen
{
/// Base class for all ng exceptions /// Base class for all ng exceptions
class NgException class NgException
@ -26,5 +28,6 @@ public:
/// verbal description of exception /// verbal description of exception
const string & What() const { return what; } const string & What() const { return what; }
}; };
}
#endif #endif

View File

@ -7,6 +7,9 @@
/* Date: 04. Apr. 97 */ /* Date: 04. Apr. 97 */
/**************************************************************************/ /**************************************************************************/
namespace netgen
{
/** /**
Optimized Memory allocation classes Optimized Memory allocation classes
*/ */
@ -54,6 +57,6 @@ private:
// void Alloc2 (); // void Alloc2 ();
}; };
}
#endif #endif

View File

@ -11,6 +11,9 @@
Parallel thread, Mutex, Parallel thread, Mutex,
*/ */
namespace netgen
{
#ifdef NO_PARALLEL_THREADS #ifdef NO_PARALLEL_THREADS
class NgMutex { }; class NgMutex { };
@ -183,4 +186,6 @@ public:
#endif #endif
}
#endif #endif

View File

@ -17,7 +17,8 @@
#define VT_TRACER(n) #define VT_TRACER(n)
#endif #endif
namespace netgen
{
class NgProfiler class NgProfiler
{ {
@ -59,4 +60,6 @@ public:
}; };
}; };
}
#endif #endif

View File

@ -8,6 +8,9 @@
/* Date: 20. Mar. 98 */ /* Date: 20. Mar. 98 */
/**************************************************************************/ /**************************************************************************/
namespace netgen
{
/** /**
Set of Integers Set of Integers
*/ */
@ -41,5 +44,7 @@ public:
const Array<int> & GetArray() { return set; } const Array<int> & GetArray() { return set; }
}; };
}
#endif #endif

View File

@ -7,6 +7,8 @@
/* Date: 07. Jan. 00 */ /* Date: 07. Jan. 00 */
/**************************************************************************/ /**************************************************************************/
namespace netgen
{
// order(i) is sorted index of element i // order(i) is sorted index of element i
extern void Sort (const Array<double> & values, extern void Sort (const Array<double> & values,
@ -39,4 +41,6 @@ inline void BubbleSort (Array<T> & data)
BubbleSort (data.Size(), &data[data.Begin()]); BubbleSort (data.Size(), &data[data.Begin()]);
} }
}
#endif #endif

View File

@ -11,6 +11,8 @@
Implementation of sparse 2 dimensional bitarray Implementation of sparse 2 dimensional bitarray
*/ */
namespace netgen
{
class SPARSE_BIT_Array_2D class SPARSE_BIT_Array_2D
{ {
@ -52,5 +54,6 @@ class SPARSE_BIT_Array_2D
INDEX GetIndex (INDEX i, INDEX nr) const { return lines[i-1].col[nr-1]; } INDEX GetIndex (INDEX i, INDEX nr) const { return lines[i-1].col[nr-1]; }
}; };
}
#endif #endif

View File

@ -14,8 +14,10 @@
*/ */
#include "array.hpp" // #include "array.hpp"
namespace netgen
{
/// ///
template <class T> class STACK template <class T> class STACK
@ -107,6 +109,6 @@ inline void STACK<T> :: MakeEmpty ()
size = 0; size = 0;
} }
}
#endif #endif

View File

@ -8,6 +8,9 @@
/* Date: 01. Jun. 95 */ /* Date: 01. Jun. 95 */
/**************************************************************************/ /**************************************************************************/
namespace netgen
{
/** /**
Base class for the generic SYMBOLTABLE. Base class for the generic SYMBOLTABLE.
An array of identifiers is maintained. An array of identifiers is maintained.
@ -154,5 +157,5 @@ inline void SYMBOLTABLE<T> :: DeleteAll ()
data.DeleteAll(); data.DeleteAll();
} }
}
#endif #endif

View File

@ -7,6 +7,10 @@
/* Date: 01. Jun. 95 */ /* Date: 01. Jun. 95 */
/**************************************************************************/ /**************************************************************************/
namespace netgen
{
/// Base class to generic class TABLE. /// Base class to generic class TABLE.
class BASE_TABLE class BASE_TABLE
{ {
@ -219,5 +223,7 @@ inline ostream & operator<< (ostream & ost, const TABLE<T,BASE> & table)
return ost; return ost;
} }
}
#endif #endif

View File

@ -7,6 +7,9 @@
/* Date: 01. Jun. 95 */ /* Date: 01. Jun. 95 */
/**************************************************************************/ /**************************************************************************/
namespace netgen
{
/* /*
templates, global types, defines and variables templates, global types, defines and variables
*/ */
@ -443,6 +446,6 @@ void MergeSort (int size, T * data, T * help);
}
#endif #endif

View File

@ -36,6 +36,7 @@ namespace netgen
template<int D> template<int D>
void SplineSeg3<D> :: Project (const Point<D> point, Point<D> & point_on_curve, double & t) const void SplineSeg3<D> :: Project (const Point<D> point, Point<D> & point_on_curve, double & t) const
{ {

View File

@ -2,6 +2,9 @@
#define NGINTERFACE #define NGINTERFACE
/**************************************************************************/ /**************************************************************************/
/* File: nginterface.h */ /* File: nginterface.h */
/* Author: Joachim Schoeberl */ /* Author: Joachim Schoeberl */

View File

@ -1,76 +1,148 @@
class Ng_Element #ifndef NGINTERFACE_V2
#define NGINTERFACE_V2
/**************************************************************************/
/* File: nginterface_v2.hpp */
/* Author: Joachim Schoeberl */
/* Date: May 09 */
/**************************************************************************/
/*
C++ interface to Netgen
*/
namespace netgen
{ {
class Ng_Element
class Ng_Points
{ {
public:
int num;
const int * ptr;
int Size() const { return num; } class Ng_Points
int operator[] (int i) const { return ptr[i]-1; } {
public:
int num;
const int * ptr;
int Size() const { return num; }
int operator[] (int i) const { return ptr[i]-1; }
};
class Ng_Vertices
{
public:
int num;
const int * ptr;
int Size() const { return num; }
int operator[] (int i) const { return ptr[i]-1; }
};
class Ng_Edges
{
public:
int num;
const int * ptr;
int Size() const { return num; }
int operator[] (int i) const { return abs (ptr[i])-1; }
};
class Ng_Faces
{
public:
int num;
const int * ptr;
int Size() const { return num; }
int operator[] (int i) const { return (ptr[i]-1) / 8; }
};
public:
NG_ELEMENT_TYPE type;
NG_ELEMENT_TYPE GetType() const { return type; }
Ng_Points points; // all points
Ng_Vertices vertices;
Ng_Edges edges;
Ng_Faces faces;
}; };
class Ng_Vertices
{
public:
int num;
const int * ptr;
int Size() const { return num; }
int operator[] (int i) const { return ptr[i]-1; } template <int DIM>
DLL_HEADER int Ng_GetNElements ();
template <int DIM>
DLL_HEADER Ng_Element Ng_GetElement (int nr);
template <int DIM> class Ng_Node;
template <>
class Ng_Node<1>
{
class Ng_Vertices
{
public:
const int * ptr;
int Size() const { return 2; }
int operator[] (int i) const { return ptr[i]-1; }
};
public:
Ng_Vertices vertices;
}; };
class Ng_Edges template <int DIM>
{ DLL_HEADER Ng_Node<DIM> Ng_GetNode (int nr);
public:
int num;
const int * ptr;
int Size() const { return num; }
int operator[] (int i) const { return abs (ptr[i])-1; }
};
class Ng_Faces template <int DIM>
{ DLL_HEADER int Ng_GetNNodes ();
public:
int num;
const int * ptr;
int Size() const { return num; }
int operator[] (int i) const { return (ptr[i]-1) / 8; }
};
public:
NG_ELEMENT_TYPE type;
NG_ELEMENT_TYPE GetType() const { return type; }
Ng_Points points; // all points
Ng_Vertices vertices;
Ng_Edges edges;
Ng_Faces faces;
};
template <int DIM>
DLL_HEADER int Ng_GetNElements ();
template <int DIM>
DLL_HEADER Ng_Element Ng_GetElement (int nr);
template <int DIM>
DLL_HEADER int Ng_GetElementIndex (int nr);
/// Curved Elements: /// Curved Elements:
/// xi..... DIM_EL local coordinates /// xi..... DIM_EL local coordinates
/// sxi ... step xi /// sxi ... step xi
/// x ..... DIM_SPACE global coordinates /// x ..... DIM_SPACE global coordinates
/// dxdxi...DIM_SPACE x DIM_EL Jacobian matrix (row major storage) /// dxdxi...DIM_SPACE x DIM_EL Jacobian matrix (row major storage)
template <int DIM_EL, int DIM_SPACE> template <int DIM_EL, int DIM_SPACE>
DLL_HEADER void Ng_MultiElementTransformation (int elnr, int npts, DLL_HEADER void Ng_MultiElementTransformation (int elnr, int npts,
const double * xi, int sxi, const double * xi, int sxi,
double * x, int sx, double * x, int sx,
double * dxdxi, int sdxdxi); double * dxdxi, int sdxdxi);
template <int DIM>
DLL_HEADER int Ng_GetElementIndex (int nr);
/// Curved Elements:
/// xi..... DIM_EL local coordinates
/// sxi ... step xi
/// x ..... DIM_SPACE global coordinates
/// dxdxi...DIM_SPACE x DIM_EL Jacobian matrix (row major storage)
template <int DIM_EL, int DIM_SPACE>
DLL_HEADER void Ng_MultiElementTransformation (int elnr, int npts,
const double * xi, int sxi,
double * x, int sx,
double * dxdxi, int sdxdxi);
}
#endif

View File

@ -85,7 +85,8 @@ public:
void GetFaceVertices (int fnr, Array<int> & vertices) const; void GetFaceVertices (int fnr, Array<int> & vertices) const;
void GetFaceVertices (int fnr, int * vertices) const; void GetFaceVertices (int fnr, int * vertices) const;
void GetEdgeVertices (int fnr, int & v1, int & v2) const; void GetEdgeVertices (int enr, int & v1, int & v2) const;
const int * GetEdgeVerticesPtr (int enr) const { return &edge2vert[enr][0]; }
void GetFaceEdges (int fnr, Array<int> & edges, bool withorientation = false) const; void GetFaceEdges (int fnr, Array<int> & edges, bool withorientation = false) const;
ELEMENT_TYPE GetFaceType (int fnr) const; ELEMENT_TYPE GetFaceType (int fnr) const;

View File

@ -4,14 +4,15 @@
#include <meshing.hpp> #include <meshing.hpp>
#include "incvis.hpp" // #include "incvis.hpp"
#include <visual.hpp>
namespace netgen namespace netgen
{ {
#include "mvdraw.hpp" // #include "meshdoc.hpp"
#include "meshdoc.hpp"
MeshDoctorParameters meshdoctor; MeshDoctorParameters meshdoctor;
@ -84,8 +85,6 @@ VisualSceneMeshDoctor :: ~VisualSceneMeshDoctor ()
void VisualSceneMeshDoctor :: DrawScene () void VisualSceneMeshDoctor :: DrawScene ()
{ {
int i, j, k;
if (!mesh) return; if (!mesh) return;
int hchval = mesh->GetNP() + mesh->GetNE() + mesh->GetNSE(); int hchval = mesh->GetNP() + mesh->GetNE() + mesh->GetNSE();
@ -162,7 +161,7 @@ void VisualSceneMeshDoctor :: DrawScene ()
void VisualSceneMeshDoctor :: BuildScene (int zoomall) void VisualSceneMeshDoctor :: BuildScene (int zoomall)
{ {
int i, j, k; int i, j;
if (zoomall) if (zoomall)
@ -198,11 +197,6 @@ void VisualSceneMeshDoctor :: BuildScene (int zoomall)
glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
static float matcol0[] = { 0.0f, 0.0f, 0.0f, 1.0f };
static float matcol1[] = { 1.0f, 1.0f, 1.0f, 1.0f };
static float matcolsel[] = { 1.0f, 0.0f, 0.0f, 1.0f };
static float matcolnosel[] = { 0.0f, 1.0f, 0.0f, 1.0f };
glLineWidth (1.0f); glLineWidth (1.0f);
glDisable (GL_COLOR_MATERIAL); glDisable (GL_COLOR_MATERIAL);
@ -456,7 +450,7 @@ void VisualSceneMeshDoctor :: MouseDblClick (int px, int py)
{ {
cout << "dblclick: " << px << " - " << py << endl; cout << "dblclick: " << px << " - " << py << endl;
int i, j, k, hits; int i, hits;
// select surface triangle by mouse click // select surface triangle by mouse click
GLuint selbuf[10000]; GLuint selbuf[10000];
@ -574,8 +568,8 @@ void VisualSceneMeshDoctor :: UpdateTables ()
for (i = 1; i <= mesh->GetNSeg(); i++) for (i = 1; i <= mesh->GetNSeg(); i++)
{ {
const Segment & seg = mesh->LineSegment(i); const Segment & seg = mesh->LineSegment(i);
if (seg[0] == selpoint && seg[1] == selpoint2 || if ( (seg[0] == selpoint && seg[1] == selpoint2) ||
seg[1] == selpoint && seg[0] == selpoint2) (seg[1] == selpoint && seg[0] == selpoint2) )
{ {
edgedist.Elem(selpoint) = 1; edgedist.Elem(selpoint) = 1;
edgedist.Elem(selpoint2) = 1; edgedist.Elem(selpoint2) = 1;

View File

@ -1,152 +1,151 @@
#ifndef FILE_MVDRAW #ifndef FILE_MVDRAW
#define FILE_MVDRAW #define FILE_MVDRAW
#include "vispar.hpp"
namespace netgen
extern void InitDrawMesh ();
extern void DrawMesh ();
extern void MouseMove(int oldx, int oldy,
int newx, int newy,
char mode);
extern void Render ();
class VisualScene
{ {
protected:
static Point3d center;
static double rad;
static float lookatmat[16];
static float transmat[16];
static float rotmat[16];
static float centermat[16];
static float transformationmat[16];
GLdouble clipplane[4];
int changeval;
static GLdouble backcolor;
static int selface;
static int selelement;
static int selpoint;
static int selpoint2;
static int locpi;
static int seledge;
static int selecttimestamp;
public:
static GLuint fontbase;
// static Tcl_Obj* fontbase; // Togl 2.0
// static GLubyte * colortexture;
static GLuint coltexname;
static int ntexcols;
// static bool linear_colors;
int invcolor;
public: extern void InitDrawMesh ();
VisualScene (); extern void DrawMesh ();
virtual ~VisualScene(); extern void MouseMove(int oldx, int oldy,
int newx, int newy,
char mode);
virtual void BuildScene (int zoomall = 0); extern void Render ();
virtual void DrawScene ();
void CalcTransformationMatrices();
void StandardRotation (const char * dir);
void ArbitraryRotation (const Array<double> & alpha, const Array<Vec3d> & vec);
void ArbitraryRotation (const double alpha, const Vec3d & vec);
void MouseMove(int oldx, int oldy, class VisualScene
int newx, int newy, {
char mode); protected:
static Point3d center;
static double rad;
void LookAt (const Point<3> & cam, const Point<3> & obj, static float lookatmat[16];
const Point<3> & camup); static float transmat[16];
static float rotmat[16];
static float centermat[16];
static float transformationmat[16];
void SetClippingPlane (); GLdouble clipplane[4];
virtual void MouseDblClick (int px, int py); int changeval;
static GLdouble backcolor;
void SetLight (); static int selface;
static void SetBackGroundColor (double col) static int selelement;
static int selpoint;
static int selpoint2;
static int locpi;
static int seledge;
static int selecttimestamp;
public:
static GLuint fontbase;
// static Tcl_Obj* fontbase; // Togl 2.0
// static GLubyte * colortexture;
static GLuint coltexname;
static int ntexcols;
// static bool linear_colors;
int invcolor;
public:
VisualScene ();
virtual ~VisualScene();
virtual void BuildScene (int zoomall = 0);
virtual void DrawScene ();
void CalcTransformationMatrices();
void StandardRotation (const char * dir);
void ArbitraryRotation (const Array<double> & alpha, const Array<Vec3d> & vec);
void ArbitraryRotation (const double alpha, const Vec3d & vec);
void MouseMove(int oldx, int oldy,
int newx, int newy,
char mode);
void LookAt (const Point<3> & cam, const Point<3> & obj,
const Point<3> & camup);
void SetClippingPlane ();
virtual void MouseDblClick (int px, int py);
void SetLight ();
static void SetBackGroundColor (double col)
{ backcolor = col; } { backcolor = col; }
void CreateTexture (int ncols, int linear, int typ = GL_DECAL); void CreateTexture (int ncols, int linear, int typ = GL_DECAL);
void DrawColorBar (double minval, double maxval, int logscale = 0, bool linear = 1); void DrawColorBar (double minval, double maxval, int logscale = 0, bool linear = 1);
void DrawCoordinateCross (); void DrawCoordinateCross ();
void DrawNetgenLogo (); void DrawNetgenLogo ();
void SetOpenGlColor(double val, double valmin, double valmax, int logscale = 0); void SetOpenGlColor(double val, double valmin, double valmax, int logscale = 0);
#ifdef PARALLELGL #ifdef PARALLELGL
void InitParallelGL (); void InitParallelGL ();
void Broadcast (); void Broadcast ();
#endif #endif
}; };
class VisualSceneGeometry : public VisualScene class VisualSceneGeometry : public VisualScene
{ {
Array<int> trilists; Array<int> trilists;
int selsurf; int selsurf;
public: public:
VisualSceneGeometry (); VisualSceneGeometry ();
virtual ~VisualSceneGeometry (); virtual ~VisualSceneGeometry ();
virtual void SelectSurface (int aselsurf); virtual void SelectSurface (int aselsurf);
virtual void BuildScene (int zoomall = 0); virtual void BuildScene (int zoomall = 0);
virtual void DrawScene (); virtual void DrawScene ();
}; };
class VisualSceneSTLGeometry : public VisualScene class VisualSceneSTLGeometry : public VisualScene
{ {
Array<int> trilists; Array<int> trilists;
public: public:
VisualSceneSTLGeometry (); VisualSceneSTLGeometry ();
virtual ~VisualSceneSTLGeometry (); virtual ~VisualSceneSTLGeometry ();
virtual void BuildScene (int zoomall = 0); virtual void BuildScene (int zoomall = 0);
virtual void DrawScene (); virtual void DrawScene ();
}; };
class VisualSceneGeometry2d : public VisualScene class VisualSceneGeometry2d : public VisualScene
{ {
public: public:
VisualSceneGeometry2d (); VisualSceneGeometry2d ();
virtual ~VisualSceneGeometry2d (); virtual ~VisualSceneGeometry2d ();
virtual void BuildScene (int zoomall = 0); virtual void BuildScene (int zoomall = 0);
virtual void DrawScene (); virtual void DrawScene ();
}; };
#ifdef OCCGEOMETRY #ifdef OCCGEOMETRY
class VisualSceneOCCGeometry : public VisualScene class VisualSceneOCCGeometry : public VisualScene
{ {
Array<int> trilists; Array<int> trilists;
Array<int> linelists; Array<int> linelists;
int selsurf; int selsurf;
public: public:
VisualSceneOCCGeometry (); VisualSceneOCCGeometry ();
virtual ~VisualSceneOCCGeometry (); virtual ~VisualSceneOCCGeometry ();
virtual void BuildScene (int zoomall = 0); virtual void BuildScene (int zoomall = 0);
virtual void DrawScene (); virtual void DrawScene ();
virtual void MouseDblClick (int px, int py); virtual void MouseDblClick (int px, int py);
}; };
#endif #endif
@ -159,48 +158,48 @@ public:
#ifdef STEP #ifdef STEP
class VisualSceneSTEPGeometry : public VisualScene class VisualSceneSTEPGeometry : public VisualScene
{ {
Array<int> gllists; Array<int> gllists;
public: public:
VisualSceneSTEPGeometry (); VisualSceneSTEPGeometry ();
virtual ~VisualSceneSTEPGeometry (); virtual ~VisualSceneSTEPGeometry ();
virtual void BuildScene (int zoomall = 0); virtual void BuildScene (int zoomall = 0);
virtual void DrawScene (); virtual void DrawScene ();
}; };
#endif #endif
class VisualSceneSTLMeshing : public VisualScene class VisualSceneSTLMeshing : public VisualScene
{ {
Array<int> trilists; Array<int> trilists;
int selecttrig, nodeofseltrig; int selecttrig, nodeofseltrig;
public: public:
VisualSceneSTLMeshing (); VisualSceneSTLMeshing ();
virtual ~VisualSceneSTLMeshing (); virtual ~VisualSceneSTLMeshing ();
virtual void BuildScene (int zoomall = 0); virtual void BuildScene (int zoomall = 0);
virtual void DrawScene (); virtual void DrawScene ();
virtual void MouseDblClick (int px, int py); virtual void MouseDblClick (int px, int py);
int seltria; int seltria;
}; };
class VisualSceneSurfaceMeshing : public VisualScene class VisualSceneSurfaceMeshing : public VisualScene
{ {
public: public:
VisualSceneSurfaceMeshing (); VisualSceneSurfaceMeshing ();
virtual ~VisualSceneSurfaceMeshing (); virtual ~VisualSceneSurfaceMeshing ();
virtual void BuildScene (int zoomall = 0); virtual void BuildScene (int zoomall = 0);
virtual void DrawScene (); virtual void DrawScene ();
}; };
@ -208,86 +207,86 @@ public:
class VisualSceneMesh : public VisualScene class VisualSceneMesh : public VisualScene
{ {
int filledlist; int filledlist;
int linelist; int linelist;
int edgelist; int edgelist;
int pointnumberlist; int pointnumberlist;
int tetlist; int tetlist;
int prismlist; int prismlist;
int pyramidlist; int pyramidlist;
int hexlist; int hexlist;
int badellist; int badellist;
int identifiedlist; int identifiedlist;
int domainsurflist; int domainsurflist;
int vstimestamp;//, selecttimestamp; int vstimestamp;//, selecttimestamp;
int filledtimestamp; int filledtimestamp;
int linetimestamp; int linetimestamp;
int edgetimestamp; int edgetimestamp;
int pointnumbertimestamp; int pointnumbertimestamp;
int tettimestamp; int tettimestamp;
int prismtimestamp; int prismtimestamp;
int pyramidtimestamp; int pyramidtimestamp;
int hextimestamp; int hextimestamp;
int badeltimestamp; int badeltimestamp;
int identifiedtimestamp; int identifiedtimestamp;
int domainsurftimestamp; int domainsurftimestamp;
#ifdef PARALLELGL #ifdef PARALLELGL
Array<int> par_linelists; Array<int> par_linelists;
Array<int> par_filledlists; Array<int> par_filledlists;
#endif #endif
NgLock *lock; NgLock *lock;
// int selface, selelement; // int selface, selelement;
// int selpoint, selpoint2, locpi; // int selpoint, selpoint2, locpi;
// int seledge; // int seledge;
double minh, maxh; // for meshsize coloring double minh, maxh; // for meshsize coloring
public: public:
VisualSceneMesh (); VisualSceneMesh ();
virtual ~VisualSceneMesh (); virtual ~VisualSceneMesh ();
virtual void BuildScene (int zoomall = 0); virtual void BuildScene (int zoomall = 0);
virtual void DrawScene (); virtual void DrawScene ();
virtual void MouseDblClick (int px, int py); virtual void MouseDblClick (int px, int py);
int SelectedFace () const int SelectedFace () const
{ return selface; } { return selface; }
void SetSelectedFace (int asf); void SetSelectedFace (int asf);
// { selface = asf; selecttimestamp = GetTimeStamp(); } // { selface = asf; selecttimestamp = GetTimeStamp(); }
int SelectedEdge () const int SelectedEdge () const
{ return seledge; } { return seledge; }
int SelectedElement () const int SelectedElement () const
{ return selelement; } { return selelement; }
int SelectedPoint () const int SelectedPoint () const
{ return selpoint; } { return selpoint; }
void BuildFilledList(); void BuildFilledList();
// private: // private:
void BuildLineList(); void BuildLineList();
void BuildEdgeList(); void BuildEdgeList();
void BuildPointNumberList(); void BuildPointNumberList();
void BuildTetList(); void BuildTetList();
void BuildPrismList(); void BuildPrismList();
void BuildPyramidList(); void BuildPyramidList();
void BuildHexList(); void BuildHexList();
void BuildBadelList(); void BuildBadelList();
void BuildIdentifiedList(); void BuildIdentifiedList();
void BuildDomainSurfList(); void BuildDomainSurfList();
}; };
@ -295,33 +294,37 @@ public:
class VisualSceneSpecPoints : public VisualScene class VisualSceneSpecPoints : public VisualScene
{ {
public: public:
VisualSceneSpecPoints (); VisualSceneSpecPoints ();
virtual ~VisualSceneSpecPoints (); virtual ~VisualSceneSpecPoints ();
virtual void BuildScene (int zoomall = 0); virtual void BuildScene (int zoomall = 0);
virtual void DrawScene (); virtual void DrawScene ();
double len; double len;
}; };
// extern struct Tcl_Interp * hinterp; // extern struct Tcl_Interp * hinterp;
extern void AddVisualizationScene (const string & name, extern void AddVisualizationScene (const string & name,
VisualScene * vs); VisualScene * vs);
void MouseDblClickSelect (const int px, const int py, void MouseDblClickSelect (const int px, const int py,
const GLdouble * clipplane, const GLdouble backcolor, const GLdouble * clipplane, const GLdouble backcolor,
const float * transformationmat, const float * transformationmat,
const Point3d & center, const Point3d & center,
const double rad, const double rad,
const int displaylist, const int displaylist,
int & selelement, int & selface, int & seledge, int & selpoint, int & selelement, int & selface, int & seledge, int & selpoint,
int & selpoint2, int & locpi); int & selpoint2, int & locpi);
}
#endif #endif

View File

@ -2,57 +2,67 @@
#define FILE_SOLDATA #define FILE_SOLDATA
using namespace std; namespace netgen
class SolutionData
{ {
protected:
string name; using namespace std;
int components;
bool iscomplex;
int multidimcomponent; class SolutionData
{
protected:
public: string name;
SolutionData (const string & aname, int components;
int acomponents = 1, bool aiscomplex = 0) bool iscomplex;
: name(aname), components(acomponents), iscomplex(aiscomplex)
{ ; }
virtual ~SolutionData () int multidimcomponent;
{ ; }
int GetComponents() { return components; } public:
bool IsComplex() { return iscomplex; } SolutionData (const string & aname,
int acomponents = 1, bool aiscomplex = 0)
: name(aname), components(acomponents), iscomplex(aiscomplex)
{ ; }
virtual bool GetValue (int /* elnr */, virtual ~SolutionData ()
double /* lam1 */, double /* lam2 */, double /* lam3 */, { ; }
double * /* values */)
{ return false; }
virtual bool GetValue (int selnr, int GetComponents() { return components; }
const double xref[], const double x[], const double dxdxref[], bool IsComplex() { return iscomplex; }
double * values)
{ return GetValue (selnr, xref[0], xref[1], xref[2], values); } virtual bool GetValue (int /* elnr */,
double /* lam1 */, double /* lam2 */, double /* lam3 */,
double * /* values */)
{ return false; }
virtual bool GetValue (int selnr,
const double xref[], const double x[], const double dxdxref[],
double * values)
{ return GetValue (selnr, xref[0], xref[1], xref[2], values); }
virtual bool GetSurfValue (int /* selnr */, virtual bool GetSurfValue (int /* selnr */,
double /* lam1 */, double /* lam2 */, double /* lam1 */, double /* lam2 */,
double * /* values */) double * /* values */)
{ return false; } { return false; }
virtual bool GetSurfValue (int selnr, virtual bool GetSurfValue (int selnr,
const double xref[], const double x[], const double dxdxref[], const double xref[], const double x[], const double dxdxref[],
double * values) double * values)
{ return GetSurfValue (selnr, xref[0], xref[1], values); } { return GetSurfValue (selnr, xref[0], xref[1], values); }
void SetMultiDimComponent (int mc) virtual bool GetMultiSurfValue (int selnr, int npts,
{ multidimcomponent = mc; } const double * xref, int sxref,
}; const double * x, int sx,
const double * dxdxref, int sdxdxref,
double * values, int svalues);
void SetMultiDimComponent (int mc)
{ multidimcomponent = mc; }
};
}
#endif #endif

View File

@ -52,7 +52,7 @@ void VisualSceneSTLMeshing :: DrawScene ()
int colormeshsize = vispar.colormeshsize; int colormeshsize = vispar.colormeshsize;
double hmin, hmax; double hmin = 0.0, hmax = 1.0;
if (colormeshsize) if (colormeshsize)
{ {
@ -99,7 +99,7 @@ void VisualSceneSTLMeshing :: DrawScene ()
glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, mat_spec_col); glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, mat_spec_col);
double shine = vispar.shininess; double shine = vispar.shininess;
double transp = vispar.transp; // double transp = vispar.transp;
glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, shine); glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, shine);
glLogicOp (GL_COPY); glLogicOp (GL_COPY);
@ -109,11 +109,11 @@ void VisualSceneSTLMeshing :: DrawScene ()
float mat_colblue[] = { 0.1f, 0.1f, 1.0f, 1.0f }; float mat_colblue[] = { 0.1f, 0.1f, 1.0f, 1.0f };
float mat_colbluegreen[] = { 0.1f, 0.5f, 0.9f, 1.0f }; float mat_colbluegreen[] = { 0.1f, 0.5f, 0.9f, 1.0f };
float mat_colpink[] = { 1.0f, 0.1f, 0.5f, 1.0f }; // float mat_colpink[] = { 1.0f, 0.1f, 0.5f, 1.0f };
float mat_colviolet[] = { 1.0f, 0.1f, 1.0f, 1.0f }; float mat_colviolet[] = { 1.0f, 0.1f, 1.0f, 1.0f };
float mat_colbrown[] = { 0.8f, 0.6f, 0.1f, 1.0f }; float mat_colbrown[] = { 0.8f, 0.6f, 0.1f, 1.0f };
float mat_colorange[] = { 0.9f, 0.7f, 0.1f, 1.0f }; // float mat_colorange[] = { 0.9f, 0.7f, 0.1f, 1.0f };
float mat_colturquis[] = { 0.0f, 1.0f, 0.8f, 1.0f }; // float mat_colturquis[] = { 0.0f, 1.0f, 0.8f, 1.0f };
float mat_colgrey[] = { 0.3f, 0.3f, 0.3f, 1.0f }; float mat_colgrey[] = { 0.3f, 0.3f, 0.3f, 1.0f };
@ -122,7 +122,7 @@ void VisualSceneSTLMeshing :: DrawScene ()
float mat_collbrown[] = { 1.0f, 0.8f, 0.3f, 1.0f }; float mat_collbrown[] = { 1.0f, 0.8f, 0.3f, 1.0f };
float mat_collgrey[] = { 0.8f, 0.8f, 0.8f, 1.0f }; float mat_collgrey[] = { 0.8f, 0.8f, 0.8f, 1.0f };
float mat_colmgrey[] = { 0.4f, 0.4f, 0.4f, 1.0f }; // float mat_colmgrey[] = { 0.4f, 0.4f, 0.4f, 1.0f };
float mat_colstlbody[] = { 0.0f, 0.0f, 0.8f, 1.0f }; float mat_colstlbody[] = { 0.0f, 0.0f, 0.8f, 1.0f };
float mat_colseltrig[] = { 0.7f, 0.7f, 0.3f, 1.0f }; float mat_colseltrig[] = { 0.7f, 0.7f, 0.3f, 1.0f };

View File

@ -1,6 +1,9 @@
#ifndef FILE_VISPAR #ifndef FILE_VISPAR
#define FILE_VISPAR #define FILE_VISPAR
namespace netgen
{
class VisualizationParameters class VisualizationParameters
{ {
public: public:
@ -98,5 +101,6 @@ public:
VisualizationParameters(); VisualizationParameters();
}; };
extern VisualizationParameters vispar; extern VisualizationParameters vispar;
}
#endif #endif

View File

@ -19,12 +19,15 @@ Visualization
#include "../include/incvis.hpp" #include "../include/incvis.hpp"
namespace netgen #include "vispar.hpp"
{
#include "mvdraw.hpp" #include "mvdraw.hpp"
#include "soldata.hpp" #include "soldata.hpp"
namespace netgen
{
#include "vssolution.hpp" #include "vssolution.hpp"
#include "meshdoc.hpp" #include "meshdoc.hpp"
} }
#endif #endif

View File

@ -8,10 +8,11 @@
#include <csg.hpp> #include <csg.hpp>
#include <stlgeom.hpp> #include <stlgeom.hpp>
#include <visual.hpp>
namespace netgen namespace netgen
{ {
#include "mvdraw.hpp"
/* *********************** Draw Geometry **************** */ /* *********************** Draw Geometry **************** */

View File

@ -196,7 +196,7 @@ namespace netgen
if(vsol -> iscomplex) if(vsol -> iscomplex)
SetPhase(phaser,phasei); SetPhase(phaser,phasei);
double crit; double crit = 1.0;
if(randomized) if(randomized)
{ {
@ -327,7 +327,7 @@ namespace netgen
double startval; double startval;
bool startdraw; bool startdraw;
bool drawelem; bool drawelem = false;
int elnr; int elnr;
for (int i=0; i<6; i++) values[i]=0.0; for (int i=0; i<6; i++) values[i]=0.0;

View File

@ -116,7 +116,7 @@ namespace netgen
GLfloat matcol1[] = { 1, 1, 1, 1 }; GLfloat matcol1[] = { 1, 1, 1, 1 };
GLfloat matcolf[] = { 0, 1, 0, 1 }; GLfloat matcolf[] = { 0, 1, 0, 1 };
GLfloat matcolb[] = { 0.5, 0, 0, 1 }; GLfloat matcolb[] = { 0.5, 0, 0, 1 };
GLfloat matcolblue[] = { 0, 0, 1, 1 }; // GLfloat matcolblue[] = { 0, 0, 1, 1 };
glMatrixMode (GL_MODELVIEW); glMatrixMode (GL_MODELVIEW);
@ -503,7 +503,7 @@ namespace netgen
Array<int> v; Array<int> v;
for (i = 1; i <= mesh->GetNE(); i++) for (i = 1; i <= mesh->GetNE(); i++)
{ {
const ELEMENTTYPE & eltype = mesh->ElementType(i); // const ELEMENTTYPE & eltype = mesh->ElementType(i);
Array<int> pnums; Array<int> pnums;
Point3d p; Point3d p;
@ -1635,8 +1635,6 @@ namespace netgen
if (mesh->GetCurvedElements().IsHighOrder()) if (mesh->GetCurvedElements().IsHighOrder())
{ {
int j;
int hoplotn = 1 << vispar.subdivisions; int hoplotn = 1 << vispar.subdivisions;
// mesh->GetCurvedElements().GetNVisualSubsecs(); // mesh->GetCurvedElements().GetNVisualSubsecs();
@ -2392,7 +2390,7 @@ namespace netgen
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, hexcol); glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, hexcol);
Array<Element2d> faces; Array<Element2d> faces;
int hoplotn = 1 << vispar.subdivisions; // int hoplotn = 1 << vispar.subdivisions;
for (ElementIndex ei = 0; ei < mesh->GetNE(); ei++) for (ElementIndex ei = 0; ei < mesh->GetNE(); ei++)
{ {
@ -2608,7 +2606,6 @@ namespace netgen
const Element & el = (*mesh)[ei]; const Element & el = (*mesh)[ei];
if (el.GetType() == PYRAMID && !el.IsDeleted()) if (el.GetType() == PYRAMID && !el.IsDeleted())
{ {
int j;
int i = ei + 1; int i = ei + 1;
CurvedElements & curv = mesh->GetCurvedElements(); CurvedElements & curv = mesh->GetCurvedElements();
@ -3381,8 +3378,8 @@ namespace netgen
for (i = 1; i <= mesh->GetNSeg(); i++) for (i = 1; i <= mesh->GetNSeg(); i++)
{ {
const Segment & seg = mesh->LineSegment(i); const Segment & seg = mesh->LineSegment(i);
if (seg[0] == selpoint && seg[1] == selpoint2 || if ( (seg[0] == selpoint && seg[1] == selpoint2) ||
seg[1] == selpoint && seg[0] == selpoint2) (seg[1] == selpoint && seg[0] == selpoint2) )
{ {
seledge = seg.edgenr; seledge = seg.edgenr;
cout << "seledge = " << seledge << endl; cout << "seledge = " << seledge << endl;

View File

@ -31,6 +31,17 @@ namespace netgen
delete solclass; delete solclass;
} }
bool SolutionData :: GetMultiSurfValue (int selnr, int npts,
const double * xref, int sxref,
const double * x, int sx,
const double * dxdxref, int sdxdxref,
double * values, int svalues)
{
bool res = false;
for (int i = 0; i < npts; i++)
res = GetSurfValue (selnr, &xref[i*sxref], &x[i*sx], &dxdxref[i*sdxdxref], &values[i*svalues]);
return res;
}
VisualSceneSolution :: VisualSceneSolution () VisualSceneSolution :: VisualSceneSolution ()
: VisualScene() : VisualScene()
@ -119,6 +130,8 @@ namespace netgen
} }
break; break;
} }
default:
nsd->size = 0;
} }
solutiontimestamp = NextTimeStamp(); solutiontimestamp = NextTimeStamp();
} }
@ -180,6 +193,8 @@ namespace netgen
ost << " -type=noncontinuous"; break; ost << " -type=noncontinuous"; break;
case SOL_SURFACE_NONCONTINUOUS: case SOL_SURFACE_NONCONTINUOUS:
ost << " -type=surfacenoncontinuous"; break; ost << " -type=surfacenoncontinuous"; break;
default:
cerr << "save solution data, case not handeld" << endl;
} }
ost << endl; ost << endl;
@ -236,6 +251,8 @@ namespace netgen
{ {
case QUAD: surf_ost << 9; break; case QUAD: surf_ost << 9; break;
case TRIG: surf_ost << 5; break; case TRIG: surf_ost << 5; break;
default:
cerr << "not implemented 2378" << endl;
} }
surf_ost << "\n"; surf_ost << "\n";
} }
@ -276,6 +293,8 @@ namespace netgen
switch (el.GetType()) switch (el.GetType())
{ {
case TET: ost << 10; break; case TET: ost << 10; break;
default:
cerr << "not implemented 67324" << endl;
} }
ost << "\n"; ost << "\n";
} }
@ -1090,6 +1109,7 @@ namespace netgen
Vec<3> nvs[1100]; Vec<3> nvs[1100];
double values[1100]; double values[1100];
double mvalues[11000];
double valuesc[1100][2]; double valuesc[1100][2];
@ -1238,8 +1258,8 @@ namespace netgen
for (int iy = 0; iy < n; iy++, ii++) for (int iy = 0; iy < n; iy++, ii++)
for (int ix = 0; ix < n; ix++, ii++) for (int ix = 0; ix < n; ix++, ii++)
{ {
double x = double(ix) / n; // double x = double(ix) / n;
double y = double(iy) / n; // double y = double(iy) / n;
int index[] = { ii, ii+1, ii+n+2, ii+n+1 }; int index[] = { ii, ii+1, ii+n+2, ii+n+1 };
@ -1396,11 +1416,19 @@ namespace netgen
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][0], valuesc[ii][1]);
else else
for (int ii = 0; ii < npt; ii++) {
{ // for (int ii = 0; ii < npt; ii++)
drawelem = GetSurfValue (sol, sei, &pref[ii](0), &points[ii](0), &dxdxis[ii](0), scalcomp, values[ii]); // drawelem = GetSurfValue (sol, sei, &pref[ii](0), &points[ii](0), &dxdxis[ii](0), scalcomp, values[ii]);
// drawelem = GetSurfValue (sol, sei, pref[ii](0), pref[ii](1), 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)
@ -1521,8 +1549,8 @@ namespace netgen
Point<3> pnt; Point<3> pnt;
for (int k = 0; k < nv; k++) for (int k = 0; k < nv; k++)
{ {
Point<2> p0; Point<2> p0 = 0.0;
Vec<2> vtau; Vec<2> vtau = 0.0;
if (nv == 3) if (nv == 3)
switch (k) switch (k)
{ {
@ -1635,7 +1663,7 @@ namespace netgen
glBegin (GL_TRIANGLES); glBegin (GL_TRIANGLES);
int np = mesh->GetNP(); // int np = mesh->GetNP();
int ne = mesh->GetNE(); int ne = mesh->GetNE();
@ -1719,6 +1747,9 @@ namespace netgen
double(iy) / n * (1-double(iz)/n), double(iy) / n * (1-double(iz)/n),
double(iz)/n); double(iz)/n);
break; break;
default:
cerr << "case not implementd 878234" << endl;
ploc = 0.0;
} }
if (compress[ii] != -1) if (compress[ii] != -1)
locgrid[compress[ii]] = ploc; locgrid[compress[ii]] = ploc;
@ -1840,7 +1871,7 @@ namespace netgen
Vec<3> normal = Cross (points[2]-points[0], points[1]-points[0]); Vec<3> normal = Cross (points[2]-points[0], points[1]-points[0]);
if ( (normal * (p2-p1)) > 0 == nodevali[lpi1] < 0) if ( ( (normal * (p2-p1)) > 0 ) == ( nodevali[lpi1] < 0) )
normal *= -1; normal *= -1;
glNormal3dv (normal); glNormal3dv (normal);
@ -2426,7 +2457,7 @@ namespace netgen
double lam1, double lam2, double lam3, double lam1, double lam2, double lam3,
double * values) const double * values) const
{ {
bool ok; bool ok = false;
switch (data->soltype) switch (data->soltype)
{ {
case SOL_VIRTUALFUNCTION: case SOL_VIRTUALFUNCTION:
@ -2448,7 +2479,7 @@ namespace netgen
const double xref[], const double x[], const double dxdxref[], const double xref[], const double x[], const double dxdxref[],
double * values) const double * values) const
{ {
bool ok; bool ok = false;
switch (data->soltype) switch (data->soltype)
{ {
case SOL_VIRTUALFUNCTION: case SOL_VIRTUALFUNCTION:
@ -2496,7 +2527,7 @@ namespace netgen
} }
case FUNC_ABS_TENSOR: case FUNC_ABS_TENSOR:
{ {
int d; int d = 0;
switch (data->components) switch (data->components)
{ {
case 1: d = 1; break; case 1: d = 1; break;
@ -2514,7 +2545,7 @@ namespace netgen
case FUNC_MISES: case FUNC_MISES:
{ {
int d; int d = 0;
switch(data->components) switch(data->components)
{ {
case 1: d = 1; break; case 1: d = 1; break;
@ -2534,7 +2565,7 @@ namespace netgen
} }
case FUNC_MAIN: case FUNC_MAIN:
{ {
int d; int d = 0;
switch(data->components) switch(data->components)
{ {
case 1: d = 1; break; case 1: d = 1; break;
@ -2587,8 +2618,8 @@ namespace netgen
{ {
const Element & el = (*mesh)[elnr]; const Element & el = (*mesh)[elnr];
double lami[8]; double lami[8] = { 0.0 };
int np, i; int np = 0;
switch (el.GetType()) switch (el.GetType())
{ {
@ -2614,9 +2645,11 @@ namespace netgen
np = 6; np = 6;
break; break;
} }
default:
cerr << "case not implementd 23523" << endl;
} }
for (i = 0; i < np; i++) for (int i = 0; i < np; i++)
val += lami[i] * data->data[(el[i]-1) * data->dist + comp-1]; val += lami[i] * data->data[(el[i]-1) * data->dist + comp-1];
return 1; return 1;
@ -2635,8 +2668,8 @@ namespace netgen
{ {
const Element & el = (*mesh)[elnr]; const Element & el = (*mesh)[elnr];
double lami[8]; double lami[8] = { 0.0 };
int np, i; int np = 0;
switch (el.GetType()) switch (el.GetType())
{ {
@ -2693,7 +2726,7 @@ namespace netgen
base = 10 * elnr; base = 10 * elnr;
for (i = 0; i < np; i++) for (int i = 0; i < np; i++)
val += lami[i] * data->data[(base+i) * data->dist + comp-1]; val += lami[i] * data->data[(base+i) * data->dist + comp-1];
return 1; return 1;
@ -2710,6 +2743,9 @@ namespace netgen
val = (*mesh)[elnr].GetOrder(); val = (*mesh)[elnr].GetOrder();
return 1; return 1;
} }
default:
cerr << "case not handled 7234" << endl;
} }
return 0; return 0;
} }
@ -2741,7 +2777,7 @@ namespace netgen
} }
case FUNC_ABS_TENSOR: case FUNC_ABS_TENSOR:
{ {
int d; int d = 0;
switch (data->components) switch (data->components)
{ {
case 1: d = 1; break; case 1: d = 1; break;
@ -2759,7 +2795,7 @@ namespace netgen
case FUNC_MISES: case FUNC_MISES:
{ {
int d; int d = 0;
switch(data->components) switch(data->components)
{ {
case 1: d = 1; break; case 1: d = 1; break;
@ -2779,7 +2815,7 @@ namespace netgen
} }
case FUNC_MAIN: case FUNC_MAIN:
{ {
int d; int d = 0;
switch(data->components) switch(data->components)
{ {
case 1: d = 1; break; case 1: d = 1; break;
@ -2832,8 +2868,8 @@ namespace netgen
{ {
const Element & el = (*mesh)[elnr]; const Element & el = (*mesh)[elnr];
double lami[8]; double lami[8] = { 0.0 };
int np, i; int np = 0;
switch (el.GetType()) switch (el.GetType())
{ {
@ -2859,9 +2895,11 @@ namespace netgen
np = 6; np = 6;
break; break;
} }
default:
cerr << "case not implemented 234324" << endl;
} }
for (i = 0; i < np; i++) for (int i = 0; i < np; i++)
val += lami[i] * data->data[(el[i]-1) * data->dist + comp-1]; val += lami[i] * data->data[(el[i]-1) * data->dist + comp-1];
return 1; return 1;
@ -2880,8 +2918,8 @@ namespace netgen
{ {
const Element & el = (*mesh)[elnr]; const Element & el = (*mesh)[elnr];
double lami[8]; double lami[8] = { 0.0 };
int np, i; int np = 0;
switch (el.GetType()) switch (el.GetType())
{ {
@ -2938,7 +2976,7 @@ namespace netgen
base = 10 * elnr; base = 10 * elnr;
for (i = 0; i < np; i++) for (int i = 0; i < np; i++)
val += lami[i] * data->data[(base+i) * data->dist + comp-1]; val += lami[i] * data->data[(base+i) * data->dist + comp-1];
return 1; return 1;
@ -2955,6 +2993,8 @@ namespace netgen
val = (*mesh)[elnr].GetOrder(); val = (*mesh)[elnr].GetOrder();
return 1; return 1;
} }
default:
cerr << "case not implemented 234234" << endl;
} }
return 0; return 0;
} }
@ -2986,7 +3026,8 @@ namespace netgen
vali = values[comp]; vali = values[comp];
return ok; return ok;
} }
default:
cerr << "case not handled 234234" << endl;
} }
return 0; return 0;
} }
@ -3003,7 +3044,7 @@ namespace netgen
double lam1, double lam2, double lam1, double lam2,
double * values) const double * values) const
{ {
bool ok; bool ok = false;
switch (data->soltype) switch (data->soltype)
{ {
case SOL_VIRTUALFUNCTION: case SOL_VIRTUALFUNCTION:
@ -3028,7 +3069,7 @@ namespace netgen
const double xref[], const double x[], const double dxdxref[], const double xref[], const double x[], const double dxdxref[],
double * values) const double * values) const
{ {
bool ok; bool ok = false;
switch (data->soltype) switch (data->soltype)
{ {
case SOL_VIRTUALFUNCTION: case SOL_VIRTUALFUNCTION:
@ -3045,6 +3086,118 @@ namespace netgen
return ok; return ok;
} }
bool VisualSceneSolution ::
GetMultiSurfValues (const SolData * data, SurfaceElementIndex elnr, int npt,
const double * xref, int sxref,
const double * x, int sx,
const double * dxdxref, int sdxdxref,
double * val, int sval) const
{
bool drawelem = false;
if (data->soltype == SOL_VIRTUALFUNCTION)
drawelem = data->solclass->GetMultiSurfValue(elnr, npt, xref, sxref, x, sx, dxdxref, sdxdxref, val, sval);
else
for (int i = 0; i < npt; i++)
drawelem = GetSurfValues (data, elnr, xref+i*sxref, x+i*sx, dxdxref+i*sdxdxref, val+i*sval);
return drawelem;
}
double VisualSceneSolution :: ExtractValue (const SolData * data, int comp, double * values) const
{
double val = 0;
if (comp == 0)
{
switch (evalfunc)
{
case FUNC_ABS:
{
for (int ci = 0; ci < data->components; ci++)
val += sqr (values[ci]);
val = sqrt (val);
break;
}
case FUNC_ABS_TENSOR:
{
int d = 0;
switch (data->components)
{
case 1: d = 1; break;
case 3: d = 2; break;
case 6: d = 3; break;
}
for (int ci = 0; ci < d; ci++)
val += sqr (values[ci]);
for (int ci = d; ci < data->components; ci++)
val += 2*sqr (values[ci]);
val = sqrt (val);
break;
}
case FUNC_MISES:
{
int d = 0;
switch(data->components)
{
case 1: d = 1; break;
case 3: d = 2; break;
case 6: d = 3; break;
}
int ci;
double trace = 0.;
for (ci = 0; ci < d; ci++)
trace += 1./3.*(values[ci]);
for (ci = 0; ci < d; ci++)
val += sqr (values[ci]-trace);
for (ci = d; ci < data->components; ci++)
val += 2.*sqr (values[ci]);
val = sqrt (val);
break;
}
case FUNC_MAIN:
{
int d = 0;
switch(data->components)
{
case 1: d = 1; break;
case 3: d = 2; break;
case 6: d = 3; break;
}
Mat<3,3> m ;
Vec<3> ev;
int ci;
for (ci = 0; ci < d; ci++)
m(ci,ci) = (values[ci]);
m(0,1) = m(1,0) = values[3];
m(0,2) = m(2,0) = values[4];
m(1,2) = m(2,1) = values[5];
EigenValues (m, ev);
double help;
for (int i=0; i<d; i++)
{
for (int j=d-1; i<j; j--)
{
if ( abs(ev(j)) > abs(ev(j-1)) )
{
help = ev(j);
ev(j) = ev(j-1);
ev(j-1) = help;
}
}
}
val = (ev(0));
break;
}
}
return val;
}
return values[comp-1];
}
bool VisualSceneSolution :: bool VisualSceneSolution ::
@ -3077,6 +3230,8 @@ namespace netgen
return ok; return ok;
} }
default:
cerr << "case not implementd 6565" << endl;
} }
return 0; return 0;
} }
@ -3106,7 +3261,7 @@ namespace netgen
} }
case FUNC_ABS_TENSOR: case FUNC_ABS_TENSOR:
{ {
int d; int d = 0;
switch (data->components) switch (data->components)
{ {
case 1: d = 1; break; case 1: d = 1; break;
@ -3124,7 +3279,7 @@ namespace netgen
case FUNC_MISES: case FUNC_MISES:
{ {
int d; int d = 0;
switch(data->components) switch(data->components)
{ {
case 1: d = 1; break; case 1: d = 1; break;
@ -3144,7 +3299,7 @@ namespace netgen
} }
case FUNC_MAIN: case FUNC_MAIN:
{ {
int d; int d = 0;
switch(data->components) switch(data->components)
{ {
case 1: d = 1; break; case 1: d = 1; break;
@ -3312,7 +3467,7 @@ namespace netgen
const Element2d & el = (*mesh)[selnr]; const Element2d & el = (*mesh)[selnr];
double lami[8]; double lami[8];
int np, i; int np = 0;
val = 0; val = 0;
int order = data->order; int order = data->order;
@ -3333,6 +3488,8 @@ namespace netgen
np = 3; np = 3;
break; break;
} }
default:
cerr << "case not implementd 2342" << endl;
} }
break; break;
} }
@ -3360,6 +3517,8 @@ namespace netgen
np = 6; np = 6;
break; break;
} }
default:
cerr << "case not implemented 8712" << endl;
} }
break; break;
} }
@ -3371,10 +3530,9 @@ namespace netgen
else else
base = 9 * selnr; base = 9 * selnr;
for (i = 0; i < np; i++) for (int i = 0; i < np; i++)
{ val += lami[i] * data->data[(base+i) * data->dist + comp-1];
val += lami[i] * data->data[(base+i) * data->dist + comp-1];
}
return 1; return 1;
} }
@ -3430,7 +3588,7 @@ namespace netgen
} }
case FUNC_ABS_TENSOR: case FUNC_ABS_TENSOR:
{ {
int d; int d = 0;
switch (data->components) switch (data->components)
{ {
case 1: d = 1; break; case 1: d = 1; break;
@ -3448,7 +3606,7 @@ namespace netgen
case FUNC_MISES: case FUNC_MISES:
{ {
int d; int d = 0;
switch(data->components) switch(data->components)
{ {
case 1: d = 1; break; case 1: d = 1; break;
@ -3468,7 +3626,7 @@ namespace netgen
} }
case FUNC_MAIN: case FUNC_MAIN:
{ {
int d; int d = 0;
switch(data->components) switch(data->components)
{ {
case 1: d = 1; break; case 1: d = 1; break;
@ -3636,8 +3794,8 @@ namespace netgen
{ {
const Element2d & el = (*mesh)[selnr]; const Element2d & el = (*mesh)[selnr];
double lami[8]; double lami[8] = { 0.0 };
int np, i; int np = 0;
val = 0; val = 0;
int order = data->order; int order = data->order;
@ -3658,6 +3816,8 @@ namespace netgen
np = 3; np = 3;
break; break;
} }
default:
cerr << "case not impl 234234" << endl;
} }
break; break;
} }
@ -3685,6 +3845,8 @@ namespace netgen
np = 6; np = 6;
break; break;
} }
default:
cerr << "case not implented 3234" << endl;
} }
break; break;
} }
@ -3696,10 +3858,9 @@ namespace netgen
else else
base = 9 * selnr; base = 9 * selnr;
for (i = 0; i < np; i++) for (int i = 0; i < np; i++)
{ val += lami[i] * data->data[(base+i) * data->dist + comp-1];
val += lami[i] * data->data[(base+i) * data->dist + comp-1];
}
return 1; return 1;
} }
@ -3736,7 +3897,7 @@ namespace netgen
GetValues (soldata[vecfunction], elnr, p(0), p(1), p(2), &def(0)); GetValues (soldata[vecfunction], elnr, p(0), p(1), p(2), &def(0));
def *= scaledeform; def *= scaledeform;
if (soldata[vecfunction]->dist == 2) def(2) = 0; if (soldata[vecfunction]->components == 2) def(2) = 0;
} }
else else
def = 0; def = 0;
@ -3753,7 +3914,7 @@ namespace netgen
GetSurfValues (soldata[vecfunction], elnr, lam1, lam2, &def(0)); GetSurfValues (soldata[vecfunction], elnr, lam1, lam2, &def(0));
def *= scaledeform; def *= scaledeform;
if (soldata[vecfunction]->dist == 2) def(2) = 0; if (soldata[vecfunction]->components == 2) def(2) = 0;
} }
else if (deform && scalfunction != -1 && mesh->GetDimension()==2) else if (deform && scalfunction != -1 && mesh->GetDimension()==2)
{ // he: allow for 3d plots of 2d surfaces: usage: turn deformation on { // he: allow for 3d plots of 2d surfaces: usage: turn deformation on
@ -3770,7 +3931,6 @@ namespace netgen
SurfaceElementIndex elnr) const SurfaceElementIndex elnr) const
{ {
p = mesh->Point (pnum+1); p = mesh->Point (pnum+1);
if (deform && vecfunction != -1) if (deform && vecfunction != -1)
{ {
const SolData * vsol = soldata[vecfunction]; const SolData * vsol = soldata[vecfunction];
@ -3816,7 +3976,6 @@ namespace netgen
NgProfiler::RegionTimer reg1 (timer1); NgProfiler::RegionTimer reg1 (timer1);
int np = mesh->GetNP();
int ne = mesh->GetNE(); int ne = mesh->GetNE();
const int edgei[6][2] = const int edgei[6][2] =
@ -3929,6 +4088,9 @@ namespace netgen
double(iz)/n); double(iz)/n);
if (iz == n) ploc = Point<3> (0,0,1-1e-8); if (iz == n) ploc = Point<3> (0,0,1-1e-8);
break; break;
default:
cerr << "clip plane trigs not implemented" << endl;
ploc = Point<3> (0,0,0);
} }
if (compress[ii] != -1) if (compress[ii] != -1)
locgrid[compress[ii]] = ploc; locgrid[compress[ii]] = ploc;
@ -4192,10 +4354,6 @@ namespace netgen
void VisualSceneSolution :: GetClippingPlaneGrid (Array<ClipPlanePoint> & pts) void VisualSceneSolution :: GetClippingPlaneGrid (Array<ClipPlanePoint> & pts)
{ {
int i, j, k;
int np = mesh->GetNV();
int ne = mesh->GetNE();
Vec3d n(clipplane[0], clipplane[1], clipplane[2]); Vec3d n(clipplane[0], clipplane[1], clipplane[2]);
double mu = -clipplane[3] / n.Length2(); double mu = -clipplane[3] / n.Length2();
@ -4406,7 +4564,6 @@ namespace netgen
rotmat(0,1) = -rotmat(1,0); rotmat(0,1) = -rotmat(1,0);
glBegin (GL_TRIANGLES); glBegin (GL_TRIANGLES);
double phi;
for (i = 1; i <= n; i++) for (i = 1; i <= n; i++)
{ {
/* /*
@ -4468,7 +4625,6 @@ namespace netgen
rotmat(0,1) = -rotmat(1,0); rotmat(0,1) = -rotmat(1,0);
glBegin (GL_QUADS); glBegin (GL_QUADS);
double phi;
for (i = 1; i <= n; i++) for (i = 1; i <= n; i++)
{ {
newcs = rotmat * cs; newcs = rotmat * cs;
@ -4667,10 +4823,8 @@ namespace netgen
for (i = 0; i < vssolution.soldata.Size(); i++) for (i = 0; i < vssolution.soldata.Size(); i++)
{ {
if (strlen (vssolution.soldata[i]->name) == if ( (strlen (vssolution.soldata[i]->name) == pointpos-1) &&
pointpos-1 && (strncmp (vssolution.soldata[i]->name, scalname, pointpos-1) == 0) )
strncmp (vssolution.soldata[i]->name, scalname,
pointpos-1) == 0)
{ {
vssolution.scalfunction = i; vssolution.scalfunction = i;
vssolution.scalcomp = atoi (scalname + pointpos); vssolution.scalcomp = atoi (scalname + pointpos);

View File

@ -242,6 +242,8 @@ private:
const double xref[], const double x[], const double dxdxref[], const double xref[], const double x[], const double dxdxref[],
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;
@ -254,6 +256,13 @@ private:
const double xref[], const double x[], const double dxdxref[], const double xref[], const double x[], const double dxdxref[],
double * values) const; double * values) const;
bool GetMultiSurfValues (const SolData * data, SurfaceElementIndex elnr, int npt,
const double * xref, int sxref,
const double * x, int sx,
const double * dxdxref, int sdxdxref,
double * val, int sval) const;
double ExtractValue (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

@ -21,7 +21,7 @@ netgen_LDADD = $(top_builddir)/libsrc/visualization/libvisual.a \
# #
# add for static linkage of ngsolve: # add for static linkage of ngsolve:
# /opt/netgen/lib/libngsolve.a /opt/netgen/lib/libngcomp.a /opt/netgen/lib/libngfem.a /opt/netgen/lib/libngcomp.a /opt/netgen/lib/libngfem.a /opt/netgen/lib/libngmg.a /opt/netgen/lib/libngla.a /opt/netgen/lib/libngbla.a /opt/netgen/lib/libngstd.a # /opt/netgen/lib/libngsolve.a /opt/netgen/lib/libngcomp.a /opt/netgen/lib/libngcomp.a /opt/netgen/lib/libngfemng.a /opt/netgen/lib/libngmg.a /opt/netgen/lib/libngla.a /opt/netgen/lib/libngbla.a /opt/netgen/lib/libngstd.a -llapack
# #
# #

View File

@ -89,20 +89,7 @@ catch {
# catch { source ${ngdir}/ngsolve/ngsolve.tcl }
# catch { [source ${ngdir}/ngsolve/preproc.tcl] }
# catch { [source ${ngdir}/ngsolve/pdecreator.tcl] }
# some applications:
# source ${ngdir}/demoapp/demoapp.tcl
# source ${ngdir}/metis/ngmetis.tcl
# trafo/zugstange : menu
##################################################
set zugstange 0 set zugstange 0
catch { source ${ngdir}/trafo/menu.tcl } catch { source ${ngdir}/trafo/menu.tcl }

View File

@ -417,7 +417,6 @@ int Tcl_AppInit(Tcl_Interp * interp)
return TCL_ERROR; return TCL_ERROR;
*/ */
#ifdef DEMOAPP #ifdef DEMOAPP
extern int DemoApp_Init (Tcl_Interp * interp); extern int DemoApp_Init (Tcl_Interp * interp);
if (DemoApp_Init(interp) == TCL_ERROR) if (DemoApp_Init(interp) == TCL_ERROR)

View File

@ -37,7 +37,7 @@ namespace netgen
{ {
#include "writeuser.hpp" #include "writeuser.hpp"
extern AutoPtr<Mesh> mesh; extern AutoPtr<Mesh> mesh;
#ifndef NOTCL #ifndef NOTCL
extern VisualSceneMesh vsmesh; extern VisualSceneMesh vsmesh;
extern Tcl_Interp * tcl_interp; extern Tcl_Interp * tcl_interp;
@ -67,172 +67,195 @@ namespace netgen
} }
using namespace netgen; namespace netgen
template <> int DLL_HEADER Ng_GetNElements<1> ()
{ {
return mesh->GetNSeg();
template <> int DLL_HEADER Ng_GetNElements<1> ()
{
return mesh->GetNSeg();
}
template <> DLL_HEADER int Ng_GetNElements<2> ()
{
return mesh->GetNSE();
}
template <> DLL_HEADER int Ng_GetNElements<3> ()
{
return mesh->GetNE();
}
template <> DLL_HEADER Ng_Element Ng_GetElement<1> (int nr)
{
const Segment & el = mesh->LineSegment (SegmentIndex(nr));
Ng_Element ret;
ret.type = NG_ELEMENT_TYPE(el.GetType());
ret.points.num = el.GetNP();
ret.points.ptr = (int*)&(el[0]);
ret.vertices.num = 2;
ret.vertices.ptr = (int*)&(el[0]);
ret.edges.num = 1;
ret.edges.ptr = mesh->GetTopology().GetSegmentElementEdgesPtr (nr);
ret.faces.num = 0;
ret.faces.ptr = NULL;
return ret;
}
template <> DLL_HEADER Ng_Element Ng_GetElement<2> (int nr)
{
const Element2d & el = mesh->SurfaceElement (SurfaceElementIndex (nr));
Ng_Element ret;
ret.type = NG_ELEMENT_TYPE(el.GetType());
ret.points.num = el.GetNP();
ret.points.ptr = (int*)&el[0];
ret.vertices.num = el.GetNV();
ret.vertices.ptr = (int*)&(el[0]);
ret.edges.num = MeshTopology::GetNEdges (el.GetType());
ret.edges.ptr = mesh->GetTopology().GetSurfaceElementEdgesPtr (nr);
ret.faces.num = MeshTopology::GetNFaces (el.GetType());
ret.faces.ptr = mesh->GetTopology().GetSurfaceElementFacesPtr (nr);
return ret;
}
template <> DLL_HEADER Ng_Element Ng_GetElement<3> (int nr)
{
const Element & el = mesh->VolumeElement (ElementIndex (nr));
Ng_Element ret;
ret.type = NG_ELEMENT_TYPE(el.GetType());
ret.points.num = el.GetNP();
ret.points.ptr = (int*)&el[0];
ret.vertices.num = el.GetNV();
ret.vertices.ptr = (int*)&(el[0]);
ret.edges.num = MeshTopology::GetNEdges (el.GetType());
ret.edges.ptr = mesh->GetTopology().GetElementEdgesPtr (nr);
ret.faces.num = MeshTopology::GetNFaces (el.GetType());
ret.faces.ptr = mesh->GetTopology().GetElementFacesPtr (nr);
return ret;
}
template <>
DLL_HEADER int Ng_GetElementIndex<1> (int nr)
{
return (*mesh)[SegmentIndex(nr)].si;
}
template <>
DLL_HEADER int Ng_GetElementIndex<2> (int nr)
{
int ind = (*mesh)[SurfaceElementIndex(nr)].GetIndex();
return mesh->GetFaceDescriptor(ind).BCProperty();
}
template <>
DLL_HEADER int Ng_GetElementIndex<3> (int nr)
{
return (*mesh)[ElementIndex(nr)].GetIndex();
}
template <>
DLL_HEADER void Ng_MultiElementTransformation<3,3> (int elnr, int npts,
const double * xi, int sxi,
double * x, int sx,
double * dxdxi, int sdxdxi)
{
mesh->GetCurvedElements().CalcMultiPointElementTransformation (elnr, npts, xi, sxi, x, sx, dxdxi, sdxdxi);
}
template <>
DLL_HEADER void Ng_MultiElementTransformation<2,2> (int elnr, int npts,
const double * xi, int sxi,
double * x, int sx,
double * dxdxi, int sdxdxi)
{
mesh->GetCurvedElements().CalcMultiPointSurfaceTransformation<2> (elnr, npts, xi, sxi, x, sx, dxdxi, sdxdxi);
}
template <>
DLL_HEADER void Ng_MultiElementTransformation<2,3> (int elnr, int npts,
const double * xi, int sxi,
double * x, int sx,
double * dxdxi, int sdxdxi)
{
mesh->GetCurvedElements().CalcMultiPointSurfaceTransformation<3> (elnr, npts, xi, sxi, x, sx, dxdxi, sdxdxi);
}
template <>
DLL_HEADER void Ng_MultiElementTransformation<1,2> (int elnr, int npts,
const double * xi, int sxi,
double * x, int sx,
double * dxdxi, int sdxdxi)
{
for (int ip = 0; ip < npts; ip++)
{
Point<3> xg;
Vec<3> dx;
mesh->GetCurvedElements().CalcSegmentTransformation (xi[ip*sxi], elnr, xg, dx);
if (x)
for (int i = 0; i < 2; i++)
x[ip*sx+i] = xg(i);
if (dxdxi)
for (int i=0; i<2; i++)
dxdxi[ip*sdxdxi+i] = dx(i);
}
}
template <>
DLL_HEADER void Ng_MultiElementTransformation<1,1> (int elnr, int npts,
const double * xi, int sxi,
double * x, int sx,
double * dxdxi, int sdxdxi)
{
cout << "1D not supported" << endl;
}
template <> DLL_HEADER int Ng_GetNNodes<1> ()
{
return mesh->GetTopology().GetNEdges();
}
template <> DLL_HEADER int Ng_GetNNodes<2> ()
{
return mesh->GetTopology().GetNFaces();
}
template <> DLL_HEADER Ng_Node<1> Ng_GetNode<1> (int nr)
{
Ng_Node<1> node;
node.vertices.ptr = mesh->GetTopology().GetEdgeVerticesPtr(nr);
return node;
}
} }
template <> DLL_HEADER int Ng_GetNElements<2> ()
{
return mesh->GetNSE();
}
template <> DLL_HEADER int Ng_GetNElements<3> ()
{
return mesh->GetNE();
}
template <> DLL_HEADER Ng_Element Ng_GetElement<1> (int nr)
{
const Segment & el = mesh->LineSegment (SegmentIndex(nr));
Ng_Element ret;
ret.type = NG_ELEMENT_TYPE(el.GetType());
ret.points.num = el.GetNP();
ret.points.ptr = (int*)&(el[0]);
ret.vertices.num = 2;
ret.vertices.ptr = (int*)&(el[0]);
ret.edges.num = 1;
ret.edges.ptr = mesh->GetTopology().GetSegmentElementEdgesPtr (nr);
ret.faces.num = 0;
ret.faces.ptr = NULL;
return ret;
}
template <> DLL_HEADER Ng_Element Ng_GetElement<2> (int nr)
{
const Element2d & el = mesh->SurfaceElement (SurfaceElementIndex (nr));
Ng_Element ret;
ret.type = NG_ELEMENT_TYPE(el.GetType());
ret.points.num = el.GetNP();
ret.points.ptr = (int*)&el[0];
ret.vertices.num = el.GetNV();
ret.vertices.ptr = (int*)&(el[0]);
ret.edges.num = MeshTopology::GetNEdges (el.GetType());
ret.edges.ptr = mesh->GetTopology().GetSurfaceElementEdgesPtr (nr);
ret.faces.num = MeshTopology::GetNFaces (el.GetType());
ret.faces.ptr = mesh->GetTopology().GetSurfaceElementFacesPtr (nr);
return ret;
}
template <> DLL_HEADER Ng_Element Ng_GetElement<3> (int nr)
{
const Element & el = mesh->VolumeElement (ElementIndex (nr));
Ng_Element ret;
ret.type = NG_ELEMENT_TYPE(el.GetType());
ret.points.num = el.GetNP();
ret.points.ptr = (int*)&el[0];
ret.vertices.num = el.GetNV();
ret.vertices.ptr = (int*)&(el[0]);
ret.edges.num = MeshTopology::GetNEdges (el.GetType());
ret.edges.ptr = mesh->GetTopology().GetElementEdgesPtr (nr);
ret.faces.num = MeshTopology::GetNFaces (el.GetType());
ret.faces.ptr = mesh->GetTopology().GetElementFacesPtr (nr);
return ret;
}
template <>
DLL_HEADER int Ng_GetElementIndex<1> (int nr)
{
return (*mesh)[SegmentIndex(nr)].si;
}
template <>
DLL_HEADER int Ng_GetElementIndex<2> (int nr)
{
int ind = (*mesh)[SurfaceElementIndex(nr)].GetIndex();
return mesh->GetFaceDescriptor(ind).BCProperty();
}
template <>
DLL_HEADER int Ng_GetElementIndex<3> (int nr)
{
return (*mesh)[ElementIndex(nr)].GetIndex();
}
template <>
DLL_HEADER void Ng_MultiElementTransformation<3,3> (int elnr, int npts,
const double * xi, int sxi,
double * x, int sx,
double * dxdxi, int sdxdxi)
{
mesh->GetCurvedElements().CalcMultiPointElementTransformation (elnr, npts, xi, sxi, x, sx, dxdxi, sdxdxi);
}
template <>
DLL_HEADER void Ng_MultiElementTransformation<2,2> (int elnr, int npts,
const double * xi, int sxi,
double * x, int sx,
double * dxdxi, int sdxdxi)
{
mesh->GetCurvedElements().CalcMultiPointSurfaceTransformation<2> (elnr, npts, xi, sxi, x, sx, dxdxi, sdxdxi);
}
template <>
DLL_HEADER void Ng_MultiElementTransformation<2,3> (int elnr, int npts,
const double * xi, int sxi,
double * x, int sx,
double * dxdxi, int sdxdxi)
{
mesh->GetCurvedElements().CalcMultiPointSurfaceTransformation<3> (elnr, npts, xi, sxi, x, sx, dxdxi, sdxdxi);
}
template <>
DLL_HEADER void Ng_MultiElementTransformation<1,2> (int elnr, int npts,
const double * xi, int sxi,
double * x, int sx,
double * dxdxi, int sdxdxi)
{
for (int ip = 0; ip < npts; ip++)
{
Point<3> xg;
Vec<3> dx;
mesh->GetCurvedElements().CalcSegmentTransformation (xi[ip*sxi], elnr, xg, dx);
if (x)
for (int i = 0; i < 2; i++)
x[ip*sx+i] = xg(i);
if (dxdxi)
for (int i=0; i<2; i++)
dxdxi[ip*sdxdxi+i] = dx(i);
}
}
template <>
DLL_HEADER void Ng_MultiElementTransformation<1,1> (int elnr, int npts,
const double * xi, int sxi,
double * x, int sx,
double * dxdxi, int sdxdxi)
{
cout << "1D not supported" << endl;
}

View File

@ -4008,7 +4008,7 @@ namespace netgen
{ {
char script[50]; char script[50];
sprintf (script, "selectentity {Face %i}", facenr); sprintf (script, "selectentity {Face %i}", facenr);
int errcode = Tcl_GlobalEval (tcl_interp, script); Tcl_GlobalEval (tcl_interp, script);
} }