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
09152952
Commit
09152952
authored
8 years ago
by
PA Beaufort
Browse files
Options
Downloads
Patches
Plain Diff
hack (setTopo) to avoid bugs of the existing bugs
parent
3762320c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Geo/discreteEdge.cpp
+30
-14
30 additions, 14 deletions
Geo/discreteEdge.cpp
Geo/discreteEdge.h
+2
-1
2 additions, 1 deletion
Geo/discreteEdge.h
with
32 additions
and
15 deletions
Geo/discreteEdge.cpp
+
30
−
14
View file @
09152952
...
@@ -36,6 +36,14 @@ discreteEdge::discreteEdge(GModel *model, int num, GVertex *_v0, GVertex *_v1)
...
@@ -36,6 +36,14 @@ discreteEdge::discreteEdge(GModel *model, int num, GVertex *_v0, GVertex *_v1)
CreateReversedCurve
(
c
);
CreateReversedCurve
(
c
);
}
}
// topology is already set
void
discreteEdge
::
setTopo
(
std
::
vector
<
MLine
*>
mlines
)
{
createdTopo
=
true
;
lines
=
mlines
;
_orientation
=
std
::
vector
<
int
>
(
lines
.
size
(),
1
);
}
void
discreteEdge
::
createTopo
()
void
discreteEdge
::
createTopo
()
{
{
if
(
!
createdTopo
){
if
(
!
createdTopo
){
...
@@ -48,16 +56,14 @@ void discreteEdge::createTopo()
...
@@ -48,16 +56,14 @@ void discreteEdge::createTopo()
// FULL OF BUGS !!!!!!
// FULL OF BUGS !!!!!!
void
discreteEdge
::
orderMLines
()
void
discreteEdge
::
orderMLines
()
{
{
//printf("ordering line %d
\n", tag
());
//printf("ordering line %d
(%d,%d)\n", tag(),getBeginVertex()->mesh_vertices[0]->getNum(),getEndVertex()->mesh_vertices[0]->getNum
());
//if(lines.size() <= 1) return;
//if(lines.size() <= 1) return;
std
::
vector
<
MLine
*>
_m
;
std
::
vector
<
MLine
*>
_m
;
std
::
list
<
MLine
*>
segments
;
std
::
list
<
MLine
*>
segments
;
// store all lines in a list : segments
// store all lines in a list : segments
for
(
unsigned
int
i
=
0
;
i
<
lines
.
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
lines
.
size
();
i
++
)
segments
.
push_back
(
lines
[
i
]);
segments
.
push_back
(
lines
[
i
]);
}
// find a lonly MLine
// find a lonly MLine
for
(
std
::
list
<
MLine
*>::
iterator
it
=
segments
.
begin
();
for
(
std
::
list
<
MLine
*>::
iterator
it
=
segments
.
begin
();
...
@@ -71,7 +77,6 @@ void discreteEdge::orderMLines()
...
@@ -71,7 +77,6 @@ void discreteEdge::orderMLines()
if
(
it2
==
boundv
.
end
())
boundv
.
insert
(
std
::
make_pair
(
vR
,
*
it
));
if
(
it2
==
boundv
.
end
())
boundv
.
insert
(
std
::
make_pair
(
vR
,
*
it
));
else
boundv
.
erase
(
it2
);
else
boundv
.
erase
(
it2
);
}
}
// find the first MLine and erase it from the list segments
// find the first MLine and erase it from the list segments
MLine
*
firstLine
;
MLine
*
firstLine
;
if
(
boundv
.
size
()
==
2
){
// non periodic
if
(
boundv
.
size
()
==
2
){
// non periodic
...
@@ -92,14 +97,13 @@ void discreteEdge::orderMLines()
...
@@ -92,14 +97,13 @@ void discreteEdge::orderMLines()
Msg
::
Error
(
"EdgeCompound %d is wrong (it has %d end points)"
,
Msg
::
Error
(
"EdgeCompound %d is wrong (it has %d end points)"
,
tag
(),
boundv
.
size
());
tag
(),
boundv
.
size
());
}
}
// loop over all segments to order segments and store it in the list _m
// loop over all segments to order segments and store it in the list _m
_m
.
push_back
(
firstLine
);
_m
.
push_back
(
firstLine
);
_orientation
.
push_back
(
1
);
_orientation
.
push_back
(
1
);
MVertex
*
first
=
_m
[
0
]
->
getVertex
(
0
);
MVertex
*
first
=
_m
[
0
]
->
getVertex
(
0
);
MVertex
*
last
=
_m
[
0
]
->
getVertex
(
1
);
MVertex
*
last
=
_m
[
0
]
->
getVertex
(
1
);
while
(
first
!=
last
){
while
(
first
!=
last
){
if
(
segments
.
empty
())
break
;
if
(
segments
.
empty
())
break
;
bool
found
=
false
;
bool
found
=
false
;
for
(
std
::
list
<
MLine
*>::
iterator
it
=
segments
.
begin
();
for
(
std
::
list
<
MLine
*>::
iterator
it
=
segments
.
begin
();
it
!=
segments
.
end
();
++
it
){
it
!=
segments
.
end
();
++
it
){
...
@@ -137,18 +141,19 @@ void discreteEdge::orderMLines()
...
@@ -137,18 +141,19 @@ void discreteEdge::orderMLines()
//lines is now a list of ordered MLines
//lines is now a list of ordered MLines
lines
=
_m
;
lines
=
_m
;
//mesh_vertices
//mesh_vertices
mesh_vertices
.
clear
();
mesh_vertices
.
clear
();
for
(
unsigned
int
i
=
0
;
i
<
lines
.
size
();
++
i
){
for
(
unsigned
int
i
=
0
;
i
<
lines
.
size
()
-
1
;
++
i
){
MVertex
*
v1
=
lines
[
i
]
->
getVertex
(
0
);
MVertex
*
v1
=
lines
[
i
]
->
getVertex
(
0
);
MVertex
*
v2
=
lines
[
i
]
->
getVertex
(
1
);
MVertex
*
v2
=
lines
[
i
]
->
getVertex
(
1
);
if
(
std
::
find
(
mesh_vertices
.
begin
(),
mesh_vertices
.
end
(),
v1
)
==
if
(
std
::
find
(
mesh_vertices
.
begin
(),
mesh_vertices
.
end
(),
v1
)
==
mesh_vertices
.
end
())
mesh_vertices
.
push_back
(
v1
);
mesh_vertices
.
end
())
mesh_vertices
.
push_back
(
v1
);
if
(
std
::
find
(
mesh_vertices
.
begin
(),
mesh_vertices
.
end
(),
v2
)
==
if
(
std
::
find
(
mesh_vertices
.
begin
(),
mesh_vertices
.
end
(),
v2
)
==
mesh_vertices
.
end
())
mesh_vertices
.
push_back
(
v2
);
mesh_vertices
.
end
())
mesh_vertices
.
push_back
(
v2
);
}
}
//special case reverse orientation
//special case reverse orientation
if
(
lines
.
size
()
<
2
)
return
;
if
(
lines
.
size
()
<
2
)
return
;
if
(
_orientation
[
0
]
&&
lines
[
0
]
->
getVertex
(
1
)
!=
lines
[
1
]
->
getVertex
(
1
)
if
(
_orientation
[
0
]
&&
lines
[
0
]
->
getVertex
(
1
)
!=
lines
[
1
]
->
getVertex
(
1
)
...
@@ -287,9 +292,7 @@ void discreteEdge::parametrize(std::map<GFace*, std::map<MVertex*, MVertex*,
...
@@ -287,9 +292,7 @@ void discreteEdge::parametrize(std::map<GFace*, std::map<MVertex*, MVertex*,
MVertex
*
vL
=
getBeginVertex
()
->
mesh_vertices
[
0
];
MVertex
*
vL
=
getBeginVertex
()
->
mesh_vertices
[
0
];
int
i
=
0
;
int
i
=
0
;
for
(
i
=
0
;
i
<
(
int
)
lines
.
size
()
-
1
;
i
++
){
for
(
i
=
0
;
i
<
(
int
)
lines
.
size
()
-
1
;
i
++
){
MVertex
*
vR
;
MVertex
*
vR
=
lines
[
i
]
->
getVertex
(
_orientation
[
i
]);
if
(
_orientation
[
i
]
==
1
)
vR
=
lines
[
i
]
->
getVertex
(
1
);
else
vR
=
lines
[
i
]
->
getVertex
(
0
);
int
param
=
i
+
1
;
int
param
=
i
+
1
;
MVertex
*
vNEW
=
new
MEdgeVertex
(
vR
->
x
(),
vR
->
y
(),
vR
->
z
(),
this
,
MVertex
*
vNEW
=
new
MEdgeVertex
(
vR
->
x
(),
vR
->
y
(),
vR
->
z
(),
this
,
param
,
-
1.
,
vR
->
getNum
());
param
,
-
1.
,
vR
->
getNum
());
...
@@ -450,6 +453,7 @@ GPoint discreteEdge::point(double par) const
...
@@ -450,6 +453,7 @@ GPoint discreteEdge::point(double par) const
int
iEdge
;
int
iEdge
;
if
(
!
getLocalParameter
(
par
,
iEdge
,
tLoc
))
return
GPoint
();
if
(
!
getLocalParameter
(
par
,
iEdge
,
tLoc
))
return
GPoint
();
double
x
,
y
,
z
;
double
x
,
y
,
z
;
MVertex
*
vB
=
discrete_lines
[
iEdge
]
->
getVertex
(
0
);
MVertex
*
vB
=
discrete_lines
[
iEdge
]
->
getVertex
(
0
);
MVertex
*
vE
=
discrete_lines
[
iEdge
]
->
getVertex
(
1
);
MVertex
*
vE
=
discrete_lines
[
iEdge
]
->
getVertex
(
1
);
...
@@ -463,6 +467,7 @@ GPoint discreteEdge::point(double par) const
...
@@ -463,6 +467,7 @@ GPoint discreteEdge::point(double par) const
SVector3
discreteEdge
::
firstDer
(
double
par
)
const
SVector3
discreteEdge
::
firstDer
(
double
par
)
const
{
{
double
tLoc
;
double
tLoc
;
int
iEdge
;
int
iEdge
;
if
(
!
getLocalParameter
(
par
,
iEdge
,
tLoc
))
return
SVector3
();
if
(
!
getLocalParameter
(
par
,
iEdge
,
tLoc
))
return
SVector3
();
...
@@ -522,6 +527,7 @@ void discreteEdge::createGeometry()
...
@@ -522,6 +527,7 @@ void discreteEdge::createGeometry()
if
(
discrete_lines
.
empty
()){
if
(
discrete_lines
.
empty
()){
createTopo
();
createTopo
();
// copy the mesh
// copy the mesh
for
(
unsigned
int
i
=
0
;
i
<
mesh_vertices
.
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
mesh_vertices
.
size
();
i
++
){
MEdgeVertex
*
v
=
new
MEdgeVertex
(
mesh_vertices
[
i
]
->
x
(),
mesh_vertices
[
i
]
->
y
(),
MEdgeVertex
*
v
=
new
MEdgeVertex
(
mesh_vertices
[
i
]
->
x
(),
mesh_vertices
[
i
]
->
y
(),
...
@@ -582,6 +588,16 @@ void discreteEdge::interpolateInGeometry(MVertex *v, MVertex **v1,
...
@@ -582,6 +588,16 @@ void discreteEdge::interpolateInGeometry(MVertex *v, MVertex **v1,
void
discreteEdge
::
mesh
(
bool
verbose
){
void
discreteEdge
::
mesh
(
bool
verbose
){
#if defined(HAVE_MESH)
#if defined(HAVE_MESH)
if
(
!
CTX
::
instance
()
->
meshDiscrete
)
return
;
if
(
!
CTX
::
instance
()
->
meshDiscrete
)
return
;
/*
if(tag()==47 || tag() == 50 || tag() == 51 || tag() == 53 || tag() == 56){
for(unsigned int i =0; i<mesh_vertices.size(); i++){
double p;
mesh_vertices[i]->getParameter(0,p);
printf("%f\t",p);
}
printf("\n\n");
}
*/
meshGEdge
mesher
;
meshGEdge
mesher
;
mesher
(
this
);
mesher
(
this
);
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
Geo/discreteEdge.h
+
2
−
1
View file @
09152952
...
@@ -14,7 +14,7 @@ class discreteEdge : public GEdge {
...
@@ -14,7 +14,7 @@ class discreteEdge : public GEdge {
protected:
protected:
std
::
map
<
MVertex
*
,
MVertex
*>
v2v
;
std
::
map
<
MVertex
*
,
MVertex
*>
v2v
;
std
::
vector
<
double
>
_pars
;
std
::
vector
<
double
>
_pars
;
std
::
vector
<
int
>
_orientation
;
std
::
vector
<
int
>
_orientation
;
// ?
std
::
map
<
MVertex
*
,
MLine
*>
boundv
;
std
::
map
<
MVertex
*
,
MLine
*>
boundv
;
bool
createdTopo
;
bool
createdTopo
;
std
::
vector
<
MVertex
*>
discrete_vertices
;
std
::
vector
<
MVertex
*>
discrete_vertices
;
...
@@ -41,6 +41,7 @@ class discreteEdge : public GEdge {
...
@@ -41,6 +41,7 @@ class discreteEdge : public GEdge {
void
orderMLines
();
void
orderMLines
();
void
setBoundVertices
();
void
setBoundVertices
();
void
setTopo
(
std
::
vector
<
MLine
*>
);
void
createTopo
();
void
createTopo
();
void
createGeometry
();
void
createGeometry
();
void
computeNormals
()
const
;
void
computeNormals
()
const
;
...
...
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