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
afa8e98b
Commit
afa8e98b
authored
8 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
fix warnings
parent
53ab3a2a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Geo/GModelCreateTopologyFromMesh.cpp
+13
-3
13 additions, 3 deletions
Geo/GModelCreateTopologyFromMesh.cpp
Geo/GModelCreateTopologyFromMesh.h
+8
-1
8 additions, 1 deletion
Geo/GModelCreateTopologyFromMesh.h
Mesh/meshGEdge.cpp
+27
-21
27 additions, 21 deletions
Mesh/meshGEdge.cpp
with
48 additions
and
25 deletions
Geo/GModelCreateTopologyFromMesh.cpp
+
13
−
3
View file @
afa8e98b
// Gmsh - Copyright (C) 1997-2016 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to the public mailing list <gmsh@onelab.info>.
#include
<stack>
#include
<stack>
#include
<set>
#include
<set>
#include
<map>
#include
<map>
...
@@ -78,7 +83,7 @@ void createTopologyFromMesh1D ( GModel *gm , int &num) {
...
@@ -78,7 +83,7 @@ void createTopologyFromMesh1D ( GModel *gm , int &num) {
for
(
GModel
::
eiter
it
=
gm
->
firstEdge
();
it
!=
gm
->
lastEdge
();
it
++
)
{
for
(
GModel
::
eiter
it
=
gm
->
firstEdge
();
it
!=
gm
->
lastEdge
();
it
++
)
{
for
(
int
i
=
0
;
i
<
(
*
it
)
->
lines
.
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
lines
.
size
();
i
++
){
MLine
*
e
=
(
*
it
)
->
lines
[
i
];
MLine
*
e
=
(
*
it
)
->
lines
[
i
];
for
(
int
j
=
0
;
j
<
2
;
j
++
){
for
(
int
j
=
0
;
j
<
2
;
j
++
){
MVertex
*
v
=
e
->
getVertex
(
j
);
MVertex
*
v
=
e
->
getVertex
(
j
);
...
@@ -234,7 +239,7 @@ std::vector<GEdge*> ensureSimplyConnectedEdge ( GEdge *ge ) {
...
@@ -234,7 +239,7 @@ std::vector<GEdge*> ensureSimplyConnectedEdge ( GEdge *ge ) {
_all
.
push_back
(
ge
);
_all
.
push_back
(
ge
);
for
(
int
i
=
0
;
i
<
ge
->
lines
.
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
ge
->
lines
.
size
();
i
++
){
_lines
.
insert
(
ge
->
lines
[
i
]);
_lines
.
insert
(
ge
->
lines
[
i
]);
for
(
int
j
=
0
;
j
<
2
;
j
++
){
for
(
int
j
=
0
;
j
<
2
;
j
++
){
std
::
map
<
MVertex
*
,
std
::
pair
<
MLine
*
,
MLine
*>
>::
iterator
it
=
_conn
.
find
(
ge
->
lines
[
i
]
->
getVertex
(
j
));
std
::
map
<
MVertex
*
,
std
::
pair
<
MLine
*
,
MLine
*>
>::
iterator
it
=
_conn
.
find
(
ge
->
lines
[
i
]
->
getVertex
(
j
));
...
@@ -294,7 +299,7 @@ void createTopologyFromMesh2D ( GModel *gm , int & num) {
...
@@ -294,7 +299,7 @@ void createTopologyFromMesh2D ( GModel *gm , int & num) {
// create an inverse dictionnary for existing edges
// create an inverse dictionnary for existing edges
for
(
GModel
::
eiter
it
=
gm
->
firstEdge
();
it
!=
gm
->
lastEdge
();
it
++
)
{
for
(
GModel
::
eiter
it
=
gm
->
firstEdge
();
it
!=
gm
->
lastEdge
();
it
++
)
{
for
(
int
i
=
0
;
i
<
(
*
it
)
->
lines
.
size
();
i
++
)
_existingEdges
[(
*
it
)
->
lines
[
i
]
->
getEdge
(
0
)]
=
*
it
;
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
lines
.
size
();
i
++
)
_existingEdges
[(
*
it
)
->
lines
[
i
]
->
getEdge
(
0
)]
=
*
it
;
}
}
// printf("%d mesh edges are already classified\n",_existingEdges.size());
// printf("%d mesh edges are already classified\n",_existingEdges.size());
...
@@ -477,6 +482,8 @@ public:
...
@@ -477,6 +482,8 @@ public:
}
}
}
}
found
=
false
;
found
=
false
;
// bad design of this routine
return
v
[
0
].
second
;
}
}
};
};
...
@@ -497,6 +504,9 @@ inline MYFACE builder (MElement *e, int num){
...
@@ -497,6 +504,9 @@ inline MYFACE builder (MElement *e, int num){
e
->
getVertex
(
2
));
e
->
getVertex
(
2
));
}
}
Msg
::
Fatal
(
"JF : finish the code of createtopologyfrommesh"
);
Msg
::
Fatal
(
"JF : finish the code of createtopologyfrommesh"
);
return
topoFace
(
e
->
getVertex
(
0
),
e
->
getVertex
(
1
),
e
->
getVertex
(
2
));
#endif
#endif
}
}
...
...
This diff is collapsed.
Click to expand it.
Geo/GModelCreateTopologyFromMesh.h
+
8
−
1
View file @
afa8e98b
// Gmsh - Copyright (C) 1997-2016 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to the public mailing list <gmsh@onelab.info>.
#ifndef _CREATE_TOPOLOGY_FROM_MESH
#ifndef _CREATE_TOPOLOGY_FROM_MESH
#define _CREATE_TOPOLOGY_FROM_MESH
#define _CREATE_TOPOLOGY_FROM_MESH
class
GModel
;
class
GModel
;
void
createTopologyFromMeshNew
(
GModel
*
gm
)
;
void
createTopologyFromMeshNew
(
GModel
*
gm
);
#endif
#endif
This diff is collapsed.
Click to expand it.
Mesh/meshGEdge.cpp
+
27
−
21
View file @
afa8e98b
...
@@ -89,7 +89,7 @@ static double F_LcB(GEdge *ge, double t)
...
@@ -89,7 +89,7 @@ static double F_LcB(GEdge *ge, double t)
double
lc
=
BGM_MeshSize
(
ge
,
t
,
0
,
p
.
x
(),
p
.
y
(),
p
.
z
());
double
lc
=
BGM_MeshSize
(
ge
,
t
,
0
,
p
.
x
(),
p
.
y
(),
p
.
z
());
if
(
blf
){
if
(
blf
){
double
lc2
=
(
*
blf
)(
p
.
x
(),
p
.
y
(),
p
.
z
()
,
ge
);
double
lc2
=
(
*
blf
)(
p
.
x
(),
p
.
y
(),
p
.
z
()
,
ge
);
// printf("p %g %g lc %g\n",p.x(),p.y(),lc2);
// printf("p %g %g lc %g\n",p.x(),p.y(),lc2);
lc
=
std
::
min
(
lc
,
lc2
);
lc
=
std
::
min
(
lc
,
lc2
);
}
}
...
@@ -105,7 +105,7 @@ static double F_Lc(GEdge *ge, double t)
...
@@ -105,7 +105,7 @@ static double F_Lc(GEdge *ge, double t)
Field
*
bl_field
=
fields
->
get
(
fields
->
getBoundaryLayerField
());
Field
*
bl_field
=
fields
->
get
(
fields
->
getBoundaryLayerField
());
blf
=
dynamic_cast
<
BoundaryLayerField
*>
(
bl_field
);
blf
=
dynamic_cast
<
BoundaryLayerField
*>
(
bl_field
);
#endif
#endif
GPoint
p
=
ge
->
point
(
t
);
GPoint
p
=
ge
->
point
(
t
);
double
lc_here
;
double
lc_here
;
...
@@ -121,7 +121,7 @@ static double F_Lc(GEdge *ge, double t)
...
@@ -121,7 +121,7 @@ static double F_Lc(GEdge *ge, double t)
lc_here
=
BGM_MeshSize
(
ge
,
t
,
0
,
p
.
x
(),
p
.
y
(),
p
.
z
());
lc_here
=
BGM_MeshSize
(
ge
,
t
,
0
,
p
.
x
(),
p
.
y
(),
p
.
z
());
if
(
blf
){
if
(
blf
){
double
lc2
=
(
*
blf
)(
p
.
x
(),
p
.
y
(),
p
.
z
()
,
ge
);
double
lc2
=
(
*
blf
)(
p
.
x
(),
p
.
y
(),
p
.
z
()
,
ge
);
// printf("p %g %g lc %g\n",p.x(),p.y(),lc2);
// printf("p %g %g lc %g\n",p.x(),p.y(),lc2);
lc_here
=
std
::
min
(
lc_here
,
lc2
);
lc_here
=
std
::
min
(
lc_here
,
lc2
);
}
}
...
@@ -315,16 +315,16 @@ void copyMesh(GEdge *from, GEdge *to, int direction)
...
@@ -315,16 +315,16 @@ void copyMesh(GEdge *from, GEdge *to, int direction)
double
to_u_min
=
to_u_bounds
.
low
();
double
to_u_min
=
to_u_bounds
.
low
();
// include begin and end point to avoid conflicts when realigning
// include begin and end point to avoid conflicts when realigning
MVertex
*
vt0
=
to
->
getBeginVertex
()
->
mesh_vertices
[
0
];
MVertex
*
vt0
=
to
->
getBeginVertex
()
->
mesh_vertices
[
0
];
MVertex
*
vt1
=
to
->
getEndVertex
()
->
mesh_vertices
[
0
];
MVertex
*
vt1
=
to
->
getEndVertex
()
->
mesh_vertices
[
0
];
MVertex
*
vs0
=
from
->
getBeginVertex
()
->
mesh_vertices
[
0
];
MVertex
*
vs0
=
from
->
getBeginVertex
()
->
mesh_vertices
[
0
];
MVertex
*
vs1
=
from
->
getEndVertex
()
->
mesh_vertices
[
0
];
MVertex
*
vs1
=
from
->
getEndVertex
()
->
mesh_vertices
[
0
];
to
->
correspondingVertices
[
vt0
]
=
direction
>
0
?
vs0
:
vs1
;
to
->
correspondingVertices
[
vt0
]
=
direction
>
0
?
vs0
:
vs1
;
to
->
correspondingVertices
[
vt1
]
=
direction
>
0
?
vs1
:
vs0
;
to
->
correspondingVertices
[
vt1
]
=
direction
>
0
?
vs1
:
vs0
;
for
(
unsigned
int
i
=
0
;
i
<
from
->
mesh_vertices
.
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
from
->
mesh_vertices
.
size
();
i
++
){
int
index
=
(
direction
<
0
)
?
(
from
->
mesh_vertices
.
size
()
-
1
-
i
)
:
i
;
int
index
=
(
direction
<
0
)
?
(
from
->
mesh_vertices
.
size
()
-
1
-
i
)
:
i
;
MVertex
*
v
=
from
->
mesh_vertices
[
index
];
MVertex
*
v
=
from
->
mesh_vertices
[
index
];
...
@@ -379,7 +379,8 @@ static int increaseN (int N)
...
@@ -379,7 +379,8 @@ static int increaseN (int N)
// ensure not to have points that are too close to each other.
// ensure not to have points that are too close to each other.
// can be caused by a coarse 1D mesh or by a noisy curve
// can be caused by a coarse 1D mesh or by a noisy curve
static
void
filterPoints
(
GEdge
*
ge
,
int
nMinimumPoints
)
{
static
void
filterPoints
(
GEdge
*
ge
,
int
nMinimumPoints
)
{
if
(
ge
->
mesh_vertices
.
empty
())
return
;
if
(
ge
->
mesh_vertices
.
empty
())
return
;
if
(
ge
->
meshAttributes
.
method
==
MESH_TRANSFINITE
)
return
;
if
(
ge
->
meshAttributes
.
method
==
MESH_TRANSFINITE
)
return
;
//if (ge->mesh_vertices.size() <=3)return;
//if (ge->mesh_vertices.size() <=3)return;
...
@@ -396,7 +397,10 @@ static void filterPoints (GEdge*ge, int nMinimumPoints) {
...
@@ -396,7 +397,10 @@ static void filterPoints (GEdge*ge, int nMinimumPoints) {
std
::
vector
<
std
::
pair
<
double
,
MVertex
*>
>
lengths
;
std
::
vector
<
std
::
pair
<
double
,
MVertex
*>
>
lengths
;
for
(
unsigned
int
i
=
0
;
i
<
ge
->
mesh_vertices
.
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
ge
->
mesh_vertices
.
size
();
i
++
){
MEdgeVertex
*
v
=
dynamic_cast
<
MEdgeVertex
*>
(
ge
->
mesh_vertices
[
i
]);
MEdgeVertex
*
v
=
dynamic_cast
<
MEdgeVertex
*>
(
ge
->
mesh_vertices
[
i
]);
if
(
!
v
)
Msg
::
Fatal
(
"in 1D mesh"
);
if
(
!
v
){
Msg
::
Error
(
"in 1D mesh filterPoints"
);
return
;
}
double
d
=
distance
(
v
,
v0
);
double
d
=
distance
(
v
,
v0
);
double
t
;
double
t
;
v
->
getParameter
(
0
,
t
);
v
->
getParameter
(
0
,
t
);
...
@@ -406,7 +410,7 @@ static void filterPoints (GEdge*ge, int nMinimumPoints) {
...
@@ -406,7 +410,7 @@ static void filterPoints (GEdge*ge, int nMinimumPoints) {
t
=
0.5
*
(
t
+
t0
);
t
=
0.5
*
(
t
+
t0
);
}
}
double
lc
=
F_LcB
(
ge
,
t
);
double
lc
=
F_LcB
(
ge
,
t
);
//
double lc = v->getLc();
// double lc = v->getLc();
if
(
d
<
lc
*
.3
)
{
if
(
d
<
lc
*
.3
)
{
lengths
.
push_back
(
std
::
make_pair
(
lc
/
d
,
v
));
lengths
.
push_back
(
std
::
make_pair
(
lc
/
d
,
v
));
}
}
...
@@ -419,20 +423,22 @@ static void filterPoints (GEdge*ge, int nMinimumPoints) {
...
@@ -419,20 +423,22 @@ static void filterPoints (GEdge*ge, int nMinimumPoints) {
while
(
last
%
2
!=
0
)
last
--
;
while
(
last
%
2
!=
0
)
last
--
;
}
}
/*
/*
if (CTX::instance()->mesh.algoRecombine == 2){
if (CTX::instance()->mesh.algoRecombine == 2){
if (last < 4)last = 0;
if (last < 4)last = 0;
while (last %4 != 0)last--;
while (last %4 != 0)last--;
}
}
else {
else {
while (last %2 != 0)last--;
while (last %2 != 0)last--;
}
}
}
}
*/
*/
bool
filteringObservesMinimumN
=
((
ge
->
mesh_vertices
.
size
()
-
last
)
>=
nMinimumPoints
);
bool
filteringObservesMinimumN
=
((
(
int
)
ge
->
mesh_vertices
.
size
()
-
last
)
>=
nMinimumPoints
);
if
(
filteringObservesMinimumN
){
if
(
filteringObservesMinimumN
){
for
(
int
i
=
0
;
i
<
last
;
i
++
){
for
(
int
i
=
0
;
i
<
last
;
i
++
){
std
::
vector
<
MVertex
*>::
iterator
it
=
std
::
find
(
ge
->
mesh_vertices
.
begin
(),
ge
->
mesh_vertices
.
end
(),
lengths
[
i
].
second
);
std
::
vector
<
MVertex
*>::
iterator
it
=
std
::
find
(
ge
->
mesh_vertices
.
begin
(),
ge
->
mesh_vertices
.
end
(),
lengths
[
i
].
second
);
ge
->
mesh_vertices
.
erase
(
it
);
ge
->
mesh_vertices
.
erase
(
it
);
delete
lengths
[
i
].
second
;
delete
lengths
[
i
].
second
;
}
}
...
...
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