#include #define MAXVALUE 2147483647 int renumberfrd( int firstelem, int firstnode, Summen *anz, Nodes **nptr, Elements **eptr, Datasets **lptr ) { static Nodes *node; static Elements *elem; static Datasets *lcase; int i,n, ipuf; int nlc; int *newnode, *newelem; double *newnode_x, *newnode_y, *newnode_z, *dat; node=*nptr; elem=*eptr; lcase=*lptr; if ( (newnode = (int *)malloc( (anz->nmax+firstnode)*sizeof(int) )) == NULL ) { printf("\n\n ERROR: malloc failed in renumberfrd()\n\n") ; return(-1); } if ( (newelem = (int *)malloc( (anz->emax+firstelem)*sizeof(int) )) == NULL ) { printf("\n\n ERROR: malloc failed in renumberfrd()\n\n") ; return(-1); } if ( (dat = (double *)malloc( (anz->nmax+firstnode)*sizeof(double) )) == NULL ) { printf("\n\n ERROR: malloc failed in renumberfrd()\n\n") ; return(-1); } if ( (newnode_x = (double *)malloc( (anz->nmax+firstnode)*sizeof(double) )) == NULL ) { printf("\n\n ERROR: malloc failed in renumberfrd()\n\n") ; return(-1); } if ( (newnode_y = (double *)malloc( (anz->nmax+firstnode)*sizeof(double) )) == NULL ) { printf("\n\n ERROR: malloc failed in renumberfrd()\n\n") ; return(-1); } if ( (newnode_z = (double *)malloc( (anz->nmax+firstnode)*sizeof(double) )) == NULL ) { printf("\n\n ERROR: malloc failed in renumberfrd()\n\n") ; return(-1); } if (anz->n > 0) { anz->nmax=-MAXVALUE; anz->nmin= MAXVALUE; for (i=0; in; i++) { newnode[node[i].nr]=i+firstnode; newnode_x[node[i].nr]=node[node[i].nr].nx; newnode_y[node[i].nr]=node[node[i].nr].ny; newnode_z[node[i].nr]=node[node[i].nr].nz; if (newnode[node[i].nr] > anz->nmax) anz->nmax=newnode[node[i].nr]; if (newnode[node[i].nr] < anz->nmin) anz->nmin=newnode[node[i].nr]; } } if (anz->e > 0) { anz->emax=-MAXVALUE; anz->emin=MAXVALUE; for (i=0; ie; i++) { ipuf=0; if (elem[i].type == 1) ipuf = 8; /* CHEXA8 */ if (elem[i].type == 3) ipuf = 4; /* CTET4 */ if (elem[i].type == 4) ipuf = 20; /* CHEXA20 */ if (elem[i].type == 6) ipuf = 10; /* CTET10 */ if (elem[i].type == 7) ipuf = 3; /* CTRI3 */ if (elem[i].type == 8) ipuf = 6; /* CTRI6 */ if (elem[i].type == 9) ipuf = 4; /* CQUAD4 */ if (elem[i].type == 10) ipuf = 10; /* CQUAD8 */ if (elem[i].type == 11) ipuf = 2; /* CBEAM2 */ if (elem[i].type == 12) ipuf = 3; /* CBEAM3 */ if (ipuf==0) { printf (" elem(%d) not a known type (%d)\n", elem[i].nr, elem[i].type); } else { elem[i].nr=i+firstelem; if (elem[i].nr > anz->emax) anz->emax=elem[i].nr; if (elem[i].nr < anz->emin) anz->emin=elem[i].nr; for (n=0; nl > 0) { for (nlc=0; nlc< anz->l; nlc++) { if (lcase[nlc].ncomps ==1 ) { for (i=0; in; i++) { dat[node[i].nr]=lcase[nlc].dat[0][node[i].nr] ; } if ( (lcase[nlc].dat = (float **)realloc( (float **)lcase[nlc].dat , 1 * sizeof(float *))) == NULL ) { printf("\n\n ERROR: realloc failed\n\n" ); exit(-1); } if ( (lcase[nlc].dat[0] = (float *)realloc( (float *)lcase[nlc].dat[0] ,(anz->nmax+1) * sizeof(float))) == NULL ) { printf("\n\n ERROR: realloc failed\n\n" ); exit(-1); } for (i=0; in; i++) { lcase[nlc].dat[0][newnode[node[i].nr]]=dat[node[i].nr]; } } } } if (anz->n > 0) { for (i=0; in; i++) { if ( (node = (Nodes *)realloc((Nodes *)node, (anz->nmax+1) * sizeof(Nodes))) == NULL ) { printf("\n\n ERROR: realloc failed, nodenr\n") ; exit(-1); } node[newnode[node[i].nr]].nx=newnode_x[node[i].nr]; node[newnode[node[i].nr]].ny=newnode_y[node[i].nr]; node[newnode[node[i].nr]].nz=newnode_z[node[i].nr]; node[i].nr=newnode[node[i].nr]; } } free(newnode); free(newnode_x); free(newnode_y); free(newnode_z); free(newelem); free(dat); *nptr = node; *eptr = elem; *lptr = lcase; return (1); }