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
Package registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Romin Tomasetti
gmsh
Commits
52240528
Commit
52240528
authored
7 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
remove obsolete examples
parent
6dc75aad
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
utils/api_demos/mainGeoFactory.cpp
+0
-31
0 additions, 31 deletions
utils/api_demos/mainGeoFactory.cpp
utils/api_demos/mainOcc.cpp
+0
-94
0 additions, 94 deletions
utils/api_demos/mainOcc.cpp
with
0 additions
and
125 deletions
utils/api_demos/mainGeoFactory.cpp
deleted
100644 → 0
+
0
−
31
View file @
6dc75aad
#include
<stdio.h>
#include
"Gmsh.h"
#include
"GModel.h"
int
main
(
int
argc
,
char
**
argv
)
{
GmshInitialize
(
argc
,
argv
);
GModel
*
m
=
new
GModel
();
m
->
setFactory
(
"Gmsh"
);
GVertex
*
v1
=
m
->
addVertex
(
0
,
0
,
0
,
0.1
);
GVertex
*
v2
=
m
->
addVertex
(
1
,
0
,
0
,
0.1
);
GVertex
*
v3
=
m
->
addVertex
(
1
,
1
,
0
,
0.1
);
GVertex
*
v4
=
m
->
addVertex
(
0
,
1
,
0
,
0.1
);
std
::
vector
<
GEdge
*>
edges
;
edges
.
push_back
(
m
->
addLine
(
v1
,
v2
));
edges
.
push_back
(
m
->
addLine
(
v2
,
v3
));
edges
.
push_back
(
m
->
addLine
(
v3
,
v4
));
edges
.
push_back
(
m
->
addLine
(
v4
,
v1
));
std
::
vector
<
std
::
vector
<
GEdge
*>
>
loop
;
loop
.
push_back
(
edges
);
GFace
*
f
=
m
->
addPlanarFace
(
loop
);
m
->
mesh
(
2
);
m
->
writeMSH
(
"test.msh"
);
delete
m
;
GmshFinalize
();
}
This diff is collapsed.
Click to expand it.
utils/api_demos/mainOcc.cpp
deleted
100644 → 0
+
0
−
94
View file @
6dc75aad
// This demonstrates how to import an OpenCASCADE model WITHOUT using
// Gmsh's own I/O layer (useful if you create OCC objects in your own
// code, that you want to import dynamically in Gmsh).
//
// If you just want to load OpenCASCADE files (.brep, .step, etc.) you
// SHOULD NOT use this interface: simply use the standard I/O API.
// 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
#include
<stdio.h>
#include
"Gmsh.h"
#include
"GmshConfig.h"
#include
"GModel.h"
#include
"MElement.h"
#if !defined(HAVE_NO_OCC_CONFIG_H)
#include
"config.h"
#endif
#include
<TopoDS_Shape.hxx>
#include
<BRep_Tool.hxx>
#include
<BRep_Builder.hxx>
#include
<BRepTools.hxx>
class
mymsg
:
public
GmshMessage
{
private:
GModel
*
_model
;
public:
mymsg
(
GModel
*
model
)
:
_model
(
model
),
GmshMessage
()
{}
void
operator
()(
std
::
string
level
,
std
::
string
msg
)
{
printf
(
"level=%s msg=%s
\n
"
,
level
.
c_str
(),
msg
.
c_str
());
if
(
level
==
"Fatal"
||
level
==
"Error"
){
GEntity
*
e
=
_model
->
getCurrentMeshEntity
();
if
(
e
){
printf
(
"error occurred while meshing entity:
\n
"
);
printf
(
" tag=%d
\n
"
,
e
->
tag
());
printf
(
" dimension=%d
\n
"
,
e
->
dim
());
printf
(
" native pointer=%p
\n
"
,
e
->
getNativePtr
());
}
}
if
(
level
==
"Fatal"
)
throw
"Fatal error in Gmsh"
;
}
};
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
);
// initialize gmsh
GmshInitialize
(
argc
,
argv
);
// create a model and set error handler
GModel
m
;
mymsg
c
(
&
m
);
GmshSetMessageHandler
(
&
c
);
// import the shape, and mesh it
m
.
importOCCShape
((
void
*
)
&
shape
);
try
{
m
.
mesh
(
2
);
}
catch
(...){
printf
(
"Unrecoverable error in gmsh--aborting mesh!
\n
"
);
}
for
(
GModel
::
fiter
it
=
m
.
firstFace
();
it
!=
m
.
lastFace
();
++
it
){
GFace
*
f
=
*
it
;
printf
(
"Surface %d contains %d elements:
\n
"
,
f
->
tag
(),
f
->
getNumMeshElements
());
for
(
unsigned
int
i
=
0
;
i
<
f
->
getNumMeshElements
();
i
++
){
MElement
*
e
=
f
->
getMeshElement
(
i
);
printf
(
" element %d:"
,
e
->
getNum
());
for
(
unsigned
int
j
=
0
;
j
<
e
->
getNumVertices
();
j
++
){
MVertex
*
v
=
e
->
getVertex
(
j
);
printf
(
" %d (%g,%g,%g)"
,
v
->
getNum
(),
v
->
x
(),
v
->
y
(),
v
->
z
());
}
printf
(
"
\n
"
);
}
printf
(
"
\n
"
);
}
m
.
writeMSH
(
"test.msh"
);
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