txliu007的个人博客分享 http://blog.sciencenet.cn/u/txliu007

博文

ANSYS灰度云图显示

已有 11101 次阅读 2012-6-20 00:03 |系统分类:科研笔记| 灰度图

ANSYS软件计算的结果云图,默认都是彩色云图显示。但有些杂志投稿时,要求采用灰度云图表达结果,问题突然就来了。利用ANSYS软件灰度图输出时,彩色云图中的红色和蓝色都显示为黑色,这使得输出的云图结果表达错误。于是只能设置系统的colormap(颜色映射,我觉得译为“色谱”也不错^^)。
采用命令行设置,将下面的命令(带/的行)拷贝到ANSYS命令输入框后Enter即可:
以下为ANSYS的0-15阶灰度图(适用于win32图形模式)
/RGB,INDEX,0,0,0,0
/RGB,INDEX,6.66667,6.66667,6.66667,1
/RGB,INDEX,13.3333,13.3333,13.3333,2
/RGB,INDEX,20,20,20,3
/RGB,INDEX,26.6667,26.6667,26.6667,4
/RGB,INDEX,33.3333,33.3333,33.3333,5
/RGB,INDEX,40,40,40,6
/RGB,INDEX,46.6667,46.6667,46.6667,7
/RGB,INDEX,53.3333,53.3333,53.3333,8
/RGB,INDEX,60,60,60,9
/RGB,INDEX,66.6667,66.6667,66.6667,10
/RGB,INDEX,73.3333,73.3333,73.3333,11
/RGB,INDEX,80,80,80,12
/RGB,INDEX,86.6667,86.6667,86.6667,13
/RGB,INDEX,93.3333,93.3333,93.3333,14
/RGB,INDEX,100,100,100,15
/replot

