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: */
|
---|
10 | Elements *elements = NULL;
|
---|
11 | Nodes *nodes = NULL;
|
---|
12 | Vertices *vertices = NULL;
|
---|
13 | Loads *loads = NULL;
|
---|
14 | Materials *materials = NULL;
|
---|
15 | Parameters *parameters = NULL;
|
---|
16 |
|
---|
17 | /* output datasets: */
|
---|
18 | Mat Kgg = NULL;
|
---|
19 | Vec pg = NULL;
|
---|
20 | double kmax;
|
---|
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: */
|
---|
29 | FetchData((DataSet**)&elements,ELEMENTS);
|
---|
30 | FetchData((DataSet**)&nodes,NODES);
|
---|
31 | FetchData((DataSet**)&vertices,VERTICES);
|
---|
32 | FetchData((DataSet**)&loads,LOADS);
|
---|
33 | FetchData((DataSet**)&materials,MATERIALS);
|
---|
34 | FetchParams(¶meters,PARAMETERS);
|
---|
35 |
|
---|
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);
|
---|
40 | materials-> Configure(elements, loads, nodes,vertices, materials,parameters);
|
---|
41 |
|
---|
42 | /*!Generate internal degree of freedom numbers: */
|
---|
43 | SystemMatricesx(&Kgg,&pg,&kmax,elements,nodes,vertices,loads,materials,parameters);
|
---|
44 |
|
---|
45 | /*write output datasets: */
|
---|
46 | WriteData(KGG,Kgg);
|
---|
47 | WriteData(PG,pg);
|
---|
48 | WriteData(KMAX,kmax);
|
---|
49 |
|
---|
50 | /*Free ressources: */
|
---|
51 | delete elements;
|
---|
52 | delete nodes;
|
---|
53 | delete vertices;
|
---|
54 | delete loads;
|
---|
55 | delete materials;
|
---|
56 | delete parameters;
|
---|
57 | MatFree(&Kgg);
|
---|
58 | VecFree(&pg);
|
---|
59 |
|
---|
60 | /*end module: */
|
---|
61 | MODULEEND();
|
---|
62 | }
|
---|
63 |
|
---|
64 | void SystemMatricesUsage(void)
|
---|
65 | {
|
---|
66 | _printf_("\n");
|
---|
67 | _printf_(" usage: [Kgg,pg,kmax] = %s(elements,nodes,vertices,loads,materials,parameters);\n",__FUNCT__);
|
---|
68 | _printf_("\n");
|
---|
69 | }
|
---|