| [1] | 1 | /*\file SystemMatrices.c | 
|---|
|  | 2 | *\brief: build system matrices (stiffness matrix, loads vector) | 
|---|
|  | 3 | */ | 
|---|
|  | 4 |  | 
|---|
|  | 5 | #include "./SystemMatrices.h" | 
|---|
|  | 6 |  | 
|---|
|  | 7 | void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){ | 
|---|
|  | 8 |  | 
|---|
|  | 9 | /*input datasets: */ | 
|---|
| [5689] | 10 | Elements   *elements   = NULL; | 
|---|
|  | 11 | Nodes      *nodes      = NULL; | 
|---|
|  | 12 | Vertices   *vertices   = NULL; | 
|---|
|  | 13 | Loads      *loads      = NULL; | 
|---|
|  | 14 | Materials  *materials  = NULL; | 
|---|
|  | 15 | Parameters *parameters = NULL; | 
|---|
| [1] | 16 |  | 
|---|
|  | 17 | /* output datasets: */ | 
|---|
| [5693] | 18 | Mat    Kgg  = NULL; | 
|---|
|  | 19 | Vec    pg   = NULL; | 
|---|
|  | 20 | double kmax; | 
|---|
| [1] | 21 |  | 
|---|
|  | 22 | /*Boot module: */ | 
|---|
|  | 23 | MODULEBOOT(); | 
|---|
|  | 24 |  | 
|---|
|  | 25 | /*checks on arguments on the matlab side: */ | 
|---|
|  | 26 | CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&SystemMatricesUsage); | 
|---|
|  | 27 |  | 
|---|
|  | 28 | /*Input datasets: */ | 
|---|
| [4215] | 29 | FetchData((DataSet**)&elements,ELEMENTS); | 
|---|
| [4211] | 30 | FetchData((DataSet**)&nodes,NODES); | 
|---|
| [4213] | 31 | FetchData((DataSet**)&vertices,VERTICES); | 
|---|
| [4214] | 32 | FetchData((DataSet**)&loads,LOADS); | 
|---|
| [4218] | 33 | FetchData((DataSet**)&materials,MATERIALS); | 
|---|
| [2333] | 34 | FetchParams(¶meters,PARAMETERS); | 
|---|
|  | 35 |  | 
|---|
| [4573] | 36 | /*configure: */ | 
|---|
|  | 37 | elements->  Configure(elements,loads, nodes,vertices, materials,parameters); | 
|---|
|  | 38 | nodes->     Configure(elements,loads, nodes,vertices, materials,parameters); | 
|---|
|  | 39 | loads->     Configure(elements, loads, nodes,vertices, materials,parameters); | 
|---|
| [5689] | 40 | materials-> Configure(elements, loads, nodes,vertices, materials,parameters); | 
|---|
| [4573] | 41 |  | 
|---|
| [1] | 42 | /*!Generate internal degree of freedom numbers: */ | 
|---|
| [5693] | 43 | SystemMatricesx(&Kgg,&pg,&kmax,elements,nodes,vertices,loads,materials,parameters); | 
|---|
| [1] | 44 |  | 
|---|
|  | 45 | /*write output datasets: */ | 
|---|
| [2316] | 46 | WriteData(KGG,Kgg); | 
|---|
|  | 47 | WriteData(PG,pg); | 
|---|
| [5693] | 48 | WriteData(KMAX,kmax); | 
|---|
| [1] | 49 |  | 
|---|
|  | 50 | /*Free ressources: */ | 
|---|
|  | 51 | delete elements; | 
|---|
|  | 52 | delete nodes; | 
|---|
| [3445] | 53 | delete vertices; | 
|---|
| [1] | 54 | delete loads; | 
|---|
|  | 55 | delete materials; | 
|---|
| [2333] | 56 | delete parameters; | 
|---|
| [1] | 57 | MatFree(&Kgg); | 
|---|
|  | 58 | VecFree(&pg); | 
|---|
|  | 59 |  | 
|---|
|  | 60 | /*end module: */ | 
|---|
|  | 61 | MODULEEND(); | 
|---|
|  | 62 | } | 
|---|
|  | 63 |  | 
|---|
|  | 64 | void SystemMatricesUsage(void) | 
|---|
|  | 65 | { | 
|---|
|  | 66 | _printf_("\n"); | 
|---|
| [5693] | 67 | _printf_("   usage: [Kgg,pg,kmax] = %s(elements,nodes,vertices,loads,materials,parameters);\n",__FUNCT__); | 
|---|
| [1] | 68 | _printf_("\n"); | 
|---|
|  | 69 | } | 
|---|