This commit is contained in:
Joachim Schoeberl 2014-02-23 19:31:40 +00:00
parent 725a714bf3
commit 3a82cf2258
10 changed files with 104 additions and 7 deletions

View File

@ -1,8 +1,6 @@
noinst_HEADERS = array.hpp myadt.hpp optmem.hpp sort.hpp table.hpp autodiff.hpp flags.hpp mystring.hpp spbita2d.hpp template.hpp autoptr.hpp hashtabl.hpp netgenout.hpp profiler.hpp stack.hpp bitarray.hpp seti.hpp symbolta.hpp dynamicmem.hpp parthreads.hpp mpi_interface.hpp gzstream.h noinst_HEADERS = array.hpp myadt.hpp optmem.hpp sort.hpp table.hpp autodiff.hpp flags.hpp mystring.hpp spbita2d.hpp template.hpp autoptr.hpp hashtabl.hpp netgenout.hpp profiler.hpp stack.hpp bitarray.hpp seti.hpp symbolta.hpp dynamicmem.hpp parthreads.hpp mpi_interface.hpp gzstream.h
# moveablemem.hpp include_HEADERS = ngexception.hpp archive_base.hpp
include_HEADERS = ngexception.hpp
AM_CPPFLAGS = $(MPI_INCLUDES) -I$(top_srcdir)/libsrc/include AM_CPPFLAGS = $(MPI_INCLUDES) -I$(top_srcdir)/libsrc/include
METASOURCES = AUTO METASOURCES = AUTO
@ -12,4 +10,3 @@ libgen_la_SOURCES = array.cpp bitarray.cpp dynamicmem.cpp flags.cpp \
profiler.cpp seti.cpp sort.cpp spbita2d.cpp symbolta.cpp table.cpp \ profiler.cpp seti.cpp sort.cpp spbita2d.cpp symbolta.cpp table.cpp \
mpi_interface.cpp gzstream.cpp mpi_interface.cpp gzstream.cpp
# moveablemem.cpp

View File

@ -0,0 +1,34 @@
#ifndef NGS_ARCHIVE_BASE
#define NGS_ARCHIVE_BASE
namespace ngstd
{
class Archive
{
public:
virtual bool Output () = 0;
virtual bool Input () { return !Output(); }
virtual Archive & operator & (double & d) = 0;
virtual Archive & operator & (int & i) = 0;
virtual Archive & operator & (short & i) = 0;
virtual Archive & operator & (unsigned char & i) = 0;
virtual Archive & operator & (bool & b) = 0;
virtual Archive & operator & (string & str) = 0;
virtual Archive & operator & (char *& str) = 0;
template <typename T>
Archive & operator << (const T & t)
{
T ht(t);
(*this) & ht;
return *this;
}
};
}
#endif

View File

