90   register int i=0, j=0;
    91   int  nodeflag=0, elemflag=0, errFlag=0, firsttime=1;
    94   fpos_t *filepntr=NULL;
    95   int elem_data=0,nod_data=0, nod_1st_block=0; 
    97   int  ncomps, maxcomps=0, nvals, nentities;
    99   int  node_field_size, elem_field_size;
   100   int  e_nmax=1, e_nmin=1;
   101   int  length, flag, format_flag;
   103   static float *value=NULL;
   105   char **dat, **compName;
   106   int          *menu, *ictype, *icind1, *icind2, *iexist; 
   117     printf(
"\n\n ERROR: malloc failed\n\n") ;
   119   anz->
u=anz->
n=anz->
e=anz->
l=-1;
   124   handle = fopen (datin, 
"r");
   125   if ( handle== NULL )  { printf (
"ERROR: The input file \"%s\" could not be opened.\n\n", datin); 
return(-1); }
   126   else  printf (
" file:%s opened\n", datin);
   129   printf (
" reading frd format\n");
   130   length = 
frecord( handle, rec_str);
   131   rec_str[length]=
'\0';
   132   flag = 
stoi(rec_str,4,5);
   136     printf (
" MODEL NAME:  %s", anz->
model);
   140     printf (
"\n\nFATAL ERROR: no proper file-format found.\n\n");
   149     {  
if( (filepntr=(fpos_t *)malloc(1*
sizeof(fpos_t))) == NULL ) printf(
" ERROR: malloc failed\n"); }
   151     if(fgetpos( handle, (fpos_t *)filepntr)!=0) { printf(
"error in fgetpos"); 
return(-1); }
   154     length = 
frecord( handle, rec_str);
   155     if (rec_str[length] == (
char)EOF) 
break;
   156     else rec_str[length] =(char)0;
   157     printf (
"record:%s\n", rec_str);
   160     flag = 
stoi(rec_str,1,5);
   161     format_flag = 
stoi(rec_str,74,75);
   164     if(flag == 9999) 
goto read_again;
   165     if(( (nodeflag==1)&&(flag == 2) ) || ( (elemflag==1)&&(flag == 3) ))
   167       printf (
"found a second mesh. This mesh will be ignored\n");
   177         { 
if(( anz->
uheader=(
char **)malloc( 
sizeof(
char *))) == NULL )
   178           printf(
"\n\n ERROR: malloc failed\n\n") ; }
   179         else if(( anz->
uheader=(
char **)realloc((
char **)anz->
uheader, (anz->
u+1)*
sizeof(
char *))) == NULL )
   180           printf(
"\n\n ERROR: realloc failed\n\n") ;
   182           printf(
"\n\n ERROR: malloc failed\n\n") ;
   183         strcpy(anz->
uheader[anz->
u],rec_str);
   191         { 
if(( pheader=(
char **)malloc( 
sizeof(
char *))) == NULL )
   192           printf(
"\n\n ERROR: malloc failed\n\n") ; }
   193         else if(( pheader=(
char **)realloc((
char **)pheader, (anz_p+1)*
sizeof(
char *))) == NULL )
   194           printf(
"\n\n ERROR: realloc failed\n\n") ;
   195         if(( pheader[anz_p]=(
char *)malloc( 
MAX_LINE_LENGTH * 
sizeof(
char))) == NULL )
   196           printf(
"\n\n ERROR: malloc failed\n\n") ;
   197         strcpy(pheader[anz_p],rec_str);
   209       printf (
"reading Nodes\n");
   214       nod_data=
stoi( rec_str, 25, 36 );
   215       if(nod_data>0) node_field_size=nod_data;
   219         if ( (node = (
Nodes *)realloc( (
Nodes *)node, (node_field_size+1) * 
sizeof(
Nodes))) == NULL )
   221           printf(
"WARNING: in readfrd() is INI_FIELD_SIZE:%d to large and is reduced\n", node_field_size );
   224         if(node_field_size<0)
   226           printf(
"\n\n ERROR: not enough memory in readfrd()\n\n");
   230       for(i=0; i<node_field_size; i++) node[i].indx=-1;
   236         length = 
frecord( handle, rec_str);
   237         if (rec_str[length] == (
char)EOF) 
break;
   238         flag = 
stoi(rec_str,1,3);
   240         if (flag == -3) 
