ReadBinary_DKE

PURPOSE ^

C/C++ source

SYNOPSIS ^

C/C++ source

DESCRIPTION ^

C/C++ source

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 #include <stdlib.h>
0002 #include <stdio.h>
0003 #include "tensor.h"
0004 
0005 void ReadBinary_DKE(char* file,struct Tensor *A)
0006 {
0007 FILE* TENSOR;
0008 int i;
0009 int cookie;
0010 /*fprintf(stdout,"Opening\n");*/
0011 TENSOR=fopen(file,"r");
0012 if(!TENSOR){printf("couldn't open file\n");}
0013 
0014 /*fprintf(stdout,"Reading cookie\n");*/
0015 fread(&cookie,sizeof(int),1,TENSOR);
0016 
0017 /*fprintf(stdout,"reading A ndims\n");*/
0018 fread(&((*A).ndims),sizeof(int),1,TENSOR);
0019 
0020 
0021 (*A).sizedim=malloc((*A).ndims*sizeof(int));
0022 fread((*A).sizedim,sizeof(int),(*A).ndims,TENSOR);
0023 
0024 
0025 fread(&((*A).size),sizeof(int),1,TENSOR);
0026 /*fprintf(stdout,"YP*******,size=%d\n",(*A).size);*/
0027 
0028 /*fprintf(stdout,"%i \n", *pp);*/
0029 
0030 /*for(i=0;i<*pm;i++){
0031 fprintf(stdout,"%i \n", *(*n+i));}*/
0032 
0033 
0034 
0035 ((*A).vals)=malloc((*A).size*sizeof(DOUBLE));
0036 fread((*A).vals,sizeof(DOUBLE),(*A).size,TENSOR);
0037 
0038 /*fprintf(stdout,"YP*******,toto=%d\n",toto);
0039 fprintf(stdout,"YP*******,sizeofdouble=%d\n",sizeof(DOUBLE));
0040 fprintf(stdout,"YP*******,sizeofint=%d\n",sizeof(int));*/
0041 
0042 
0043 
0044 /*for(i=0;i<*pp;i++){
0045 fprintf(stdout,"%g \t", *(*vals+i));}*/
0046 fclose(TENSOR);
0047 /* fprintf(stdout,"end read\n");*/
0048 }

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.