shared pointer

This commit is contained in:
Joachim Schoeberl 2014-09-09 15:58:35 +00:00
parent 7892d0eeec
commit 9805ec973a
2 changed files with 23 additions and 23 deletions

View File

@ -18,8 +18,8 @@ extern "C" int Ng_CSG_Init (Tcl_Interp * interp);
namespace netgen namespace netgen
{ {
// extern DLL_HEADER NetgenGeometry * ng_geometry; // extern DLL_HEADER NetgenGeometry * ng_geometry;
extern DLL_HEADER AutoPtr<NetgenGeometry> ng_geometry; extern DLL_HEADER shared_ptr<NetgenGeometry> ng_geometry;
extern DLL_HEADER AutoPtr<Mesh> mesh; extern DLL_HEADER shared_ptr<Mesh> mesh;
static VisualSceneGeometry vsgeom; static VisualSceneGeometry vsgeom;
@ -34,7 +34,7 @@ namespace netgen
Tcl_Interp * interp, Tcl_Interp * interp,
int argc, tcl_const char *argv[]) int argc, tcl_const char *argv[])
{ {
CSGeometry * csgeom = dynamic_cast<CSGeometry*> (ng_geometry.Ptr()); CSGeometry * csgeom = dynamic_cast<CSGeometry*> (ng_geometry.get());
if (csgeom) if (csgeom)
{ {
double detail = atof (Tcl_GetVar (interp, "::geooptions.detail", 0)); double detail = atof (Tcl_GetVar (interp, "::geooptions.detail", 0));
@ -53,7 +53,7 @@ namespace netgen
Tcl_Interp * interp, Tcl_Interp * interp,
int argc, tcl_const char *argv[]) int argc, tcl_const char *argv[])
{ {
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr()); CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.get());
const char * command = argv[1]; const char * command = argv[1];
@ -108,7 +108,7 @@ namespace netgen
Tcl_Interp * interp, Tcl_Interp * interp,
int argc, tcl_const char *argv[]) int argc, tcl_const char *argv[])
{ {
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr()); CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.get());
if (!geometry) if (!geometry)
{ {
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC); Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
@ -143,7 +143,7 @@ namespace netgen
Tcl_Interp * interp, Tcl_Interp * interp,
int argc, tcl_const char *argv[]) int argc, tcl_const char *argv[])
{ {
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr()); CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.get());
if (!geometry) if (!geometry)
{ {
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC); Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
@ -181,7 +181,7 @@ namespace netgen
Tcl_Interp * interp, Tcl_Interp * interp,
int argc, tcl_const char *argv[]) int argc, tcl_const char *argv[])
{ {
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr()); CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.get());
if (!geometry) if (!geometry)
{ {
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC); Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
@ -208,7 +208,7 @@ namespace netgen
Tcl_Interp * interp, Tcl_Interp * interp,
int argc, tcl_const char *argv[]) int argc, tcl_const char *argv[])
{ {
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr()); CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.get());
if (!geometry) if (!geometry)
{ {
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC); Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
@ -246,7 +246,7 @@ namespace netgen
Tcl_Interp * interp, Tcl_Interp * interp,
int argc, tcl_const char *argv[]) int argc, tcl_const char *argv[])
{ {
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr()); CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.get());
if (!geometry) if (!geometry)
{ {
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC); Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
@ -273,7 +273,7 @@ namespace netgen
Tcl_Interp * interp, Tcl_Interp * interp,
int argc, tcl_const char *argv[]) int argc, tcl_const char *argv[])
{ {
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr()); CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.get());
if (!geometry) if (!geometry)
{ {
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC); Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
@ -306,7 +306,7 @@ namespace netgen
Tcl_Interp * interp, Tcl_Interp * interp,
int argc, tcl_const char *argv[]) int argc, tcl_const char *argv[])
{ {
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr()); CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.get());
if (!geometry) if (!geometry)
{ {
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC); Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
@ -337,7 +337,7 @@ namespace netgen
Tcl_Interp * interp, Tcl_Interp * interp,
int argc, tcl_const char *argv[]) int argc, tcl_const char *argv[])
{ {
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr()); CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.get());
if (!geometry) if (!geometry)
{ {
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC); Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
@ -368,7 +368,7 @@ namespace netgen
Tcl_Interp * interp, Tcl_Interp * interp,
int argc, tcl_const char *argv[]) int argc, tcl_const char *argv[])
{ {
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr()); CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.get());
if (!geometry) if (!geometry)
{ {
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC); Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
@ -493,14 +493,14 @@ namespace netgen
Tcl_Interp * interp, Tcl_Interp * interp,
int argc, tcl_const char *argv[]) int argc, tcl_const char *argv[])
{ {
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr()); CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.get());
if (!geometry) if (!geometry)
{ {
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC); Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
return TCL_ERROR; return TCL_ERROR;
} }
if (!mesh.Ptr()) if (!mesh)
{ {
Tcl_SetResult (interp, err_needsmesh, TCL_STATIC); Tcl_SetResult (interp, err_needsmesh, TCL_STATIC);
return TCL_ERROR; return TCL_ERROR;
@ -522,7 +522,7 @@ namespace netgen
Tcl_Interp * interp, Tcl_Interp * interp,
int argc, tcl_const char *argv[]) int argc, tcl_const char *argv[])
{ {
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr()); CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.get());
if (!geometry) if (!geometry)
{ {
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC); Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
@ -611,7 +611,7 @@ namespace netgen
VisualScene * CSGeometryRegister :: GetVisualScene (const NetgenGeometry * geom) const VisualScene * CSGeometryRegister :: GetVisualScene (const NetgenGeometry * geom) const
{ {
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr()); CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.get());
if (geometry) if (geometry)
{ {
vsgeom.SetGeometry (geometry); vsgeom.SetGeometry (geometry);

View File

@ -19,8 +19,8 @@ extern "C" int Ng_STL_Init (Tcl_Interp * interp);
namespace netgen namespace netgen
{ {
extern AutoPtr<NetgenGeometry> ng_geometry; extern shared_ptr<NetgenGeometry> ng_geometry;
extern AutoPtr<Mesh> mesh; extern shared_ptr<Mesh> mesh;
static VisualSceneSTLGeometry vsstlgeom; static VisualSceneSTLGeometry vsstlgeom;
static VisualSceneSTLMeshing vsstlmeshing; static VisualSceneSTLMeshing vsstlmeshing;
@ -122,7 +122,7 @@ namespace netgen
{ {
//cout << "STL doctor" << endl; //cout << "STL doctor" << endl;
STLGeometry * stlgeometry = STLGeometry * stlgeometry =
dynamic_cast<STLGeometry*> (ng_geometry.Ptr()); dynamic_cast<STLGeometry*> (ng_geometry.get());
stldoctor.drawmeshededges = stldoctor.drawmeshededges =
@ -418,7 +418,7 @@ namespace netgen
double data[10]; double data[10];
static char buf[20]; static char buf[20];
STLGeometry * stlgeometry = dynamic_cast<STLGeometry*> (ng_geometry.Ptr()); STLGeometry * stlgeometry = dynamic_cast<STLGeometry*> (ng_geometry.get());
if (!stlgeometry) if (!stlgeometry)
{ {
@ -520,8 +520,8 @@ namespace netgen
Ng_SetMeshingParameters (clientData, interp, argc, argv); Ng_SetMeshingParameters (clientData, interp, argc, argv);
STLGeometry * stlgeometry = dynamic_cast<STLGeometry*> (ng_geometry.Ptr()); STLGeometry * stlgeometry = dynamic_cast<STLGeometry*> (ng_geometry.get());
if (mesh.Ptr() && stlgeometry) if (mesh && stlgeometry)
{ {
mesh -> SetLocalH (stlgeometry->GetBoundingBox().PMin() - Vec3d(10, 10, 10), mesh -> SetLocalH (stlgeometry->GetBoundingBox().PMin() - Vec3d(10, 10, 10),
stlgeometry->GetBoundingBox().PMax() + Vec3d(10, 10, 10), stlgeometry->GetBoundingBox().PMax() + Vec3d(10, 10, 10),