break;
   241         if (!format_flag) node[anz->
n].
nr = 
stoi(rec_str,4,8);
   242         else              node[anz->
n].
nr = 
stoi(rec_str,4,13);
   243         if (node[anz->
n].
nr>=node_field_size)
   246           nodenr=node[anz->
n].
nr;
   249             if ( (node = (
Nodes *)realloc( (
Nodes *)node, (node_field_size+1) * 
sizeof(
Nodes))) == NULL )
   251               printf(
"WARNING: in readfrd() is INI_FIELD_SIZE:%d to large and is reduced\n", node_field_size );
   252               node_field_size=nodenr+(node_field_size-nodenr)/2;
   254             if(node_field_size<=nodenr)
   256               printf(
"\n\n ERROR: not enough memory in readfrd() for node-nr:%d available\n\n", nodenr);
   260           for(i=anz->
nmax+1; i<node_field_size; i++) node[i].
indx=-1;
   263         if(node[node[anz->
n].
nr].
indx<0)
   268             node[node[anz->
n].
nr].
nx = 
stof(&rec_str[8],1,12);
   269             node[node[anz->
n].
nr].
ny = 
stof(&rec_str[20],1,12);
   270             node[node[anz->
n].
nr].
nz = 
stof(&rec_str[32],1,12);
   274             node[node[anz->
n].
nr].
nx = 
stof(&rec_str[13],1,12);
   275             node[node[anz->
n].
nr].
ny = 
stof(&rec_str[25],1,12);
   276             node[node[anz->
n].
nr].
nz = 
stof(&rec_str[37],1,12);
   281         printf (
" n=%d x=%lf y=%lf z=%lf \n",  node[anz->
n].
nr,
   282           node[node[anz->
n].
nr].
nx, node[node[anz->
n].nr].ny,
   283           node[node[anz->
n].nr].nz); 
   292        if ( (value = (
float *)realloc((
float *)value, (3) * 
sizeof(
float))) == NULL )
   293          printf(
"\n\n ERROR: realloc failed, value\n\n") ;
   294        for(i=0; i<nod_data; i++)
   297         length=fread((
int *)&node[anz->
n].
nr,
sizeof(
int),1,handle);
   299         if (node[anz->
n].
nr>=node_field_size)
   302           nodenr= node[anz->
n].
nr;
   305             if ( (node = (
Nodes *)realloc( (
Nodes *)node, (node_field_size+1) * 
sizeof(
Nodes))) == NULL )
   307               printf(
"WARNING: in readfrd() is INI_FIELD_SIZE:%d to large and is reduced\n", node_field_size );
   308               node_field_size=nodenr+(node_field_size-nodenr)/2;
   310             if(node_field_size<=nodenr)
   312               printf(
"\n\n ERROR: not enough memory in readfrd() for the node-nr:%d available\n\n", nodenr);
   316           for(n=node[anz->
n].
nr; n<node_field_size; n++) node[n].
indx=-1;
   319         if (format_flag == 2)
   321           length=fread((
float *)value,
sizeof(
float),3,handle);
   323           if(node[node[anz->
n].
nr].
indx<0)
   326         node[node[anz->
n].
nr].
nx = value[0];
   327             node[node[anz->
n].
nr].
ny = value[1];
   328             node[node[anz->
n].
nr].
nz = value[2];
   333           if(node[node[anz->
n].
nr].
indx<0)
   335             length=fread((
double *)&node[node[anz->
n].
nr].
nx,
sizeof(
double),3,handle);
   338           else fseek(handle, 3*
sizeof(
double), SEEK_CUR);
   343         printf (
" n=%d x=%lf y=%lf z=%lf \n",  node[anz->
n].
nr,
   344           node[node[anz->
n].
nr].
nx, node[node[anz->
n].nr].ny,
   345           node[node[anz->
n].nr].nz); 
   350       node_field_size=anz->
nmax+1;
   351       if((node = (
Nodes *)realloc( (
Nodes *)node, node_field_size * 
sizeof(
Nodes))) == NULL )
   352         printf(
"\n\n ERROR: realloc failed\n\n") ;
   354         printf (
"\n %d nodes reallocated \n",anz->
nmax);
   359       printf (
"reading Elements\n");
   365       elem_data=
stoi( rec_str, 25, 36 );
   366       if(elem_data>0) elem_field_size=elem_data;
   372           printf(
"WARNING: in readfrd() is INI_FIELD_SIZE:%d to large and is reduced\n", elem_field_size );
   375         if(elem_field_size<0)
   377           printf(
"\n\n ERROR: not enough memory in readfrd()\n\n");
   383       if (format_flag == 2)
   386           printf(
"\n\n ERROR: in readfrd realloc failed\n\n") ;
   388           printf (
"\n %d elements allocated \n", elem_data);
   389         for (i=0; i<elem_data; i++)
   392           length=fread((
int *)&elem[anz->
e].
nr,
sizeof(
int),1,handle);
   393           length=fread((
int *)&elem[anz->
e].
type,
sizeof(
int),1,handle);
   394           length=fread((
int *)&elem[anz->
e].
group,
sizeof(
int),1,handle);
   395           length=fread((
int *)&elem[anz->
e].
mat,
sizeof(
int),1,handle);
   396       elem[anz->
e].
attr = 0;
   400           if (elem[anz->
e].
type == 1)      ipuf = 8;   
   401           else if (elem[anz->
e].
type == 2) ipuf = 6;   
   402           else if (elem[anz->
e].
type == 3) ipuf = 4;   
   403           else if (elem[anz->
e].
type == 4) ipuf = 20;  
   404           else if (elem[anz->
e].
type == 5) ipuf = 15;  
   405           else if (elem[anz->
e].
type == 6) ipuf = 10;  
   406           else if (elem[anz->
e].
type == 7) ipuf = 3;   
   407           else if (elem[anz->
e].
type == 8) ipuf = 6;   
   408           else if (elem[anz->
e].
type == 9) ipuf = 4;   
   409           else if (elem[anz->
e].
type == 10) ipuf = 8; 
   410           else if (elem[anz->
e].
type == 11) ipuf = 2;  
   411           else if (elem[anz->
e].
type == 12) ipuf = 3;  
   413           length=fread((
int *)elem[anz->
e].
nod,
sizeof(
int),ipuf,handle);
   422         length = 
frecord( handle, rec_str);
   423         if (rec_str[length] == (
char)EOF) 
break;
   424         flag = 
stoi(rec_str,1,3);
   427         if (flag == -3) 
break;
   428         else if ((flag == -1)||(flag == -2))
   430           if (anz->
e>=elem_field_size)
   437                 printf(
"WARNING: in readfrd() is INI_FIELD_SIZE:%d to large and is reduced\n", elem_field_size );
   438                 elem_field_size=anz->
