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
26567646
Commit
26567646
authored
17 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
pp
parent
5b175449
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
Post/ColorTable.cpp
+39
-39
39 additions, 39 deletions
Post/ColorTable.cpp
Post/ColorTable.h
+1
-1
1 addition, 1 deletion
Post/ColorTable.h
Post/PViewDataGModel.cpp
+44
-1
44 additions, 1 deletion
Post/PViewDataGModel.cpp
with
84 additions
and
41 deletions
Post/ColorTable.cpp
+
39
−
39
View file @
26567646
// $Id: ColorTable.cpp,v 1.
1
2007-0
7-09 13:54
:37 geuzaine Exp $
// $Id: ColorTable.cpp,v 1.
2
2007-0
9-13 06:31
:37 geuzaine Exp $
//
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
extern
Context_T
CTX
;
extern
Context_T
CTX
;
void
ColorTable_InitParam
(
int
number
,
GmshColorTable
*
ct
)
void
ColorTable_InitParam
(
int
number
,
GmshColorTable
*
ct
)
{
{
ct
->
size
=
255
;
ct
->
size
=
255
;
for
(
int
i
=
0
;
i
<
COLORTABLE_NBMAX_PARAM
;
i
++
){
for
(
int
i
=
0
;
i
<
COLORTABLE_NBMAX_PARAM
;
i
++
){
...
@@ -54,17 +54,17 @@ static double gray(double s)
...
@@ -54,17 +54,17 @@ static double gray(double s)
static
double
hot_r
(
double
s
)
static
double
hot_r
(
double
s
)
{
{
return
s
<
0.
?
0.
:
(
s
<
3.
/
8.
?
8.
/
3.
*
s
:
1.
);
return
s
<
0.
?
0.
:
(
s
<
3.
/
8.
?
8.
/
3.
*
s
:
1.
);
}
}
static
double
hot_g
(
double
s
)
static
double
hot_g
(
double
s
)
{
{
return
s
<
3.
/
8.
?
0.
:
(
s
<
6.
/
8.
?
8.
/
3.
*
(
s
-
3.
/
8.
)
:
1.
);
return
s
<
3.
/
8.
?
0.
:
(
s
<
6.
/
8.
?
8.
/
3.
*
(
s
-
3.
/
8.
)
:
1.
);
}
}
static
double
hot_b
(
double
s
)
static
double
hot_b
(
double
s
)
{
{
return
s
<
6.
/
8.
?
0.
:
(
s
<
1.
?
8.
/
2.
*
(
s
-
6.
/
8.
)
:
1.
);
return
s
<
6.
/
8.
?
0.
:
(
s
<
1.
?
8.
/
2.
*
(
s
-
6.
/
8.
)
:
1.
);
}
}
static
double
cubic
(
double
a
,
double
b
,
double
c
,
double
d
,
double
x
)
static
double
cubic
(
double
a
,
double
b
,
double
c
,
double
d
,
double
x
)
...
@@ -109,27 +109,27 @@ void ColorTable_Recompute(GmshColorTable * ct)
...
@@ -109,27 +109,27 @@ void ColorTable_Recompute(GmshColorTable * ct)
break
;
break
;
case
2
:
// matlab "jet"
case
2
:
// matlab "jet"
{
{
double
ii
=
(
double
)(
s
-
bias
)
*
128.
;
double
ii
=
(
double
)(
s
-
bias
)
*
128.
;
if
(
ii
<
0
)
ii
=
0
;
if
(
ii
<
0
)
ii
=
0
;
if
(
ii
>
128
)
ii
=
128
;
if
(
ii
>
128
)
ii
=
128
;
double
rr
=
double
rr
=
ii
<=
46
?
0.
:
ii
<=
46
?
0.
:
ii
>=
111
?
-
0.03125
*
(
ii
-
111
)
+
1.
:
ii
>=
111
?
-
0.03125
*
(
ii
-
111
)
+
1.
:
ii
>=
78
?
1.
:
ii
>=
78
?
1.
:
0.03125
*
(
ii
-
46
);
0.03125
*
(
ii
-
46
);
double
gg
=
double
gg
=
ii
<=
14
||
ii
>=
111
?
0.
:
ii
<=
14
||
ii
>=
111
?
0.
:
ii
>=
79
?
-
0.03125
*
(
ii
-
111
)
:
ii
>=
79
?
-
0.03125
*
(
ii
-
111
)
:
ii
<=
46
?
0.03125
*
(
ii
-
14
)
:
ii
<=
46
?
0.03125
*
(
ii
-
14
)
:
1.
;
1.
;
double
bb
=
double
bb
=
ii
>=
79
?
0.
:
ii
>=
79
?
0.
:
ii
>=
47
?
-
0.03125
*
(
ii
-
79
)
:
ii
>=
47
?
-
0.03125
*
(
ii
-
79
)
:
ii
<=
14
?
0.03125
*
(
ii
-
14
)
+
1.
:
ii
<=
14
?
0.03125
*
(
ii
-
14
)
+
1.
:
1.
;
1.
;
r
=
(
int
)(
rr
*
255.
);
r
=
(
int
)(
rr
*
255.
);
g
=
(
int
)(
gg
*
255.
);
g
=
(
int
)(
gg
*
255.
);
b
=
(
int
)(
bb
*
255.
);
b
=
(
int
)(
bb
*
255.
);
}
}
break
;
break
;
case
3
:
// lucie, samcef (?)
case
3
:
// lucie, samcef (?)
...
@@ -248,9 +248,9 @@ void ColorTable_Recompute(GmshColorTable * ct)
...
@@ -248,9 +248,9 @@ void ColorTable_Recompute(GmshColorTable * ct)
b
=
(
int
)(
255.
*
hot_b
(
s
-
bias
));
b
=
(
int
)(
255.
*
hot_b
(
s
-
bias
));
break
;
break
;
case
8
:
// matlab "pink"
case
8
:
// matlab "pink"
r
=
(
int
)(
255.
*
sqrt
((
2.
*
gray
(
s
-
bias
)
+
hot_r
(
s
-
bias
))
/
3.
));
r
=
(
int
)(
255.
*
sqrt
((
2.
*
gray
(
s
-
bias
)
+
hot_r
(
s
-
bias
))
/
3.
));
g
=
(
int
)(
255.
*
sqrt
((
2.
*
gray
(
s
-
bias
)
+
hot_g
(
s
-
bias
))
/
3.
));
g
=
(
int
)(
255.
*
sqrt
((
2.
*
gray
(
s
-
bias
)
+
hot_g
(
s
-
bias
))
/
3.
));
b
=
(
int
)(
255.
*
sqrt
((
2.
*
gray
(
s
-
bias
)
+
hot_b
(
s
-
bias
))
/
3.
));
b
=
(
int
)(
255.
*
sqrt
((
2.
*
gray
(
s
-
bias
)
+
hot_b
(
s
-
bias
))
/
3.
));
break
;
break
;
case
9
:
// grayscale
case
9
:
// grayscale
if
(
s
-
bias
<=
0.
)
{
if
(
s
-
bias
<=
0.
)
{
...
@@ -285,39 +285,39 @@ void ColorTable_Recompute(GmshColorTable * ct)
...
@@ -285,39 +285,39 @@ void ColorTable_Recompute(GmshColorTable * ct)
}
}
break
;
break
;
case
13
:
// matlab "bone"
case
13
:
// matlab "bone"
r
=
(
int
)(
255.
*
(
7.
*
gray
(
s
-
bias
)
+
hot_b
(
s
-
bias
))
/
8.
);
r
=
(
int
)(
255.
*
(
7.
*
gray
(
s
-
bias
)
+
hot_b
(
s
-
bias
))
/
8.
);
g
=
(
int
)(
255.
*
(
7.
*
gray
(
s
-
bias
)
+
hot_g
(
s
-
bias
))
/
8.
);
g
=
(
int
)(
255.
*
(
7.
*
gray
(
s
-
bias
)
+
hot_g
(
s
-
bias
))
/
8.
);
b
=
(
int
)(
255.
*
(
7.
*
gray
(
s
-
bias
)
+
hot_r
(
s
-
bias
))
/
8.
);
b
=
(
int
)(
255.
*
(
7.
*
gray
(
s
-
bias
)
+
hot_r
(
s
-
bias
))
/
8.
);
break
;
break
;
case
14
:
// matlab "spring"
case
14
:
// matlab "spring"
r
=
(
int
)(
255.
*
1.
);
r
=
(
int
)(
255.
*
1.
);
g
=
(
int
)(
255.
*
gray
(
s
-
bias
));
g
=
(
int
)(
255.
*
gray
(
s
-
bias
));
b
=
(
int
)(
255.
*
(
1.
-
gray
(
s
-
bias
)));
b
=
(
int
)(
255.
*
(
1.
-
gray
(
s
-
bias
)));
break
;
break
;
case
15
:
// matlab "summer"
case
15
:
// matlab "summer"
r
=
(
int
)(
255.
*
gray
(
s
-
bias
));
r
=
(
int
)(
255.
*
gray
(
s
-
bias
));
g
=
(
int
)(
255.
*
(
0.5
+
gray
(
s
-
bias
)
/
2.
));
g
=
(
int
)(
255.
*
(
0.5
+
gray
(
s
-
bias
)
/
2.
));
b
=
(
int
)(
255.
*
0.4
);
b
=
(
int
)(
255.
*
0.4
);
break
;
break
;
case
16
:
// matlab "autumn"
case
16
:
// matlab "autumn"
r
=
(
int
)(
255.
*
1.
);
r
=
(
int
)(
255.
*
1.
);
g
=
(
int
)(
255.
*
gray
(
s
-
bias
));
g
=
(
int
)(
255.
*
gray
(
s
-
bias
));
b
=
(
int
)(
255.
*
0.
);
b
=
(
int
)(
255.
*
0.
);
break
;
break
;
case
17
:
// matlab "winter"
case
17
:
// matlab "winter"
r
=
(
int
)(
255.
*
0.
);
r
=
(
int
)(
255.
*
0.
);
g
=
(
int
)(
255.
*
gray
(
s
-
bias
));
g
=
(
int
)(
255.
*
gray
(
s
-
bias
));
b
=
(
int
)(
255.
*
(
0.5
+
(
1.
-
gray
(
s
-
bias
))
/
2.
));
b
=
(
int
)(
255.
*
(
0.5
+
(
1.
-
gray
(
s
-
bias
))
/
2.
));
break
;
break
;
case
18
:
// matlab "cool"
case
18
:
// matlab "cool"
r
=
(
int
)(
255.
*
gray
(
s
-
bias
));
r
=
(
int
)(
255.
*
gray
(
s
-
bias
));
g
=
(
int
)(
255.
*
(
1.
-
gray
(
s
-
bias
)));
g
=
(
int
)(
255.
*
(
1.
-
gray
(
s
-
bias
)));
b
=
(
int
)(
255.
*
1.
);
b
=
(
int
)(
255.
*
1.
);
break
;
break
;
case
19
:
// matlab "copper"
case
19
:
// matlab "copper"
r
=
(
int
)(
255.
*
DMIN
(
1.
,
gray
(
s
-
bias
)
*
1.25
));
r
=
(
int
)(
255.
*
DMIN
(
1.
,
gray
(
s
-
bias
)
*
1.25
));
g
=
(
int
)(
255.
*
DMIN
(
1.
,
gray
(
s
-
bias
)
*
0.7812
));
g
=
(
int
)(
255.
*
DMIN
(
1.
,
gray
(
s
-
bias
)
*
0.7812
));
b
=
(
int
)(
255.
*
DMIN
(
1.
,
gray
(
s
-
bias
)
*
0.4975
));
b
=
(
int
)(
255.
*
DMIN
(
1.
,
gray
(
s
-
bias
)
*
0.4975
));
break
;
break
;
default
:
default
:
r
=
g
=
b
=
0
;
r
=
g
=
b
=
0
;
...
@@ -433,9 +433,9 @@ void HSV_to_RGB(double H, double S, double V,
...
@@ -433,9 +433,9 @@ void HSV_to_RGB(double H, double S, double V,
else
{
else
{
int
i
=
(
int
)
H
;
int
i
=
(
int
)
H
;
double
f
=
H
-
(
float
)
i
;
double
f
=
H
-
(
float
)
i
;
double
p1
=
V
*
(
1.0
-
S
);
double
p1
=
V
*
(
1.0
-
S
);
double
p2
=
V
*
(
1.0
-
S
*
f
);
double
p2
=
V
*
(
1.0
-
S
*
f
);
double
p3
=
V
*
(
1.0
-
S
*
(
1.0
-
f
));
double
p3
=
V
*
(
1.0
-
S
*
(
1.0
-
f
));
switch
(
i
){
switch
(
i
){
case
0
:
*
R
=
V
;
*
G
=
p3
;
*
B
=
p1
;
break
;
case
0
:
*
R
=
V
;
*
G
=
p3
;
*
B
=
p1
;
break
;
case
1
:
*
R
=
p2
;
*
G
=
V
;
*
B
=
p1
;
break
;
case
1
:
*
R
=
p2
;
*
G
=
V
;
*
B
=
p1
;
break
;
...
@@ -452,13 +452,13 @@ void RGB_to_HSV(double R, double G, double B,
...
@@ -452,13 +452,13 @@ void RGB_to_HSV(double R, double G, double B,
{
{
double
maxv
=
R
>
G
?
R
:
G
;
if
(
B
>
maxv
)
maxv
=
B
;
double
maxv
=
R
>
G
?
R
:
G
;
if
(
B
>
maxv
)
maxv
=
B
;
*
V
=
maxv
;
*
V
=
maxv
;
if
(
maxv
>
0
){
if
(
maxv
>
0
){
double
minv
=
R
<
G
?
R
:
G
;
if
(
B
<
minv
)
minv
=
B
;
double
minv
=
R
<
G
?
R
:
G
;
if
(
B
<
minv
)
minv
=
B
;
*
S
=
1.0
-
double
(
minv
)
/
maxv
;
*
S
=
1.0
-
double
(
minv
)
/
maxv
;
if
(
maxv
>
minv
){
if
(
maxv
>
minv
){
if
(
maxv
==
R
){
*
H
=
(
G
-
B
)
/
double
(
maxv
-
minv
);
if
(
*
H
<
0
)
*
H
+=
6.0
;
}
if
(
maxv
==
R
){
*
H
=
(
G
-
B
)
/
double
(
maxv
-
minv
);
if
(
*
H
<
0
)
*
H
+=
6.0
;
}
else
if
(
maxv
==
G
)
*
H
=
2.0
+
(
B
-
R
)
/
double
(
maxv
-
minv
);
else
if
(
maxv
==
G
)
*
H
=
2.0
+
(
B
-
R
)
/
double
(
maxv
-
minv
);
else
*
H
=
4.0
+
(
R
-
G
)
/
double
(
maxv
-
minv
);
else
*
H
=
4.0
+
(
R
-
G
)
/
double
(
maxv
-
minv
);
}
}
}
}
}
}
This diff is collapsed.
Click to expand it.
Post/ColorTable.h
+
1
−
1
View file @
26567646
...
@@ -35,7 +35,7 @@ typedef struct{
...
@@ -35,7 +35,7 @@ typedef struct{
#define COLORTABLE_RGB 1
#define COLORTABLE_RGB 1
#define COLORTABLE_HSV 2
#define COLORTABLE_HSV 2
// integ
r
er parameters indices
// integer parameters indices
#define COLORTABLE_NUMBER 0 // predefined curve index
#define COLORTABLE_NUMBER 0 // predefined curve index
#define COLORTABLE_INVERT 1 // invert (rbg<->255-rgb)
#define COLORTABLE_INVERT 1 // invert (rbg<->255-rgb)
...
...
This diff is collapsed.
Click to expand it.
Post/PViewDataGModel.cpp
+
44
−
1
View file @
26567646
// $Id: PViewDataGModel.cpp,v 1.
3
2007-09-
08 21:26:05
geuzaine Exp $
// $Id: PViewDataGModel.cpp,v 1.
4
2007-09-
13 06:31:37
geuzaine Exp $
//
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -24,6 +24,49 @@
...
@@ -24,6 +24,49 @@
#include
"PViewDataGModel.h"
#include
"PViewDataGModel.h"
/*
add new optional field in .msh file to store
- node or element post-pro data
- one field per-time step, per view
$Data
name precision-single-double step time-value
type node-or-ele-id num-comp val (num-comp times)
type node-or-ele-id num-comp val (num-comp times)
...
$EndData
Then?
1) in MVertex and MElement, add
std::vector<std::vector<double> > _scalar, _vector, _tensor;
and access using e.g. _scalar[viewIndex][comp & time step]. In GModel
we would store a map with the correspondance between the index and the
unique view id created in PView().
2) Or, we store directly a map indexed with the unique view id
1) and 2) are pretty expensive, due to the overhead and the "micro"
allocations (in each element/node)
3) It might be better to store the data *per entity*?
4) Or just store the big vectors in the GModel?
My preference at the moment is to store per entity (i.e., (3)): not
too much overhead; can do local indexing and checks with
nodes/elements--which are stored per entity too; avoids storing entity
ptr in each value (I think we should have that info in the post-pro:
it's one of the annoying shortcomings of the old format)
f we choose 3, unfortunately, we need to keep track of some local
indices to access the data with a single, continuous index. This is
exactly the same problem as with PViewDataList. Maybe it's worth it?
*/
bool
PViewDataGModel
::
writePOS
(
std
::
string
name
,
bool
binary
,
bool
parsed
,
bool
PViewDataGModel
::
writePOS
(
std
::
string
name
,
bool
binary
,
bool
parsed
,
bool
append
)
bool
append
)
{
{
...
...
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