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
2ec6dfbb
Commit
2ec6dfbb
authored
16 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
use correct subset of colors when drawing points or arrows in "Filled Iso" mode
(Thanks to Charles Shahrokh GHAVAMIAN from www.necs.eu)
parent
201fc201
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
Graphics/Post.cpp
+11
-5
11 additions, 5 deletions
Graphics/Post.cpp
Post/PViewOptions.cpp
+18
-3
18 additions, 3 deletions
Post/PViewOptions.cpp
Post/PViewOptions.h
+2
-1
2 additions, 1 deletion
Post/PViewOptions.h
with
31 additions
and
9 deletions
Graphics/Post.cpp
+
11
−
5
View file @
2ec6dfbb
...
...
@@ -323,7 +323,9 @@ static void addScalarPoint(PView *p, double xyz[NMAX][3], double val[NMAX][9],
if
(
opt
->
SaturateValues
)
saturate
(
1
,
val
,
vmin
,
vmax
,
i0
);
if
(
val
[
i0
][
0
]
>=
vmin
&&
val
[
i0
][
0
]
<=
vmax
){
unsigned
int
col
=
opt
->
getColor
(
val
[
i0
][
0
],
vmin
,
vmax
);
unsigned
int
col
=
opt
->
getColor
(
val
[
i0
][
0
],
vmin
,
vmax
,
false
,
(
opt
->
IntervalsType
==
PViewOptions
::
Discrete
)
?
opt
->
NbIso
:
-
1
);
SVector3
n
=
getPointNormal
(
p
,
val
[
i0
][
0
]);
p
->
va_points
->
add
(
&
xyz
[
i0
][
0
],
&
xyz
[
i0
][
1
],
&
xyz
[
i0
][
2
],
&
n
,
&
col
,
0
,
unique
);
}
...
...
@@ -399,7 +401,7 @@ static void addScalarLine(PView *p, double xyz[NMAX][3], double val[NMAX][9],
double
x2
[
2
],
y2
[
2
],
z2
[
2
],
v2
[
2
];
int
nb
=
CutLine
(
x
,
y
,
z
,
v
,
min
,
max
,
x2
,
y2
,
z2
,
v2
);
if
(
nb
==
2
){
unsigned
color
=
opt
->
getColor
(
k
,
opt
->
NbIso
);
unsigned
int
color
=
opt
->
getColor
(
k
,
opt
->
NbIso
);
unsigned
int
col
[
2
]
=
{
color
,
color
};
SVector3
n
[
2
];
getLineNormal
(
p
,
x2
,
y2
,
z2
,
v2
,
n
,
true
);
...
...
@@ -524,7 +526,7 @@ static void addScalarTriangle(PView *p, double xyz[NMAX][3], double val[NMAX][9]
double
x2
[
10
],
y2
[
10
],
z2
[
10
],
v2
[
10
];
int
nb
=
CutTriangle
(
x
,
y
,
z
,
v
,
min
,
max
,
x2
,
y2
,
z2
,
v2
);
if
(
nb
>=
3
){
unsigned
color
=
opt
->
getColor
(
k
,
opt
->
NbIso
);
unsigned
int
color
=
opt
->
getColor
(
k
,
opt
->
NbIso
);
unsigned
int
col
[
3
]
=
{
color
,
color
,
color
};
for
(
int
j
=
2
;
j
<
nb
;
j
++
){
double
x3
[
3
]
=
{
x2
[
0
],
x2
[
j
-
1
],
x2
[
j
]};
...
...
@@ -868,7 +870,9 @@ static void addVectorElement(PView *p, int ient, int iele, int numNodes,
for
(
int
i
=
0
;
i
<
numNodes
;
i
++
){
double
v2
=
ComputeScalarRep
(
numComp2
,
val2
[
i
]);
if
(
v2
>=
opt
->
ExternalMin
&&
v2
<=
opt
->
ExternalMax
){
unsigned
int
color
=
opt
->
getColor
(
v2
,
opt
->
ExternalMin
,
opt
->
ExternalMax
);
unsigned
int
color
=
opt
->
getColor
(
v2
,
opt
->
ExternalMin
,
opt
->
ExternalMax
,
false
,
(
opt
->
IntervalsType
==
PViewOptions
::
Discrete
)
?
opt
->
NbIso
:
-
1
);
unsigned
int
col
[
2
]
=
{
color
,
color
};
double
dxyz
[
3
][
2
];
for
(
int
j
=
0
;
j
<
3
;
j
++
){
...
...
@@ -899,7 +903,9 @@ static void addVectorElement(PView *p, int ient, int iele, int numNodes,
double
v2
=
ComputeScalarRep
(
numComp2
,
d2
);
if
(
v2
>=
opt
->
ExternalMin
*
(
1.
-
1.e-15
)
&&
v2
<=
opt
->
ExternalMax
*
(
1.
+
1.e-15
)){
unsigned
int
color
=
opt
->
getColor
(
v2
,
opt
->
ExternalMin
,
opt
->
ExternalMax
);
unsigned
int
color
=
opt
->
getColor
(
v2
,
opt
->
ExternalMin
,
opt
->
ExternalMax
,
false
,
(
opt
->
IntervalsType
==
PViewOptions
::
Discrete
)
?
opt
->
NbIso
:
-
1
);
unsigned
int
col
[
2
]
=
{
color
,
color
};
double
dxyz
[
3
][
2
];
for
(
int
i
=
0
;
i
<
3
;
i
++
){
...
...
This diff is collapsed.
Click to expand it.
Post/PViewOptions.cpp
+
18
−
3
View file @
2ec6dfbb
...
...
@@ -46,6 +46,7 @@ double PViewOptions::getScaleValue(int iso, int numIso, double min, double max)
return
0.
;
}
// return index between 0 and (numIso-1)
int
PViewOptions
::
getScaleIndex
(
double
val
,
int
numIso
,
double
min
,
double
max
,
bool
forceLinear
)
{
...
...
@@ -68,11 +69,23 @@ int PViewOptions::getScaleIndex(double val, int numIso, double min, double max,
// val in [min, max]
unsigned
int
PViewOptions
::
getColor
(
double
val
,
double
min
,
double
max
,
bool
forceLinear
)
bool
forceLinear
,
int
numColors
)
{
if
(
CT
.
size
==
1
)
return
CT
.
table
[
0
];
int
index
=
getScaleIndex
(
val
,
CT
.
size
,
min
,
max
,
forceLinear
);
return
CT
.
table
[
index
];
if
(
numColors
<=
0
){
// use full colormap
int
index
=
getScaleIndex
(
val
,
CT
.
size
,
min
,
max
,
forceLinear
);
if
(
index
<
0
)
index
=
0
;
else
if
(
index
>
CT
.
size
-
1
)
index
=
CT
.
size
-
1
;
return
CT
.
table
[
index
];
}
else
{
// the maximum should belong to the last interval: so use
// numColors + 1 and correct afterwards
int
index
=
getScaleIndex
(
val
,
numColors
+
1
,
min
,
max
,
forceLinear
);
if
(
index
>
numColors
-
1
)
index
=
numColors
-
1
;
return
getColor
(
index
,
numColors
);
}
}
// i in [0, nb - 1]
...
...
@@ -80,6 +93,8 @@ unsigned int PViewOptions::getColor(int i, int nb)
{
int
index
=
(
nb
==
1
)
?
CT
.
size
/
2
:
(
int
)(
i
/
(
double
)(
nb
-
1
)
*
(
CT
.
size
-
1
)
+
0.5
);
if
(
index
<
0
)
index
=
0
;
else
if
(
index
>
CT
.
size
-
1
)
index
=
CT
.
size
-
1
;
return
CT
.
table
[
index
];
}
...
...
This diff is collapsed.
Click to expand it.
Post/PViewOptions.h
+
2
−
1
View file @
2ec6dfbb
...
...
@@ -102,7 +102,8 @@ class PViewOptions {
int
getScaleIndex
(
double
val
,
int
numIso
,
double
min
,
double
max
,
bool
forceLinear
=
false
);
unsigned
int
getColor
(
int
i
,
int
nb
);
unsigned
int
getColor
(
double
val
,
double
min
,
double
max
,
bool
forceLinear
=
false
);
unsigned
int
getColor
(
double
val
,
double
min
,
double
max
,
bool
forceLinear
=
false
,
int
numColors
=-
1
);
bool
skipElement
(
int
numEdges
);
};
...
...
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