| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 722 人关注过本帖
标题:重金酬谢!!!急救!@@@@@@!!!!
取消只看楼主 加入收藏
求救的BOY
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2005-12-2
收藏
 问题点数:0 回复次数:0 
重金酬谢!!!急救!@@@@@@!!!!

小弟我不是学计算机的,VC也没有学过啊...只是学过一点TC.....今年大四了,老师说要用VC来模拟什么温度场~~~~考试就考这个....小弟我无奈上来求助!!!!!
请大侠门帮帮忙啊~~~~能不能在下面的程序中有问号"????"的地方帮小弟我注释下是什么意思~~~~~~求求大家了~~~~还希望大家能告诉我这个算出来到底应该是什么????
跪谢~~~~!!!!!
再次跪谢!!!!!!

能解决的朋友希望可以尽快联系我`~~~~~QQ:12559504 (请说明是VC编程的),
若您给的东西有用,本人可以用Q币,IP卡,电话卡,游戏电数卡等酬谢~~~~~~~~




#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h"
#include "malloc.h"
#include "string.h"

#define Max_Buffer 250 ????

int Mx, My, Mz;
int *M;

float *dx, *dy, *dz;
double dt;
double *w1, *w2, *w3, *w4, *w5, *w6;
double time=0, deltat=0.1, alpha=0.5, f=2/(deltat*alpha), T0=25, Tt=100;

double *T, *T1;
void readgeo(FILE *fp);
void init();
void Saulyev();
void output();

int main(int argc, char* argv[])
{int flag_run; ????

FILE *fp;

fp = fopen("readgeo.txt", "r");
if( fp == NULL ) ????
{ printf("Can't open readgeo.txt file for reading\n");
exit(1);
}
readgeo (fp);

fclose (fp);

init();

flag_run = 1;
do
{
Saulyev();
time = time + deltat;
if( time > 10 )
flag_run = 0;

}while(flag_run);

output();

return 0;
}


void readgeo(FILE *fp)
{
int i,j,k;
int counter;
int number;
float dimension;
char buffer[Max_Buffer]; ????
size_t size;

fgets(buffer, Max_Buffer, fp); ????
fgets(buffer, Max_Buffer, fp);
sscanf(buffer, "%d", &Mx); ????
printf("Mx = %d\n", Mx);
dx=(float *)malloc(Mx * sizeof(float)); ????
counter = 0;
do
{
fgets(buffer, Max_Buffer, fp); ????
sscanf(buffer, "%d %f", &number, &dimension); ????
for(i=0; i<number; i++)
dx[i+counter] = dimension;
counter += number;
}while( counter < Mx );

fgets(buffer, Max_Buffer, fp);
fgets(buffer, Max_Buffer, fp);
sscanf(buffer, "%d", &My);
printf("My = %d\n", My);
dy=(float *)malloc(My * sizeof(float));
counter = 0;
do
{
fgets(buffer, Max_Buffer, fp);
sscanf(buffer, "%d %f", &number, &dimension);
for(i=0; i<number; i++)
dy[i+counter] = dimension;
counter += number;
}while( counter < My );

fgets(buffer, Max_Buffer, fp);
fgets(buffer, Max_Buffer, fp);
sscanf(buffer, "%d", &Mz);
printf("Mz = %d\n\n", Mz);
dz=(float *)malloc(Mz * sizeof(float)); ?????
counter = 0;
do
{
fgets(buffer, Max_Buffer, fp);
sscanf(buffer, "%d %f", &number, &dimension);
for(i=0; i<number; i++)
dz[i+counter] = dimension;
counter += number;
}while( counter < Mz );


size = Mx*My*Mz*sizeof(int);
M=(int *)malloc(size);
fgets(buffer, Max_Buffer, fp);

for(i=0; i<Mx; i++)
for(j=0; j<My; j++)
for(k=0; k<Mz; k++)
fscanf(fp, "%d", (M+i*My*Mz+j*Mz+k)); ????
for(i=0;i<Mx;i++)
{
for(j=0;j<My;j++)
{
for(k=0;k<Mz;k++)
printf("%d " , *(M+i*My*Mz+j*Mz+k));
printf("\n");
}
printf("\n\n");
}

}

void init(void)
{
int i, j, k;
size_t size;


size = Mx * My * Mz * sizeof (double); ????
T = (double *)malloc(size); ????
T1= (double *)malloc(size); ????


for(i=0; i<Mx; i++)
for(j=0; j<My; j++)
for(k=0; k<Mz; k++)
{
if( *(M+i*My*Mz+j*Mz+k)==1 )
*(T+i*My*Mz+j*Mz+k) = T0;
else
*(T+i*My*Mz+j*Mz+k) = Tt;
}

for(i=0; i<Mx; i++)
for(j=0; j<My; j++)
for(k=0; k<Mz; k++)
*(T1+i*My*Mz+j*Mz+k) = *(T+i*My*Mz+j*Mz+k);

size = Mx * sizeof(double);
w1 = (double *)malloc(size); ????
w2 = (double *)malloc(size); ????

size = My * sizeof(double);
w3 = (double *)malloc(size);
w4 = (double *)malloc(size);

size = Mz * sizeof(double);
w5 = (double *)malloc(size);
w6 = (double *)malloc(size);


for(i=1; i<Mx-1; i++)
{
w1[i] = 2/(dx[i] * (dx[i]+dx[i+1]));
w2[i] = 2/(dx[i] * (dx[i]+dx[i-1]));
}

for(j=1; j<My-1; j++)
{
w3[j] = 2/(dy[j] * (dy[j]+dy[j+1]) );
w4[j] = 2/(dy[j] * (dy[j]+dy[j-1]) );
}

for(k=1; k<Mz-1; k++)
{
w5[k] = 2/(dz[k] * (dz[k]+dz[k+1]) );
w6[k] = 2/(dz[k] * (dz[k]+dz[k-1]) );
}

}

void Saulyev(void)
{
int i, j, k;

for(i=1; i<Mx-1; i++)
for (j=1; j<My-1; j++)
for (k=1; k<Mz-1; k++)
{
if( *(M+i*My*Mz+j*Mz+k) == 1)
{
*(T+i*My*Mz+j*Mz+k) = *(T+i*My*Mz+j*Mz+k)
+( (*(T+(i+1)*My*Mz+j*Mz+k)-*(T+i*My*Mz+j*Mz+k))*w1[i]
+(*(T+(i-1)*My*Mz+j*Mz+k)-*(T+i*My*Mz+j*Mz+k))*w2[i]
+(*(T+i*My*Mz+(j+1)*Mz+k)-*(T+i*My*Mz+j*Mz+k))*w3[j]
+(*(T+i*My*Mz+(j-1)*Mz+k)-*(T+i*My*Mz+j*Mz+k))*w4[j]
+(*(T+i*My*Mz+j*Mz+(k+1))-*(T+i*My*Mz+j*Mz+k))*w5[k]
+(*(T+i*My*Mz+j*Mz+(k-1))-*(T+i*My*Mz+j*Mz+k))*w6[k] )/f;
}
}
for(i=Mx-2; i>0; i--)
for(j=My-2; j>0; j--)
for(k=Mz-2; k>0; k--)
{
if( *(M+i*My*Mz+j*Mz+k) == 1)
{
*(T+i*My*Mz+j*Mz+k) = *(T+i*My*Mz+j*Mz+k)
+( (*(T+(i+1)*My*Mz+j*Mz+k)-*(T+i*My*Mz+j*Mz+k))*w1[i]
+(*(T+(i-1)*My*Mz+j*Mz+k)-*(T+i*My*Mz+j*Mz+k))*w2[i]
+(*(T+i*My*Mz+(j+1)*Mz+k)-*(T+i*My*Mz+j*Mz+k))*w3[j]
+(*(T+i*My*Mz+(j-1)*Mz+k)-*(T+i*My*Mz+j*Mz+k))*w4[j]
+(*(T+i*My*Mz+j*Mz+(k+1))-*(T+i*My*Mz+j*Mz+k))*w5[k]
+(*(T+i*My*Mz+j*Mz+(k-1))-*(T+i*My*Mz+j*Mz+k))*w6[k] )/f;
}
}
}

void output()
{
int i,j,k;
for(i=0;i<Mx;i++)
{
for(j=0;j<My;j++)
{
for(k=0;k<Mz;k++)
{
printf("%6.2f " , *(T+i*My*Mz+j*Mz+k));
}
printf("\n");
}
printf("\n\n");
}
}


下面的文件是放在一个写字板里的~~~就是READGEO.TXT文件里的东西~~~~
Exp Solution
10
10 1

10
10 1

10
10 1

0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0
0 1 1 0 0 0 0 1 1 0
0 1 1 0 0 0 0 1 1 0
0 1 1 1 1 1 1 1 1 0
0 1 1 1 1 1 1 1 1 0
0 0 0 1 1 1 1 0 0 0
0 0 0 1 1 1 1 0 0 0
0 0 0 0 1 1 0 0 0 0
0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0
0 1 1 0 0 0 0 1 1 0
0 1 1 0 0 0 0 1 1 0
0 1 1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 1 1 1 1 0
0 0 0 1 1 1 1 0 0 0
0 0 0 1 1 1 1 0 0 0
0 0 0 0 1 1 0 0 0 0
0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0
0 1 1 0 0 0 0 1 1 0
0 1 1 0 0 0 0 1 1 0
0 1 1 1 1 1 1 1 1 0
0 1 1 1 1 1 1 1 1 0
0 0 0 1 1 1 1 0 0 0
0 0 0 1 1 1 1 0 0 0
0 0 0 0 1 1 0 0 0 0
0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0

能解决的朋友希望可以尽快联系我`~~~~~QQ:12559504 (请说明是VC编程的),
若您给的东西有用,本人可以用Q币,IP卡,电话卡,游戏电数卡等酬谢~~~~~~~~


[此贴子已经被作者于2005-12-2 21:53:52编辑过]

搜索更多相关主题的帖子: 重金 酬谢 急救 
2005-12-02 21:48
快速回复:重金酬谢!!!急救!@@@@@@!!!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.049259 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved