* Made the OCC subsystem independent of STLParameters (stlparam)

* Added a new class OCCParameters to handle OCC specific parameters
This commit is contained in:
Philippose Rajan 2009-08-30 12:36:11 +00:00
parent eb742ce90a
commit 4fc9c40286
4 changed files with 1210 additions and 1112 deletions

View File

@ -4,8 +4,6 @@
#include <occgeom.hpp> #include <occgeom.hpp>
#include <meshing.hpp> #include <meshing.hpp>
#include <stlgeom.hpp>
namespace netgen namespace netgen
{ {
@ -15,23 +13,26 @@ namespace netgen
#define TCL_OK 0 #define TCL_OK 0
#define TCL_ERROR 1 #define TCL_ERROR 1
extern STLParameters stlparam;
#define DIVIDEEDGESECTIONS 1000 #define DIVIDEEDGESECTIONS 1000
#define IGNORECURVELENGTH 1e-4 #define IGNORECURVELENGTH 1e-4
extern OCCParameters occparam;
bool merge_solids = 1; bool merge_solids = 1;
inline Point<3> occ2ng (const gp_Pnt & p) inline Point<3> occ2ng (const gp_Pnt & p)
{ {
return Point<3> (p.X(), p.Y(), p.Z()); return Point<3> (p.X(), p.Y(), p.Z());
} }
void DivideEdge (TopoDS_Edge & edge,
Array<MeshPoint> & ps,
Array<double> & params,
Mesh & mesh) void DivideEdge (TopoDS_Edge & edge, Array<MeshPoint> & ps,
Array<double> & params, Mesh & mesh)
{ {
double s0, s1; double s0, s1;
double maxh = mparam.maxh; double maxh = mparam.maxh;
@ -1284,7 +1285,7 @@ namespace netgen
// setting close edges // setting close edges
if (stlparam.resthcloseedgeenable) if (occparam.resthcloseedgeenable)
{ {
multithread.task = "Setting local mesh size (close edges)"; multithread.task = "Setting local mesh size (close edges)";
@ -1366,7 +1367,7 @@ namespace netgen
mindist = min (mindist, line.Dist(lines[num])); mindist = min (mindist, line.Dist(lines[num]));
} }
mindist *= stlparam.resthcloseedgefac; mindist *= occparam.resthcloseedgefac;
if (mindist < 1e-3) if (mindist < 1e-3)
{ {

View File

@ -853,14 +853,17 @@ namespace netgen
facemeshstatus.DeleteAll();
facemeshstatus.SetSize (fmap.Extent()); facemeshstatus.SetSize (fmap.Extent());
facemeshstatus = 0; facemeshstatus = 0;
// Philippose - 15/01/2009 // Philippose - 15/01/2009
face_maxh.DeleteAll();
face_maxh.SetSize (fmap.Extent()); face_maxh.SetSize (fmap.Extent());
face_maxh = mparam.maxh; face_maxh = mparam.maxh;
// Philippose - 17/01/2009 // Philippose - 17/01/2009
face_sel_status.DeleteAll();
face_sel_status.SetSize (fmap.Extent()); face_sel_status.SetSize (fmap.Extent());
face_sel_status = 0; face_sel_status = 0;
@ -1614,6 +1617,30 @@ namespace netgen
return * new OCCRefinementSurfaces (*this); return * new OCCRefinementSurfaces (*this);
} }
OCCParameters :: OCCParameters()
{
resthcloseedgefac = 1;
resthcloseedgeenable = 1;
}
void OCCParameters :: Print(ostream & ost) const
{
ost << "OCC Parameters:" << endl
<< "close edges: " << resthcloseedgeenable
<< ", fac = " << resthcloseedgefac << endl;
}
OCCParameters occparam;
} }

View File

@ -119,6 +119,12 @@ namespace netgen
#define ENTITYISHIGHLIGHTED 2 #define ENTITYISHIGHLIGHTED 2
#define ENTITYISDRAWABLE 4 #define ENTITYISDRAWABLE 4
#define OCCGEOMETRYVISUALIZATIONNOCHANGE 0
#define OCCGEOMETRYVISUALIZATIONFULLCHANGE 1 // Compute transformation matrices and redraw
#define OCCGEOMETRYVISUALIZATIONHALFCHANGE 2 // Redraw
class EntityVisualizationCode class EntityVisualizationCode
{ {
int code; int code;
@ -156,6 +162,9 @@ namespace netgen
{ code &= ~ENTITYISDRAWABLE;} { code &= ~ENTITYISDRAWABLE;}
}; };
inline double Det3 (double a00, double a01, double a02, inline double Det3 (double a00, double a01, double a02,
double a10, double a11, double a12, double a10, double a11, double a12,
double a20, double a21, double a22) double a20, double a21, double a22)
@ -163,11 +172,8 @@ namespace netgen
return a00*a11*a22 + a01*a12*a20 + a10*a21*a02 - a20*a11*a02 - a10*a01*a22 - a21*a12*a00; return a00*a11*a22 + a01*a12*a20 + a10*a21*a02 - a20*a11*a02 - a10*a01*a22 - a21*a12*a00;
} }
#define OCCGEOMETRYVISUALIZATIONNOCHANGE 0
#define OCCGEOMETRYVISUALIZATIONFULLCHANGE 1
// == compute transformation matrices and redraw
#define OCCGEOMETRYVISUALIZATIONHALFCHANGE 2
// == redraw
class OCCGeometry : public NetgenGeometry class OCCGeometry : public NetgenGeometry
{ {
@ -343,12 +349,43 @@ namespace netgen
virtual const Refinement & GetRefinement () const; virtual const Refinement & GetRefinement () const;
}; };
class OCCParameters
{
public:
/// Factor for meshing close edges
double resthcloseedgefac;
/// Enable / Disable detection of close edges
int resthcloseedgeenable;
/*!
Default Constructor for the OpenCascade
Mesh generation parameter set
*/
OCCParameters();
/*!
Dump all the OpenCascade specific meshing parameters
to console
*/
void Print (ostream & ost) const;
};
void PrintContents (OCCGeometry * geom); void PrintContents (OCCGeometry * geom);
OCCGeometry * LoadOCC_IGES (const char * filename); OCCGeometry * LoadOCC_IGES (const char * filename);
OCCGeometry * LoadOCC_STEP (const char * filename); OCCGeometry * LoadOCC_STEP (const char * filename);
OCCGeometry * LoadOCC_BREP (const char * filename); OCCGeometry * LoadOCC_BREP (const char * filename);
extern OCCParameters occparam;
} }
#endif #endif