e+(elem_field_size-anz->
e)/2;
   440               if(elem_field_size<=anz->e)
   442                 printf(
"\n\n ERROR: not enough memory in readfrd()\n\n");
   449         elem[anz->
e].
nr = 
stoi(&rec_str[3], 1, 5);
   450         elem[anz->
e].
type = 
stoi(&rec_str[8], 1, 5);
   451         elem[anz->
e].
group = 
stoi(&rec_str[13], 1, 5);
   452         elem[anz->
e].
mat = 
stoi(&rec_str[18], 1, 5);
   456         elem[anz->
e].
nr = 
stoi(&rec_str[3], 1, 10);
   457         elem[anz->
e].
type = 
stoi(&rec_str[13], 1, 5);
   458         elem[anz->
e].
group = 
stoi(&rec_str[18], 1, 5);
   459         elem[anz->
e].
mat = 
stoi(&rec_str[23], 1, 5);
   461       elem[anz->
e].
attr = 0;
   465           if (elem[anz->
e].
type == 1)      ipuf = 8;   
   466           else if (elem[anz->
e].
type == 2) ipuf = 6;   
   467           else if (elem[anz->
e].
type == 3) ipuf = 4;   
   468           else if (elem[anz->
e].
type == 4) ipuf = 20;  
   469           else if (elem[anz->
e].
type == 5) ipuf = 15;  
   470           else if (elem[anz->
e].
type == 6) ipuf = 10;  
   471           else if (elem[anz->
e].
type == 7) ipuf = 3;   
   472           else if (elem[anz->
e].
type == 8) ipuf = 6;   
   473           else if (elem[anz->
e].
type == 9) ipuf = 4;   
   474           else if (elem[anz->
e].
type == 10) ipuf = 8; 
   475           else if (elem[anz->
e].
type == 11) ipuf = 2;  
   476           else if (elem[anz->
e].
type == 12) ipuf = 3;  
   478           printf (
"\n%d e=%d typ=%d grp=%d mat=%d \n", flag, elem[anz->
e].
nr,
   481           length = 
frecord( handle, rec_str );
   484             printf (
" element:%d is from unknown type:%d\n", elem[anz->
e].
nr, elem[anz->
e].
type);
   493               for (i=0; i<ipuf; i++)
   495         elem[anz->
e].
nod[i] = 
stoi(&rec_str[3+j*5], 1, 5);
   499                   if (i<ipuf-1) length = 
frecord( handle, rec_str ); j=0;
   506               for (i=0; i<ipuf; i++)
   508                 elem[anz->
e].
nod[i] = 
stoi(&rec_str[3+j*10], 1, 10);
   512                   if (i<ipuf-1) length = 
frecord( handle, rec_str ); j=0;
   520           printf (
"ERROR: flag:%d is not expected, must be -1 or -2!\n%s", flag, rec_str );
   524        elem_field_size=anz->
e+1;
   526          printf(
"\n\n ERROR: in readfrd realloc failed\n\n") ;
   528          printf (
"\n %d elements reallocated \n", anz->
e);
   536       printf (
"reading Dataset No:%d\n",anz->
l+1);
   538       { printf(
"\n\n ERROR: malloc failure\n\n" ); exit(1); }
   540       lcase[anz->
l].
handle=(FILE *)NULL;
   556       nod_data=
stoi( rec_str, 25, 36 );
   560         printf(
" WARNING: in this result-block are more nodes announced:%d than in the model defined:%d\n Please inform the program-admin of the originator of the frd-file\n\n", nod_data, anz->
n);
   567         nod_data=nod_1st_block;
   568         printf(
"nods in block assumed:%d\n",nod_data );
   574       if(strlen(rec_str)>72 )
   583       if (!format_flag) n=8;
   596             sscanf(lcase[anz->
l].
pheader[i],
"%*s %d", &ipuf);
   597             if(ipuf>-1) sprintf(lcase[anz->
l].
dataset_text,
"ND:%d",ipuf);
   600         if(ipuf!=-1) 
for(i=0;i<lcase[anz->
l].
npheader; i++)
   604             sscanf(lcase[anz->
l].
pheader[i],
"%*s %d", &ipuf);
   613         if (( format_flag==2)&&(lcase[anz->
l].
ncomps>0)&&(ncomps==lcase[anz->
l].
ncomps))
   631               if( fseek( handle, offset, SEEK_CUR )!=0) printf(
"error in fseek\n");
   636             if ( (value = (
float *)realloc((
float *)value, (lcase[anz->
l].
ncomps) * 
sizeof(
float))) == NULL )
   637               printf(
"\n\n ERROR: realloc failed, value\n\n") ;
   638             for(n=0; n<nod_data; n++)
   640               length=fread((
int *)&nodenr,
sizeof(
int),1,handle);
   641               length=fread((
float *)value,
sizeof(
float),lcase[anz->
l].
ncomps,handle);
   643               for(i=0; i<lcase[anz->
l].
ncomps; i++)
   646                 lcase[anz->
l].
dat[i][nodenr]= value[i];
   654         length = 
frecord( handle, rec_str);
   655         if (rec_str[length] == (
char)EOF) 
break;
   656         flag = 
stoi(rec_str,1,3);
   677               if( fseek( handle, offset-length, SEEK_CUR )!=0) printf(
"error in fseek\n");
   683             if (format_flag) nodenr = 
stoi(rec_str,4,13); 
else nodenr = 
stoi(rec_str,4,8); 
   684             if (nodenr>anz->
nmax)
   686               if (!errFlag) { errFlag=1; printf(
"WARNING: found node:%d in Dataset higher than in geometry allocated:%d\n", nodenr, anz->
nmax); }
   688             else if ( lcase[anz->
l].
irtype == 1 )
   695                   lcase[anz->
l].
dat[0][nodenr]= 
stof(&rec_str[  13  ], 1, 12);
   696                   lcase[anz->
l].
dat[1][nodenr]= 
stof(&rec_str[  25  ], 1, 12);
   697                   lcase[anz->
l].
dat[2][nodenr]= 
stof(&rec_str[  37  ], 1, 12);
   698                   lcase[anz->
l].
dat[3][nodenr]= 
stof(&rec_str[  49  ], 1, 12);
   699                   lcase[anz->
l].
dat[4][nodenr]= 
stof(&rec_str[  61  ], 1, 12);
   700                   lcase[anz->
l].
dat[5][nodenr]= 
stof(&rec_str[  73  ], 1, 12);
   704                   lcase[anz->
l].
dat[0][nodenr]= 
stof(&rec_str[  8   ], 1, 12);
   705                   lcase[anz->
l].
dat[1][nodenr]= 
stof(&rec_str[  20  ], 1, 12);
   706                   lcase[anz->
l].
dat[2][nodenr]= 
stof(&rec_str[  32  ], 1, 12);
   707                   lcase[anz->
l].
dat[3][nodenr]= 
stof(&rec_str[  44  ], 1, 12);
   708                   lcase[anz->
l].
dat[4][nodenr]= 
stof(&rec_str[  56  ], 1, 12);
   709                   lcase[anz->
l].
dat[5][nodenr]= 
stof(&rec_str[  68  ], 1, 12);
   714             for(i=0; i<maxcomps; i++) lcase[anz->
l].
dat[i][nodenr]= 
stof(&rec_str[n+i*12], 1, 12);
   723           if (!format_flag) n=8;
   732               lcase[anz->
l].
dat[i][nodenr]= 
stof(&rec_str[n+j*12], 1, 12);
   734             }
