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

🚧 added getters for displacement and velocities

parent dda0317f
......@@ -600,8 +600,68 @@ void beam_setTwistFromFile(Beam *bm, char *fname)
free(line);
fclose(fid);
}
void beam_getNodeVelocities(double **vel, Beam *bm){
int i,j;
int step = bm->nstep-1;
for(i=0;i<bm->nkp;i++)
{
for(j=0;j<NSTRN;j++)
{
// !!! it is vel(j,i) to ease the access from interpolation methods!
vel[j][i] = (bm->sol_pt[step][i][j+NDIM] - bm->sol_pt[step-1][i][j+NDIM]) / bm->dt;
}
}
}
void beam_getMemberVelocities(double **vel, Beam *bm){
int i,j;
int step = bm->nstep-1;
for(i=0;i<bm->nelem;i++)
{
for(j=0;j<NSTRN;j++)
{
// !!! it is vel(j,i) to ease the access from interpolation methods!
vel[j][i] = (bm->sol_mb[step][i][j+NDIM] - bm->sol_mb[step-1][i][j+NDIM]) / bm->dt;
}
}
}
/* disp = allocated double pointer of size (6,nkp)
/!\ the order of is reversed!
*/
void beam_getNodeDisplacement(double **disp, Beam *bm){
int i,j;
int step = bm->nstep-1;
for(i=0;i<bm->nkp;i++)
{
for(j=0;j<NSTRN;j++)
{
// !!! it is disp(j,i) to ease the access from interpolation methods!
disp[j][i] = bm->sol_pt[step][i][j+NDIM];
}
}
}
/* disp = allocated double pointer of size (6,nelem)
/!\ the order of is reversed!
*/
void beam_getNodeDisplacement(double **disp, Beam *bm){
int i,j;
int step = bm->nstep-1;
for(i=0;i<bm->nelem;i++)
{
for(j=0;j<NSTRN;j++)
{
// !!! it is disp(j,i) to ease the access from interpolation methods!
disp[j][i] = bm->sol_mb[step][i][j+NDIM];
}
}
}
void beam_writeSolToFile(Beam *bm,char* fileName)
......
......@@ -160,6 +160,12 @@ void beam_setEndLoad(Beam *bm, double loads, int load_no);
void beam_analysis(Beam *bm);
void beam_getNodeVelocities(double **vel, Beam *bm);
void beam_getMemberVelocities(double **vel, Beam *bm);
void beam_getNodeDisplacement(double **disp, Beam *bm);
void beam_getMemberDisplacement(double **disp, Beam *bm);
void beam_writeBeamToFile(Beam *bm,char *fname);
void beam_writeSolToFile(Beam *bm, char *fileName);
......
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