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
3fd2ce6f
Commit
3fd2ce6f
authored
23 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
oups
parent
06fdb51f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Graphics/Graph2D.cpp
+29
-23
29 additions, 23 deletions
Graphics/Graph2D.cpp
with
29 additions
and
23 deletions
Graphics/Graph2D.cpp
+
29
−
23
View file @
3fd2ce6f
// $Id: Graph2D.cpp,v 1.
9
2001-11-05 0
8:37:43
geuzaine Exp $
// $Id: Graph2D.cpp,v 1.
10
2001-11-05 0
9:27:28
geuzaine Exp $
#include
"Gmsh.h"
#include
"Gmsh.h"
#include
"GmshUI.h"
#include
"GmshUI.h"
...
@@ -15,6 +15,26 @@ extern Context_T CTX;
...
@@ -15,6 +15,26 @@ extern Context_T CTX;
2D graphics (gnuplot style)
2D graphics (gnuplot style)
------------------------------------------------------------------------ */
------------------------------------------------------------------------ */
static
void
getval
(
Post_View
*
v
,
int
i
,
int
j
,
double
*
p1
,
double
*
p2
,
double
*
Abs
,
double
*
Val
){
int
k
;
if
(
v
->
Type
==
DRAW_POST_2D_SPACE
){
for
(
k
=
0
;
k
<
3
;
k
++
){
List_Read
(
v
->
SP
,
j
+
k
,
&
p2
[
k
]);
if
(
j
)
p1
[
k
]
=
p2
[
k
]
-
p1
[
k
];
}
*
Abs
+=
sqrt
(
p1
[
0
]
*
p1
[
0
]
+
p1
[
1
]
*
p1
[
1
]
+
p1
[
2
]
*
p1
[
2
]);
for
(
k
=
0
;
k
<
3
;
k
++
){
p1
[
k
]
=
p2
[
k
];
}
*
Val
=
((
double
*
)
List_Pointer_Fast
(
v
->
SP
,
j
+
3
))[
v
->
TimeStep
];
}
else
{
*
Abs
=
*
(
double
*
)
List_Pointer_Fast
(
v
->
Time
,
j
);
*
Val
=
((
double
*
)
List_Pointer_Fast
(
v
->
SP
,
i
+
3
))[
j
];
}
}
static
void
addval
(
Post_View
*
v
,
double
Abs
,
double
Val
,
static
void
addval
(
Post_View
*
v
,
double
Abs
,
double
Val
,
double
AbsMin
,
double
AbsMax
,
double
ValMin
,
double
ValMax
,
double
AbsMin
,
double
AbsMax
,
double
ValMin
,
double
ValMax
,
double
xtop
,
double
width
,
double
ybot
,
double
height
,
double
xtop
,
double
width
,
double
ybot
,
double
height
,
...
@@ -60,7 +80,8 @@ static void Draw_Graph2D(Post_View *v,
...
@@ -60,7 +80,8 @@ static void Draw_Graph2D(Post_View *v,
double
xtop
=
xx
;
double
xtop
=
xx
;
double
ytop
=
CTX
.
viewport
[
3
]
-
yy
;
double
ytop
=
CTX
.
viewport
[
3
]
-
yy
;
double
ybot
=
ytop
-
height
;
double
ybot
=
ytop
-
height
;
double
ValMin
,
ValMax
,
AbsMin
,
AbsMax
;
double
Abs
,
Val
,
ValMin
,
ValMax
,
AbsMin
,
AbsMax
;
double
p1
[
3
],
p2
[
3
];
if
(
!
v
->
TransparentScale
){
if
(
!
v
->
TransparentScale
){
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
bg
);
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
bg
);
...
@@ -256,46 +277,31 @@ static void Draw_Graph2D(Post_View *v,
...
@@ -256,46 +277,31 @@ static void Draw_Graph2D(Post_View *v,
j_max
=
v
->
TimeStep
+
1
;
j_max
=
v
->
TimeStep
+
1
;
}
}
double
Abs
=
0.
,
Val
=
0.
,
p1
[
3
]
=
{
0.
,
0.
,
0.
},
p2
[
3
];
#define GETVAL \
if(v->Type==DRAW_POST_2D_SPACE){ \
for(k=0;k<3;k++){ \
List_Read(v->SP,j+k,&p2[k]); \
if(j) p1[k] = p2[k]-p1[k]; \
} \
Abs += sqrt (p1[0] * p1[0] + p1[1] * p1[1] + p1[2] * p1[2]); \
for(k=0;k<3;k++){ \
p1[k] = p2[k]; \
} \
Val = ((double*)List_Pointer_Fast(v->SP,j+3))[v->TimeStep]; \
} \
else{ \
Abs = *(double*)List_Pointer_Fast(v->Time,j); \
Val = ((double*)List_Pointer_Fast(v->SP,i+3))[j]; \
}
for
(
i
=
0
;
i
<
i_max
;
i
+=
i_inc
){
for
(
i
=
0
;
i
<
i_max
;
i
+=
i_inc
){
if
(
v
->
IntervalsType
==
DRAW_POST_ISO
||
if
(
v
->
IntervalsType
==
DRAW_POST_ISO
||
v
->
IntervalsType
==
DRAW_POST_DISCRETE
||
v
->
IntervalsType
==
DRAW_POST_DISCRETE
||
v
->
IntervalsType
==
DRAW_POST_NUMERIC
){
v
->
IntervalsType
==
DRAW_POST_NUMERIC
){
glBegin
(
GL_POINTS
);
glBegin
(
GL_POINTS
);
Abs
=
Val
=
p1
[
0
]
=
p1
[
1
]
=
p1
[
2
]
=
0.
;
for
(
j
=
0
;
j
<
j_max
;
j
+=
j_inc
){
for
(
j
=
0
;
j
<
j_max
;
j
+=
j_inc
){
GETVAL
;
getval
(
v
,
i
,
j
,
p1
,
p2
,
&
Abs
,
&
Val
)
;
addval
(
v
,
Abs
,
Val
,
AbsMin
,
AbsMax
,
ValMin
,
ValMax
,
xtop
,
width
,
ybot
,
height
,
0
);
addval
(
v
,
Abs
,
Val
,
AbsMin
,
AbsMax
,
ValMin
,
ValMax
,
xtop
,
width
,
ybot
,
height
,
0
);
}
}
glEnd
();
glEnd
();
}
}
if
(
v
->
IntervalsType
==
DRAW_POST_NUMERIC
){
if
(
v
->
IntervalsType
==
DRAW_POST_NUMERIC
){
Abs
=
Val
=
p1
[
0
]
=
p1
[
1
]
=
p1
[
2
]
=
0.
;
for
(
j
=
0
;
j
<
j_max
;
j
+=
j_inc
){
for
(
j
=
0
;
j
<
j_max
;
j
+=
j_inc
){
GETVAL
;
getval
(
v
,
i
,
j
,
p1
,
p2
,
&
Abs
,
&
Val
)
;
addval
(
v
,
Abs
,
Val
,
AbsMin
,
AbsMax
,
ValMin
,
ValMax
,
xtop
,
width
,
ybot
,
height
,
1
);
addval
(
v
,
Abs
,
Val
,
AbsMin
,
AbsMax
,
ValMin
,
ValMax
,
xtop
,
width
,
ybot
,
height
,
1
);
}
}
}
}
if
(
v
->
IntervalsType
==
DRAW_POST_DISCRETE
||
if
(
v
->
IntervalsType
==
DRAW_POST_DISCRETE
||
v
->
IntervalsType
==
DRAW_POST_CONTINUOUS
){
v
->
IntervalsType
==
DRAW_POST_CONTINUOUS
){
glBegin
(
GL_LINE_STRIP
);
glBegin
(
GL_LINE_STRIP
);
Abs
=
Val
=
p1
[
0
]
=
p1
[
1
]
=
p1
[
2
]
=
0.
;
for
(
j
=
0
;
j
<
j_max
;
j
+=
j_inc
){
for
(
j
=
0
;
j
<
j_max
;
j
+=
j_inc
){
GETVAL
;
getval
(
v
,
i
,
j
,
p1
,
p2
,
&
Abs
,
&
Val
)
;
addval
(
v
,
Abs
,
Val
,
AbsMin
,
AbsMax
,
ValMin
,
ValMax
,
xtop
,
width
,
ybot
,
height
,
0
);
addval
(
v
,
Abs
,
Val
,
AbsMin
,
AbsMax
,
ValMin
,
ValMax
,
xtop
,
width
,
ybot
,
height
,
0
);
}
}
glEnd
();
glEnd
();
...
...
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