Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
0c50beef
Commit
0c50beef
authored
16 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
test importOCCShape
parent
4280c455
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Common/Gmsh.h
+1
-1
1 addition, 1 deletion
Common/Gmsh.h
Geo/GModelIO_OCC.cpp
+12
-7
12 additions, 7 deletions
Geo/GModelIO_OCC.cpp
utils/misc/driver.cpp
+1
-0
1 addition, 0 deletions
utils/misc/driver.cpp
utils/misc/driverOCC.cpp
+39
-0
39 additions, 0 deletions
utils/misc/driverOCC.cpp
with
53 additions
and
8 deletions
Common/Gmsh.h
+
1
−
1
View file @
0c50beef
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
//
//
// Please report all bugs and problems to <gmsh@geuz.org>.
// Please report all bugs and problems to <gmsh@geuz.org>.
int
GmshInitialize
(
int
argc
,
char
**
argv
);
int
GmshInitialize
(
int
argc
=
0
,
char
**
argv
=
0
);
int
GmshFinalize
();
int
GmshFinalize
();
int
GmshBatch
();
int
GmshBatch
();
...
...
This diff is collapsed.
Click to expand it.
Geo/GModelIO_OCC.cpp
+
12
−
7
View file @
0c50beef
// $Id: GModelIO_OCC.cpp,v 1.3
3
2008-0
5-25 07:10:5
7 geuzaine Exp $
// $Id: GModelIO_OCC.cpp,v 1.3
4
2008-0
6-03 07:25:0
7 geuzaine Exp $
//
//
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -279,7 +279,7 @@ void OCC_Internals::healGeometry(double tolerance, bool fixsmalledges,
...
@@ -279,7 +279,7 @@ void OCC_Internals::healGeometry(double tolerance, bool fixsmalledges,
if
(
fixspotstripfaces
){
if
(
fixspotstripfaces
){
Msg
::
Info
(
"- fixing spot and strip faces"
);
Msg
::
Info
(
"- fixing spot and strip faces"
);
Handle
(
ShapeFix_FixSmallFace
)
sffsm
=
new
ShapeFix_FixSmallFace
()
;
Handle
(
ShapeFix_FixSmallFace
)
sffsm
=
new
ShapeFix_FixSmallFace
;
sffsm
->
Init
(
shape
);
sffsm
->
Init
(
shape
);
sffsm
->
SetPrecision
(
tolerance
);
sffsm
->
SetPrecision
(
tolerance
);
sffsm
->
Perform
();
sffsm
->
Perform
();
...
@@ -399,11 +399,12 @@ void OCC_Internals::loadShape(const TopoDS_Shape *s)
...
@@ -399,11 +399,12 @@ void OCC_Internals::loadShape(const TopoDS_Shape *s)
{
{
shape
=
*
s
;
shape
=
*
s
;
BRepTools
::
Clean
(
shape
);
BRepTools
::
Clean
(
shape
);
healGeometry
(
CTX
.
geom
.
tolerance
,
// FIXME should we apply the healing stuff when we import a shape?
CTX
.
geom
.
occ_fix_small_edges
,
// healGeometry(CTX.geom.tolerance,
CTX
.
geom
.
occ_fix_small_faces
,
// CTX.geom.occ_fix_small_edges,
CTX
.
geom
.
occ_sew_faces
);
// CTX.geom.occ_fix_small_faces,
BRepTools
::
Clean
(
shape
);
// CTX.geom.occ_sew_faces);
// BRepTools::Clean(shape);
buildLists
();
buildLists
();
}
}
...
@@ -478,6 +479,10 @@ int GModel::importOCCShape(const void *shape, const void *options)
...
@@ -478,6 +479,10 @@ int GModel::importOCCShape(const void *shape, const void *options)
_occ_internals
=
new
OCC_Internals
;
_occ_internals
=
new
OCC_Internals
;
_occ_internals
->
loadShape
((
TopoDS_Shape
*
)
shape
);
_occ_internals
->
loadShape
((
TopoDS_Shape
*
)
shape
);
_occ_internals
->
buildGModel
(
this
);
_occ_internals
->
buildGModel
(
this
);
snapVertices
();
// FIXME remove this when CL API is done
extern
void
SetBoundingBox
();
SetBoundingBox
();
return
1
;
return
1
;
}
}
...
...
This diff is collapsed.
Click to expand it.
utils/misc/driver.cpp
+
1
−
0
View file @
0c50beef
...
@@ -25,5 +25,6 @@ int main(int argc, char **argv)
...
@@ -25,5 +25,6 @@ int main(int argc, char **argv)
}
}
m
->
writeMSH
(
"test.msh"
);
m
->
writeMSH
(
"test.msh"
);
m
->
writeUNV
(
"test.unv"
);
m
->
writeUNV
(
"test.unv"
);
delete
m
;
GmshFinalize
();
GmshFinalize
();
}
}
This diff is collapsed.
Click to expand it.
utils/misc/driverOCC.cpp
0 → 100644
+
39
−
0
View file @
0c50beef
// g++ -I/usr/local/opencascade/inc driverOCC.cpp -lGmsh -L/usr/local/opencascade/lib -lTKSTEP -lTKSTEP209 -lTKSTEPAttr -lTKSTEPBase -lTKIGES -lTKXSBase -lTKOffset -lTKFeat -lTKFillet -lTKBool -lTKShHealing -lTKMesh -lTKHLR -lTKBO -lTKPrim -lTKTopAlgo -lTKGeomAlgo -lTKBRep -lTKGeomBase -lTKG3d -lTKG2d -lTKAdvTools -lTKMath -lTKernel -lm
#if !defined(WIN32) || defined(__CYGWIN__)
#include
"config.h"
#endif
#include
"TopoDS_Shape.hxx"
#include
"BRep_Tool.hxx"
#include
"BRep_Builder.hxx"
#include
"BRepTools.hxx"
#include
<stdio.h>
#include
<gmsh/Gmsh.h>
#include
<gmsh/GModel.h>
#include
<gmsh/MElement.h>
int
main
(
int
argc
,
char
**
argv
)
{
// create an OCC shape (by loading it from a brep file)
TopoDS_Shape
shape
;
BRep_Builder
builder
;
BRepTools
::
Read
(
shape
,
argv
[
1
],
builder
);
BRepTools
::
Clean
(
shape
);
// import the shape in gmsh and mesh it
GmshInitialize
(
argc
,
argv
);
GModel
*
m
=
new
GModel
();
m
->
importOCCShape
((
void
*
)
&
shape
,
0
);
m
->
mesh
(
2
);
for
(
GModel
::
riter
it
=
m
->
firstRegion
();
it
!=
m
->
lastRegion
();
++
it
){
GRegion
*
r
=
*
it
;
printf
(
"volume %d contains %d elements:
\n
"
,
r
->
tag
(),
r
->
getNumMeshElements
());
for
(
unsigned
int
i
=
0
;
i
<
r
->
getNumMeshElements
();
i
++
)
printf
(
" %d"
,
r
->
getMeshElement
(
i
)
->
getNum
());
printf
(
"
\n
"
);
}
m
->
writeMSH
(
"test.msh"
);
delete
m
;
GmshFinalize
();
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment