* 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

File diff suppressed because it is too large Load Diff

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,13 +172,10 @@ 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
{ {
Point<3> center; Point<3> center;
@ -337,18 +343,49 @@ namespace netgen
void WriteOCC_STL(char * filename); void WriteOCC_STL(char * filename);
virtual int GenerateMesh (Mesh*& mesh, virtual int GenerateMesh (Mesh*& mesh,
int perfstepsstart, int perfstepsend, char* optstring); int perfstepsstart, int perfstepsend, char* optstring);
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,