Commit fe067b84 authored by François Trigaux's avatar François Trigaux
Browse files

new io function to binary files

parent b41cec3f
......@@ -787,6 +787,45 @@ void gebt_writeSolToFile(Gebt *bm,char* fileName)
//}
}
void gebt_writeSolToBin(Gebt *bm,char* fileName)
{
int i,j,k;
char fname[32];
FILE *fid;
if(bm->lastStep<0)
{
printf("Unable to write the solution: No time-step have been performed with bm_analysis");
exit(EXIT_FAILURE);
}
k = bm->lastStep;
sprintf(fname,"%s.bin",fileName);
fid = fopen(fname,"ab");
if (fid==NULL)
{
printf("Unable to open file %s to write the solution of the structural analysis\n",fileName);
exit(EXIT_FAILURE);
}
fwrite(&(bm->t),sizeof(double),1,fid);
for (i=0;i<bm->nkp;i++)
{
for(j=0;j<NDIM + NDOF_ND;j++)
{
fwrite(bm->sol_pt[k][i],sizeof(double),NDIM+NDOF_ND,fid);
}
}
for (i=0;i<bm->nelem;i++)
{
for(j=0;j<NDIM + bm->ndof_el;j++)
{
fwrite(bm->sol_mb[k][i],sizeof(double),NDIM + bm->ndof_el,fid);
}
}
fclose(fid);
}
void gebt_setLoads(Gebt *bm, double *loads, int load_no)
......
......@@ -171,6 +171,7 @@ void gebt_getRotationMatrix(double out[3][3],double c[3]);
void gebt_writeGebtToFile(Gebt *bm,char *fname);
void gebt_writeSolToFile(Gebt *bm, char *fileName);
void gebt_writeSolToBin(Gebt *bm,char* fileName);
void freeGebt(Gebt *bm);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment