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
ee262f99
Commit
ee262f99
authored
14 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
fix compile
parent
a280b999
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Geo/GModelFactory.h
+103
-69
103 additions, 69 deletions
Geo/GModelFactory.h
Geo/GRegion.cpp
+1
-1
1 addition, 1 deletion
Geo/GRegion.cpp
Mesh/meshGFaceOptimize.cpp
+38
-33
38 additions, 33 deletions
Mesh/meshGFaceOptimize.cpp
with
142 additions
and
103 deletions
Geo/GModelFactory.h
+
103
−
69
View file @
ee262f99
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#include
<vector>
#include
<vector>
#include
"GmshConfig.h"
#include
"GmshConfig.h"
#include
"GmshMessage.h"
class
GEntity
;
class
GEntity
;
class
GVertex
;
class
GVertex
;
...
@@ -26,116 +27,149 @@ class GModelFactory {
...
@@ -26,116 +27,149 @@ class GModelFactory {
// brep primitives
// brep primitives
enum
arcCreationMethod
{
THREE_POINTS
=
1
,
CENTER_START_END
=
2
};
enum
arcCreationMethod
{
THREE_POINTS
=
1
,
CENTER_START_END
=
2
};
enum
splineType
{
BEZIER
=
1
,
BSPLINE
=
2
};
enum
splineType
{
BEZIER
=
1
,
BSPLINE
=
2
};
// vertex primitive
virtual
GVertex
*
addVertex
(
GModel
*
gm
,
double
x
,
double
y
,
double
z
,
virtual
GVertex
*
addVertex
(
GModel
*
gm
,
double
x
,
double
y
,
double
z
,
double
lc
)
=
0
;
double
lc
)
=
0
;
// edge primitives
virtual
GEdge
*
addLine
(
GModel
*
,
GVertex
*
v1
,
GVertex
*
v2
)
=
0
;
virtual
GEdge
*
addLine
(
GModel
*
,
GVertex
*
v1
,
GVertex
*
v2
)
=
0
;
virtual
GFace
*
addPlanarFace
(
GModel
*
gm
,
std
::
vector
<
std
::
vector
<
GEdge
*>
>
edges
)
=
0
;
virtual
GRegion
*
addVolume
(
GModel
*
gm
,
std
::
vector
<
std
::
vector
<
GFace
*>
>
faces
)
=
0
;
virtual
GEdge
*
addCircleArc
(
GModel
*
gm
,
const
arcCreationMethod
&
method
,
virtual
GEdge
*
addCircleArc
(
GModel
*
gm
,
const
arcCreationMethod
&
method
,
GVertex
*
start
,
GVertex
*
end
,
GVertex
*
start
,
GVertex
*
end
,
const
SPoint3
&
aPoint
)
=
0
;
const
SPoint3
&
aPoint
)
{
Msg
::
Error
(
"addCircleArc not implemented yet"
);
return
0
;
}
virtual
GEdge
*
addSpline
(
GModel
*
gm
,
const
splineType
&
type
,
virtual
GEdge
*
addSpline
(
GModel
*
gm
,
const
splineType
&
type
,
GVertex
*
start
,
GVertex
*
start
,
GVertex
*
end
,
GVertex
*
end
,
std
::
vector
<
std
::
vector
<
double
>
>
controlPoints
)
=
0
;
std
::
vector
<
std
::
vector
<
double
>
>
controlPoints
)
{
Msg
::
Error
(
"addSpline not implemented yet"
);
return
0
;
}
virtual
GEdge
*
addNURBS
(
GModel
*
gm
,
GVertex
*
start
,
GVertex
*
end
,
virtual
GEdge
*
addNURBS
(
GModel
*
gm
,
GVertex
*
start
,
GVertex
*
end
,
std
::
vector
<
std
::
vector
<
double
>
>
controlPoints
,
std
::
vector
<
std
::
vector
<
double
>
>
controlPoints
,
std
::
vector
<
double
>
knots
,
std
::
vector
<
double
>
knots
,
std
::
vector
<
double
>
weights
,
std
::
vector
<
double
>
weights
,
std
::
vector
<
int
>
multiplicity
)
=
0
;
std
::
vector
<
int
>
multiplicity
)
// faces primitives
{
// this one tries to build a model face with one single list
Msg
::
Error
(
"addNURBS not implemented yet"
);
// of faces. If boundaries are co-planar, then it's a plane,
return
0
;
// otherwise, we tru ruled, sweep or other kind of surfaces
}
// this one tries to build a model face with one single list of
// faces. If boundaries are co-planar, then it's a plane, otherwise,
// we tru ruled, sweep or other kind of surfaces
virtual
std
::
vector
<
GFace
*>
addRuledFaces
(
GModel
*
gm
,
virtual
std
::
vector
<
GFace
*>
addRuledFaces
(
GModel
*
gm
,
std
::
vector
<
std
::
vector
<
GEdge
*>
>
edges
)
=
0
;
std
::
vector
<
std
::
vector
<
GEdge
*>
>
edges
)
{
Msg
::
Error
(
"addRuledFaces not implemented yet"
);
return
std
::
vector
<
GFace
*>
();
}
virtual
GFace
*
addFace
(
GModel
*
gm
,
std
::
vector
<
GEdge
*>
edges
,
virtual
GFace
*
addFace
(
GModel
*
gm
,
std
::
vector
<
GEdge
*>
edges
,
std
::
vector
<
std
::
vector
<
double
>
>
points
)
=
0
;
std
::
vector
<
std
::
vector
<
double
>
>
points
)
virtual
GFace
*
addPlanarFace
(
GModel
*
gm
,
std
::
vector
<
std
::
vector
<
GEdge
*>
>
edges
)
=
0
;
{
Msg
::
Error
(
"addFace not implemented yet"
);
return
0
;
}
// sweep stuff
// sweep stuff
virtual
GEntity
*
revolve
(
GModel
*
gm
,
GEntity
*
,
std
::
vector
<
double
>
p1
,
virtual
GEntity
*
revolve
(
GModel
*
gm
,
GEntity
*
,
std
::
vector
<
double
>
p1
,
std
::
vector
<
double
>
p2
,
double
angle
)
=
0
;
std
::
vector
<
double
>
p2
,
double
angle
)
{
Msg
::
Error
(
"revolve not implemented yet"
);
return
0
;
}
virtual
GEntity
*
extrude
(
GModel
*
gm
,
GEntity
*
,
std
::
vector
<
double
>
p1
,
virtual
GEntity
*
extrude
(
GModel
*
gm
,
GEntity
*
,
std
::
vector
<
double
>
p1
,
std
::
vector
<
double
>
p2
)
=
0
;
std
::
vector
<
double
>
p2
)
virtual
GEntity
*
addPipe
(
GModel
*
gm
,
GEntity
*
base
,
std
::
vector
<
GEdge
*>
wire
)
=
0
;
{
Msg
::
Error
(
"extrude not implemented yet"
);
return
0
;
}
virtual
GEntity
*
addPipe
(
GModel
*
gm
,
GEntity
*
base
,
std
::
vector
<
GEdge
*>
wire
)
{
Msg
::
Error
(
"addPipe not implemented yet"
);
return
0
;
}
// solid primitives
// solid primitives
virtual
GEntity
*
addSphere
(
GModel
*
gm
,
double
cx
,
double
cy
,
double
cz
,
virtual
GEntity
*
addSphere
(
GModel
*
gm
,
double
cx
,
double
cy
,
double
cz
,
double
radius
)
=
0
;
double
radius
)
{
Msg
::
Error
(
"addSphere not implemented yet"
);
return
0
;
}
virtual
GEntity
*
addCylinder
(
GModel
*
gm
,
std
::
vector
<
double
>
p1
,
virtual
GEntity
*
addCylinder
(
GModel
*
gm
,
std
::
vector
<
double
>
p1
,
std
::
vector
<
double
>
p2
,
double
radius
)
=
0
;
std
::
vector
<
double
>
p2
,
double
radius
)
{
Msg
::
Error
(
"addCylinder not implemented yet"
);
return
0
;
}
virtual
GEntity
*
addTorus
(
GModel
*
gm
,
std
::
vector
<
double
>
p1
,
virtual
GEntity
*
addTorus
(
GModel
*
gm
,
std
::
vector
<
double
>
p1
,
std
::
vector
<
double
>
p2
,
double
radius1
,
std
::
vector
<
double
>
p2
,
double
radius1
,
double
radius2
)
=
0
;
double
radius2
)
{
Msg
::
Error
(
"addTorus not implemented yet"
);
return
0
;
}
virtual
GEntity
*
addBlock
(
GModel
*
gm
,
std
::
vector
<
double
>
p1
,
virtual
GEntity
*
addBlock
(
GModel
*
gm
,
std
::
vector
<
double
>
p1
,
std
::
vector
<
double
>
p2
)
=
0
;
std
::
vector
<
double
>
p2
)
{
Msg
::
Error
(
"addBlock not implemented yet"
);
return
0
;
}
virtual
GEntity
*
addCone
(
GModel
*
gm
,
std
::
vector
<
double
>
p1
,
virtual
GEntity
*
addCone
(
GModel
*
gm
,
std
::
vector
<
double
>
p1
,
std
::
vector
<
double
>
p2
,
double
radius1
,
std
::
vector
<
double
>
p2
,
double
radius1
,
double
radius2
)
=
0
;
double
radius2
)
{
Msg
::
Error
(
"addCone not implemented yet"
);
return
0
;
}
// here, we should give a list of GEdges. Yet, I still can't figure out how
// here, we should give a list of GEdges. Yet, I still can't figure out how
// to get those automatically ... wait and see
// to get those automatically ... wait and see
virtual
void
fillet
(
GModel
*
gm
,
std
::
vector
<
int
>
edges
,
double
radius
)
=
0
;
virtual
void
fillet
(
GModel
*
gm
,
std
::
vector
<
int
>
edges
,
double
radius
)
{
Msg
::
Error
(
"fillet not implemented yet"
);
}
// rigid body motions
// rigid body motions
virtual
void
translate
(
GModel
*
gm
,
std
::
vector
<
double
>
dx
,
int
addToTheModel
)
=
0
;
virtual
void
translate
(
GModel
*
gm
,
std
::
vector
<
double
>
dx
,
int
addToTheModel
)
{
Msg
::
Error
(
"translate not implemented yet"
);
}
virtual
void
rotate
(
GModel
*
gm
,
std
::
vector
<
double
>
p1
,
std
::
vector
<
double
>
p2
,
virtual
void
rotate
(
GModel
*
gm
,
std
::
vector
<
double
>
p1
,
std
::
vector
<
double
>
p2
,
double
angle
,
int
addToTheModel
)
=
0
;
double
angle
,
int
addToTheModel
)
{
Msg
::
Error
(
"rotate not implemented yet"
);
}
// boolean operators acting on 2 GModels
// boolean operators acting on 2 GModels
virtual
GModel
*
computeBooleanUnion
(
GModel
*
obj
,
GModel
*
tool
,
int
createNewModel
)
=
0
;
virtual
GModel
*
computeBooleanUnion
(
GModel
*
obj
,
GModel
*
tool
,
int
createNewModel
)
{
Msg
::
Error
(
"computeBooleanUnion not implemented yet"
);
return
0
;
}
virtual
GModel
*
computeBooleanIntersection
(
GModel
*
obj
,
GModel
*
tool
,
virtual
GModel
*
computeBooleanIntersection
(
GModel
*
obj
,
GModel
*
tool
,
int
createNewModel
)
=
0
;
int
createNewModel
)
{
Msg
::
Error
(
"computeBooleanIntersection not implemented yet"
);
return
0
;
}
virtual
GModel
*
computeBooleanDifference
(
GModel
*
obj
,
GModel
*
tool
,
virtual
GModel
*
computeBooleanDifference
(
GModel
*
obj
,
GModel
*
tool
,
int
createNewModel
)
=
0
;
int
createNewModel
)
virtual
GRegion
*
addVolume
(
GModel
*
gm
,
std
::
vector
<
std
::
vector
<
GFace
*>
>
faces
)
=
0
;
{
Msg
::
Error
(
"computeBooleanDifference not implemented yet"
);
return
0
;
}
};
};
class
GeoFactory
:
public
GModelFactory
{
class
GeoFactory
:
public
GModelFactory
{
public:
public:
GeoFactory
(){}
GeoFactory
(){}
GVertex
*
addVertex
(
GModel
*
gm
,
double
x
,
double
y
,
double
z
,
double
lc
);
GVertex
*
addVertex
(
GModel
*
gm
,
double
x
,
double
y
,
double
z
,
double
lc
);
virtual
GEdge
*
addLine
(
GModel
*
gm
,
GVertex
*
v1
,
GVertex
*
v2
);
GEdge
*
addLine
(
GModel
*
gm
,
GVertex
*
v1
,
GVertex
*
v2
);
GFace
*
addPlanarFace
(
GModel
*
gm
,
std
::
vector
<
std
::
vector
<
GEdge
*>
>
edges
);
GFace
*
addPlanarFace
(
GModel
*
gm
,
std
::
vector
<
std
::
vector
<
GEdge
*>
>
edges
);
GRegion
*
addVolume
(
GModel
*
gm
,
std
::
vector
<
std
::
vector
<
GFace
*>
>
faces
);
GRegion
*
addVolume
(
GModel
*
gm
,
std
::
vector
<
std
::
vector
<
GFace
*>
>
faces
);
//not implemented yet
GEdge
*
addCircleArc
(
GModel
*
gm
,
const
arcCreationMethod
&
method
,
GVertex
*
start
,
GVertex
*
end
,
const
SPoint3
&
aPoint
){};
GEdge
*
addSpline
(
GModel
*
gm
,
const
splineType
&
type
,
GVertex
*
start
,
GVertex
*
end
,
std
::
vector
<
std
::
vector
<
double
>
>
controlPoints
){};
GEdge
*
addNURBS
(
GModel
*
gm
,
GVertex
*
start
,
GVertex
*
end
,
std
::
vector
<
std
::
vector
<
double
>
>
controlPoints
,
std
::
vector
<
double
>
knots
,
std
::
vector
<
double
>
weights
,
std
::
vector
<
int
>
multiplicity
){};
GEntity
*
revolve
(
GModel
*
gm
,
GEntity
*
,
std
::
vector
<
double
>
p1
,
std
::
vector
<
double
>
p2
,
double
angle
){};
GEntity
*
extrude
(
GModel
*
gm
,
GEntity
*
,
std
::
vector
<
double
>
p1
,
std
::
vector
<
double
>
p2
){};
GEntity
*
addPipe
(
GModel
*
gm
,
GEntity
*
base
,
std
::
vector
<
GEdge
*>
wire
){};
GEntity
*
addSphere
(
GModel
*
gm
,
double
cx
,
double
cy
,
double
cz
,
double
radius
){};
GEntity
*
addCylinder
(
GModel
*
gm
,
std
::
vector
<
double
>
p1
,
std
::
vector
<
double
>
p2
,
double
radius
){};
std
::
vector
<
GFace
*>
addRuledFaces
(
GModel
*
gm
,
std
::
vector
<
std
::
vector
<
GEdge
*>
>
edges
){};
GFace
*
addFace
(
GModel
*
gm
,
std
::
vector
<
GEdge
*>
edges
,
std
::
vector
<
std
::
vector
<
double
>
>
points
){};
GEntity
*
addTorus
(
GModel
*
gm
,
std
::
vector
<
double
>
p1
,
std
::
vector
<
double
>
p2
,
double
radius1
,
double
radius2
){};
GEntity
*
addBlock
(
GModel
*
gm
,
std
::
vector
<
double
>
p1
,
std
::
vector
<
double
>
p2
){};
GEntity
*
addCone
(
GModel
*
gm
,
std
::
vector
<
double
>
p1
,
std
::
vector
<
double
>
p2
,
double
radius1
,
double
radius2
){};
void
translate
(
GModel
*
gm
,
std
::
vector
<
double
>
dx
,
int
addToTheModel
){};
void
rotate
(
GModel
*
gm
,
std
::
vector
<
double
>
p1
,
std
::
vector
<
double
>
p2
,
double
angle
,
int
addToTheModel
){};
GModel
*
computeBooleanUnion
(
GModel
*
obj
,
GModel
*
tool
,
int
createNewModel
){};
GModel
*
computeBooleanIntersection
(
GModel
*
obj
,
GModel
*
tool
,
int
createNewModel
){};
GModel
*
computeBooleanDifference
(
GModel
*
obj
,
GModel
*
tool
,
int
createNewModel
){};
void
fillet
(
GModel
*
gm
,
std
::
vector
<
int
>
edges
,
double
radius
){};
};
};
...
@@ -170,6 +204,7 @@ class OCCFactory : public GModelFactory {
...
@@ -170,6 +204,7 @@ class OCCFactory : public GModelFactory {
GFace
*
addFace
(
GModel
*
gm
,
std
::
vector
<
GEdge
*>
edges
,
GFace
*
addFace
(
GModel
*
gm
,
std
::
vector
<
GEdge
*>
edges
,
std
::
vector
<
std
::
vector
<
double
>
>
points
);
std
::
vector
<
std
::
vector
<
double
>
>
points
);
GFace
*
addPlanarFace
(
GModel
*
gm
,
std
::
vector
<
std
::
vector
<
GEdge
*>
>
edges
);
GFace
*
addPlanarFace
(
GModel
*
gm
,
std
::
vector
<
std
::
vector
<
GEdge
*>
>
edges
);
GRegion
*
addVolume
(
GModel
*
gm
,
std
::
vector
<
std
::
vector
<
GFace
*>
>
faces
);
GEntity
*
addTorus
(
GModel
*
gm
,
std
::
vector
<
double
>
p1
,
std
::
vector
<
double
>
p2
,
GEntity
*
addTorus
(
GModel
*
gm
,
std
::
vector
<
double
>
p1
,
std
::
vector
<
double
>
p2
,
double
radius1
,
double
radius2
);
double
radius1
,
double
radius2
);
GEntity
*
addBlock
(
GModel
*
gm
,
std
::
vector
<
double
>
p1
,
std
::
vector
<
double
>
p2
);
GEntity
*
addBlock
(
GModel
*
gm
,
std
::
vector
<
double
>
p1
,
std
::
vector
<
double
>
p2
);
...
@@ -182,7 +217,6 @@ class OCCFactory : public GModelFactory {
...
@@ -182,7 +217,6 @@ class OCCFactory : public GModelFactory {
GModel
*
computeBooleanIntersection
(
GModel
*
obj
,
GModel
*
tool
,
int
createNewModel
);
GModel
*
computeBooleanIntersection
(
GModel
*
obj
,
GModel
*
tool
,
int
createNewModel
);
GModel
*
computeBooleanDifference
(
GModel
*
obj
,
GModel
*
tool
,
int
createNewModel
);
GModel
*
computeBooleanDifference
(
GModel
*
obj
,
GModel
*
tool
,
int
createNewModel
);
void
fillet
(
GModel
*
gm
,
std
::
vector
<
int
>
edges
,
double
radius
);
void
fillet
(
GModel
*
gm
,
std
::
vector
<
int
>
edges
,
double
radius
);
GRegion
*
addVolume
(
GModel
*
gm
,
std
::
vector
<
std
::
vector
<
GFace
*>
>
faces
);
};
};
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
Geo/GRegion.cpp
+
1
−
1
View file @
ee262f99
...
@@ -310,7 +310,7 @@ double GRegion::computeSolidProperties (std::vector<double> cg,
...
@@ -310,7 +310,7 @@ double GRegion::computeSolidProperties (std::vector<double> cg,
double
surface
=
0
;
double
surface
=
0
;
cg
[
0
]
=
cg
[
1
]
=
cg
[
2
]
=
0.0
;
cg
[
0
]
=
cg
[
1
]
=
cg
[
2
]
=
0.0
;
for
(
;
it
!=
l_faces
.
end
();
++
it
,
++
itdir
){
for
(
;
it
!=
l_faces
.
end
();
++
it
,
++
itdir
){
printf
(
"face %d dir %d %d elements
\n
"
,(
*
it
)
->
tag
(),
*
itdir
,(
*
it
)
->
triangles
.
size
());
printf
(
"face %d dir %d %d elements
\n
"
,(
*
it
)
->
tag
(),
*
itdir
,(
int
)(
*
it
)
->
triangles
.
size
());
for
(
int
i
=
0
;
i
<
(
*
it
)
->
triangles
.
size
();
++
i
){
for
(
int
i
=
0
;
i
<
(
*
it
)
->
triangles
.
size
();
++
i
){
MTriangle
*
e
=
(
*
it
)
->
triangles
[
i
];
MTriangle
*
e
=
(
*
it
)
->
triangles
[
i
];
// MElement *e = (*it)->getMeshElement(i);
// MElement *e = (*it)->getMeshElement(i);
...
...
This diff is collapsed.
Click to expand it.
Mesh/meshGFaceOptimize.cpp
+
38
−
33
View file @
ee262f99
...
@@ -308,7 +308,6 @@ double surfaceTriangleUV(MVertex *v1, MVertex *v2, MVertex *v3,
...
@@ -308,7 +308,6 @@ double surfaceTriangleUV(MVertex *v1, MVertex *v2, MVertex *v3,
int
_removeFourTrianglesNodes
(
GFace
*
gf
,
bool
replace_by_quads
)
int
_removeFourTrianglesNodes
(
GFace
*
gf
,
bool
replace_by_quads
)
{
{
v2t_cont
adj
;
v2t_cont
adj
;
buildVertexToElement
(
gf
->
triangles
,
adj
);
buildVertexToElement
(
gf
->
triangles
,
adj
);
v2t_cont
::
iterator
it
=
adj
.
begin
();
v2t_cont
::
iterator
it
=
adj
.
begin
();
...
@@ -326,7 +325,6 @@ int _removeFourTrianglesNodes(GFace *gf,bool replace_by_quads)
...
@@ -326,7 +325,6 @@ int _removeFourTrianglesNodes(GFace *gf,bool replace_by_quads)
break
;
break
;
}
}
int
j
;
int
j
;
surfaceRef
+=
surfaceFaceUV
(
lt
[
i
],
gf
);
surfaceRef
+=
surfaceFaceUV
(
lt
[
i
],
gf
);
for
(
j
=
0
;
j
<
3
;
j
++
)
{
for
(
j
=
0
;
j
<
3
;
j
++
)
{
if
(
lt
[
i
]
->
getVertex
(
j
)
==
it
->
first
)
{
if
(
lt
[
i
]
->
getVertex
(
j
)
==
it
->
first
)
{
...
@@ -355,10 +353,13 @@ int _removeFourTrianglesNodes(GFace *gf,bool replace_by_quads)
...
@@ -355,10 +353,13 @@ int _removeFourTrianglesNodes(GFace *gf,bool replace_by_quads)
}
}
}
}
}
}
if
(
edges
[
0
][
1
]
==
edges
[
1
][
0
]
&&
edges
[
1
][
1
]
==
edges
[
2
][
0
]
&&
edges
[
2
][
1
]
==
edges
[
3
][
0
]
&&
edges
[
3
][
1
]
==
edges
[
0
][
0
])
{
if
(
edges
[
0
][
1
]
==
edges
[
1
][
0
]
&&
edges
[
1
][
1
]
==
edges
[
2
][
0
]
&&
edges
[
2
][
1
]
==
edges
[
3
][
0
]
&&
edges
[
3
][
1
]
==
edges
[
0
][
0
])
{
if
(
replace_by_quads
){
if
(
replace_by_quads
){
gf
->
quadrangles
.
push_back
(
new
MQuadrangle
(
edges
[
0
][
0
],
edges
[
1
][
0
],
edges
[
2
][
0
],
edges
[
3
][
0
]));
gf
->
quadrangles
.
push_back
(
new
MQuadrangle
(
edges
[
0
][
0
],
edges
[
1
][
0
],
}
else
{
edges
[
2
][
0
],
edges
[
3
][
0
]));
}
else
{
MTriangle
*
newt
[
4
];
MTriangle
*
newt
[
4
];
double
surf
[
4
],
qual
[
4
];
double
surf
[
4
],
qual
[
4
];
for
(
int
i
=
0
;
i
<
4
;
i
++
){
for
(
int
i
=
0
;
i
<
4
;
i
++
){
...
@@ -366,19 +367,23 @@ int _removeFourTrianglesNodes(GFace *gf,bool replace_by_quads)
...
@@ -366,19 +367,23 @@ int _removeFourTrianglesNodes(GFace *gf,bool replace_by_quads)
surf
[
i
]
=
surfaceFaceUV
(
newt
[
i
],
gf
);
surf
[
i
]
=
surfaceFaceUV
(
newt
[
i
],
gf
);
qual
[
i
]
=
qmTriangle
(
newt
[
i
],
QMTRI_RHO
);
qual
[
i
]
=
qmTriangle
(
newt
[
i
],
QMTRI_RHO
);
}
}
double
q02
=
(
fabs
((
surf
[
0
]
+
surf
[
2
]
-
surfaceRef
)
/
surfaceRef
)
<
1e-8
)
?
std
::
min
(
qual
[
0
],
qual
[
2
])
:
-
1
;
double
q02
=
(
fabs
((
surf
[
0
]
+
surf
[
2
]
-
surfaceRef
)
/
surfaceRef
)
<
1e-8
)
?
double
q13
=
(
fabs
((
surf
[
1
]
+
surf
[
3
]
-
surfaceRef
)
/
surfaceRef
)
<
1e-8
)
?
std
::
min
(
qual
[
1
],
qual
[
3
])
:
-
1
;
std
::
min
(
qual
[
0
],
qual
[
2
])
:
-
1
;
double
q13
=
(
fabs
((
surf
[
1
]
+
surf
[
3
]
-
surfaceRef
)
/
surfaceRef
)
<
1e-8
)
?
std
::
min
(
qual
[
1
],
qual
[
3
])
:
-
1
;
if
(
q02
>
q13
&&
q02
>
0
)
{
if
(
q02
>
q13
&&
q02
>
0
)
{
delete
newt
[
1
];
delete
newt
[
1
];
delete
newt
[
3
];
delete
newt
[
3
];
gf
->
triangles
.
push_back
(
newt
[
0
]);
gf
->
triangles
.
push_back
(
newt
[
0
]);
gf
->
triangles
.
push_back
(
newt
[
2
]);
gf
->
triangles
.
push_back
(
newt
[
2
]);
}
else
if
(
q13
>
0
)
{
}
else
if
(
q13
>
0
)
{
delete
newt
[
0
];
delete
newt
[
0
];
delete
newt
[
2
];
delete
newt
[
2
];
gf
->
triangles
.
push_back
(
newt
[
1
]);
gf
->
triangles
.
push_back
(
newt
[
1
]);
gf
->
triangles
.
push_back
(
newt
[
3
]);
gf
->
triangles
.
push_back
(
newt
[
3
]);
}
else
{
}
else
{
it
++
;
it
++
;
continue
;
continue
;
}
}
...
@@ -531,7 +536,7 @@ static bool _isItAGoodIdeaToCollapseThatVertex (GFace *gf,
...
@@ -531,7 +536,7 @@ static bool _isItAGoodIdeaToCollapseThatVertex (GFace *gf,
// v->setParameter(0,p.x());
// v->setParameter(0,p.x());
// v->setParameter(1,p.y());
// v->setParameter(1,p.y());
for
(
int
j
=
0
;
j
<
e1
.
size
();
++
j
){
for
(
unsigned
int
j
=
0
;
j
<
e1
.
size
();
++
j
){
surface_old
+=
surfaceFaceUV
(
e1
[
j
],
gf
);
surface_old
+=
surfaceFaceUV
(
e1
[
j
],
gf
);
// worst_quality_old = std::min(worst_quality_old,e1[j]-> etaShapeMeasure());
// worst_quality_old = std::min(worst_quality_old,e1[j]-> etaShapeMeasure());
for
(
int
k
=
0
;
k
<
e1
[
j
]
->
getNumVertices
();
k
++
){
for
(
int
k
=
0
;
k
<
e1
[
j
]
->
getNumVertices
();
k
++
){
...
@@ -546,7 +551,7 @@ static bool _isItAGoodIdeaToCollapseThatVertex (GFace *gf,
...
@@ -546,7 +551,7 @@ static bool _isItAGoodIdeaToCollapseThatVertex (GFace *gf,
}
}
}
}
for
(
int
j
=
0
;
j
<
e2
.
size
();
++
j
){
for
(
unsigned
int
j
=
0
;
j
<
e2
.
size
();
++
j
){
surface_old
+=
surfaceFaceUV
(
e2
[
j
],
gf
);
surface_old
+=
surfaceFaceUV
(
e2
[
j
],
gf
);
// worst_quality_old = std::min(worst_quality_old,e2[j]-> etaShapeMeasure());
// worst_quality_old = std::min(worst_quality_old,e2[j]-> etaShapeMeasure());
for
(
int
k
=
0
;
k
<
e2
[
j
]
->
getNumVertices
();
k
++
){
for
(
int
k
=
0
;
k
<
e2
[
j
]
->
getNumVertices
();
k
++
){
...
@@ -583,13 +588,13 @@ static bool _isItAGoodIdeaToMoveThatVertex (GFace *gf,
...
@@ -583,13 +588,13 @@ static bool _isItAGoodIdeaToMoveThatVertex (GFace *gf,
double
surface_old
=
0
;
double
surface_old
=
0
;
double
surface_new
=
0
;
double
surface_new
=
0
;
for
(
int
j
=
0
;
j
<
e1
.
size
();
++
j
)
for
(
unsigned
int
j
=
0
;
j
<
e1
.
size
();
++
j
)
surface_old
+=
surfaceFaceUV
(
e1
[
j
],
gf
);
surface_old
+=
surfaceFaceUV
(
e1
[
j
],
gf
);
v1
->
setParameter
(
0
,
after
.
x
());
v1
->
setParameter
(
0
,
after
.
x
());
v1
->
setParameter
(
1
,
after
.
y
());
v1
->
setParameter
(
1
,
after
.
y
());
for
(
int
j
=
0
;
j
<
e1
.
size
();
++
j
)
for
(
unsigned
int
j
=
0
;
j
<
e1
.
size
();
++
j
)
surface_new
+=
surfaceFaceUV
(
e1
[
j
],
gf
);
surface_new
+=
surfaceFaceUV
(
e1
[
j
],
gf
);
v1
->
setParameter
(
0
,
before
.
x
());
v1
->
setParameter
(
0
,
before
.
x
());
...
@@ -648,7 +653,7 @@ static int _quadWithOneVertexOnBoundary (GFace *gf,
...
@@ -648,7 +653,7 @@ static int _quadWithOneVertexOnBoundary (GFace *gf,
*/
*/
// if (line.size() == 2)printf("caca\n");
// if (line.size() == 2)printf("caca\n");
// else printf("hohcozbucof\n");
// else printf("hohcozbucof\n");
for
(
int
j
=
0
;
j
<
e2
.
size
();
++
j
){
for
(
unsigned
int
j
=
0
;
j
<
e2
.
size
();
++
j
){
for
(
int
k
=
0
;
k
<
e2
[
j
]
->
getNumVertices
();
k
++
){
for
(
int
k
=
0
;
k
<
e2
[
j
]
->
getNumVertices
();
k
++
){
if
(
e2
[
j
]
->
getVertex
(
k
)
==
v2
&&
e2
[
j
]
!=
q
)
if
(
e2
[
j
]
->
getVertex
(
k
)
==
v2
&&
e2
[
j
]
!=
q
)
e2
[
j
]
->
setVertex
(
k
,
v4
);
e2
[
j
]
->
setVertex
(
k
,
v4
);
...
@@ -663,8 +668,8 @@ static int _quadWithOneVertexOnBoundary (GFace *gf,
...
@@ -663,8 +668,8 @@ static int _quadWithOneVertexOnBoundary (GFace *gf,
static
int
_countCommon
(
std
::
vector
<
MElement
*>
&
a
,
std
::
vector
<
MElement
*>
&
b
)
{
static
int
_countCommon
(
std
::
vector
<
MElement
*>
&
a
,
std
::
vector
<
MElement
*>
&
b
)
{
int
count
=
0
;
int
count
=
0
;
for
(
int
i
=
0
;
i
<
a
.
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
a
.
size
();
i
++
){
for
(
int
j
=
0
;
j
<
b
.
size
();
j
++
){
for
(
unsigned
int
j
=
0
;
j
<
b
.
size
();
j
++
){
if
(
a
[
i
]
==
b
[
j
])
count
++
;
if
(
a
[
i
]
==
b
[
j
])
count
++
;
}
}
}
}
...
@@ -718,7 +723,7 @@ static int _removeDiamonds(GFace *gf)
...
@@ -718,7 +723,7 @@ static int _removeDiamonds(GFace *gf)
touched
.
insert
(
v2
);
touched
.
insert
(
v2
);
touched
.
insert
(
v3
);
touched
.
insert
(
v3
);
touched
.
insert
(
v4
);
touched
.
insert
(
v4
);
for
(
int
j
=
0
;
j
<
it1
->
second
.
size
();
++
j
){
for
(
unsigned
int
j
=
0
;
j
<
it1
->
second
.
size
();
++
j
){
for
(
int
k
=
0
;
k
<
it1
->
second
[
j
]
->
getNumVertices
();
k
++
){
for
(
int
k
=
0
;
k
<
it1
->
second
[
j
]
->
getNumVertices
();
k
++
){
if
(
it1
->
second
[
j
]
->
getVertex
(
k
)
==
v1
&&
it1
->
second
[
j
]
!=
q
)
if
(
it1
->
second
[
j
]
->
getVertex
(
k
)
==
v1
&&
it1
->
second
[
j
]
!=
q
)
it1
->
second
[
j
]
->
setVertex
(
k
,
v3
);
it1
->
second
[
j
]
->
setVertex
(
k
,
v3
);
...
@@ -738,7 +743,7 @@ static int _removeDiamonds(GFace *gf)
...
@@ -738,7 +743,7 @@ static int _removeDiamonds(GFace *gf)
touched
.
insert
(
v2
);
touched
.
insert
(
v2
);
touched
.
insert
(
v3
);
touched
.
insert
(
v3
);
touched
.
insert
(
v4
);
touched
.
insert
(
v4
);
for
(
int
j
=
0
;
j
<
it2
->
second
.
size
();
++
j
){
for
(
unsigned
int
j
=
0
;
j
<
it2
->
second
.
size
();
++
j
){
for
(
int
k
=
0
;
k
<
it2
->
second
[
j
]
->
getNumVertices
();
k
++
){
for
(
int
k
=
0
;
k
<
it2
->
second
[
j
]
->
getNumVertices
();
k
++
){
if
(
it2
->
second
[
j
]
->
getVertex
(
k
)
==
v2
&&
it2
->
second
[
j
]
!=
q
)
if
(
it2
->
second
[
j
]
->
getVertex
(
k
)
==
v2
&&
it2
->
second
[
j
]
!=
q
)
it2
->
second
[
j
]
->
setVertex
(
k
,
v4
);
it2
->
second
[
j
]
->
setVertex
(
k
,
v4
);
...
@@ -1376,7 +1381,7 @@ static int _recombineIntoQuads(GFace *gf, int recur_level, bool cubicGraph = 1)
...
@@ -1376,7 +1381,7 @@ static int _recombineIntoQuads(GFace *gf, int recur_level, bool cubicGraph = 1)
Msg
::
Debug
(
"Perfect Match Starts %d edges %d nodes"
,
ecount
,
ncount
);
Msg
::
Debug
(
"Perfect Match Starts %d edges %d nodes"
,
ecount
,
ncount
);
std
::
map
<
MElement
*
,
int
>
t2n
;
std
::
map
<
MElement
*
,
int
>
t2n
;
std
::
map
<
int
,
MElement
*>
n2t
;
std
::
map
<
int
,
MElement
*>
n2t
;
for
(
int
i
=
0
;
i
<
gf
->
triangles
.
size
();
++
i
){
for
(
unsigned
int
i
=
0
;
i
<
gf
->
triangles
.
size
();
++
i
){
t2n
[
gf
->
triangles
[
i
]]
=
i
;
t2n
[
gf
->
triangles
[
i
]]
=
i
;
n2t
[
i
]
=
gf
->
triangles
[
i
];
n2t
[
i
]
=
gf
->
triangles
[
i
];
}
}
...
@@ -1437,7 +1442,7 @@ static int _recombineIntoQuads(GFace *gf, int recur_level, bool cubicGraph = 1)
...
@@ -1437,7 +1442,7 @@ static int _recombineIntoQuads(GFace *gf, int recur_level, bool cubicGraph = 1)
Msg
::
Warning
(
"Perfect Match Failed in Quadrangulation, Applying Graph Splits"
);
Msg
::
Warning
(
"Perfect Match Failed in Quadrangulation, Applying Graph Splits"
);
std
::
set
<
MElement
*>
removed
;
std
::
set
<
MElement
*>
removed
;
std
::
vector
<
MTriangle
*>
triangles2
;
std
::
vector
<
MTriangle
*>
triangles2
;
for
(
int
i
=
0
;
i
<
pairs
.
size
();
++
i
){
for
(
unsigned
int
i
=
0
;
i
<
pairs
.
size
();
++
i
){
RecombineTriangle
&
rt
=
pairs
[
i
];
RecombineTriangle
&
rt
=
pairs
[
i
];
if
((
rt
.
n1
->
onWhat
()
->
dim
()
<
2
&&
if
((
rt
.
n1
->
onWhat
()
->
dim
()
<
2
&&
rt
.
n2
->
onWhat
()
->
dim
()
<
2
)
||
rt
.
n2
->
onWhat
()
->
dim
()
<
2
)
||
...
...
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