mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-26 05:50:32 +05:00
nglib / nginterface interfaces
This commit is contained in:
parent
7eb9da3ac1
commit
f069933fc3
@ -215,6 +215,8 @@ extern "C" {
|
|||||||
DLL_HEADER const NG_EDGE * Ng_ME_GetEdges (NG_ELEMENT_TYPE et);
|
DLL_HEADER const NG_EDGE * Ng_ME_GetEdges (NG_ELEMENT_TYPE et);
|
||||||
DLL_HEADER const NG_FACE * Ng_ME_GetFaces (NG_ELEMENT_TYPE et);
|
DLL_HEADER const NG_FACE * Ng_ME_GetFaces (NG_ELEMENT_TYPE et);
|
||||||
|
|
||||||
|
DLL_HEADER void Ng_UpdateTopology();
|
||||||
|
|
||||||
DLL_HEADER int Ng_GetNEdges();
|
DLL_HEADER int Ng_GetNEdges();
|
||||||
DLL_HEADER int Ng_GetNFaces();
|
DLL_HEADER int Ng_GetNFaces();
|
||||||
|
|
||||||
@ -391,6 +393,10 @@ extern "C" {
|
|||||||
// if qualityloss is not equal to NULL at input, a (1-based) list of qualitylosses (due to projection)
|
// if qualityloss is not equal to NULL at input, a (1-based) list of qualitylosses (due to projection)
|
||||||
// is saved in *qualityloss, its size is the return value
|
// is saved in *qualityloss, its size is the return value
|
||||||
DLL_HEADER int Ng_Bisect_WithInfo ( const char * refinementfile, double ** qualityloss);
|
DLL_HEADER int Ng_Bisect_WithInfo ( const char * refinementfile, double ** qualityloss);
|
||||||
|
|
||||||
|
typedef void * Ng_Mesh;
|
||||||
|
DLL_HEADER Ng_Mesh Ng_SelectMesh (Ng_Mesh mesh);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,8 +2,9 @@ noinst_HEADERS = writeuser.hpp
|
|||||||
|
|
||||||
AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include -I$(top_srcdir)/libsrc/interface $(TCL_INCLUDES) -DOPENGL
|
AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include -I$(top_srcdir)/libsrc/interface $(TCL_INCLUDES) -DOPENGL
|
||||||
METASOURCES = AUTO
|
METASOURCES = AUTO
|
||||||
noinst_LTLIBRARIES = libinterface.la
|
lib_LTLIBRARIES = libinterface.la
|
||||||
libinterface_la_SOURCES = read_fnf_mesh.cpp readtetmesh.cpp readuser.cpp writeabaqus.cpp writediffpack.cpp \
|
libinterface_la_SOURCES = nginterface.cpp nginterface_v2.cpp \
|
||||||
|
read_fnf_mesh.cpp readtetmesh.cpp readuser.cpp writeabaqus.cpp writediffpack.cpp \
|
||||||
writedolfin.cpp writeelmer.cpp writefeap.cpp writefluent.cpp writegmsh.cpp writejcm.cpp \
|
writedolfin.cpp writeelmer.cpp writefeap.cpp writefluent.cpp writegmsh.cpp writejcm.cpp \
|
||||||
writepermas.cpp writetecplot.cpp writetet.cpp writetochnog.cpp writeuser.cpp \
|
writepermas.cpp writetecplot.cpp writetet.cpp writetochnog.cpp writeuser.cpp \
|
||||||
wuchemnitz.cpp writegmsh2.cpp writeOpenFOAM15x.cpp
|
wuchemnitz.cpp writegmsh2.cpp writeOpenFOAM15x.cpp
|
||||||
|
@ -3,8 +3,8 @@ include_HEADERS =
|
|||||||
AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include -I$(top_srcdir)/libsrc/interface -DOPENGL -D$(TOGL_WINDOWINGSYSTEM) $(TCL_INCLUDES) $(MPI_INCLUDES) $(FFMPEG_INCLUDES) $(JPEGLIB_INCLUDES)
|
AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include -I$(top_srcdir)/libsrc/interface -DOPENGL -D$(TOGL_WINDOWINGSYSTEM) $(TCL_INCLUDES) $(MPI_INCLUDES) $(FFMPEG_INCLUDES) $(JPEGLIB_INCLUDES)
|
||||||
|
|
||||||
bin_PROGRAMS = netgen
|
bin_PROGRAMS = netgen
|
||||||
netgen_SOURCES = demoview.cpp ngappinit.cpp onetcl.cpp nginterface.cpp nginterface_v2.cpp parallelfunc.cpp parallelinterface.cpp ngpkg.cpp demoview.hpp parallelfunc.hpp togl_1_7.h
|
netgen_SOURCES = demoview.cpp ngappinit.cpp onetcl.cpp parallelfunc.cpp parallelinterface.cpp ngpkg.cpp demoview.hpp parallelfunc.hpp togl_1_7.h
|
||||||
|
# nginterface.cpp nginterface_v2.cpp
|
||||||
|
|
||||||
netgen_LDADD = $(top_builddir)/libsrc/visualization/libvisual.a \
|
netgen_LDADD = $(top_builddir)/libsrc/visualization/libvisual.a \
|
||||||
$(top_builddir)/libsrc/csg/libcsgvis.la \
|
$(top_builddir)/libsrc/csg/libcsgvis.la \
|
||||||
|
156
ng/ngpkg.cpp
156
ng/ngpkg.cpp
@ -31,9 +31,8 @@ The interface between the GUI and the netgen library
|
|||||||
|
|
||||||
extern bool nodisplay;
|
extern bool nodisplay;
|
||||||
|
|
||||||
|
#include <nginterface.h>
|
||||||
// #include <nginterface.h>
|
// extern "C" void RunParallel ( void * (*fun)(void *), void * in);
|
||||||
extern "C" void RunParallel ( void * (*fun)(void *), void * in);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2637,6 +2636,157 @@ namespace netgen
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// from ng_interface
|
||||||
|
void Ng_SetVisualizationParameter (const char * name, const char * value)
|
||||||
|
{
|
||||||
|
// #ifdef OPENGL
|
||||||
|
// #ifndef NOTCL
|
||||||
|
char buf[100];
|
||||||
|
sprintf (buf, "visoptions.%s", name);
|
||||||
|
if (printmessage_importance>0)
|
||||||
|
{
|
||||||
|
cout << "name = " << name << ", value = " << value << endl;
|
||||||
|
cout << "set tcl-variable " << buf << " to " << value << endl;
|
||||||
|
}
|
||||||
|
Tcl_SetVar (tcl_interp, buf, const_cast<char*> (value), 0);
|
||||||
|
Tcl_Eval (tcl_interp, "Ng_Vis_Set parameters;");
|
||||||
|
// #endif
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
using namespace netgen;
|
||||||
|
void Ng_InitSolutionData (Ng_SolutionData * soldata)
|
||||||
|
{
|
||||||
|
|
||||||
|
soldata -> name = NULL;
|
||||||
|
soldata -> data = NULL;
|
||||||
|
soldata -> components = 1;
|
||||||
|
soldata -> dist = 1;
|
||||||
|
soldata -> order = 1;
|
||||||
|
soldata -> iscomplex = 0;
|
||||||
|
soldata -> draw_surface = 1;
|
||||||
|
soldata -> draw_volume = 1;
|
||||||
|
soldata -> soltype = NG_SOLUTION_NODAL;
|
||||||
|
soldata -> solclass = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Ng_SetSolutionData (Ng_SolutionData * soldata)
|
||||||
|
{
|
||||||
|
#ifdef OPENGL
|
||||||
|
// vssolution.ClearSolutionData ();
|
||||||
|
VisualSceneSolution::SolData * vss = new VisualSceneSolution::SolData;
|
||||||
|
|
||||||
|
vss->name = new char[strlen (soldata->name)+1];
|
||||||
|
strcpy (vss->name, soldata->name);
|
||||||
|
|
||||||
|
vss->data = soldata->data;
|
||||||
|
vss->components = soldata->components;
|
||||||
|
vss->dist = soldata->dist;
|
||||||
|
vss->order = soldata->order;
|
||||||
|
vss->iscomplex = bool(soldata->iscomplex);
|
||||||
|
vss->draw_surface = soldata->draw_surface;
|
||||||
|
vss->draw_volume = soldata->draw_volume;
|
||||||
|
vss->soltype = VisualSceneSolution::SolType (soldata->soltype);
|
||||||
|
vss->solclass = soldata->solclass;
|
||||||
|
vssolution.AddSolutionData (vss);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void Ng_ClearSolutionData ()
|
||||||
|
{
|
||||||
|
#ifdef OPENGL
|
||||||
|
vssolution.ClearSolutionData();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace netgen
|
||||||
|
{
|
||||||
|
extern void Render ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Ng_Redraw ()
|
||||||
|
{
|
||||||
|
#ifdef OPENGL
|
||||||
|
extern bool nodisplay; // he: global in ngappinit.cpp
|
||||||
|
if (!nodisplay)
|
||||||
|
{
|
||||||
|
netgen::vssolution.UpdateSolutionTimeStamp();
|
||||||
|
Render();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace netgen
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
int firsttime = 1;
|
||||||
|
int animcnt = 0;
|
||||||
|
void PlayAnimFile(const char* name, int speed, int maxcnt)
|
||||||
|
{
|
||||||
|
//extern Mesh * mesh;
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (mesh.Ptr()) mesh->DeleteMesh();
|
||||||
|
if (!mesh.Ptr()) mesh = new Mesh();
|
||||||
|
*/
|
||||||
|
mesh.Reset (new Mesh());
|
||||||
|
|
||||||
|
int ne, np, i;
|
||||||
|
|
||||||
|
char str[80];
|
||||||
|
char str2[80];
|
||||||
|
|
||||||
|
//int tend = 5000;
|
||||||
|
// for (ti = 1; ti <= tend; ti++)
|
||||||
|
//{
|
||||||
|
int rti = (animcnt%(maxcnt-1)) + 1;
|
||||||
|
animcnt+=speed;
|
||||||
|
|
||||||
|
sprintf(str2,"%05i.sol",rti);
|
||||||
|
strcpy(str,"mbssol/");
|
||||||
|
strcat(str,name);
|
||||||
|
strcat(str,str2);
|
||||||
|
|
||||||
|
if (printmessage_importance>0)
|
||||||
|
cout << "read file '" << str << "'" << endl;
|
||||||
|
|
||||||
|
ifstream infile(str);
|
||||||
|
infile >> ne;
|
||||||
|
for (i = 1; i <= ne; i++)
|
||||||
|
{
|
||||||
|
int j;
|
||||||
|
Element2d tri(TRIG);
|
||||||
|
tri.SetIndex(1); //faceind
|
||||||
|
|
||||||
|
for (j = 1; j <= 3; j++)
|
||||||
|
infile >> tri.PNum(j);
|
||||||
|
|
||||||
|
infile >> np;
|
||||||
|
for (i = 1; i <= np; i++)
|
||||||
|
{
|
||||||
|
Point3d p;
|
||||||
|
infile >> p.X() >> p.Y() >> p.Z();
|
||||||
|
if (firsttime)
|
||||||
|
mesh->AddPoint (p);
|
||||||
|
else
|
||||||
|
mesh->Point(i) = Point<3> (p);
|
||||||
|
}
|
||||||
|
|
||||||
|
//firsttime = 0;
|
||||||
|
Ng_Redraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int Ng_SetVisParameters (ClientData clientData,
|
int Ng_SetVisParameters (ClientData clientData,
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
#include <occgeom.hpp>
|
#include <occgeom.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <nginterface.h>
|
||||||
|
|
||||||
|
|
||||||
namespace netgen {
|
namespace netgen {
|
||||||
extern void MeshFromSpline2D (SplineGeometry2d & geometry,
|
extern void MeshFromSpline2D (SplineGeometry2d & geometry,
|
||||||
@ -1208,3 +1210,12 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
} // End of namespace netgen
|
} // End of namespace netgen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Ng_Redraw () { ; }
|
||||||
|
void Ng_ClearSolutionData () { ; }
|
||||||
|
void Ng_SetSolutionData (Ng_SolutionData * soldata) { ; }
|
||||||
|
void Ng_InitSolutionData (Ng_SolutionData * soldata) { ; }
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user