Commit 7b8b387e authored by François Trigaux's avatar François Trigaux 🤠
Browse files

🎨 changed many "beam" to "gebt"

parent 7b099e2a
......@@ -3,17 +3,17 @@
#include <math.h>
#include "readINIFile.h"
#include "beam.h"
#include "gebt.h"
int check;
int i_,j_,k_; // macro iterators
void initBeam(Beam *bm)
void initGebt(Gebt *bm)
{
int i,j,k;
char *section;
dataINI fileBeam = readINIFile("Beam.ini");
dataINI fileGebt = readINIFile("Gebt.ini");
char* line = NULL; // don't forget to free!
ssize_t read;
......@@ -22,26 +22,26 @@ void initBeam(Beam *bm)
/* Set the mesh parameters */
/*section = "Beam";
SET_OR_DEFAULT(&(bm->analysis_flag),%d,fileBeam,section,"analysis_flag",2);
SET_OR_DEFAULT(&(bm->nkp),%d,fileBeam,section,"nkp",2);
SET_OR_DEFAULT(&(bm->nframe),%d,fileBeam,section,"nframe",0);// number of different cross-sectional frames
SET_OR_DEFAULT(&(bm->ncurv),%d,fileBeam,section,"ncurv",0);// number of sets of initial curvature/twists
SET_OR_DEFAULT(&(bm->L),%lf,fileBeam,section,"L",1.0);// number of sets of initial curvature/twists
SET_OR_DEFAULT(&(bm->initFromFile),%d,fileBeam,section,"initFromFile",0);// number of sets of initial curvature/twists
SET_OR_DEFAULT(&(bm->analysis_flag),%d,fileGebt,section,"analysis_flag",2);
SET_OR_DEFAULT(&(bm->nkp),%d,fileGebt,section,"nkp",2);
SET_OR_DEFAULT(&(bm->nframe),%d,fileGebt,section,"nframe",0);// number of different cross-sectional frames
SET_OR_DEFAULT(&(bm->ncurv),%d,fileGebt,section,"ncurv",0);// number of sets of initial curvature/twists
SET_OR_DEFAULT(&(bm->L),%lf,fileGebt,section,"L",1.0);// number of sets of initial curvature/twists
SET_OR_DEFAULT(&(bm->initFromFile),%d,fileGebt,section,"initFromFile",0);// number of sets of initial curvature/twists
*/
section = "Beam";
SET_OR_DEFAULT(&(bm->analysis_flag),%d,fileBeam,section,"analysis_flag",2);
SET_OR_DEFAULT(&(bm->nkp),%d,fileBeam,section,"nkp",2);
SET_OR_DEFAULT(&(bm->analysis_flag),%d,fileGebt,section,"analysis_flag",2);
SET_OR_DEFAULT(&(bm->nkp),%d,fileGebt,section,"nkp",2);
SET_OR_DEFAULT(&(bm->L),%lf,fileBeam,section,"L",1.0);// number of sets of initial curvature/twists
SET_OR_DEFAULT(&(bm->initFromFile),%d,fileBeam,section,"initFromFile",0);// number of sets of initial curvature/twists
SET_OR_DEFAULT(&(bm->L),%lf,fileGebt,section,"L",1.0);// number of sets of initial curvature/twists
SET_OR_DEFAULT(&(bm->initFromFile),%d,fileGebt,section,"initFromFile",0);// number of sets of initial curvature/twists
SET_OR_DEFAULT(&(bm->niter),%d,fileBeam,section,"niter",100);
SET_OR_DEFAULT(&(bm->nstep),%d,fileBeam,section,"nstep",1);
SET_OR_DEFAULT(&(bm->niter),%d,fileGebt,section,"niter",100);
SET_OR_DEFAULT(&(bm->nstep),%d,fileGebt,section,"nstep",1);
if(bm->analysis_flag>0){
SET(&(bm->dt),%lf,fileBeam,section,"dt");
SET(&(bm->dt),%lf,fileGebt,section,"dt");
}
bm->nmemb = bm->nkp-1; // specific for beams.
......@@ -74,15 +74,15 @@ void initBeam(Beam *bm)
bm->omega_a_tf[i] = 0;
bm->v_root_a_tf[i] = 0;
}
SET_OR_DEFAULT(&bm->omega_a0[0],%lf,fileBeam,section,"omegaX",0.0);
SET_OR_DEFAULT(&bm->omega_a0[1],%lf,fileBeam,section,"omegaY",0.0);
SET_OR_DEFAULT(&bm->omega_a0[2],%lf,fileBeam,section,"omegaZ",0.0);
SET_OR_DEFAULT(&bm->v_root_a0[0],%lf,fileBeam,section,"vrootX",0.0);
SET_OR_DEFAULT(&bm->v_root_a0[1],%lf,fileBeam,section,"vrootY",0.0);
SET_OR_DEFAULT(&bm->v_root_a0[2],%lf,fileBeam,section,"vrootZ",0.0);
SET_OR_DEFAULT(&bm->omega_a0[0],%lf,fileGebt,section,"omegaX",0.0);
SET_OR_DEFAULT(&bm->omega_a0[1],%lf,fileGebt,section,"omegaY",0.0);
SET_OR_DEFAULT(&bm->omega_a0[2],%lf,fileGebt,section,"omegaZ",0.0);
SET_OR_DEFAULT(&bm->v_root_a0[0],%lf,fileGebt,section,"vrootX",0.0);
SET_OR_DEFAULT(&bm->v_root_a0[1],%lf,fileGebt,section,"vrootY",0.0);
SET_OR_DEFAULT(&bm->v_root_a0[2],%lf,fileGebt,section,"vrootZ",0.0);
}
freeDataINI(fileBeam);
freeDataINI(fileGebt);
bm->nev = 0;
ALLOCATE2(bm->coord, double, bm->nkp, NDIM);
......@@ -215,10 +215,10 @@ void initBeam(Beam *bm)
if((bm->analysis_flag==2) && (bm->initFromFile==1))
{
// READ INITIAL CONIDITIONS FROM THE FILE
FILE *INIT = fopen("Beam_initCond.ini","r");
FILE *INIT = fopen("Gebt_initCond.ini","r");
if (INIT==NULL)
{
printf("Cannot read %s\n","Beam_init.dat");
printf("Cannot read %s\n","Gebt_initCond.ini");
exit(EXIT_FAILURE);
}
......@@ -249,11 +249,11 @@ void initBeam(Beam *bm)
void initBeamFromGebtFile(Beam *bm)
void initGebtFromGebtFile(Gebt *bm)
{
int i,j;
char *section, dataFileName[32];
dataINI fileBeam = readINIFile("Beam.ini");
dataINI fileGebt = readINIFile("Gebt.ini");
int tmp_no;
char * line = NULL;
......@@ -262,28 +262,28 @@ void initBeamFromGebtFile(Beam *bm)
size_t len = 0;
double a, b, c;
FILE *IN = fopen("Beam_data.dat","r");
FILE *IN = fopen("Gebt_data.dat","r");
if (IN==NULL)
{
printf("Unable to read file %s for beam data\n","Beam_data.dat");
printf("Unable to read file %s for beam data\n","Gebt_data.dat");
exit(EXIT_FAILURE);
}
/* Set the mesh parameters */
section = "Beam";
SET_OR_DEFAULT(&(bm->analysis_flag),%d,fileBeam,section,"analysis_flag",2);
SET_OR_DEFAULT(&(bm->nkp),%d,fileBeam,section,"nkp",2);
SET_OR_DEFAULT(&(bm->nmemb),%d,fileBeam,section,"nmemb",1);// number of beam members
SET_OR_DEFAULT(&(bm->ncond_pt),%d,fileBeam,section,"ncond_pt",2);// number of point conditions
SET_OR_DEFAULT(&(bm->nmate),%d,fileBeam,section,"nmate",1);// number of different cross-sections
SET_OR_DEFAULT(&(bm->nframe),%d,fileBeam,section,"nframe",0);// number of different cross-sectional frames
SET_OR_DEFAULT(&(bm->ndistrfun),%d,fileBeam,section,"ndistrfun",0);// number of distribution functions
SET_OR_DEFAULT(&(bm->ncurv),%d,fileBeam,section,"ncurv",0);// number of sets of initial curvature/twists
SET_OR_DEFAULT(&(bm->analysis_flag),%d,fileGebt,section,"analysis_flag",2);
SET_OR_DEFAULT(&(bm->nkp),%d,fileGebt,section,"nkp",2);
SET_OR_DEFAULT(&(bm->nmemb),%d,fileGebt,section,"nmemb",1);// number of beam members
SET_OR_DEFAULT(&(bm->ncond_pt),%d,fileGebt,section,"ncond_pt",2);// number of point conditions
SET_OR_DEFAULT(&(bm->nmate),%d,fileGebt,section,"nmate",1);// number of different cross-sections
SET_OR_DEFAULT(&(bm->nframe),%d,fileGebt,section,"nframe",0);// number of different cross-sectional frames
SET_OR_DEFAULT(&(bm->ndistrfun),%d,fileGebt,section,"ndistrfun",0);// number of distribution functions
SET_OR_DEFAULT(&(bm->ncurv),%d,fileGebt,section,"ncurv",0);// number of sets of initial curvature/twists
SET_OR_DEFAULT(&(bm->niter),%d,fileBeam,section,"niter",100);
SET_OR_DEFAULT(&(bm->nstep),%d,fileBeam,section,"nstep",0);
SET_OR_DEFAULT(&(bm->niter),%d,fileGebt,section,"niter",100);
SET_OR_DEFAULT(&(bm->nstep),%d,fileGebt,section,"nstep",0);
SET_OR_DEFAULT(&(bm->ncond_mb),%d,fileBeam,section,"ncond_mb",2);
SET_OR_DEFAULT(&(bm->ncond_mb),%d,fileGebt,section,"ncond_mb",2);
bm->ntimefun = 0; // impossible to pass time-functions to fortran
......@@ -473,10 +473,10 @@ void initBeamFromGebtFile(Beam *bm)
if(bm->analysis_flag==2){
// READ INITIAL CONIDITIONS FROM THE FILE
FILE *INIT = fopen("Beam_initCond.ini","r");
FILE *INIT = fopen("Gebt_initCond.ini","r");
if (INIT==NULL)
{
printf("Cannot read %s\n","Beam_init.dat");
printf("Cannot read %s\n","Gebt_initCond.ini");
exit(EXIT_FAILURE);
}
......@@ -504,7 +504,7 @@ void initBeamFromGebtFile(Beam *bm)
// Assign the twist to each of the member by changing its frame
// twist_per_L [rad/arc length] is only required if there are subdivisions to the members
void gebt_setTwist(Beam *bm, double *twist)
void gebt_setTwist(Gebt *bm, double *twist)
{
int i;
double k1;
......@@ -530,7 +530,7 @@ void gebt_setTwist(Beam *bm, double *twist)
// Assign the twist to each of the member by changing its frame
// twist_per_L [rad/arc length] is only required if there are subdivisions to the members
void gebt_setTwistFromFile(Beam *bm, char *fname)
void gebt_setTwistFromFile(Gebt *bm, char *fname)
{
int i,j,k;
int idx,np;
......@@ -602,7 +602,7 @@ void gebt_setTwistFromFile(Beam *bm, char *fname)
fclose(fid);
}
void gebt_getNodeVelocities(double **vel, Beam *bm){
void gebt_getNodeVelocities(double **vel, Gebt *bm){
int i,j;
int step = bm->nstep-1;
......@@ -616,7 +616,7 @@ void gebt_getNodeVelocities(double **vel, Beam *bm){
}
}
void gebt_getMemberVelocities(double **vel, Beam *bm){
void gebt_getMemberVelocities(double **vel, Gebt *bm){
int i,j;
int step = bm->nstep-1;
......@@ -633,7 +633,7 @@ void gebt_getMemberVelocities(double **vel, Beam *bm){
/* disp = allocated double pointer of size (6,nkp)
/!\ the order of is reversed!
*/
void gebt_getNodeDisplacement(double **disp, Beam *bm){
void gebt_getNodeDisplacement(double **disp, Gebt *bm){
int i,j;
int step = bm->nstep-1;
......@@ -650,7 +650,7 @@ void gebt_getNodeDisplacement(double **disp, Beam *bm){
/* disp = allocated double pointer of size (6,nelem)
/!\ the order of is reversed!
*/
void gebt_getMemberDisplacement(double **disp, Beam *bm){
void gebt_getMemberDisplacement(double **disp, Gebt *bm){
int i,j;
int step = bm->nstep-1;
......@@ -664,7 +664,7 @@ void gebt_getMemberDisplacement(double **disp, Beam *bm){
}
}
void gebt_writeSolToFile(Beam *bm,char* fileName)
void gebt_writeSolToFile(Gebt *bm,char* fileName)
{
int i,j,k;
char fname[32];
......@@ -703,7 +703,7 @@ void gebt_writeSolToFile(Beam *bm,char* fileName)
void gebt_setLoads(Beam *bm, double *loads, int load_no)
void gebt_setLoads(Gebt *bm, double *loads, int load_no)
{
int i;
for(i=0;i<bm->ncond_mb;i++)
......@@ -719,7 +719,7 @@ void gebt_setLoads(Beam *bm, double *loads, int load_no)
}
}
void gebt_setEndLoad(Beam *bm, double loads, int load_no)
void gebt_setEndLoad(Gebt *bm, double loads, int load_no)
{
int i;
for(i=0;i<bm->ncond_mb;i++)
......@@ -736,7 +736,7 @@ void gebt_setEndLoad(Beam *bm, double loads, int load_no)
}
void gebt_analysis(Beam *bm)
void gebt_analysis(Gebt *bm)
{
int i;
......@@ -806,7 +806,7 @@ void gebt_analysis(Beam *bm)
/*
This updates the initial condition, but when the analysis does its initial step, it does not work
void gebt_updateInitialConditions(Beam *bm)
void gebt_updateInitialConditions(Gebt *bm)
{
int i,j;
for (i=0;i<bm->nelem;i++)
......@@ -842,7 +842,7 @@ void gebt_updateInitialConditions(Beam *bm)
fprintf(fid,#type " ",ptr[i_][j_]);\
fprintf(fid,"\n");}
void gebt_writeBeamToFile(Beam *bm,char *fname)
void gebt_writeGebtToFile(Gebt *bm,char *fname)
{
int i,j,k;
FILE *fid = fopen(fname,"w");
......@@ -873,7 +873,7 @@ void gebt_writeBeamToFile(Beam *bm,char *fname)
}
void freeBeam(Beam *bm)
void freeGebt(Gebt *bm)
{
printf("Freeing the memory...\n");
......@@ -954,7 +954,7 @@ static void gebt_interpolateMatrix(double **out, double x, double *xp, double **
static void gebt_setMaterial(Beam *bm)
static void gebt_setMaterial(Gebt *bm)
{
int i,j,k;
int ncomp, nmass;
......
#ifndef _BEAM_H_
#define _BEAM_H_
#ifndef _GEBT_H_
#define _GEBT_H_
#define NSTRN 6
......@@ -146,36 +146,36 @@ typedef struct
int initFromFile;
double dt;
int initialize; // flag indicating if an initialisation step is required to find the compatible state variables
} Beam;
} Gebt;
void initBeam(Beam *bm);
void initGebt(Gebt *bm);
void gebt_setTwist(Beam *bm, double *twist);
void gebt_setTwistFromFile(Beam *bm, char *fname);
void gebt_setTwist(Gebt *bm, double *twist);
void gebt_setTwistFromFile(Gebt *bm, char *fname);
void gebt_setLoads(Beam *bm, double *loads, int load_no);
void gebt_setEndLoad(Beam *bm, double loads, int load_no);
void gebt_setLoads(Gebt *bm, double *loads, int load_no);
void gebt_setEndLoad(Gebt *bm, double loads, int load_no);
void gebt_analysis(Beam *bm);
void gebt_analysis(Gebt *bm);
void gebt_getNodeVelocities(double **vel, Beam *bm);
void gebt_getMemberVelocities(double **vel, Beam *bm);
void gebt_getNodeVelocities(double **vel, Gebt *bm);
void gebt_getMemberVelocities(double **vel, Gebt *bm);
void gebt_getNodeDisplacement(double **disp, Beam *bm);
void gebt_getMemberDisplacement(double **disp, Beam *bm);
void gebt_getNodeDisplacement(double **disp, Gebt *bm);
void gebt_getMemberDisplacement(double **disp, Gebt *bm);
void gebt_writeBeamToFile(Beam *bm,char *fname);
void gebt_writeSolToFile(Beam *bm, char *fileName);
void gebt_writeGebtToFile(Gebt *bm,char *fname);
void gebt_writeSolToFile(Gebt *bm, char *fileName);
void freeBeam(Beam *bm);
void freeGebt(Gebt *bm);
// Private functions
static void gebt_interpolateMatrix(double **out, double x, double *xp, double ***matrix, int np, int nx, int ny, int ixStart, int iyStart);
static void gebt_setMaterial(Beam *bm);
static void gebt_setMaterial(Gebt *bm);
void fortran_analysis(int nkp,int nelem,int ndof_el,int nmemb,int ncond_pt,int nmate,int nframe,int ndistrfun,int ncurv, double **coord,
int **member,struct PrescriInf **pt_condition, double **material, int niter, int nstep, double **sol_pt, double **sol_mb,char *error, int ncond_mb,
......
#include <stdlib.h>
#include <stdio.h>
#include "beam.h"
#include "gebt.h"
int main(int argc, char* argv[])
......@@ -9,8 +9,8 @@ int main(int argc, char* argv[])
int i;
printf("Reading...\n");
Beam *bm = malloc(sizeof(Beam));
initBeam(bm);
Gebt *bm = malloc(sizeof(Gebt));
initGebt(bm);
printf("...Done!\n");
printf("Creating the loads...\n");
......
Supports Markdown
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