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
1364f936
Commit
1364f936
authored
8 years ago
by
PA Beaufort
Browse files
Options
Downloads
Patches
Plain Diff
setting of the optimizer for P2 parameterization
parent
0dea8b19
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/discreteDiskFace.cpp
+91
-4
91 additions, 4 deletions
Geo/discreteDiskFace.cpp
Geo/discreteDiskFace.h
+3
-14
3 additions, 14 deletions
Geo/discreteDiskFace.h
Geo/discreteFace.cpp
+5
-5
5 additions, 5 deletions
Geo/discreteFace.cpp
with
99 additions
and
23 deletions
Geo/discreteDiskFace.cpp
+
91
−
4
View file @
1364f936
...
@@ -26,6 +26,8 @@
...
@@ -26,6 +26,8 @@
#include
"convexCombinationTerm.h"
// #FIXME
#include
"convexCombinationTerm.h"
// #FIXME
#include
"qualityMeasuresJacobian.h"
// #temporary?
#include
"qualityMeasuresJacobian.h"
// #temporary?
#include
"OptHomRun.h"
#include
"MeshQualityOptimizer.h"
static
inline
void
functionShapes
(
int
p
,
double
Xi
[
2
],
double
*
phi
)
static
inline
void
functionShapes
(
int
p
,
double
Xi
[
2
],
double
*
phi
)
{
{
...
@@ -286,13 +288,17 @@ discreteDiskFace::discreteDiskFace(int id, GFace *gf, triangulation* diskTriangu
...
@@ -286,13 +288,17 @@ discreteDiskFace::discreteDiskFace(int id, GFace *gf, triangulation* diskTriangu
if
(
!
checkOrientationUV
()){
if
(
!
checkOrientationUV
()){
Msg
::
Info
(
"discreteDiskFace:: parametrization is not one-to-one; fixing "
Msg
::
Info
(
"discreteDiskFace:: parametrization is not one-to-one; fixing "
"the discrete system."
);
"the discrete system."
);
parametrize
(
true
);
//parametrize(true);
//buildOct(CAD);
optimize
();
buildOct
(
CAD
);
buildOct
(
CAD
);
}
}
putOnView
(
true
,
false
);
putOnView
(
true
,
false
);
printParamMesh
();
printParamMesh
();
if
(
!
checkOrientationUV
())
Msg
::
Fatal
(
"discreteDiskFace:: failing to fix the discrete system"
);
if
(
!
checkOrientationUV
())
Msg
::
Fatal
(
"discreteDiskFace:: failing to fix the discrete system"
);
else
Msg
::
Info
(
"Parameterization done :-)"
);
}
}
/*end BUILDER*/
/*end BUILDER*/
...
@@ -497,6 +503,87 @@ bool discreteDiskFace::checkOrientationUV()
...
@@ -497,6 +503,87 @@ bool discreteDiskFace::checkOrientationUV()
}
}
}
}
void
discreteDiskFace
::
optimize
(){
// parameters for mesh optimization
// -- high order
OptHomParameters
optParams
;
optParams
.
dim
=
2
;
optParams
.
optPassMax
=
10
;
optParams
.
TMAX
=
300
;
optParams
.
fixBndNodes
=
true
;
optParams
.
strategy
=
1
;
// -- linear
MeshQualOptParameters
opt
;
opt
.
dim
=
2
;
opt
.
fixBndNodes
=
true
;
//creating the "geometry" of the parametrization, and its corresponding mesh
// -- generation of parametric nodes
std
::
map
<
SPoint3
,
MVertex
*>
sp2mv
;
std
::
vector
<
MElement
*>
paramTriangles
;
for
(
std
::
map
<
MVertex
*
,
SPoint3
>::
iterator
it
=
coordinates
.
begin
();
it
!=
coordinates
.
end
();
++
it
)
sp2mv
[
it
->
second
]
=
new
MVertex
(
it
->
second
.
x
(),
it
->
second
.
y
(),
0.
);
// -- generation of parametric triangles
paramTriangles
.
resize
(
discrete_triangles
.
size
()
-
geoTriangulation
->
fillingHoles
.
size
());
for
(
unsigned
int
i
=
0
;
i
<
discrete_triangles
.
size
()
-
geoTriangulation
->
fillingHoles
.
size
();
i
++
){
discreteDiskFaceTriangle
*
ct
=
&
_ddft
[
i
];
std
::
vector
<
MVertex
*>
mv
;
mv
.
resize
(
ct
->
tri
->
getNumVertices
());
for
(
int
j
=
0
;
j
<
ct
->
tri
->
getNumVertices
();
j
++
)
mv
[
j
]
=
sp2mv
[
ct
->
p
[
j
]];
if
(
_order
==
1
)
paramTriangles
[
i
]
=
new
MTriangle
(
mv
);
else
paramTriangles
[
i
]
=
new
MTriangle6
(
mv
);
}
// -- generation of the parametric topology #mark what about the GFace for the GModel ?
std
::
map
<
int
,
std
::
vector
<
MElement
*>
>
e2e
;
e2e
[
0
]
=
paramTriangles
;
std
::
vector
<
int
>
v
;
v
.
push_back
(
0
);
std
::
map
<
int
,
std
::
vector
<
int
>
>
e2p
;
e2p
[
0
]
=
v
;
GModel
*
paramDisk
=
GModel
::
createGModel
(
e2e
,
e2p
);
discreteVertex
dv
(
paramDisk
,
NEWPOINT
());
dv
.
mesh_vertices
.
push_back
(
sp2mv
[
coordinates
[
_U0
[
0
]]]);
sp2mv
[
coordinates
[
_U0
[
0
]]]
->
setEntity
(
&
dv
);
paramDisk
->
add
(
&
dv
);
discreteEdge
de
(
paramDisk
,
NEWLINE
(),
&
dv
,
&
dv
);
paramDisk
->
add
(
&
de
);
for
(
unsigned
int
i
=
1
;
i
<
_U0
.
size
();
i
++
){
sp2mv
[
coordinates
[
_U0
[
i
]]]
->
setEntity
(
&
de
);
de
.
mesh_vertices
.
push_back
(
sp2mv
[
coordinates
[
_U0
[
i
]]]);
de
.
lines
.
push_back
(
new
MLine
(
sp2mv
[
coordinates
[
_U0
[
i
-
1
]]],
sp2mv
[
coordinates
[
_U0
[
i
]]]));
}
de
.
createGeometry
();
// optimization
if
(
_order
>
1
)
HighOrderMeshOptimizer
(
paramDisk
,
optParams
);
else
MeshQualityOptimizer
(
paramDisk
,
opt
);
// update the parametrization
paramTriangles
=
e2e
[
0
];
for
(
unsigned
int
i
=
0
;
i
<
paramTriangles
.
size
();
i
++
){
discreteDiskFaceTriangle
*
ct
=
&
_ddft
[
i
];
MElement
*
tri
=
paramTriangles
[
i
];
for
(
int
j
=
0
;
j
<
ct
->
tri
->
getNumVertices
();
j
++
){
MVertex
*
mv
=
tri
->
getVertex
(
j
);
SPoint3
p
(
mv
->
x
(),
mv
->
y
(),
0
);
coordinates
[
ct
->
tri
->
getVertex
(
j
)]
=
p
;
ct
->
p
[
j
]
=
p
;
}
}
// cleaning
delete
paramDisk
;
}
// (u;v) |-> < (x;y;z); GFace; (u;v) >
// (u;v) |-> < (x;y;z); GFace; (u;v) >
GPoint
discreteDiskFace
::
point
(
const
double
par1
,
const
double
par2
)
const
GPoint
discreteDiskFace
::
point
(
const
double
par1
,
const
double
par2
)
const
{
{
...
@@ -1010,7 +1097,7 @@ double triangulation::geodesicDistance () {
...
@@ -1010,7 +1097,7 @@ double triangulation::geodesicDistance () {
addTo
(
v2t
,
tri
[
i
]
->
getVertex
(
2
),
tri
[
i
]);
addTo
(
v2t
,
tri
[
i
]
->
getVertex
(
2
),
tri
[
i
]);
}
}
// printf("computing geodesic distance with %d triangles and %d vert
cie
\n",
// printf("computing geodesic distance with %d triangles and %d vert
ices
\n",
// tri.size(),v2t.size());
// tri.size(),v2t.size());
std
::
map
<
MVertex
*
,
double
>
Fixed
;
std
::
map
<
MVertex
*
,
double
>
Fixed
;
...
...
This diff is collapsed.
Click to expand it.
Geo/discreteDiskFace.h
+
3
−
14
View file @
1364f936
...
@@ -22,20 +22,7 @@
...
@@ -22,20 +22,7 @@
#include
"meshGFaceOptimize.h"
#include
"meshGFaceOptimize.h"
#include
"PView.h"
#include
"PView.h"
#include
"robustPredicates.h"
#include
"robustPredicates.h"
#include
"MLine.h"
inline
double
tri3Darea
(
MVertex
*
mv0
,
MVertex
*
mv1
,
MVertex
*
mv2
)
{
SVector3
v1
(
mv1
->
x
()
-
mv0
->
x
(),
mv1
->
y
()
-
mv0
->
y
(),
mv1
->
z
()
-
mv0
->
z
());
SVector3
v2
(
mv2
->
x
()
-
mv0
->
x
(),
mv2
->
y
()
-
mv0
->
y
(),
mv2
->
z
()
-
mv0
->
z
());
SVector3
n
(
v1
.
y
()
*
v2
.
z
()
-
v2
.
y
()
*
v1
.
z
(),
v2
.
x
()
*
v1
.
z
()
-
v1
.
x
()
*
v2
.
z
(),
v1
.
x
()
*
v2
.
y
()
-
v2
.
x
()
*
v1
.
y
());
return
.5
*
n
.
norm
();
}
inline
int
nodeLocalNum
(
MElement
*
e
,
MVertex
*
v
)
inline
int
nodeLocalNum
(
MElement
*
e
,
MVertex
*
v
)
{
{
...
@@ -231,6 +218,7 @@ class discreteDiskFace : public GFace {
...
@@ -231,6 +218,7 @@ class discreteDiskFace : public GFace {
bool
parametrize
(
bool
one2one
=
false
)
const
;
bool
parametrize
(
bool
one2one
=
false
)
const
;
void
putOnView
(
bool
,
bool
);
void
putOnView
(
bool
,
bool
);
bool
checkOrientationUV
();
bool
checkOrientationUV
();
void
optimize
();
void
printParamMesh
();
void
printParamMesh
();
public:
public:
...
@@ -274,6 +262,7 @@ class discreteDiskFace : public GFace {
...
@@ -274,6 +262,7 @@ class discreteDiskFace : public GFace {
mutable
discreteDiskFaceTriangle
*
_ddft
;
mutable
discreteDiskFaceTriangle
*
_ddft
;
mutable
Octree
*
oct
;
mutable
Octree
*
oct
;
mutable
std
::
vector
<
double
>
_coords
;
mutable
std
::
vector
<
double
>
_coords
;
};
};
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
Geo/discreteFace.cpp
+
5
−
5
View file @
1364f936
...
@@ -111,7 +111,7 @@ void discreteFace::secondDer(const SPoint2 ¶m,
...
@@ -111,7 +111,7 @@ void discreteFace::secondDer(const SPoint2 ¶m,
void
discreteFace
::
createGeometry
()
void
discreteFace
::
createGeometry
()
{
{
checkAndFixOrientation
();
checkAndFixOrientation
();
int
order
=
1
;
int
order
=
2
;
int
nPart
=
2
;
int
nPart
=
2
;
double
eta
=
2
*
3.14
/
7
;
double
eta
=
2
*
3.14
/
7
;
...
@@ -154,12 +154,12 @@ void discreteFace::createGeometry()
...
@@ -154,12 +154,12 @@ void discreteFace::createGeometry()
for
(
unsigned
int
i
=
0
;
i
<
toParam
.
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
toParam
.
size
();
i
++
){
//printf("MAP(%d) : aspect ratio = %12.5E\n",i,toParam[i]->aspectRatio());
//printf("MAP(%d) : aspect ratio = %12.5E\n",i,toParam[i]->aspectRatio());
char
name
[
256
];
//
char name[256];
//sprintf(name,"map%d.pos",i);
//sprintf(name,"map%d.pos",i);
toParam
[
i
]
->
print
(
name
,
i
);
//
toParam[i]->print(name,i);
fillHoles
(
toParam
[
i
]);
fillHoles
(
toParam
[
i
]);
//sprintf(name,"mapFilled%d.pos",i);
//sprintf(name,"mapFilled%d.pos",i);
toParam
[
i
]
->
print
(
name
,
i
);
//
toParam[i]->print(name,i);
}
}
for
(
unsigned
int
i
=
0
;
i
<
toParam
.
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
toParam
.
size
();
i
++
){
std
::
vector
<
MElement
*>
mytri
=
toParam
[
i
]
->
tri
;
std
::
vector
<
MElement
*>
mytri
=
toParam
[
i
]
->
tri
;
...
@@ -167,6 +167,7 @@ void discreteFace::createGeometry()
...
@@ -167,6 +167,7 @@ void discreteFace::createGeometry()
df
->
replaceEdges
(
toParam
[
i
]
->
my_GEdges
);
df
->
replaceEdges
(
toParam
[
i
]
->
my_GEdges
);
_atlas
.
push_back
(
df
);
_atlas
.
push_back
(
df
);
}
}
#endif
#endif
}
}
...
@@ -215,7 +216,6 @@ void discreteFace::gatherMeshes()
...
@@ -215,7 +216,6 @@ void discreteFace::gatherMeshes()
void
discreteFace
::
mesh
(
bool
verbose
)
void
discreteFace
::
mesh
(
bool
verbose
)
{
{
#if defined(HAVE_ANN) && defined(HAVE_SOLVER) && defined(HAVE_MESH)
#if defined(HAVE_ANN) && defined(HAVE_SOLVER) && defined(HAVE_MESH)
if
(
!
CTX
::
instance
()
->
meshDiscrete
)
return
;
if
(
!
CTX
::
instance
()
->
meshDiscrete
)
return
;
for
(
unsigned
int
i
=
0
;
i
<
_atlas
.
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
_atlas
.
size
();
i
++
){
...
...
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