以下为ANSYS的1-128阶灰度图(适用于win32c图形模式)
/RGB,CNTR,0,0,0,1
/RGB,CNTR,0.789063,0.789063,0.789063,2
/RGB,CNTR,1.57813,1.57813,1.57813,3
/RGB,CNTR,2.36719,2.36719,2.36719,4
/RGB,CNTR,3.15625,3.15625,3.15625,5
/RGB,CNTR,3.94531,3.94531,3.94531,6
/RGB,CNTR,4.73438,4.73438,4.73438,7
/RGB,CNTR,5.52344,5.52344,5.52344,8
/RGB,CNTR,6.3125,6.3125,6.3125,9
/RGB,CNTR,7.10156,7.10156,7.10156,10
/RGB,CNTR,7.89063,7.89063,7.89063,11
/RGB,CNTR,8.67969,8.67969,8.67969,12
/RGB,CNTR,9.46875,9.46875,9.46875,13
/RGB,CNTR,10.2578,10.2578,10.2578,14
/RGB,CNTR,11.0469,11.0469,11.0469,15
/RGB,CNTR,11.8359,11.8359,11.8359,16
/RGB,CNTR,12.625,12.625,12.625,17
/RGB,CNTR,13.4141,13.4141,13.4141,18
/RGB,CNTR,14.2031,14.2031,14.2031,19
/RGB,CNTR,14.9922,14.9922,14.9922,20
/RGB,CNTR,15.7813,15.7813,15.7813,21
/RGB,CNTR,16.5703,16.5703,16.5703,22
/RGB,CNTR,17.3594,17.3594,17.3594,23
/RGB,CNTR,18.1484,18.1484,18.1484,24
/RGB,CNTR,18.9375,18.9375,18.9375,25
/RGB,CNTR,19.7266,19.7266,19.7266,26
/RGB,CNTR,20.5156,20.5156,20.5156,27
/RGB,CNTR,21.3047,21.3047,21.3047,28
/RGB,CNTR,22.0938,22.0938,22.0938,29
/RGB,CNTR,22.8828,22.8828,22.8828,30
/RGB,CNTR,23.6719,23.6719,23.6719,31
/RGB,CNTR,24.4609,24.4609,24.4609,32
/RGB,CNTR,25.25,25.25,25.25,33
/RGB,CNTR,26.0391,26.0391,26.0391,34
/RGB,CNTR,26.8281,26.8281,26.8281,35
/RGB,CNTR,27.6172,27.6172,27.6172,36
/RGB,CNTR,28.4063,28.4063,28.4063,37
/RGB,CNTR,29.1953,29.1953,29.1953,38
/RGB,CNTR,29.9844,29.9844,29.9844,39
/RGB,CNTR,30.7734,30.7734,30.7734,40
/RGB,CNTR,31.5625,31.5625,31.5625,41
/RGB,CNTR,32.3516,32.3516,32.3516,42
/RGB,CNTR,33.1406,33.1406,33.1406,43
/RGB,CNTR,33.9297,33.9297,33.9297,44
/RGB,CNTR,34.7188,34.7188,34.7188,45
/RGB,CNTR,35.5078,35.5078,35.5078,46
/RGB,CNTR,36.2969,36.2969,36.2969,47
/RGB,CNTR,37.0859,37.0859,37.0859,48
/RGB,CNTR,37.875,37.875,37.875,49
/RGB,CNTR,38.6641,38.6641,38.6641,50
/RGB,CNTR,39.4531,39.4531,39.4531,51
/RGB,CNTR,40.2422,40.2422,40.2422,52
/RGB,CNTR,41.0313,41.0313,41.0313,53
/RGB,CNTR,41.8203,41.8203,41.8203,54
/RGB,CNTR,42.6094,42.6094,42.6094,55
/RGB,CNTR,43.3984,43.3984,43.3984,56
/RGB,CNTR,44.1875,44.1875,44.1875,57
/RGB,CNTR,44.9766,44.9766,44.9766,58
/RGB,CNTR,45.7656,45.7656,45.7656,59
/RGB,CNTR,46.5547,46.5547,46.5547,60
/RGB,CNTR,47.3438,47.3438,47.3438,61
/RGB,CNTR,48.1328,48.1328,48.1328,62
/RGB,CNTR,48.9219,48.9219,48.9219,63
/RGB,CNTR,49.7109,49.7109,49.7109,64
/RGB,CNTR,50.5,50.5,50.5,65
/RGB,CNTR,51.2891,51.2891,51.2891,66
/RGB,CNTR,52.0781,52.0781,52.0781,67
/RGB,CNTR,52.8672,52.8672,52.8672,68
/RGB,CNTR,53.6563,53.6563,53.6563,69
/RGB,CNTR,54.4453,54.4453,54.4453,70
/RGB,CNTR,55.2344,55.2344,55.2344,71
/RGB,CNTR,56.0234,56.0234,56.0234,72
/RGB,CNTR,56.8125,56.8125,56.8125,73
/RGB,CNTR,57.6016,57.6016,57.6016,74
/RGB,CNTR,58.3906,58.3906,58.3906,75
/RGB,CNTR,59.1797,59.1797,59.1797,76
/RGB,CNTR,59.9688,59.9688,59.9688,77
/RGB,CNTR,60.7578,60.7578,60.7578,78
/RGB,CNTR,61.5469,61.5469,61.5469,79
/RGB,CNTR,62.3359,62.3359,62.3359,80
/RGB,CNTR,63.125,63.125,63.125,81
/RGB,CNTR,63.9141,63.9141,63.9141,82
/RGB,CNTR,64.7031,64.7031,64.7031,83
/RGB,CNTR,65.4922,65.4922,65.4922,84
/RGB,CNTR,66.2813,66.2813,66.2813,85
/RGB,CNTR,67.0703,67.0703,67.0703,86
/RGB,CNTR,67.8594,67.8594,67.8594,87
/RGB,CNTR,68.6484,68.6484,68.6484,88
/RGB,CNTR,69.4375,69.4375,69.4375,89
/RGB,CNTR,70.2266,70.2266,70.2266,90
/RGB,CNTR,71.0156,71.0156,71.0156,91
/RGB,CNTR,71.8047,71.8047,71.8047,92
/RGB,CNTR,72.5938,72.5938,72.5938,93
/RGB,CNTR,73.3828,73.3828,73.3828,94
/RGB,CNTR,74.1719,74.1719,74.1719,95
/RGB,CNTR,74.9609,74.9609,74.9609,96
/RGB,CNTR,75.75,75.75,75.75,97
/RGB,CNTR,76.5391,76.5391,76.5391,98
/RGB,CNTR,77.3281,77.3281,77.3281,99
/RGB,CNTR,78.1172,78.1172,78.1172,100
/RGB,CNTR,78.9063,78.9063,78.9063,101
/RGB,CNTR,79.6953,79.6953,79.6953,102
/RGB,CNTR,80.4844,80.4844,80.4844,103
/RGB,CNTR,81.2734,81.2734,81.2734,104
/RGB,CNTR,82.0625,82.0625,82.0625,105
/RGB,CNTR,82.8516,82.8516,82.8516,106
/RGB,CNTR,83.6406,83.6406,83.6406,107
/RGB,CNTR,84.4297,84.4297,84.4297,108
/RGB,CNTR,85.2188,85.2188,85.2188,109
/RGB,CNTR,86.0078,86.0078,86.0078,110
/RGB,CNTR,86.7969,86.7969,86.7969,111
/RGB,CNTR,87.5859,87.5859,87.5859,112
/RGB,CNTR,88.375,88.375,88.375,113
/RGB,CNTR,89.1641,89.1641,89.1641,114
/RGB,CNTR,89.9531,89.9531,89.9531,115
/RGB,CNTR,90.7422,90.7422,90.7422,116
/RGB,CNTR,91.5313,91.5313,91.5313,117
/RGB,CNTR,92.3203,92.3203,92.3203,118
/RGB,CNTR,93.1094,93.1094,93.1094,119
/RGB,CNTR,93.8984,93.8984,93.8984,120
/RGB,CNTR,94.6875,94.6875,94.6875,121
/RGB,CNTR,95.4766,95.4766,95.4766,122
/RGB,CNTR,96.2656,96.2656,96.2656,123
/RGB,CNTR,97.0547,97.0547,97.0547,124
/RGB,CNTR,97.8438,97.8438,97.8438,125
/RGB,CNTR,98.6328,98.6328,98.6328,126
/RGB,CNTR,99.4219,99.4219,99.4219,127
/RGB,CNTR,100.211,100.211,100.211,128
/replot

