main.c 1.17 KB
Newer Older
1
2
3
#include <stdlib.h>
#include <stdio.h>

4
#include "gebt.h"
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20


int main(int argc, char* argv[])
{
    int i;

    // Check the input argument
    if(argc<2)
    {
        printf("Please specify the uniform load value as arguments\n");
        printf("Example: ./gebt 100\n");
        exit(EXIT_FAILURE);
    }

    // Initializing the Beam
    printf("Initializing the beam...\n");
21
22
    Gebt *bm = malloc(sizeof(Gebt));
    initGebt(bm);
23
24
25
26
27
28
29
30
31
32
    printf("...Done!\n");

    // Creating an array with the uniform load for each member
    printf("Creating the loads...\n");
    double *loads = malloc(sizeof(double)*bm->nmemb);
    for(i=0;i<bm->nmemb;i++)
    {
        loads[i] = atof(argv[1])*0.0;
    }
    loads[bm->nmemb-1] = atof(argv[1]);
François Trigaux's avatar
François Trigaux committed
33
    gebt_setLoads(bm,loads,2);
34
    free(loads);
35
36
37
38
39
40
41
42
43
44
45
    printf("...Done!\n");

    char fname[32];
    
    // Performing the analysis
    printf("Performing the analysis...\n");
    
    for (i=0;i<10;i++)
    {
        sprintf(fname,"output%d_",i);
        printf("Global Step = %d...\n",i);
François Trigaux's avatar
François Trigaux committed
46
47
        gebt_analysis(bm);
        gebt_writeSolToFile(bm,fname);
48
49
        printf("... Ok! \n");
    }
50

51
    freeGebt(bm);
52
    free(bm);
53
54
55
    
    return EXIT_SUCCESS;
}