while((j<6)&&(i<lcase[anz->
l].
ncomps));
   739           stos( rec_str, 6, 13, lcase[anz->
l].
name);
   745             printf(
" Found ELEMENT DATA, this is not suported!\n");
   750           if ( (lcase[anz->
l].
nmax = (
int *)malloc( (lcase[anz->
l].
ncomps) * 
sizeof(
int))) == NULL )
   751             printf(
"\n\n ERROR: malloc failure\n\n" );
   752           if ( (lcase[anz->
l].
nmin = (
int *)malloc( (lcase[anz->
l].
ncomps) * 
sizeof(
int))) == NULL )
   753             printf(
"\n\n ERROR: malloc failure\n\n" );
   754           if ( (lcase[anz->
l].
max = (
float *)malloc( (lcase[anz->
l].
ncomps) * 
sizeof(
float))) == NULL )
   755             printf(
"\n\n ERROR: malloc failure\n\n" );
   756           if ( (lcase[anz->
l].
min = (
float *)malloc( (lcase[anz->
l].
ncomps) * 
sizeof(
float))) == NULL )
   757             printf(
"\n\n ERROR: malloc failure\n\n" );
   758           if ( (lcase[anz->
l].
compName = (
char **)malloc( (lcase[anz->
l].
ncomps) * 
sizeof(
char *))) == NULL )
   759             printf(
"\n\n ERROR: malloc failure\n\n" );
   760           if ( (lcase[anz->
l].
icname = (
char **)malloc( (lcase[anz->
l].
ncomps) * 
sizeof(
char *))) == NULL )
   761             printf(
"\n\n ERROR: malloc failure\n\n" );
   762           if ( (lcase[anz->
l].
menu = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
   763             printf(
"\n\n ERROR: malloc failure\n\n" );
   764           if ( (lcase[anz->
l].
ictype = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
   765             printf(
"\n\n ERROR: malloc failure\n\n" );
   766           if ( (lcase[anz->
l].
icind1 = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
   767             printf(
"\n\n ERROR: malloc failure\n\n" );
   768           if ( (lcase[anz->
l].
icind2 = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
   769             printf(
"\n\n ERROR: malloc failure\n\n" );
   770           if ( (lcase[anz->
l].
iexist = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
   771             printf(
"\n\n ERROR: malloc failure\n\n" );
   772           if ( (lcase[anz->
l].
dat = (
float **)malloc( (lcase[anz->
l].
ncomps) * 
sizeof(
float *))) == NULL )
   773             printf(
"\n\n ERROR: malloc failure\n\n" );
   774   printf(
" gen lc[%d] ncomps:%d\n",anz->
l,lcase[anz->
l].
ncomps);
   775           for(i=0; i<(lcase[anz->
l].
ncomps); i++)
   778                printf(
"\n\n ERROR: malloc failed\n\n" );
   780                printf(
"\n\n ERROR: malloc failed\n\n" );
   787           if(ncomps<lcase[anz->
l].
ncomps)
   790             lcase[anz->
l].
menu[ncomps] = 
stoi(rec_str,14,18);
   791             lcase[anz->
l].
ictype[ncomps] = 
stoi(rec_str,19,23);
   792             lcase[anz->
l].
icind1[ncomps] = 
stoi(rec_str,24,28);
   793             lcase[anz->
l].
icind2[ncomps] = 
stoi(rec_str,29,33);
   794             lcase[anz->
l].
iexist[ncomps] = 
stoi(rec_str,34,38);
   797             if(!lcase[anz->
l].
iexist[ncomps]) ncomps++;
   807         printf(
" WARNING: unallocated component:%d \"%s\" %d\n", ncomps, &rec_str[5],lcase[anz->
l].
ncomps);
   814           if(nentities==lcase[anz->
l].
ncomps)
   821             for (i=0; i<ncomps; i++) 
if(lcase[anz->
l].
iexist[i]!=1) nvals++;
   822         printf(
"ncomps:%d nvals:%d\n", ncomps, nvals);
   830                   offset= nod_data * (4+nvals*4); 
   835                   if (!format_flag) n=8;
   837                   if(nvals<=6) offset= nod_data * (n+nvals*12+1); 
   841                     for(i=0; i<nvals/6; i++) 
   842                       offset+= nod_data * (n+6*12+1);
   844                       offset+= nod_data * (n+(nvals%6)*12+1);
   854               for(i=0; i<(lcase[anz->
l].
ncomps); i++)
   856                 if ( (lcase[anz->
l].
dat[i] = (
float *)malloc( (anz->
nmax+1) * 
sizeof(
float))) == NULL )
   857                   printf(
"\n\n ERROR: malloc failure\n\n" );                   
   858                 for(j=0; j<=anz->
nmax; j++) lcase[anz->
l].
dat[i][j]=0.;
   866           length= 
strsplt( rec_str, 
' ', &dat);
   868           if ( (compName = (
char **)malloc( ipuf * 
sizeof(
char *))) == NULL )
   869             printf(
"\n\n ERROR: malloc failure\n\n" );
   870           for(i=0; i<ipuf; i++)
   872             if ( (compName[i] = (
char *)malloc( 
MAX_LINE_LENGTH * 
sizeof(
char))) == NULL )
   873                printf(
"\n\n ERROR: malloc failed\n\n" );
   875           for (i=0; i<ipuf; i++) strcpy(compName[i], lcase[anz->
l].
compName[ atoi(dat[i+3])-1 ]);
   876           for (i=0; i<ipuf; i++) strcpy(lcase[anz->
l].
compName[i],compName[i]);
   877           if ( (menu = (
int *)malloc( ipuf * 
sizeof(
int))) == NULL )
   878             printf(
"\n\n ERROR: malloc failure\n\n" );
   879           if ( (ictype = (
int *)malloc( ipuf * 
sizeof(
int))) == NULL )
   880             printf(
"\n\n ERROR: malloc failure\n\n" );
   881           if ( (icind1 = (
int *)malloc( ipuf * 
sizeof(
int))) == NULL )
   882             printf(
"\n\n ERROR: malloc failure\n\n" );
   883           if ( (icind2 = (
int *)malloc( ipuf * 
sizeof(
int))) == NULL )
   884             printf(
"\n\n ERROR: malloc failure\n\n" );
   885           if ( (iexist = (
int *)malloc( ipuf * 
sizeof(
int))) == NULL )
   886             printf(
"\n\n ERROR: malloc failure\n\n" );
   887           for (i=0; i<ipuf; i++) menu[i] = lcase[anz->
l].
menu[atoi(dat[i+3])-1];
   888           for (i=0; i<ipuf; i++) lcase[anz->
l].
menu[i] =menu[i];
   889           for (i=0; i<ipuf; i++) ictype[i] = lcase[anz->
l].
ictype[atoi(dat[i+3])-1];
   890           for (i=0; i<ipuf; i++) lcase[anz->
l].
ictype[i] =ictype[i];
   891           for (i=0; i<ipuf; i++) icind1[i] = lcase[anz->
l].
icind1[atoi(dat[i+3])-1];
   892           for (i=0; i<ipuf; i++) lcase[anz->
l].
icind1[i] =icind1[i];
   893           for (i=0; i<ipuf; i++) icind2[i] = lcase[anz->
l].
icind2[atoi(dat[i+3])-1];
   894           for (i=0; i<ipuf; i++) lcase[anz->
l].
icind2[i] =icind2[i];
   895           for (i=0; i<ipuf; i++) iexist[i] = lcase[anz->
l].
iexist[atoi(dat[i+3])-1];
   896           for (i=0; i<ipuf; i++) lcase[anz->
l].
iexist[i] =iexist[i];
   898           for(i=0; i<length; i++) 
SFREE(dat[i]);
   901           for(i=0; i<ipuf; i++) 
SFREE(compName[i]);
   914        for(j=0; j<anz->
n; j++)
   916         for(i=0; i<lcase[anz->
l].
ncomps; i++)
   918           if(lcase[anz->
l].
dat[i][node[j].
nr] > lcase[anz->
l].
max[i])
   920             lcase[anz->
l].
max[i]=lcase[anz->
l].
dat[i][node[j].
nr];
   921             lcase[anz->
l].
nmax[i]=node[j].
nr;
   923           if(lcase[anz->
l].
dat[i][node[j].
nr] < lcase[anz->
l].
min[i])
   925             lcase[anz->
l].
min[i]=lcase[anz->
l].
dat[i][node[j].
nr];
   926             lcase[anz->
l].
nmin[i]=node[j].
nr;
   936       printf (
"reading Dataset No:%d\n",anz->
l+1);
   938       { printf(
"\n\n ERROR: malloc failure\n\n" ); exit(1); }
   941       strcpy(lcase[anz->
l].
name,
"DISP    ");
   947       if ( (lcase[anz->
l].
nmax = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
   948         printf(
"\n\n ERROR: malloc failure\n\n" );
   949       if ( (lcase[anz->
l].
nmin = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
   950         printf(
"\n\n ERROR: malloc failure\n\n" );
   951       if ( (lcase[anz->
l].
max = (
float *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
float))) == NULL )
   952         printf(
"\n\n ERROR: malloc failure\n\n" );
   953       if ( (lcase[anz->
l].
min = (
float *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
float))) == NULL )
   954         printf(
"\n\n ERROR: malloc failure\n\n" );
   955       if ( (lcase[anz->
l].
dat = (
float **)malloc( lcase[anz->
l].
ncomps * 
sizeof(
float *))) == NULL )
   956         printf(
"\n\n ERROR: malloc failure\n\n" );
   957       if ( (lcase[anz->
l].
compName = (
char **)malloc( lcase[anz->
l].
ncomps * 
sizeof(
char *))) == NULL )
   958         printf(
"\n\n ERROR: malloc failure\n\n" );
   959       if ( (lcase[anz->
l].
icname = (
char **)malloc( lcase[anz->
l].
ncomps * 
sizeof(
char *))) == NULL )
   960         printf(
"\n\n ERROR: malloc failure\n\n" );
   961       for(i=0; i<lcase[anz->
l].
ncomps; i++)
   964            printf(
"\n\n ERROR: malloc failed\n\n" );
   966            printf(
"\n\n ERROR: malloc failed\n\n" );
   969         if ( (lcase[anz->
l].
dat[i] = (
float *)malloc( (anz->
nmax+1) * 
sizeof(
float))) == NULL )
   970           printf(
"\n\n ERROR: malloc failure\n\n" );                   
   971         for(j=0; j<=anz->
nmax; j++) lcase[anz->
l].
dat[i][j]=0.;
   973       if ( (lcase[anz->
l].
menu = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
   974         printf(
"\n\n ERROR: malloc failure\n\n" );
   975       if ( (lcase[anz->
l].
ictype = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
   976         printf(
"\n\n ERROR: malloc failure\n\n" );
   977       if ( (lcase[anz->
l].
icind1 = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
   978         printf(
"\n\n ERROR: malloc failure\n\n" );
   979       if ( (lcase[anz->
l].
icind2 = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
   980         printf(
"\n\n ERROR: malloc failure\n\n" );
   981       if ( (lcase[anz->
l].
iexist = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
   982         printf(
"\n\n ERROR: malloc failure\n\n" );
   984       for(i=0; i<lcase[anz->
l].
ncomps; i++)
   986         lcase[anz->
l].
menu[i] = 1;
   999         length = 
frecord( handle, rec_str);
  1000         if (rec_str[length] == (
char)EOF) 
break;
  1001         flag = 
stoi(rec_str,1,3);
  1004           if (!format_flag) nodenr = 
stoi(rec_str,4,8);
  1005           else              nodenr = 
stoi(rec_str,4,13);
  1006           if (nodenr>anz->
nmax)
  1008             if (!errFlag) { errFlag=1; printf(
"WARNING: found node:%d in Dataset higher than in geometry allocated:%d\n", nodenr, anz->
nmax); }
  1010           else if (!format_flag) 
  1012             for(i=0; i<lcase[anz->
l].
ncomps; i++)
  1013               lcase[anz->
l].
dat[i][nodenr]= 
stof(&rec_str[8+i*12], 1, 12);
  1017             for(i=0; i<lcase[anz->
l].
ncomps; i++)
  1018               lcase[anz->
l].
dat[i][nodenr]= 
stof(&rec_str[13+i*12], 1, 12);
  1022       for(n=0; n<anz->
n; n++)
  1025         for(i=0; i<lcase[anz->
l].
ncomps; i++)
  1027           if(lcase[anz->
l].
dat[i][nodenr] > lcase[anz->
l].
max[i])
  1029             lcase[anz->
l].
max[i]=lcase[anz->
l].
dat[i][nodenr];
  1030             lcase[anz->
l].
nmax[i]=nodenr;
  1032           if(lcase[anz->
l].
dat[i][nodenr] < lcase[anz->
l].
min[i])
  1034             lcase[anz->
l].
min[i]=lcase[anz->
l].
dat[i][nodenr];
  1035             lcase[anz->
l].
nmin[i]=nodenr;
  1044       printf (
"reading Dataset No:%d\n",anz->
l+1);
  1046       { printf(
"\n\n ERROR: malloc failure\n\n" ); exit(1); }
  1049       strcpy(lcase[anz->
l].
name,
"STRESS  ");
  1055       if ( (lcase[anz->
l].
nmax = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
  1056         printf(
"\n\n ERROR: malloc failure\n\n" );
  1057       if ( (lcase[anz->
l].
nmin = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
  1058         printf(
"\n\n ERROR: malloc failure\n\n" );
  1059       if ( (lcase[anz->
l].
max = (
float *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
float))) == NULL )
  1060         printf(
"\n\n ERROR: malloc failure\n\n" );
  1061       if ( (lcase[anz->
l].
min = (
float *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
float))) == NULL )
  1062         printf(
"\n\n ERROR: malloc failure\n\n" );
  1063       if ( (lcase[anz->
l].
dat = (
float **)malloc( lcase[anz->
l].
ncomps * 
sizeof(
float *))) == NULL )
  1064         printf(
"\n\n ERROR: malloc failure\n\n" );
  1065       if ( (lcase[anz->
l].
compName = (
char **)malloc( lcase[anz->
l].
ncomps * 
sizeof(
char *))) == NULL )
  1066         printf(
"\n\n ERROR: malloc failure\n\n" );
  1067       if ( (lcase[anz->
l].
icname = (
char **)malloc( lcase[anz->
l].
ncomps * 
sizeof(
char *))) == NULL )
  1068         printf(
"\n\n ERROR: malloc failure\n\n" );
  1069       for(i=0; i<lcase[anz->
l].
ncomps; i++)
  1071         if ( (lcase[anz->
l].
dat[i] = (
float *)malloc( (anz->
nmax+1) * 
sizeof(
float))) == NULL )
  1072           printf(
"\n\n ERROR: malloc failure\n\n" );                   
  1074            printf(
"\n\n ERROR: malloc failed\n\n" );
  1076            printf(
"\n\n ERROR: malloc failed\n\n" );
  1079         for(j=0; j<=anz->
nmax; j++) lcase[anz->
l].
dat[i][j]=0.;
  1081       if ( (lcase[anz->
l].
menu = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
  1082         printf(
"\n\n ERROR: malloc failure\n\n" );
  1083       if ( (lcase[anz->
l].
ictype = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
  1084         printf(
"\n\n ERROR: malloc failure\n\n" );
  1085       if ( (lcase[anz->
l].
icind1 = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
  1086         printf(
"\n\n ERROR: malloc failure\n\n" );
  1087       if ( (lcase[anz->
l].
icind2 = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
  1088         printf(
"\n\n ERROR: malloc failure\n\n" );
  1089       if ( (lcase[anz->
l].
iexist = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
  1090         printf(
"\n\n ERROR: malloc failure\n\n" );
  1092       for(i=0; i<lcase[anz->
l].
ncomps; i++)
  1094         lcase[anz->
l].
menu[i] = 1;
  1111       strcpy(lcase[anz->
l].
compName[0], 
"xx      ");
  1112       strcpy(lcase[anz->
l].
compName[1], 
"yy      ");
  1113       strcpy(lcase[anz->
l].
compName[2], 
"zz      ");
  1114       strcpy(lcase[anz->
l].
compName[3], 
"xy      ");
  1115       strcpy(lcase[anz->
l].
compName[4], 
"yz      ");
  1116       strcpy(lcase[anz->
l].
compName[5], 
"zx      ");
  1120         length = 
frecord( handle, rec_str);
  1121         if (rec_str[length] == (
char)EOF) 
break;
  1122         flag = 
stoi(rec_str,1,3);
  1125           if (!format_flag) nodenr = 
stoi(rec_str,4,8);
  1126           else              nodenr = 
stoi(rec_str,4,13);
  1127           if (nodenr>anz->
nmax)
  1129             if (!errFlag) { errFlag=1; printf(
"WARNING: found node:%d in Dataset higher than in geometry allocated:%d\n", nodenr, anz->
nmax); }
  1134             length = 
frecord( handle, rec_str);
  1135             if (rec_str[length] == (
char)EOF) 
break;
  1138               for(i=0; i<lcase[anz->
l].
ncomps; i++)
  1139                 lcase[anz->
l].
dat[i][nodenr]= 
stof(&rec_str[8+i*12], 1, 12);
  1143               for(i=0; i<lcase[anz->
l].
ncomps; i++)
  1144                 lcase[anz->
l].
dat[i][nodenr]= 
stof(&rec_str[13+i*12], 1, 12);
  1149       for(n=0; n<anz->
n; n++)
  1152         for(i=0; i<lcase[anz->
l].
ncomps; i++)
  1154           if(lcase[anz->
l].
dat[i][nodenr] > lcase[anz->
l].
max[i])
  1156             lcase[anz->
l].
max[i]=lcase[anz->
l].
dat[i][nodenr];
  1157             lcase[anz->
l].
nmax[i]=nodenr;
  1159           if(lcase[anz->
l].
dat[i][nodenr] < lcase[anz->
l].
min[i])
  1161             lcase[anz->
l].
min[i]=lcase[anz->
l].
dat[i][nodenr];
  1162             lcase[anz->
l].
nmin[i]=nodenr;
  1168     else if((flag == 7)||(flag == 9))
  1171       printf (
"reading Dataset No:%d\n",anz->
l+1);
  1173       { printf(
"\n\n ERROR: malloc failure\n\n" ); exit(1); }
  1176       strcpy(lcase[anz->
l].
name,
"TEMP    ");
  1182       if ( (lcase[anz->
l].
nmax = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
  1183         printf(
"\n\n ERROR: malloc failure\n\n" );
  1184       if ( (lcase[anz->
l].
nmin = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
  1185         printf(
"\n\n ERROR: malloc failure\n\n" );
  1186       if ( (lcase[anz->
l].
max = (
float *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
float))) == NULL )
  1187         printf(
"\n\n ERROR: malloc failure\n\n" );
  1188       if ( (lcase[anz->
l].
min = (
float *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
float))) == NULL )
  1189         printf(
"\n\n ERROR: malloc failure\n\n" );
  1190       if ( (lcase[anz->
l].
dat = (
float **)malloc( lcase[anz->
l].
ncomps * 
sizeof(
float *))) == NULL )
  1191         printf(
"\n\n ERROR: malloc failure\n\n" );
  1192       if ( (lcase[anz->
l].
compName = (
char **)malloc( lcase[anz->
l].
ncomps * 
sizeof(
char *))) == NULL )
  1193         printf(
"\n\n ERROR: malloc failure\n\n" );
  1194       if ( (lcase[anz->
l].
icname = (
char **)malloc( lcase[anz->
l].
ncomps * 
sizeof(
char *))) == NULL )
  1195         printf(
"\n\n ERROR: malloc failure\n\n" );
  1196       for(i=0; i<lcase[anz->
l].
ncomps; i++)
  1198         if ( (lcase[anz->
l].
dat[i] = (
float *)malloc( (anz->
nmax+1) * 
sizeof(
float))) == NULL )
  1199           printf(
"\n\n ERROR: malloc failure\n\n" );                   
  1201            printf(
"\n\n ERROR: malloc failed\n\n" );
  1203            printf(
"\n\n ERROR: malloc failed\n\n" );
  1206         for(j=0; j<=anz->
nmax; j++) lcase[anz->
l].
dat[i][j]=0.;
  1208       if ( (lcase[anz->
l].
menu = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
  1209         printf(
"\n\n ERROR: malloc failure\n\n" );
  1210       if ( (lcase[anz->
l].
ictype = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
  1211         printf(
"\n\n ERROR: malloc failure\n\n" );
  1212       if ( (lcase[anz->
l].
icind1 = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
  1213         printf(
"\n\n ERROR: malloc failure\n\n" );
  1214       if ( (lcase[anz->
l].
icind2 = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
  1215         printf(
"\n\n ERROR: malloc failure\n\n" );
  1216       if ( (lcase[anz->
l].
iexist = (
int *)malloc( lcase[anz->
l].
ncomps * 
sizeof(
int))) == NULL )
  1217         printf(
"\n\n ERROR: malloc failure\n\n" );
  1219       for(i=0; i<lcase[anz->
l].
ncomps; i++)
  1221         lcase[anz->
l].
menu[i] = 1;
  1223         lcase[anz->
l].
icind1[i] = i+1;
  1228       strcpy(lcase[anz->
l].
compName[0], 
"Value   ");
  1232         length = 
frecord( handle, rec_str);
  1233         if (rec_str[length] == (
char)EOF) 
break;
  1234         flag = 
stoi(rec_str,1,3);
  1237           if (!format_flag) nodenr = 
stoi(rec_str,4,8);
  1238           else              nodenr = 
stoi(rec_str,4,13);
  1239           if (nodenr>anz->
nmax)
  1241             if (!errFlag) { errFlag=1; printf(
"WARNING: found node:%d in Dataset higher than in geometry allocated:%d\n", nodenr, anz->
nmax); }
  1243           else if (!format_flag) 
  1245             for(i=0; i<lcase[anz->
l].
ncomps; i++)
  1246               lcase[anz->
l].
dat[i][nodenr]= 
stof(&rec_str[8+i*12], 1, 12);
  1250             for(i=0; i<lcase[anz->
l].
ncomps; i++)
  1251               lcase[anz->
l].
dat[i][nodenr]= 
stof(&rec_str[13+i*12], 1, 12);
  1255       for(n=0; n<anz->
n; n++)
  1258         for(i=0; i<lcase[anz->
l].
ncomps; i++)
  1260           if(lcase[anz->
l].
dat[i][nodenr] > lcase[anz->
l].
max[i])
  1262             lcase[anz->
l].
max[i]=lcase[anz->
l].
dat[i][nodenr];
  1263             lcase[anz->
l].
nmax[i]=nodenr;
  1265           if(lcase[anz->
l].
dat[i][nodenr] < lcase[anz->
l].
min[i])
  1267             lcase[anz->
l].
min[i]=lcase[anz->
l].
dat[i][nodenr];
  1268             lcase[anz->
l].
nmin[i]=nodenr;
  1277       printf (
" overread Block: %s\n", rec_str);
  1280         length = 
frecord( handle, rec_str);
  1281         if (rec_str[length] == (
char)EOF) 
break;
  1285           flag = 
stoi(rec_str,1,5);
  1287       } 
while(flag != -3);
  1291   for(i=0; i<anz_p; i++) 
SFREE(pheader[i]); 
SFREE(pheader);
  1296   if(anz->
n<0) anz->
n=0;
  1297   if(anz->
e<0) anz->
e=0;
  1299   if ( e_nmax > (anz->
nmax) )
  1301     printf (
"\nWARNING: element requestes a nodename higher than allocated\n\n");
  1302     printf (
" e_nmax=%d e_nmin=%d\n", e_nmax, e_nmin );
  1306     printf (
"\nWARNING: element requestes a nodename lower than allocated\n\n");
  1307     printf (
" e_nmax=%d e_nmin=%d\n", e_nmax, e_nmin );
  1315   *nptr = node; *eptr = elem; *lptr = lcase;
 int npheader
Definition: readfrd.h:77
 
char ** compName
Definition: readfrd.h:78
 
char ** pheader
Definition: readfrd.h:76
 
int * nmin
Definition: readfrd.h:104
 
char analysis_name[MAX_LINE_LENGTH]
Definition: readfrd.h:83
 
#define MAX_FLOAT
Definition: readfrd.h:12
 
char ** icname
Definition: readfrd.h:79
 
char dataset_text[MAX_LINE_LENGTH]
Definition: readfrd.h:82
 
int nmax
Definition: readfrd.h:32
 
int emax
Definition: readfrd.h:34
 
int analysis_type
Definition: readfrd.h:90
 
int u
Definition: readfrd.h:18
 
fpos_t * fileptr
Definition: readfrd.h:87
 
double stof(char *string, int a, int b)
Definition: stof.c:15
 
int mat
Definition: readfrd.h:60
 
char ** pheader
Definition: readfrd.h:17
 
char dataset_name[MAX_LINE_LENGTH]
Definition: readfrd.h:81
 
char model[MAX_LINE_LENGTH]
Definition: readfrd.h:15
 
int nmin
Definition: readfrd.h:33
 
int emin
Definition: readfrd.h:35
 
int nod[27]
Definition: readfrd.h:71
 
int n
Definition: readfrd.h:20
 
#define MAX_LINE_LENGTH
Definition: readfrd.h:10
 
FILE * handle
Definition: readfrd.h:86
 
int etype[100]
Definition: readfrd.h:31
 
void stos(char *string, int a, int b, char *puffer)
Definition: stos.c:16
 
int nr
Definition: readfrd.h:45
 
double nz
Definition: readfrd.h:52
 
int strsplt(char *rec_str, char breakchar, char ***ptr)
Definition: strsplt.c:13
 
int nr
Definition: readfrd.h:56
 
int * menu
Definition: readfrd.h:94
 
int indx
Definition: readfrd.h:46
 
float * min
Definition: readfrd.h:102
 
int orignmax
Definition: readfrd.h:36
 
double ny
Definition: readfrd.h:51
 
char name[MAX_LINE_LENGTH]
Definition: readfrd.h:80
 
int * nmax
Definition: readfrd.h:103
 
int p
Definition: readfrd.h:19
 
int olc
Definition: readfrd.h:38
 
int elemChecker(int sum_e, Nodes *node, Elements *elem)
Definition: elemChecker.c:17
 
int l
Definition: readfrd.h:28
 
#define SFREE(a)
Definition: CalculiX.h:41
 
int e
Definition: readfrd.h:21
 
#define MAX_INTEGER
Definition: readfrd.h:11
 
int ncomps
Definition: readfrd.h:92
 
int group
Definition: readfrd.h:59
 
char filename[MAX_LINE_LENGTH]
Definition: readfrd.h:85
 
int irtype
Definition: readfrd.h:93
 
float * max
Definition: readfrd.h:101
 
int orign
Definition: readfrd.h:37
 
char ** uheader
Definition: readfrd.h:16
 
float value
Definition: readfrd.h:84
 
int compare(char *str1, char *str2, int length)
Definition: compare.c:13
 
#define INI_FIELD_SIZE
Definition: readfrd.c:39
 
int format_flag
Definition: readfrd.h:89
 
int frecord(FILE *handle1, char *string)
Definition: frecord.c:17
 
float ** dat
Definition: readfrd.h:99
 
int loaded
Definition: readfrd.h:88
 
int * iexist
Definition: readfrd.h:98
 
int * icind2
Definition: readfrd.h:97
 
int stoi(char *string, int a, int b)
Definition: stoi.c:15
 
int attr
Definition: readfrd.h:61
 
int step_number
Definition: readfrd.h:91
 
int * ictype
Definition: readfrd.h:95
 
int type
Definition: readfrd.h:58
 
double nx
Definition: readfrd.h:50
 
int * icind1
Definition: readfrd.h:96