上述命令为以下C++代码生成:

//生成8位和128位ANSYS灰度命令文件
#include<fstream>
#include<cstring>
using namespace std;

void main(){
int i;
float color_value=0;
char tmp[128]="ANSYS_grayscale_colormap_8bit_128bit.txt";

fstream outfile;
outfile.open(tmp,ios::out);

outfile<<"以下为ANSYS的0-15阶灰度图(适用于win32图形模式)"<<endl;
for(i=0;i<=15;i++){
outfile<<"/RGB,INDEX,"<<i*100.0/15<<","<<i*100.0/15<<","<<i*100.0/15<<","<<i<<endl;
}
outfile<<"/replotn"<<endl;

outfile<<"n以下为ANSYS的1-128阶灰度图(适用于win32c图形模式)"<<endl;
for(i=0;i<128;i++){
outfile<<"/RGB,CNTR,"<<i*101.0/128<<","<<i*101.0/128<<","<<i*101.0/128<<","<<i+1<<endl;
}
outfile<<"/replot"<<endl;

outfile.close();
}
以下为win32c图形模式下,彩色图与128阶灰度图对比:
图1 系统默认彩色云图
图2 灰度云图

若要返回到系统默认的彩色显示,则:工具菜单PlotCtrls->Style->Colors->Default Color Map即可,别忘了Replot一下。


https://blog.sciencenet.cn/blog-352608-583905.html


收藏 IP: 202.38.87.*| 热度|

2 陈小斌 陈德鹏

该博文允许注册用户评论 请点击登录 评论 (1 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-11-29 06:38

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部