[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: */
|
---|
[4215] | 10 | Elements* elements=NULL;
|
---|
[4211] | 11 | Nodes* nodes=NULL;
|
---|
[4213] | 12 | Vertices* vertices=NULL;
|
---|
[4214] | 13 | Loads* loads=NULL;
|
---|
[4218] | 14 | Materials* materials=NULL;
|
---|
[3712] | 15 | Parameters* parameters=NULL;
|
---|
[1] | 16 | int kflag,pflag;
|
---|
| 17 |
|
---|
| 18 | /* output datasets: */
|
---|
| 19 | Mat Kgg=NULL;
|
---|
| 20 | Vec pg=NULL;
|
---|
| 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 |
|
---|
[1] | 36 | /*parameters: */
|
---|
[3715] | 37 | parameters->FindParam(&kflag,KflagEnum);
|
---|
| 38 | parameters->FindParam(&pflag,PflagEnum);
|
---|
[1] | 39 |
|
---|
[4573] | 40 | /*configure: */
|
---|
| 41 | elements-> Configure(elements,loads, nodes,vertices, materials,parameters);
|
---|
| 42 | nodes-> Configure(elements,loads, nodes,vertices, materials,parameters);
|
---|
| 43 | loads-> Configure(elements, loads, nodes,vertices, materials,parameters);
|
---|
[5332] | 44 | materials-> Configure(elements, loads, nodes,vertices, materials,parameters);
|
---|
[4573] | 45 |
|
---|
[1] | 46 | /*!Generate internal degree of freedom numbers: */
|
---|
[4103] | 47 | SystemMatricesx(&Kgg, &pg,elements,nodes,vertices,loads,materials,parameters,kflag,pflag);
|
---|
[1] | 48 |
|
---|
| 49 | /*write output datasets: */
|
---|
[2316] | 50 | WriteData(KGG,Kgg);
|
---|
| 51 | WriteData(PG,pg);
|
---|
[1] | 52 |
|
---|
| 53 | /*Free ressources: */
|
---|
| 54 | delete elements;
|
---|
| 55 | delete nodes;
|
---|
[3445] | 56 | delete vertices;
|
---|
[1] | 57 | delete loads;
|
---|
| 58 | delete materials;
|
---|
[2333] | 59 | delete parameters;
|
---|
[1] | 60 | MatFree(&Kgg);
|
---|
| 61 | VecFree(&pg);
|
---|
| 62 |
|
---|
| 63 | /*end module: */
|
---|
| 64 | MODULEEND();
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | void SystemMatricesUsage(void)
|
---|
| 68 | {
|
---|
| 69 | _printf_("\n");
|
---|
[4103] | 70 | _printf_(" usage: [Kgg,pg] = %s(elements,nodes,vertices,loads,materials,parameters);\n",__FUNCT__);
|
---|
[1] | 71 | _printf_("\n");
|
---|
| 72 | }
|
---|