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;
@ -632,7 +633,7 @@ void Intersection (const FlatArray<T> & in1, const FlatArray<T> & in2, const Fla
}
}
#endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,6 +11,8 @@
Implementation of sparse 2 dimensional bitarray
*/
namespace netgen
{
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]; }
};
}
#endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +1,20 @@
#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
{
@ -54,14 +71,47 @@ public:
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;
};
template <int DIM>
DLL_HEADER int Ng_GetElementIndex (int nr);
DLL_HEADER Ng_Node<DIM> Ng_GetNode (int nr);
template <int DIM>
DLL_HEADER int Ng_GetNNodes ();
/// Curved Elements:
@ -74,3 +124,25 @@ DLL_HEADER void Ng_MultiElementTransformation (int elnr, int npts,
const double * xi, int sxi,
double * x, int sx,
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, 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;
ELEMENT_TYPE GetFaceType (int fnr) const;

View File

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

View File

@ -1,10 +1,9 @@
#ifndef FILE_MVDRAW
#define FILE_MVDRAW
#include "vispar.hpp"
namespace netgen
{
extern void InitDrawMesh ();
@ -323,5 +322,9 @@ void MouseDblClickSelect (const int px, const int py,
int & selelement, int & selface, int & seledge, int & selpoint,
int & selpoint2, int & locpi);
}
#endif

View File

@ -2,6 +2,9 @@
#define FILE_SOLDATA
namespace netgen
{
using namespace std;
class SolutionData
@ -49,10 +52,17 @@ public:
{ return GetSurfValue (selnr, xref[0], xref[1], values); }
virtual bool GetMultiSurfValue (int selnr, int npts,
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

View File

@ -52,7 +52,7 @@ void VisualSceneSTLMeshing :: DrawScene ()
int colormeshsize = vispar.colormeshsize;
double hmin, hmax;
double hmin = 0.0, hmax = 1.0;
if (colormeshsize)
{
@ -99,7 +99,7 @@ void VisualSceneSTLMeshing :: DrawScene ()
glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, mat_spec_col);
double shine = vispar.shininess;
double transp = vispar.transp;
// double transp = vispar.transp;
glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, shine);
glLogicOp (GL_COPY);
@ -109,11 +109,11 @@ void VisualSceneSTLMeshing :: DrawScene ()
float mat_colblue[] = { 0.1f, 0.1f, 1.0f, 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_colbrown[] = { 0.8f, 0.6f, 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_colorange[] = { 0.9f, 0.7f, 0.1f, 1.0f };
// float mat_colturquis[] = { 0.0f, 1.0f, 0.8f, 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_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_colseltrig[] = { 0.7f, 0.7f, 0.3f, 1.0f };

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -242,6 +242,8 @@ private:
const double xref[], const double x[], const double dxdxref[],
int comp, double & val) const;
bool GetSurfValueComplex (const SolData * data, SurfaceElementIndex elnr,
double lam1, double lam2,
int comp, double & valr, double & vali) const;
@ -254,6 +256,13 @@ private:
const double xref[], const double x[], const double dxdxref[],
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;

View File

@ -21,7 +21,7 @@ netgen_LDADD = $(top_builddir)/libsrc/visualization/libvisual.a \
#
# 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
catch { source ${ngdir}/trafo/menu.tcl }

View File

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

View File

@ -67,7 +67,8 @@ namespace netgen
}
using namespace netgen;
namespace netgen
{
@ -236,3 +237,25 @@ DLL_HEADER void Ng_MultiElementTransformation<1,1> (int elnr, int npts,
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;
}
}

View File

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