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
a18a773d
Commit
a18a773d
authored
9 years ago
by
PA Beaufort
Browse files
Options
Downloads
Patches
Plain Diff
Several utilities added
parent
ade56fd6
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Geo/discreteDiskFace.cpp
+152
-75
152 additions, 75 deletions
Geo/discreteDiskFace.cpp
Geo/discreteDiskFace.h
+2
-1
2 additions, 1 deletion
Geo/discreteDiskFace.h
Geo/discreteFace.cpp
+1
-2
1 addition, 2 deletions
Geo/discreteFace.cpp
with
155 additions
and
78 deletions
Geo/discreteDiskFace.cpp
+
152
−
75
View file @
a18a773d
...
...
@@ -229,6 +229,7 @@ discreteDiskFace::discreteDiskFace(GFace *gf, triangulation* diskTriangulation,
for
(
unsigned
int
j
=
0
;
j
<
3
;
j
++
){
// loop over vertices AND edges of the current triangle
MVertex
*
v
=
mesh
[
i
]
->
getVertex
(
j
);
// firstly, edge vertices
if
(
v
->
onWhat
()
->
dim
()
==
2
)
{
std
::
map
<
MVertex
*
,
MVertex
*>
::
iterator
it
=
v2v
.
find
(
v
);
if
(
it
==
v2v
.
end
()){
...
...
@@ -255,6 +256,7 @@ discreteDiskFace::discreteDiskFace(GFace *gf, triangulation* diskTriangulation,
else
vs
.
push_back
(
v
);
}
else
vs
.
push_back
(
v
);
}
if
(
_order
==
2
)
{
// then, interior nodes :-)
for
(
unsigned
int
ie
=
0
;
ie
<
3
;
ie
++
){
// firstly, edge interior nodes :-)
...
...
@@ -295,7 +297,9 @@ discreteDiskFace::discreteDiskFace(GFace *gf, triangulation* diskTriangulation,
parametrize
(
true
);
buildOct
(
CAD
);
}
putOnView
();
putOnView
(
true
,
false
);
printParamMesh
();
}
/*end BUILDER*/
...
...
@@ -498,7 +502,7 @@ GPoint discreteDiskFace::point(const double par1, const double par2) const
{
double
xi
,
eta
;
double
par
[
2
]
=
{
par1
,
par2
};
discreteDiskFaceTriangle
*
dt
;
discreteDiskFaceTriangle
*
dt
=
NULL
;
getTriangleUV
(
par1
,
par2
,
&
dt
,
xi
,
eta
);
// return Xi,Eta
double
Xi
[
2
]
=
{
xi
,
eta
};
if
(
!
dt
)
{
...
...
@@ -575,7 +579,7 @@ double discreteDiskFace::curvatures(const SPoint2 ¶m, SVector3 *dirMax, SVec
Pair
<
SVector3
,
SVector3
>
discreteDiskFace
::
firstDer
(
const
SPoint2
&
param
)
const
{
double
xi
,
eta
;
discreteDiskFaceTriangle
*
ddft
;
discreteDiskFaceTriangle
*
ddft
=
NULL
;
getTriangleUV
(
param
.
x
(),
param
.
y
(),
&
ddft
,
xi
,
eta
);
MElement
*
tri
=
NULL
;
...
...
@@ -642,93 +646,139 @@ void discreteDiskFace::secondDer(const SPoint2 ¶m,
return
;
}
void
discreteDiskFace
::
putOnView
()
void
discreteDiskFace
::
putOnView
(
bool
Xu
,
bool
Ux
)
{
char
mybuffer
[
64
];
FILE
*
view_u
,
*
view_v
,
*
UVx
,
*
UVy
,
*
UVz
;
if
(
Xu
){
sprintf
(
mybuffer
,
"param_u_part%d_order%d.pos"
,
initialTriangulation
->
idNum
,
_order
);
FILE
*
view_u
=
Fopen
(
mybuffer
,
"w"
);
view_u
=
Fopen
(
mybuffer
,
"w"
);
sprintf
(
mybuffer
,
"param_v_part%d_order%d.pos"
,
initialTriangulation
->
idNum
,
_order
);
FILE
*
view_v
=
Fopen
(
mybuffer
,
"w"
);
view_v
=
Fopen
(
mybuffer
,
"w"
);
}
if
(
Ux
){
sprintf
(
mybuffer
,
"UVx_part%d_order%d.pos"
,
initialTriangulation
->
idNum
,
_order
);
FILE
*
UVx
=
Fopen
(
mybuffer
,
"w"
);
UVx
=
Fopen
(
mybuffer
,
"w"
);
sprintf
(
mybuffer
,
"UVy_part%d_order%d.pos"
,
initialTriangulation
->
idNum
,
_order
);
FILE
*
UVy
=
Fopen
(
mybuffer
,
"w"
);
UVy
=
Fopen
(
mybuffer
,
"w"
);
sprintf
(
mybuffer
,
"UVz_part%d_order%d.pos"
,
initialTriangulation
->
idNum
,
_order
);
FILE
*
UVz
=
Fopen
(
mybuffer
,
"w"
);
if
(
view_u
&&
view_v
&&
UVx
&&
UVy
&&
UVz
){
fprintf
(
view_u
,
"View
\"
paramU
\"
{
\n
"
);
fprintf
(
view_v
,
"View
\"
paramV
\"
{
\n
"
);
fprintf
(
UVx
,
"View
\"
Ux
\"
{
\n
"
);
fprintf
(
UVy
,
"View
\"
Uy
\"
{
\n
"
);
fprintf
(
UVz
,
"View
\"
Uz
\"
{
\n
"
);
UVz
=
Fopen
(
mybuffer
,
"w"
);
}
if
((
Xu
&&
view_u
&&
view_v
)
||
(
Ux
&&
UVx
&&
UVy
&&
UVz
)){
if
(
Xu
){
fprintf
(
view_u
,
"View
\"
u(X)
\"
{
\n
"
);
fprintf
(
view_v
,
"View
\"
v(X)
\"
{
\n
"
);
}
if
(
Ux
){
fprintf
(
UVx
,
"View
\"
x(U)
\"
{
\n
"
);
fprintf
(
UVy
,
"View
\"
y(U)
\"
{
\n
"
);
fprintf
(
UVz
,
"View
\"
z(U)
\"
{
\n
"
);
}
for
(
unsigned
int
i
=
0
;
i
<
discrete_triangles
.
size
();
i
++
){
discreteDiskFaceTriangle
*
my_ddft
=
&
_ddft
[
i
];
if
(
_order
==
1
){
if
(
Xu
){
fprintf
(
view_u
,
"ST("
);
fprintf
(
view_v
,
"ST("
);
}
if
(
Ux
){
fprintf
(
UVx
,
"ST("
);
fprintf
(
UVy
,
"ST("
);
fprintf
(
UVz
,
"ST("
);
}
}
else
{
if
(
Xu
){
fprintf
(
view_u
,
"ST%d("
,
_order
);
fprintf
(
view_v
,
"ST%d("
,
_order
);
}
if
(
Ux
){
fprintf
(
UVx
,
"ST%d("
,
_order
);
fprintf
(
UVy
,
"ST%d("
,
_order
);
fprintf
(
UVz
,
"ST%d("
,
_order
);
}
}
for
(
int
j
=
0
;
j
<
_N
-
1
;
j
++
){
if
(
Xu
){
fprintf
(
view_u
,
"%g,%g,%g,"
,
my_ddft
->
tri
->
getVertex
(
j
)
->
x
(),
my_ddft
->
tri
->
getVertex
(
j
)
->
y
(),
my_ddft
->
tri
->
getVertex
(
j
)
->
z
());
fprintf
(
view_v
,
"%g,%g,%g,"
,
my_ddft
->
tri
->
getVertex
(
j
)
->
x
(),
my_ddft
->
tri
->
getVertex
(
j
)
->
y
(),
my_ddft
->
tri
->
getVertex
(
j
)
->
z
());
}
if
(
Ux
){
fprintf
(
UVx
,
"%g,%g,%g,"
,
my_ddft
->
p
[
j
].
x
(),
my_ddft
->
p
[
j
].
y
(),
0.
);
fprintf
(
UVy
,
"%g,%g,%g,"
,
my_ddft
->
p
[
j
].
x
(),
my_ddft
->
p
[
j
].
y
(),
0.
);
fprintf
(
UVz
,
"%g,%g,%g,"
,
my_ddft
->
p
[
j
].
x
(),
my_ddft
->
p
[
j
].
y
(),
0.
);
}
}
if
(
Xu
){
fprintf
(
view_u
,
"%g,%g,%g){"
,
my_ddft
->
tri
->
getVertex
(
_N
-
1
)
->
x
(),
my_ddft
->
tri
->
getVertex
(
_N
-
1
)
->
y
(),
my_ddft
->
tri
->
getVertex
(
_N
-
1
)
->
z
());
fprintf
(
view_v
,
"%g,%g,%g){"
,
my_ddft
->
tri
->
getVertex
(
_N
-
1
)
->
x
(),
my_ddft
->
tri
->
getVertex
(
_N
-
1
)
->
y
(),
my_ddft
->
tri
->
getVertex
(
_N
-
1
)
->
z
());
}
if
(
Ux
){
fprintf
(
UVx
,
"%g,%g,%g){"
,
my_ddft
->
p
[
_N
-
1
].
x
(),
my_ddft
->
p
[
_N
-
1
].
y
(),
0.
);
fprintf
(
UVy
,
"%g,%g,%g){"
,
my_ddft
->
p
[
_N
-
1
].
x
(),
my_ddft
->
p
[
_N
-
1
].
y
(),
0.
);
fprintf
(
UVz
,
"%g,%g,%g){"
,
my_ddft
->
p
[
_N
-
1
].
x
(),
my_ddft
->
p
[
_N
-
1
].
y
(),
0.
);
}
for
(
int
j
=
0
;
j
<
_N
-
1
;
j
++
){
if
(
Xu
){
fprintf
(
view_u
,
"%g,"
,
my_ddft
->
p
[
j
].
x
());
fprintf
(
view_v
,
"%g,"
,
my_ddft
->
p
[
j
].
y
());
}
if
(
Ux
){
fprintf
(
UVx
,
"%g,"
,
my_ddft
->
tri
->
getVertex
(
j
)
->
x
());
fprintf
(
UVy
,
"%g,"
,
my_ddft
->
tri
->
getVertex
(
j
)
->
y
());
fprintf
(
UVz
,
"%g,"
,
my_ddft
->
tri
->
getVertex
(
j
)
->
z
());
}
}
if
(
Xu
){
fprintf
(
view_u
,
"%g};
\n
"
,
my_ddft
->
p
[
_N
-
1
].
x
());
fprintf
(
view_v
,
"%g};
\n
"
,
my_ddft
->
p
[
_N
-
1
].
y
());
}
if
(
Ux
){
fprintf
(
UVx
,
"%g};
\n
"
,
my_ddft
->
tri
->
getVertex
(
_N
-
1
)
->
x
());
fprintf
(
UVy
,
"%g};
\n
"
,
my_ddft
->
tri
->
getVertex
(
_N
-
1
)
->
y
());
fprintf
(
UVz
,
"%g};
\n
"
,
my_ddft
->
tri
->
getVertex
(
_N
-
1
)
->
z
());
}
}
if
(
Xu
){
fprintf
(
view_u
,
"};
\n
"
);
fprintf
(
view_v
,
"};
\n
"
);
}
if
(
Ux
){
fprintf
(
UVx
,
"};
\n
"
);
fprintf
(
UVy
,
"};
\n
"
);
fprintf
(
UVz
,
"};
\n
"
);
}
if
(
Xu
){
fclose
(
view_u
);
fclose
(
view_v
);
}
if
(
Ux
){
fclose
(
UVx
);
fclose
(
UVy
);
fclose
(
UVz
);
}
}
/*
#ifdef HAVE_POST
std::map<int, std::vector<double> > u;
...
...
@@ -761,7 +811,7 @@ GPoint discreteDiskFace::intersectionWithCircle(const SVector3 &n1, const SVecto
SVector3
n
=
crossprod
(
n1
,
n2
);
n
.
normalize
();
for
(
int
i
=-
1
;
i
<
(
int
)
discrete_triangles
.
size
();
i
++
){
discreteDiskFaceTriangle
*
ct
;
discreteDiskFaceTriangle
*
ct
=
NULL
;
double
U
,
V
;
if
(
i
==
-
1
)
getTriangleUV
(
uv
[
0
],
uv
[
1
],
&
ct
,
U
,
V
);
else
ct
=
&
_ddft
[
i
];
...
...
@@ -859,4 +909,31 @@ GPoint discreteDiskFace::intersectionWithCircle(const SVector3 &n1, const SVecto
return
pp
;
}
void
discreteDiskFace
::
printParamMesh
()
{
std
::
map
<
MVertex
*
,
int
>
mv2int
;
FILE
*
pmesh
=
Fopen
(
"param_mesh.msh"
,
"w"
);
int
count
=
1
;
fprintf
(
pmesh
,
"$MeshFormat
\n
2.2 0 8
\n
$EndMeshFormat
\n
$Nodes
\n
%u
\n
"
,(
unsigned
int
)
allNodes
.
size
());
for
(
std
::
set
<
MVertex
*>::
iterator
it
=
allNodes
.
begin
();
it
!=
allNodes
.
end
();
++
it
){
fprintf
(
pmesh
,
"%d %f %f 0
\n
"
,
count
,(
coordinates
[(
*
it
)]).
x
(),(
coordinates
[(
*
it
)]).
y
());
mv2int
[
*
it
]
=
count
;
count
++
;
}
fprintf
(
pmesh
,
"$EndNodes
\n
$Elements
\n
%u
\n
"
,(
unsigned
int
)
discrete_triangles
.
size
());
for
(
unsigned
int
i
=
0
;
i
<
discrete_triangles
.
size
();
i
++
){
MElement
*
tri
=
discrete_triangles
[
i
];
int
p
;
_order
==
1
?
p
=
2
:
p
=
9
;
fprintf
(
pmesh
,
"%d %d 2 0 0"
,
i
+
1
,
p
);
for
(
int
j
=
0
;
j
<
_N
;
j
++
){
MVertex
*
mv
=
tri
->
getVertex
(
j
);
fprintf
(
pmesh
,
" %d"
,
mv2int
[
mv
]);
}
fprintf
(
pmesh
,
"
\n
"
);
}
fprintf
(
pmesh
,
"$EndElements
\n
"
);
fclose
(
pmesh
);
}
#endif
This diff is collapsed.
Click to expand it.
Geo/discreteDiskFace.h
+
2
−
1
View file @
a18a773d
...
...
@@ -171,8 +171,9 @@ class discreteDiskFace : public GFace {
GFace
*
_parent
;
void
buildOct
(
std
::
vector
<
GFace
*>
*
CAD
=
NULL
)
const
;
bool
parametrize
(
bool
one2one
=
false
)
const
;
void
putOnView
();
void
putOnView
(
bool
,
bool
);
bool
checkOrientationUV
();
void
printParamMesh
();
public:
discreteDiskFace
(
GFace
*
parent
,
triangulation
*
diskTriangulation
,
...
...
This diff is collapsed.
Click to expand it.
Geo/discreteFace.cpp
+
1
−
2
View file @
a18a773d
...
...
@@ -114,8 +114,7 @@ void discreteFace::createGeometry()
int
order
=
1
;
int
nPart
=
2
;
//std::vector<triangulation*> part;
//part.resize(nPart);
#if defined(HAVE_ANN) && defined(HAVE_SOLVER)
if
(
!
_atlas
.
empty
())
return
;
...
...
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