mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
archive
This commit is contained in:
parent
725a714bf3
commit
3a82cf2258
@ -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
|
||||
|
||||
# moveablemem.hpp
|
||||
|
||||
include_HEADERS = ngexception.hpp
|
||||
include_HEADERS = ngexception.hpp archive_base.hpp
|
||||
|
||||
AM_CPPFLAGS = $(MPI_INCLUDES) -I$(top_srcdir)/libsrc/include
|
||||
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 \
|
||||
mpi_interface.cpp gzstream.cpp
|
||||
|
||||
# moveablemem.cpp
|
||||
|
34
libsrc/general/archive_base.hpp
Normal file
34
libsrc/general/archive_base.hpp
Normal 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
|
@ -289,6 +289,7 @@ extern "C" {
|
||||
// #include "../visualization/soldata.hpp"
|
||||
class SolutionData;
|
||||
class MouseEventHandler;
|
||||
class UserVisualizationObject;
|
||||
}
|
||||
|
||||
enum Ng_SolutionType
|
||||
@ -326,6 +327,8 @@ extern "C" {
|
||||
DLL_HEADER void Ng_Redraw();
|
||||
///
|
||||
DLL_HEADER void Ng_SetMouseEventHandler (netgen::MouseEventHandler * handler);
|
||||
///
|
||||
DLL_HEADER void Ng_SetUserVisualizationObject (netgen::UserVisualizationObject * vis);
|
||||
//
|
||||
DLL_HEADER void Ng_SetVisualizationParameter (const char * name,
|
||||
const char * value);
|
||||
|
@ -12,6 +12,7 @@
|
||||
C++ interface to Netgen
|
||||
*/
|
||||
|
||||
#include "../general/archive_base.hpp"
|
||||
|
||||
namespace netgen
|
||||
{
|
||||
@ -166,6 +167,10 @@ namespace netgen
|
||||
Ngx_Mesh(class Mesh * amesh = NULL);
|
||||
void LoadMesh (const string & filename);
|
||||
|
||||
void LoadMesh (istream & str);
|
||||
void SaveMesh (ostream & str) const;
|
||||
void DoArchive (ngstd::Archive & archive);
|
||||
|
||||
virtual ~Ngx_Mesh();
|
||||
|
||||
bool Valid () { return mesh != NULL; }
|
||||
|
@ -43,6 +43,39 @@ namespace netgen
|
||||
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)
|
||||
: mesh(amesh)
|
||||
|
@ -116,6 +116,14 @@ namespace netgen
|
||||
virtual void DblClick (int elnr, double x, double y, double z) = 0;
|
||||
};
|
||||
|
||||
|
||||
class DLL_HEADER UserVisualizationObject
|
||||
{
|
||||
public:
|
||||
virtual void Draw () = 0;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -580,6 +580,12 @@ namespace netgen
|
||||
glCallList (clipplane_isolinelist);
|
||||
}
|
||||
|
||||
|
||||
// user visualization
|
||||
|
||||
for (int i = 0; i < user_vis.Size(); i++)
|
||||
user_vis[i] -> Draw();
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glDisable(GL_CLIP_PLANE0);
|
||||
|
@ -86,12 +86,13 @@ class VisualSceneSolution : public VisualScene
|
||||
|
||||
NgLock *lock;
|
||||
|
||||
|
||||
|
||||
#ifdef PARALLELGL
|
||||
Array<int> par_linelists;
|
||||
Array<int> par_surfellists;
|
||||
#endif
|
||||
|
||||
Array<UserVisualizationObject*> user_vis;
|
||||
|
||||
public:
|
||||
|
||||
@ -210,6 +211,12 @@ public:
|
||||
|
||||
void GetMinMax (int funcnr, int comp, double & minv, double & maxv) const;
|
||||
|
||||
void AddUserVisualizationObject (UserVisualizationObject * vis)
|
||||
{
|
||||
user_vis.Append (vis);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
void GetClippingPlaneTrigs (Array<ClipPlaneTrig> & trigs, Array<ClipPlanePoint> & pts);
|
||||
void GetClippingPlaneGrid (Array<ClipPlanePoint> & pts);
|
||||
|
@ -408,8 +408,8 @@ set videoactive 0
|
||||
puts "Thank you for using $progname";
|
||||
|
||||
if { [catch { unload libngsolve[info sharedlibextension] ngsolve } result ] } {
|
||||
# puts "cannot unload ngsolve"
|
||||
# puts "error: $result"
|
||||
# puts "cannot unload ngsolve"
|
||||
# puts "error: $result"
|
||||
}
|
||||
|
||||
Ng_Exit;
|
||||
|
@ -2764,6 +2764,10 @@ void Ng_SetMouseEventHandler (netgen::MouseEventHandler * handler)
|
||||
vsmesh.SetMouseEventHandler (handler);
|
||||
}
|
||||
|
||||
void Ng_SetUserVisualizationObject (netgen::UserVisualizationObject * vis)
|
||||
{
|
||||
vssolution.AddUserVisualizationObject (vis);
|
||||
}
|
||||
|
||||
void Ng_ClearSolutionData ()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user