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
4ee64549
Commit
4ee64549
authored
18 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
add extra arg to XYZtoUV so we can use it also for point that are not on the surface
parent
d4c68c17
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/GFace.cpp
+22
-25
22 additions, 25 deletions
Geo/GFace.cpp
Geo/GFace.h
+4
-4
4 additions, 4 deletions
Geo/GFace.h
Mesh/meshGFaceTransfinite.cpp
+3
-4
3 additions, 4 deletions
Mesh/meshGFaceTransfinite.cpp
with
29 additions
and
33 deletions
Geo/GFace.cpp
+
22
−
25
View file @
4ee64549
// $Id: GFace.cpp,v 1.2
4
2006-12-03 00:
04:31
geuzaine Exp $
// $Id: GFace.cpp,v 1.2
5
2006-12-03 00:
35:56
geuzaine Exp $
//
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -399,37 +399,34 @@ double GFace::curvature (const SPoint2 ¶m) const
...
@@ -399,37 +399,34 @@ double GFace::curvature (const SPoint2 ¶m) const
}
}
void
GFace
::
XYZtoUV
(
const
double
X
,
const
double
Y
,
const
double
Z
,
void
GFace
::
XYZtoUV
(
const
double
X
,
const
double
Y
,
const
double
Z
,
double
&
U
,
double
&
V
,
double
&
U
,
double
&
V
,
const
double
relax
,
const
double
relax
)
const
bool
onSurface
)
const
{
{
const
double
Precision
=
1.e-8
;
const
double
Precision
=
1.e-8
;
const
int
MaxIter
=
25
;
const
int
MaxIter
=
25
;
const
int
NumInitGuess
=
11
;
const
int
NumInitGuess
=
11
;
double
Unew
=
0.
,
Vnew
=
0.
,
err
,
err_xyz
;
double
Unew
=
0.
,
Vnew
=
0.
;
int
iter
;
double
mat
[
3
][
3
],
jac
[
3
][
3
];
double
mat
[
3
][
3
],
jac
[
3
][
3
];
double
umin
,
umax
,
vmin
,
vmax
;
double
init
[
NumInitGuess
]
=
{
0.487
,
0.6
,
0.4
,
0.7
,
0.3
,
0.8
,
0.2
,
0.9
,
0.1
,
0
,
1
};
double
init
[
NumInitGuess
]
=
{
0.487
,
0.6
,
0.4
,
0.7
,
0.3
,
0.8
,
0.2
,
0.9
,
0.1
,
0
,
1
};
Range
<
double
>
ru
=
parBounds
(
0
);
Range
<
double
>
ru
=
parBounds
(
0
);
Range
<
double
>
rv
=
parBounds
(
1
);
Range
<
double
>
rv
=
parBounds
(
1
);
umin
=
ru
.
low
();
double
umin
=
ru
.
low
();
umax
=
ru
.
high
();
double
umax
=
ru
.
high
();
vmin
=
rv
.
low
();
double
vmin
=
rv
.
low
();
vmax
=
rv
.
high
();
double
vmax
=
rv
.
high
();
for
(
int
i
=
0
;
i
<
NumInitGuess
;
i
++
){
for
(
int
i
=
0
;
i
<
NumInitGuess
;
i
++
){
for
(
int
j
=
0
;
j
<
NumInitGuess
;
j
++
){
for
(
int
j
=
0
;
j
<
NumInitGuess
;
j
++
){
U
=
init
[
i
];
U
=
init
[
i
];
V
=
init
[
j
];
V
=
init
[
j
];
err
=
1.0
;
int
err
=
1.0
,
err_xyz
=
0.
;
iter
=
1
;
int
iter
=
1
;
while
(
err
>
Precision
&&
iter
<
MaxIter
)
{
while
(
err
>
Precision
&&
iter
<
MaxIter
)
{
GPoint
P
=
point
(
U
,
V
);
GPoint
P
=
point
(
U
,
V
);
Pair
<
SVector3
,
SVector3
>
der
=
firstDer
(
SPoint2
(
U
,
V
));
Pair
<
SVector3
,
SVector3
>
der
=
firstDer
(
SPoint2
(
U
,
V
));
mat
[
0
][
0
]
=
der
.
left
().
x
();
mat
[
0
][
0
]
=
der
.
left
().
x
();
mat
[
0
][
1
]
=
der
.
left
().
y
();
mat
[
0
][
1
]
=
der
.
left
().
y
();
mat
[
0
][
2
]
=
der
.
left
().
z
();
mat
[
0
][
2
]
=
der
.
left
().
z
();
...
@@ -449,7 +446,8 @@ void GFace::XYZtoUV(const double X, const double Y, const double Z,
...
@@ -449,7 +446,8 @@ void GFace::XYZtoUV(const double X, const double Y, const double Z,
jac
[
2
][
1
]
*
(
Z
-
P
.
z
()));
jac
[
2
][
1
]
*
(
Z
-
P
.
z
()));
err
=
DSQR
(
Unew
-
U
)
+
DSQR
(
Vnew
-
V
);
err
=
DSQR
(
Unew
-
U
)
+
DSQR
(
Vnew
-
V
);
err_xyz
=
DSQR
(
X
-
P
.
x
())
+
DSQR
(
Y
-
P
.
y
())
+
DSQR
(
Z
-
P
.
z
());
if
(
onSurface
)
err_xyz
=
DSQR
(
X
-
P
.
x
())
+
DSQR
(
Y
-
P
.
y
())
+
DSQR
(
Z
-
P
.
z
());
iter
++
;
iter
++
;
U
=
Unew
;
U
=
Unew
;
V
=
Vnew
;
V
=
Vnew
;
...
@@ -458,7 +456,7 @@ void GFace::XYZtoUV(const double X, const double Y, const double Z,
...
@@ -458,7 +456,7 @@ void GFace::XYZtoUV(const double X, const double Y, const double Z,
if
(
iter
<
MaxIter
&&
err
<=
Precision
&&
if
(
iter
<
MaxIter
&&
err
<=
Precision
&&
Unew
<=
umax
&&
Vnew
<=
vmax
&&
Unew
<=
umax
&&
Vnew
<=
vmax
&&
Unew
>=
umin
&&
Vnew
>=
vmin
){
Unew
>=
umin
&&
Vnew
>=
vmin
){
if
(
err_xyz
>
1.e-5
)
if
(
onSurface
&&
err_xyz
>
Precision
*
CTX
.
lc
)
Msg
(
WARNING
,
"converged for i=%d j=%d (err=%g iter=%d), but err_xyz = %g"
,
Msg
(
WARNING
,
"converged for i=%d j=%d (err=%g iter=%d), but err_xyz = %g"
,
i
,
j
,
err
,
iter
,
err_xyz
);
i
,
j
,
err
,
iter
,
err_xyz
);
return
;
return
;
...
@@ -466,21 +464,20 @@ void GFace::XYZtoUV(const double X, const double Y, const double Z,
...
@@ -466,21 +464,20 @@ void GFace::XYZtoUV(const double X, const double Y, const double Z,
}
}
}
}
if
(
relax
<
1.e-6
)
if
(
relax
<
1.e-6
)
{
Msg
(
GERROR
,
"Could not converge: surface mesh will be wrong"
);
Msg
(
GERROR
,
"Could not converge: surface mesh will be wrong"
);
}
else
{
else
{
Msg
(
INFO
,
"Relaxation factor = %g"
,
0.75
*
relax
);
Msg
(
INFO
,
"Relaxation factor = %g"
,
0.75
*
relax
);
XYZtoUV
(
X
,
Y
,
Z
,
U
,
V
,
0.75
*
relax
);
XYZtoUV
(
X
,
Y
,
Z
,
U
,
V
,
0.75
*
relax
,
onSurface
);
}
}
}
}
SPoint2
GFace
::
parFromPoint
(
const
SPoint3
&
p
)
const
SPoint2
GFace
::
parFromPoint
(
const
SPoint3
&
p
)
const
{
{
double
U
,
V
;
double
U
,
V
;
XYZtoUV
(
p
.
x
(),
p
.
y
(),
p
.
z
(),
U
,
V
,
1.0
);
XYZtoUV
(
p
.
x
(),
p
.
y
(),
p
.
z
(),
U
,
V
,
1.0
);
return
SPoint2
(
U
,
V
);
return
SPoint2
(
U
,
V
);
}
}
This diff is collapsed.
Click to expand it.
Geo/GFace.h
+
4
−
4
View file @
4ee64549
...
@@ -76,10 +76,10 @@ class GFace : public GEntity
...
@@ -76,10 +76,10 @@ class GFace : public GEntity
virtual
int
dim
()
const
{
return
2
;}
virtual
int
dim
()
const
{
return
2
;}
virtual
void
setVisibility
(
char
val
,
bool
recursive
=
false
);
virtual
void
setVisibility
(
char
val
,
bool
recursive
=
false
);
// compute
XYZ from parametric UV
// compute
the parameters UV from a point XYZ
void
XYZtoUV
(
const
double
X
,
const
double
Y
,
const
double
Z
,
void
XYZtoUV
(
const
double
X
,
const
double
Y
,
const
double
Z
,
double
&
U
,
double
&
V
,
double
&
U
,
double
&
V
,
const
double
relax
,
const
double
relax
)
const
;
bool
onSurface
=
true
)
const
;
// The bounding box
// The bounding box
virtual
SBoundingBox3d
bounds
()
const
;
virtual
SBoundingBox3d
bounds
()
const
;
...
@@ -94,7 +94,7 @@ class GFace : public GEntity
...
@@ -94,7 +94,7 @@ class GFace : public GEntity
// Return the parmater location on the face given a point in space
// Return the parmater location on the face given a point in space
// that is on the face.
// that is on the face.
virtual
SPoint2
parFromPoint
(
const
SPoint3
&
)
const
;
virtual
SPoint2
parFromPoint
(
const
SPoint3
&
)
const
;
// True if the parameter value is interior to the face.
// True if the parameter value is interior to the face.
virtual
int
containsParam
(
const
SPoint2
&
pt
)
const
=
0
;
virtual
int
containsParam
(
const
SPoint2
&
pt
)
const
=
0
;
...
...
This diff is collapsed.
Click to expand it.
Mesh/meshGFaceTransfinite.cpp
+
3
−
4
View file @
4ee64549
// $Id: meshGFaceTransfinite.cpp,v 1.1
0
2006-12-0
2 22:48:25
geuzaine Exp $
// $Id: meshGFaceTransfinite.cpp,v 1.1
1
2006-12-0
3 00:35:56
geuzaine Exp $
//
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -221,9 +221,8 @@ int MeshTransfiniteSurface( GFace *gf)
...
@@ -221,9 +221,8 @@ int MeshTransfiniteSurface( GFace *gf)
double
zp
=
TRAN_TRI
(
m_vertices
[
iP1
]
->
z
(),
m_vertices
[
iP2
]
->
z
(),
double
zp
=
TRAN_TRI
(
m_vertices
[
iP1
]
->
z
(),
m_vertices
[
iP2
]
->
z
(),
m_vertices
[
iP3
]
->
z
(),
m_vertices
[
N1
]
->
z
(),
m_vertices
[
iP3
]
->
z
(),
m_vertices
[
N1
]
->
z
(),
m_vertices
[
N2
]
->
z
(),
m_vertices
[
N3
]
->
z
(),
u
,
v
);
m_vertices
[
N2
]
->
z
(),
m_vertices
[
N3
]
->
z
(),
u
,
v
);
SPoint2
param
=
gf
->
parFromPoint
(
SPoint3
(
xp
,
yp
,
zp
));
double
Up
,
Vp
;
double
Up
=
param
.
x
();
gf
->
XYZtoUV
(
xp
,
yp
,
zp
,
Up
,
Vp
,
1.0
,
false
);
double
Vp
=
param
.
y
();
#endif
#endif
GPoint
gp
=
gf
->
point
(
SPoint2
(
Up
,
Vp
));
GPoint
gp
=
gf
->
point
(
SPoint2
(
Up
,
Vp
));
MFaceVertex
*
newv
=
new
MFaceVertex
(
gp
.
x
(),
gp
.
y
(),
gp
.
z
(),
gf
,
Up
,
Vp
);
MFaceVertex
*
newv
=
new
MFaceVertex
(
gp
.
x
(),
gp
.
y
(),
gp
.
z
(),
gf
,
Up
,
Vp
);
...
...
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