| 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 | 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: */
|
|---|
| 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 | /*parameters: */
|
|---|
| 37 | parameters->FindParam(&kflag,KflagEnum);
|
|---|
| 38 | parameters->FindParam(&pflag,PflagEnum);
|
|---|
| 39 |
|
|---|
| 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);
|
|---|
| 44 | materials-> Configure(elements, loads, nodes,vertices, materials,parameters);
|
|---|
| 45 |
|
|---|
| 46 | /*!Generate internal degree of freedom numbers: */
|
|---|
| 47 | SystemMatricesx(&Kgg, &pg,elements,nodes,vertices,loads,materials,parameters,kflag,pflag);
|
|---|
| 48 |
|
|---|
| 49 | /*write output datasets: */
|
|---|
| 50 | WriteData(KGG,Kgg);
|
|---|
| 51 | WriteData(PG,pg);
|
|---|
| 52 |
|
|---|
| 53 | /*Free ressources: */
|
|---|
| 54 | delete elements;
|
|---|
| 55 | delete nodes;
|
|---|
| 56 | delete vertices;
|
|---|
| 57 | delete loads;
|
|---|
| 58 | delete materials;
|
|---|
| 59 | delete parameters;
|
|---|
| 60 | MatFree(&Kgg);
|
|---|
| 61 | VecFree(&pg);
|
|---|
| 62 |
|
|---|
| 63 | /*end module: */
|
|---|
| 64 | MODULEEND();
|
|---|
| 65 | }
|
|---|
| 66 |
|
|---|
| 67 | void SystemMatricesUsage(void)
|
|---|
| 68 | {
|
|---|
| 69 | _printf_("\n");
|
|---|
| 70 | _printf_(" usage: [Kgg,pg] = %s(elements,nodes,vertices,loads,materials,parameters);\n",__FUNCT__);
|
|---|
| 71 | _printf_("\n");
|
|---|
| 72 | }
|
|---|