- 积分
- 6
- 注册时间
- 2007-9-18
- 仿真币
-
- 最后登录
- 1970-1-1
|
新手向各位前辈问好。有一个很小的程序,编译有一个错误: error C2819: type 'Stack' does not have an overloaded member 'operator ->' 希望朋友们能帮忙一下。感谢。
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/* FMG Solver of the EHL circular contact */
#define pi 3.1415926535897931
typedef struct
{
double hx;
int ii;
double *p, *f;
double *hfi, *hrhs;
double *w;
double *K;
double *pjac; /*old pressure for use in Jacobi relaxation*/
double rg;
double Hm;
} Level;
typedef struct
{
int nx0;
int maxlevel;
double xa,xb;
double h0;
Level *Lk;
} Stack;
void initialize(Stack *U, int nx0, int maxl, double xa, double xb, double h0)
{
/* initialize values in datastructure */
double hx;
Level *L;
int l,ii;
U->xa=xa;
U->xb=xb;
U->maxlevel=maxl;
U->h0=h0;
U->Lk=(Level *)calloc(maxl+1,sizeof(Level));
hx=(xb-xa)/nx0;
ii=nx0;
for (l=1; l<=maxl; l++)
{
L=U->Lk+l;
L->hx=hx;
L->ii=ii;
L->p =(double *)calloc(U->maxlevel+1,sizeof(double));
L->w =(double *)calloc(U->maxlevel+1,sizeof(double));
L->f =(double *)calloc(U->maxlevel+1,sizeof(double));
L->pjac =(double *)calloc(U->maxlevel+1,sizeof(double));
L->hfi =(double *)calloc(U->maxlevel+1,sizeof(double));
L->hrhs=(double *)calloc(U->maxlevel+1,sizeof(double));
L->K =(double *)calloc(U->maxlevel+1,sizeof(double));
printf("\n level: %2d ii=%4d, hx=%f",l,ii,hx);
hx*=0.5; ii*=2;
}
}
void main()
{
Stack U;
initialize(&U,128,1,-4.5,1.5,1);
printf("xa in U is %f",U->xa);
system("pause");
} |
|