View File

@ -2051,6 +2051,24 @@ namespace netgen
} }
#ifdef OCCGEOMETRY
int Ng_SetOCCParameters (ClientData clientData,
Tcl_Interp * interp,
int argc, tcl_const char *argv[])
{
occparam.resthcloseedgefac =
atof (Tcl_GetVar (interp, "::stloptions.resthcloseedgefac", 0));
occparam.resthcloseedgeenable =
atoi (Tcl_GetVar (interp, "::stloptions.resthcloseedgeenable", 0));
return TCL_OK;
}
#endif // OCCGEOMETRY
int Ng_GetCommandLineParameter (ClientData clientData, int Ng_GetCommandLineParameter (ClientData clientData,
Tcl_Interp * interp, Tcl_Interp * interp,
int argc, tcl_const char *argv[]) int argc, tcl_const char *argv[])
@ -2200,6 +2218,11 @@ namespace netgen
multithread.terminate = 0; multithread.terminate = 0;
Ng_SetSTLParameters (clientData, interp, 0, argv); Ng_SetSTLParameters (clientData, interp, 0, argv);
#ifdef OCCGEOMETRY
Ng_SetOCCParameters (clientData, interp, 0, argv);
#endif // OCCGEOMETRY
Ng_SetMeshingParameters (clientData, interp, 0, argv); Ng_SetMeshingParameters (clientData, interp, 0, argv);
perfstepsstart = 1; perfstepsstart = 1;
@ -3003,6 +3026,11 @@ namespace netgen
{ {
Ng_SetSTLParameters (clientData, interp, argc, argv); Ng_SetSTLParameters (clientData, interp, argc, argv);
#ifdef OCCGEOMETRY
Ng_SetOCCParameters (clientData, interp, argc, argv);
#endif // OCCGEOMETRY
Ng_SetMeshingParameters (clientData, interp, argc, argv); Ng_SetMeshingParameters (clientData, interp, argc, argv);
if (mesh.Ptr() && stlgeometry) if (mesh.Ptr() && stlgeometry)
@ -5011,6 +5039,11 @@ namespace netgen
(ClientData)NULL, (ClientData)NULL,
(Tcl_CmdDeleteProc*) NULL); (Tcl_CmdDeleteProc*) NULL);
#ifdef OCCGEOMETRY
Tcl_CreateCommand (interp, "Ng_SetOCCParameters", Ng_SetOCCParameters,
(ClientData)NULL,
(Tcl_CmdDeleteProc*) NULL);
#endif //OCCGEOMETRY
Tcl_CreateCommand (interp, "Ng_SelectSurface", Ng_SelectSurface, Tcl_CreateCommand (interp, "Ng_SelectSurface", Ng_SelectSurface,