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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
c4f25e5d
Commit
c4f25e5d
authored
15 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
refactor occMeshConstraints + add missing writeOCC functions
parent
9d2f8599
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
Common/CreateFile.cpp
+3
-3
3 additions, 3 deletions
Common/CreateFile.cpp
Geo/GModel.h
+2
-2
2 additions, 2 deletions
Geo/GModel.h
Geo/GModelIO_Mesh.cpp
+0
-2
0 additions, 2 deletions
Geo/GModelIO_Mesh.cpp
Geo/GModelIO_OCC.cpp
+76
-43
76 additions, 43 deletions
Geo/GModelIO_OCC.cpp
with
81 additions
and
50 deletions
Common/CreateFile.cpp
+
3
−
3
View file @
c4f25e5d
This diff is collapsed.
Click to expand it.
Geo/GModel.h
+
2
−
2
View file @
c4f25e5d
...
@@ -325,10 +325,10 @@ class GModel
...
@@ -325,10 +325,10 @@ class GModel
// OCC model
// OCC model
int
readOCCBREP
(
const
std
::
string
&
name
);
int
readOCCBREP
(
const
std
::
string
&
name
);
int
writeOCCBREP
(
const
std
::
string
&
name
);
int
readOCCIGES
(
const
std
::
string
&
name
);
int
readOCCSTEP
(
const
std
::
string
&
name
);
int
readOCCSTEP
(
const
std
::
string
&
name
);
int
readOCCIGES
(
const
std
::
string
&
name
);
int
writeOCCSTEP
(
const
std
::
string
&
name
);
int
writeOCCSTEP
(
const
std
::
string
&
name
);
int
writeOCCBREP
(
const
std
::
string
&
name
);
int
importOCCShape
(
const
void
*
shape
);
int
importOCCShape
(
const
void
*
shape
);
int
applyOCCMeshConstraints
(
const
void
*
constraints
);
int
applyOCCMeshConstraints
(
const
void
*
constraints
);
void
addShape
(
std
::
string
name
,
std
::
vector
<
double
>
&
p
,
std
::
string
op
);
void
addShape
(
std
::
string
name
,
std
::
vector
<
double
>
&
p
,
std
::
string
op
);
...
...
This diff is collapsed.
Click to expand it.
Geo/GModelIO_Mesh.cpp
+
0
−
2
View file @
c4f25e5d
...
@@ -29,8 +29,6 @@
...
@@ -29,8 +29,6 @@
#include
"GEdgeCompound.h"
#include
"GEdgeCompound.h"
#include
"GFaceCompound.h"
#include
"GFaceCompound.h"
#include
<iostream>
// DBG
void
GModel
::
_storePhysicalTagsInEntities
(
int
dim
,
void
GModel
::
_storePhysicalTagsInEntities
(
int
dim
,
std
::
map
<
int
,
std
::
map
<
int
,
std
::
string
>
>
&
map
)
std
::
map
<
int
,
std
::
map
<
int
,
std
::
string
>
>
&
map
)
{
{
...
...
This diff is collapsed.
Click to expand it.
Geo/GModelIO_OCC.cpp
+
76
−
43
View file @
c4f25e5d
...
@@ -889,6 +889,22 @@ int GModel::readOCCBREP(const std::string &fn)
...
@@ -889,6 +889,22 @@ int GModel::readOCCBREP(const std::string &fn)
return
1
;
return
1
;
}
}
int
GModel
::
readOCCSTEP
(
const
std
::
string
&
fn
)
{
_occ_internals
=
new
OCC_Internals
;
_occ_internals
->
loadSTEP
(
fn
.
c_str
());
_occ_internals
->
buildGModel
(
this
);
return
1
;
}
int
GModel
::
readOCCIGES
(
const
std
::
string
&
fn
)
{
_occ_internals
=
new
OCC_Internals
;
_occ_internals
->
loadIGES
(
fn
.
c_str
());
_occ_internals
->
buildGModel
(
this
);
return
1
;
}
int
GModel
::
writeOCCBREP
(
const
std
::
string
&
fn
)
int
GModel
::
writeOCCBREP
(
const
std
::
string
&
fn
)
{
{
if
(
!
_occ_internals
){
if
(
!
_occ_internals
){
...
@@ -911,22 +927,6 @@ int GModel::writeOCCSTEP(const std::string &fn)
...
@@ -911,22 +927,6 @@ int GModel::writeOCCSTEP(const std::string &fn)
return
1
;
return
1
;
}
}
int
GModel
::
readOCCIGES
(
const
std
::
string
&
fn
)
{
_occ_internals
=
new
OCC_Internals
;
_occ_internals
->
loadIGES
(
fn
.
c_str
());
_occ_internals
->
buildGModel
(
this
);
return
1
;
}
int
GModel
::
readOCCSTEP
(
const
std
::
string
&
fn
)
{
_occ_internals
=
new
OCC_Internals
;
_occ_internals
->
loadSTEP
(
fn
.
c_str
());
_occ_internals
->
buildGModel
(
this
);
return
1
;
}
int
GModel
::
importOCCShape
(
const
void
*
shape
)
int
GModel
::
importOCCShape
(
const
void
*
shape
)
{
{
_occ_internals
=
new
OCC_Internals
;
_occ_internals
=
new
OCC_Internals
;
...
@@ -937,37 +937,32 @@ int GModel::importOCCShape(const void *shape)
...
@@ -937,37 +937,32 @@ int GModel::importOCCShape(const void *shape)
return
1
;
return
1
;
}
}
int
GModel
::
applyOCCMeshConstraints
(
const
void
*
constraints
)
{
#if defined(HAVE_OCC_MESH_CONSTRAINTS)
#if defined(HAVE_OCC_MESH_CONSTRAINTS)
// FIXME !!!!!!!!!!!!!!!!
static
void
_applyOCCMeshConstraintsOnVertices
// COMPUTE 1D MESH AUTOMATICALLY WHEN NO CONSTRAINTS ARE APPLIED
(
GModel
*
m
,
MeshGmsh_DataMapOfShapeOfVertexConstrain
&
constraints
)
// ON SOME GEDGES !!!!!!!!!!!!!!!!!!
{
MeshGmsh_Constrain
*
meshConstraints
=
(
MeshGmsh_Constrain
*
)
constraints
;
for
(
GModel
::
viter
it
=
m
->
firstVertex
();
it
!=
m
->
lastVertex
();
++
it
){
// apply mesh constraints on model vertices
MeshGmsh_DataMapOfShapeOfVertexConstrain
vertexConstraints
;
meshConstraints
->
GetVertexConstrain
(
vertexConstraints
);
for
(
GModel
::
viter
it
=
firstVertex
();
it
!=
lastVertex
();
++
it
){
GVertex
*
gv
=
*
it
;
GVertex
*
gv
=
*
it
;
if
(
gv
->
getNativeType
()
!=
GEntity
::
OpenCascadeModel
)
continue
;
if
(
gv
->
getNativeType
()
!=
GEntity
::
OpenCascadeModel
)
continue
;
TopoDS_Shape
*
s
=
(
TopoDS_Shape
*
)
gv
->
getNativePtr
();
TopoDS_Shape
*
s
=
(
TopoDS_Shape
*
)
gv
->
getNativePtr
();
if
(
vertexC
onstraints
.
IsBound
(
*
s
))
{
if
(
c
onstraints
.
IsBound
(
*
s
))
{
Msg
::
Debug
(
"Found mesh contraints on vertex %d"
,
gv
->
tag
());
Msg
::
Debug
(
"Found mesh contraints on vertex %d"
,
gv
->
tag
());
const
MeshGmsh_VertexConstrain
&
c
(
vertexConstraints
.
Find
(
*
s
));
const
MeshGmsh_VertexConstrain
&
c
(
constraints
.
Find
(
*
s
));
// characteristic length constraint
// 1) characteristic length constraint
double
lc
=
c
.
GetSize
();
double
lc
=
c
.
GetSize
();
if
(
lc
>=
0.
){
if
(
lc
>=
0.
){
Msg
::
Debug
(
"... setting mesh size = %g"
,
lc
);
Msg
::
Debug
(
"... setting mesh size = %g"
,
lc
);
gv
->
setPrescribedMeshSizeAtVertex
(
lc
);
gv
->
setPrescribedMeshSizeAtVertex
(
lc
);
}
}
// embedding constraint
// 2) embedding constraint
if
(
c
.
IsEmbedded
()
&&
!
c
.
GetFace
().
IsNull
()){
if
(
c
.
IsEmbedded
()
&&
!
c
.
GetFace
().
IsNull
()){
TopoDS_Shape
shape
=
c
.
GetFace
();
TopoDS_Shape
shape
=
c
.
GetFace
();
Standard_Integer
nodeNum
;
Standard_Integer
nodeNum
;
c
.
GetNodeNumber
(
nodeNum
);
c
.
GetNodeNumber
(
nodeNum
);
for
(
GModel
::
fiter
it2
=
firstFace
();
it2
!=
lastFace
();
++
it2
){
for
(
GModel
::
fiter
it2
=
m
->
firstFace
();
it2
!=
m
->
lastFace
();
++
it2
){
GFace
*
gf
=
*
it2
;
GFace
*
gf
=
*
it2
;
if
(
gf
->
getNativeType
()
!=
GEntity
::
OpenCascadeModel
)
continue
;
if
(
gf
->
getNativeType
()
!=
GEntity
::
OpenCascadeModel
)
continue
;
TopoDS_Shape
*
shape2
=
(
TopoDS_Shape
*
)
gf
->
getNativePtr
();
TopoDS_Shape
*
shape2
=
(
TopoDS_Shape
*
)
gf
->
getNativePtr
();
...
@@ -980,18 +975,20 @@ int GModel::applyOCCMeshConstraints(const void *constraints)
...
@@ -980,18 +975,20 @@ int GModel::applyOCCMeshConstraints(const void *constraints)
}
}
}
}
}
}
}
//
apply
m
esh
c
onstraints
on model e
dges
static
void
_
apply
OCCM
esh
C
onstraints
OnE
dges
MeshGmsh_DataMapOfShapeOfEdgeConstrain
edgeC
onstraints
;
(
GModel
*
m
,
MeshGmsh_DataMapOfShapeOfEdgeConstrain
&
c
onstraints
)
meshConstraints
->
GetEdgeConstrain
(
edgeConstraints
);
{
for
(
GModel
::
eiter
it
=
firstEdge
();
it
!=
lastEdge
();
++
it
){
for
(
GModel
::
eiter
it
=
m
->
firstEdge
();
it
!=
m
->
lastEdge
();
++
it
){
GEdge
*
ge
=
*
it
;
GEdge
*
ge
=
*
it
;
if
(
ge
->
getNativeType
()
!=
GEntity
::
OpenCascadeModel
)
continue
;
if
(
ge
->
getNativeType
()
!=
GEntity
::
OpenCascadeModel
)
continue
;
TopoDS_Shape
*
s
=
(
TopoDS_Shape
*
)
ge
->
getNativePtr
();
TopoDS_Shape
*
s
=
(
TopoDS_Shape
*
)
ge
->
getNativePtr
();
if
(
edgeC
onstraints
.
IsBound
(
*
s
))
{
if
(
c
onstraints
.
IsBound
(
*
s
))
{
Msg
::
Debug
(
"Found mesh contraints on edge %d"
,
ge
->
tag
());
Msg
::
Debug
(
"Found mesh contraints on edge %d"
,
ge
->
tag
());
const
MeshGmsh_EdgeConstrain
&
c
(
edgeConstraints
.
Find
(
*
s
));
const
MeshGmsh_EdgeConstrain
&
c
(
constraints
.
Find
(
*
s
));
// prescribed mesh constraint
// 1) prescribed mesh constraint
if
(
c
.
IsMeshImposed
()){
if
(
c
.
IsMeshImposed
()){
TColStd_SequenceOfInteger
nodeNum
;
TColStd_SequenceOfInteger
nodeNum
;
c
.
GetNodesNumber
(
nodeNum
);
c
.
GetNodesNumber
(
nodeNum
);
...
@@ -1035,10 +1032,11 @@ int GModel::applyOCCMeshConstraints(const void *constraints)
...
@@ -1035,10 +1032,11 @@ int GModel::applyOCCMeshConstraints(const void *constraints)
}
}
}
}
}
}
// embedding constraint
// 2) embedding constraint
if
(
c
.
IsEmbedded
()
&&
!
c
.
GetFace
().
IsNull
()){
if
(
c
.
IsEmbedded
()
&&
!
c
.
GetFace
().
IsNull
()){
TopoDS_Shape
shape
=
c
.
GetFace
();
TopoDS_Shape
shape
=
c
.
GetFace
();
for
(
GModel
::
fiter
it2
=
firstFace
();
it2
!=
lastFace
();
++
it2
){
for
(
GModel
::
fiter
it2
=
m
->
firstFace
();
it2
!=
m
->
lastFace
();
++
it2
){
GFace
*
gf
=
*
it2
;
GFace
*
gf
=
*
it2
;
if
(
gf
->
getNativeType
()
!=
GEntity
::
OpenCascadeModel
)
continue
;
if
(
gf
->
getNativeType
()
!=
GEntity
::
OpenCascadeModel
)
continue
;
TopoDS_Shape
*
shape2
=
(
TopoDS_Shape
*
)
gf
->
getNativePtr
();
TopoDS_Shape
*
shape2
=
(
TopoDS_Shape
*
)
gf
->
getNativePtr
();
...
@@ -1053,6 +1051,27 @@ int GModel::applyOCCMeshConstraints(const void *constraints)
...
@@ -1053,6 +1051,27 @@ int GModel::applyOCCMeshConstraints(const void *constraints)
}
}
}
}
}
}
// FIXME: compute better characteristic length for all edges with no
// imposed mesh? Or mesh those edges directly (here?)
for
(
GModel
::
eiter
it
=
m
->
firstEdge
();
it
!=
m
->
lastEdge
();
++
it
){
// ...
}
}
#endif
int
GModel
::
applyOCCMeshConstraints
(
const
void
*
constraints
)
{
#if defined(HAVE_OCC_MESH_CONSTRAINTS)
MeshGmsh_Constrain
*
c
=
(
MeshGmsh_Constrain
*
)
constraints
;
MeshGmsh_DataMapOfShapeOfVertexConstrain
vertexConstraints
;
c
->
GetVertexConstrain
(
vertexConstraints
);
_applyOCCMeshConstraintsOnVertices
(
vertexConstraints
);
MeshGmsh_DataMapOfShapeOfEdgeConstrain
edgeConstraints
;
c
->
GetEdgeConstrain
(
edgeConstraints
);
_applyOCCMeshConstraintsOnEdges
(
edgeConstraints
);
return
1
;
return
1
;
#else
#else
return
0
;
return
0
;
...
@@ -1065,6 +1084,13 @@ void GModel::_deleteOCCInternals()
...
@@ -1065,6 +1084,13 @@ void GModel::_deleteOCCInternals()
{
{
}
}
int
GModel
::
readOCCBREP
(
const
std
::
string
&
fn
)
{
Msg
::
Error
(
"Gmsh must be compiled with OpenCascade support to load '%s'"
,
fn
.
c_str
());
return
0
;
}
int
GModel
::
readOCCSTEP
(
const
std
::
string
&
fn
)
int
GModel
::
readOCCSTEP
(
const
std
::
string
&
fn
)
{
{
Msg
::
Error
(
"Gmsh must be compiled with OpenCascade support to load '%s'"
,
Msg
::
Error
(
"Gmsh must be compiled with OpenCascade support to load '%s'"
,
...
@@ -1079,9 +1105,16 @@ int GModel::readOCCIGES(const std::string &fn)
...
@@ -1079,9 +1105,16 @@ int GModel::readOCCIGES(const std::string &fn)
return
0
;
return
0
;
}
}
int
GModel
::
read
OCCBREP
(
const
std
::
string
&
fn
)
int
GModel
::
write
OCCBREP
(
const
std
::
string
&
fn
)
{
{
Msg
::
Error
(
"Gmsh must be compiled with OpenCascade support to load '%s'"
,
Msg
::
Error
(
"Gmsh must be compiled with OpenCascade support to write '%s'"
,
fn
.
c_str
());
return
0
;
}
int
GModel
::
writeOCCSTEP
(
const
std
::
string
&
fn
)
{
Msg
::
Error
(
"Gmsh must be compiled with OpenCascade support to write '%s'"
,
fn
.
c_str
());
fn
.
c_str
());
return
0
;
return
0
;
}
}
...
...
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