From 0b2645104924f592ba5cd3503e41a2ea9f694d25 Mon Sep 17 00:00:00 2001 From: Philippose Rajan Date: Fri, 28 Aug 2009 10:52:03 +0000 Subject: [PATCH] * Initial Nglib OCC support trials * Added a new compile target for Nglib (Release(OCC)) * Netgen and Nglib solution files updated to remove non-existent files and add new source files into project --- nglib/nglib.cpp | 74 +++++++++++ nglib/nglib.h | 29 +++++ windows/netgen.vcproj | 44 +++---- windows/nglib.sln | 6 + windows/nglib.vcproj | 286 ++++++++++++++++++++++++++++++++++++++---- 5 files changed, 390 insertions(+), 49 deletions(-) diff --git a/nglib/nglib.cpp b/nglib/nglib.cpp index a0b1843f..74edfe2d 100644 --- a/nglib/nglib.cpp +++ b/nglib/nglib.cpp @@ -20,6 +20,9 @@ #include #include +#ifdef OCCGEOMETRY +#include +#endif namespace netgen { @@ -579,6 +582,77 @@ DLL_HEADER void Ng_STL_AddEdge (Ng_STL_Geometry * geom, + + + +#ifdef OCCGEOMETRY +// --------------------- OCC Geometry / Meshing Utility Functions ------------------- + +// Create new OCC Geometry Object +DLL_HEADER Ng_OCC_Geometry * Ng_OCC_NewGeometry () +{ + return (Ng_OCC_Geometry*)(void*)new OCCGeometry; +} + + +// Loads geometry from STEP File +DLL_HEADER Ng_OCC_Geometry * Ng_OCC_Load_STEP (const char * filename) +{ + Ng_OCC_Geometry * geo = Ng_OCC_NewGeometry(); + + geo = (Ng_OCC_Geometry *)LoadOCC_STEP(filename); + + return (geo); +} + + +// Loads geometry from IGES File +DLL_HEADER Ng_OCC_Geometry * Ng_OCC_Load_IGES (const char * filename) +{ + Ng_OCC_Geometry * geo = Ng_OCC_NewGeometry(); + + geo = (Ng_OCC_Geometry *)LoadOCC_IGES(filename); + + return (geo); +} + + +// Loads geometry from BREP File +DLL_HEADER Ng_OCC_Geometry * Ng_OCC_Load_BREP (const char * filename) +{ + Ng_OCC_Geometry * geo = Ng_OCC_NewGeometry(); + + geo = (Ng_OCC_Geometry *)LoadOCC_BREP(filename); + + return (geo); +} + + +// Extract a +DLL_HEADER Ng_Result Ng_OCC_GetFMap(Ng_OCC_Geometry * geom, + TopTools_IndexedMapOfShape & FMap) +{ + OCCGeometry* occgeom = (OCCGeometry*)geom; + FMap = occgeom->fmap; + + if(FMap.Extent()) + { + return NG_OK; + } + else + { + return -1; + } +} + +// ------------------ End - OCC Geometry / Meshing Utility Functions ---------------- +#endif + + + + + + DLL_HEADER Ng_Meshing_Parameters :: Ng_Meshing_Parameters() { maxh = 1000; diff --git a/nglib/nglib.h b/nglib/nglib.h index fb3558b8..8f9440cd 100644 --- a/nglib/nglib.h +++ b/nglib/nglib.h @@ -57,6 +57,10 @@ typedef void * Ng_Geometry_2D; /// Data type for NETGEN STL geometry typedef void * Ng_STL_Geometry; +#ifdef OCCGEOMETRY +/// Data type for NETGEN OpenCascade geometry +typedef void * Ng_OCC_Geometry; +#endif // *** Special Enum types used within Netgen *********** @@ -544,4 +548,29 @@ DLL_HEADER Ng_Result Ng_ACIS_GenerateSurfaceMesh (Ng_ACIS_Geometry * geom, #endif + +#ifdef OCCGEOMETRY + +// ********************************************************** +// ** OpenCascade Geometry / Meshing Utilities ** +// ********************************************************** + +// Create new OCC Geometry Object +DLL_HEADER Ng_OCC_Geometry * Ng_OCC_NewGeometry (); + +// Loads geometry from STEP file +DLL_HEADER Ng_OCC_Geometry * Ng_OCC_Load_STEP (const char * filename); + +// Loads geometry from IGES file +DLL_HEADER Ng_OCC_Geometry * Ng_OCC_Load_IGES (const char * filename); + +// Loads geometry from BREP file +DLL_HEADER Ng_OCC_Geometry * Ng_OCC_Load_BREP (const char * filename); + +// Get the face map of an already loaded OCC geometry +DLL_HEADER Ng_Result Ng_OCC_GetFMap(Ng_OCC_Geometry * geom, + TopTools_IndexedMapOfShape & FMap); + +#endif + #endif diff --git a/windows/netgen.vcproj b/windows/netgen.vcproj index 76266607..816e9323 100644 --- a/windows/netgen.vcproj +++ b/windows/netgen.vcproj @@ -767,6 +767,10 @@ RelativePath="..\libsrc\general\autoptr.hpp" > + + @@ -796,11 +800,11 @@ > - - @@ -1104,11 +1104,11 @@ > - - diff --git a/windows/nglib.sln b/windows/nglib.sln index 0a30529e..ae7d226a 100644 --- a/windows/nglib.sln +++ b/windows/nglib.sln @@ -7,6 +7,8 @@ Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 + Release(OCC)|Win32 = Release(OCC)|Win32 + Release(OCC)|x64 = Release(OCC)|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection @@ -15,6 +17,10 @@ Global {2E260C8C-595C-442A-A962-51AC06EF8143}.Debug|Win32.Build.0 = Debug|Win32 {2E260C8C-595C-442A-A962-51AC06EF8143}.Debug|x64.ActiveCfg = Debug|x64 {2E260C8C-595C-442A-A962-51AC06EF8143}.Debug|x64.Build.0 = Debug|x64 + {2E260C8C-595C-442A-A962-51AC06EF8143}.Release(OCC)|Win32.ActiveCfg = Release(OCC)|Win32 + {2E260C8C-595C-442A-A962-51AC06EF8143}.Release(OCC)|Win32.Build.0 = Release(OCC)|Win32 + {2E260C8C-595C-442A-A962-51AC06EF8143}.Release(OCC)|x64.ActiveCfg = Release(OCC)|x64 + {2E260C8C-595C-442A-A962-51AC06EF8143}.Release(OCC)|x64.Build.0 = Release(OCC)|x64 {2E260C8C-595C-442A-A962-51AC06EF8143}.Release|Win32.ActiveCfg = Release|Win32 {2E260C8C-595C-442A-A962-51AC06EF8143}.Release|Win32.Build.0 = Release|Win32 {2E260C8C-595C-442A-A962-51AC06EF8143}.Release|x64.ActiveCfg = Release|x64 diff --git a/windows/nglib.vcproj b/windows/nglib.vcproj index f62bc203..498b4f35 100644 --- a/windows/nglib.vcproj +++ b/windows/nglib.vcproj @@ -98,6 +98,86 @@ CommandLine=""$(ProjectDir)\postBuild_nglib.bat" "$(ProjectName)" "$(TargetFileName)" "$(ConfigurationName)" "$(PlatformName)" "$(ProjectDir)"" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - @@ -591,6 +755,18 @@ RelativePath="..\nglib\nglib.cpp" > + + + + + + @@ -889,6 +1065,10 @@ RelativePath="..\libsrc\general\autoptr.hpp" > + + @@ -914,11 +1094,11 @@ > - - @@ -1189,6 +1365,10 @@ RelativePath="..\libsrc\include\occgeom.hpp" > + + @@ -1354,6 +1534,62 @@ > + + + + + + + + + + + + + + + + + + + + + + + + + + + +