@ -289,6 +289,7 @@ extern "C" {
// #include "../visualization/soldata.hpp" // #include "../visualization/soldata.hpp"
class SolutionData; class SolutionData;
class MouseEventHandler; class MouseEventHandler;
class UserVisualizationObject;
} }
enum Ng_SolutionType enum Ng_SolutionType
@ -326,6 +327,8 @@ extern "C" {
DLL_HEADER void Ng_Redraw(); DLL_HEADER void Ng_Redraw();
/// ///
DLL_HEADER void Ng_SetMouseEventHandler (netgen::MouseEventHandler * handler); DLL_HEADER void Ng_SetMouseEventHandler (netgen::MouseEventHandler * handler);
///
DLL_HEADER void Ng_SetUserVisualizationObject (netgen::UserVisualizationObject * vis);
// //
DLL_HEADER void Ng_SetVisualizationParameter (const char * name, DLL_HEADER void Ng_SetVisualizationParameter (const char * name,
const char * value); const char * value);

View File

@ -12,6 +12,7 @@
C++ interface to Netgen C++ interface to Netgen
*/ */
#include "../general/archive_base.hpp"
namespace netgen namespace netgen
{ {
@ -166,6 +167,10 @@ namespace netgen
Ngx_Mesh(class Mesh * amesh = NULL); Ngx_Mesh(class Mesh * amesh = NULL);
void LoadMesh (const string & filename); void LoadMesh (const string & filename);
void LoadMesh (istream & str);
void SaveMesh (ostream & str) const;
void DoArchive (ngstd::Archive & archive);
virtual ~Ngx_Mesh(); virtual ~Ngx_Mesh();
bool Valid () { return mesh != NULL; } bool Valid () { return mesh != NULL; }

View File

@ -43,6 +43,39 @@ namespace netgen
mesh = netgen::mesh.Ptr(); mesh = netgen::mesh.Ptr();
} }
void Ngx_Mesh :: LoadMesh (istream & ist)
{
netgen::mesh.Reset (new Mesh);
netgen::mesh -> Load (ist);
mesh = netgen::mesh.Ptr();
}
void Ngx_Mesh :: SaveMesh (ostream & ost) const
{
mesh -> Save (ost);
}
void Ngx_Mesh :: DoArchive (ngstd::Archive & archive)
{
if (archive.Output())
{
stringstream str;
SaveMesh (str);
string st = str.str();
archive & st;
}
else
{
string st;
archive & st;
stringstream str(st);
LoadMesh (str);
}
}
/* /*
Ngx_Mesh :: Ngx_Mesh (Mesh * amesh) Ngx_Mesh :: Ngx_Mesh (Mesh * amesh)
: mesh(amesh) : mesh(amesh)

View File

@ -116,6 +116,14 @@ namespace netgen
virtual void DblClick (int elnr, double x, double y, double z) = 0; virtual void DblClick (int elnr, double x, double y, double z) = 0;
}; };
class DLL_HEADER UserVisualizationObject
{
public:
virtual void Draw () = 0;
};
} }
#endif #endif

View File

@ -580,6 +580,12 @@ namespace netgen
glCallList (clipplane_isolinelist); glCallList (clipplane_isolinelist);
} }
// user visualization
for (int i = 0; i < user_vis.Size(); i++)
user_vis[i] -> Draw();
glPopMatrix(); glPopMatrix();
glDisable(GL_CLIP_PLANE0); glDisable(GL_CLIP_PLANE0);

View File

@ -86,12 +86,13 @@ class VisualSceneSolution : public VisualScene
NgLock *lock; NgLock *lock;
#ifdef PARALLELGL #ifdef PARALLELGL
Array<int> par_linelists; Array<int> par_linelists;
Array<int> par_surfellists; Array<int> par_surfellists;
#endif #endif
Array<UserVisualizationObject*> user_vis;
public: public:
@ -210,6 +211,12 @@ public:
void GetMinMax (int funcnr, int comp, double & minv, double & maxv) const; void GetMinMax (int funcnr, int comp, double & minv, double & maxv) const;
void AddUserVisualizationObject (UserVisualizationObject * vis)
{
user_vis.Append (vis);
}
private: private:
void GetClippingPlaneTrigs (Array<ClipPlaneTrig> & trigs, Array<ClipPlanePoint> & pts); void GetClippingPlaneTrigs (Array<ClipPlaneTrig> & trigs, Array<ClipPlanePoint> & pts);
void GetClippingPlaneGrid (Array<ClipPlanePoint> & pts); void GetClippingPlaneGrid (Array<ClipPlanePoint> & pts);

View File

@ -408,8 +408,8 @@ set videoactive 0
puts "Thank you for using $progname"; puts "Thank you for using $progname";
if { [catch { unload libngsolve[info sharedlibextension] ngsolve } result ] } { if { [catch { unload libngsolve[info sharedlibextension] ngsolve } result ] } {
# puts "cannot unload ngsolve" # puts "cannot unload ngsolve"
# puts "error: $result" # puts "error: $result"
} }
Ng_Exit; Ng_Exit;

View File

@ -2764,6 +2764,10 @@ void Ng_SetMouseEventHandler (netgen::MouseEventHandler * handler)
vsmesh.SetMouseEventHandler (handler); vsmesh.SetMouseEventHandler (handler);
} }
void Ng_SetUserVisualizationObject (netgen::UserVisualizationObject * vis)
{
vssolution.AddUserVisualizationObject (vis);
}
void Ng_ClearSolutionData () void Ng_ClearSolutionData ()
{ {