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

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


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

    // 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");
23
24
    Gebt *bm = malloc(sizeof(Gebt));
    initGebt(bm);
25
26
    printf("...Done!\n");

François Trigaux's avatar
François Trigaux committed
27
    gebt_setTwistFromFile(bm,"Twist.dat");
28
29
30
31
32
33
34
35

    // 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]);
    }
François Trigaux's avatar
François Trigaux committed
36
    gebt_setLoads(bm,loads,2);
37
38
39
40
41
42
43
    printf("...Done!\n");

    char fname[32] = "output";
    
    // Performing the analysis
    printf("Performing the analysis...\n");
    
François Trigaux's avatar
François Trigaux committed
44
45
    gebt_analysis(bm);
    gebt_writeSolToFile(bm,fname);
46
47
    printf("... Ok! \n");
    
48
    freeGebt(bm);
49
50
51
52
    free(bm);
    
    return EXIT_SUCCESS;
}