2011-01-11 01:18:01 +05:00
|
|
|
#include <mystdlib.h>
|
|
|
|
#include <myadt.hpp>
|
|
|
|
#include <linalg.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
#include <incvis.hpp>
|
2011-02-19 03:50:58 +05:00
|
|
|
#include <meshing.hpp>
|
|
|
|
#include <geometry2d.hpp>
|
2011-01-11 01:18:01 +05:00
|
|
|
|
2011-02-19 03:50:58 +05:00
|
|
|
#include <visual.hpp>
|
2011-01-11 01:18:01 +05:00
|
|
|
#include "vsgeom2d.hpp"
|
|
|
|
|
|
|
|
|
2011-02-28 17:59:27 +05:00
|
|
|
// extern "C" int Ng_CSG_Init (Tcl_Interp * interp);
|
2011-01-11 01:18:01 +05:00
|
|
|
|
|
|
|
namespace netgen
|
|
|
|
{
|
|
|
|
extern NetgenGeometry * ng_geometry;
|
|
|
|
static VisualSceneGeometry2d vsgeom2d;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SplineGeometryRegister : public GeometryRegister
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual NetgenGeometry * Load (string filename) const;
|
|
|
|
virtual VisualScene * GetVisualScene (const NetgenGeometry * geom) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
NetgenGeometry * SplineGeometryRegister :: Load (string filename) const
|
|
|
|
{
|
|
|
|
const char * cfilename = filename.c_str();
|
|
|
|
if (strcmp (&cfilename[strlen(cfilename)-4], "in2d") == 0)
|
|
|
|
{
|
|
|
|
PrintMessage (1, "Load 2D-Spline geometry file ", cfilename);
|
|
|
|
|
|
|
|
|
|
|
|
ifstream infile(cfilename);
|
|
|
|
|
|
|
|
SplineGeometry2d * hgeom = new SplineGeometry2d();
|
|
|
|
hgeom -> Load (cfilename);
|
|
|
|
return hgeom;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VisualScene * SplineGeometryRegister :: GetVisualScene (const NetgenGeometry * geom) const
|
|
|
|
{
|
|
|
|
SplineGeometry2d * geometry = dynamic_cast<SplineGeometry2d*> (ng_geometry);
|
|
|
|
if (geometry)
|
|
|
|
{
|
|
|
|
vsgeom2d.SetGeometry (geometry);
|
|
|
|
return &vsgeom2d;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-28 17:59:27 +05:00
|
|
|
using namespace netgen;
|
|
|
|
extern "C" int Ng_geom2d_Init (Tcl_Interp * interp);
|
2011-01-11 01:18:01 +05:00
|
|
|
|
2011-02-28 17:59:27 +05:00
|
|
|
int Ng_geom2d_Init (Tcl_Interp * interp)
|
2011-01-11 01:18:01 +05:00
|
|
|
{
|
|
|
|
geometryregister.Append (new SplineGeometryRegister);
|
|
|
|
}
|