[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 | /*diverse: */
|
---|
| 10 | int noerr=1;
|
---|
| 11 |
|
---|
| 12 | /*input datasets: */
|
---|
| 13 | DataSet* elements=NULL;
|
---|
| 14 | DataSet* nodes=NULL;
|
---|
[3445] | 15 | DataSet* vertices=NULL;
|
---|
[1] | 16 | DataSet* loads=NULL;
|
---|
| 17 | DataSet* materials=NULL;
|
---|
[3712] | 18 | Parameters* parameters=NULL;
|
---|
[1] | 19 | int kflag,pflag;
|
---|
| 20 | int connectivity;
|
---|
| 21 | int numberofdofspernode;
|
---|
| 22 | ParameterInputs* inputs=NULL;
|
---|
| 23 | int analysis_type;
|
---|
[465] | 24 | int sub_analysis_type;
|
---|
[1] | 25 |
|
---|
| 26 | /* output datasets: */
|
---|
| 27 | Mat Kgg=NULL;
|
---|
| 28 | Vec pg=NULL;
|
---|
| 29 |
|
---|
| 30 | /*Boot module: */
|
---|
| 31 | MODULEBOOT();
|
---|
| 32 |
|
---|
| 33 | /*checks on arguments on the matlab side: */
|
---|
| 34 | CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&SystemMatricesUsage);
|
---|
| 35 |
|
---|
| 36 | /*Input datasets: */
|
---|
[2333] | 37 | FetchData(&elements,ELEMENTS);
|
---|
| 38 | FetchData(&nodes,NODES);
|
---|
[3445] | 39 | FetchData(&vertices,VERTICES);
|
---|
[2333] | 40 | FetchData(&loads,LOADS);
|
---|
| 41 | FetchData(&materials,MATERIALS);
|
---|
| 42 | FetchParams(¶meters,PARAMETERS);
|
---|
| 43 |
|
---|
[1] | 44 | /*parameters: */
|
---|
[2333] | 45 | parameters->FindParam(&kflag,"kflag");
|
---|
| 46 | parameters->FindParam(&pflag,"pflag");
|
---|
| 47 | parameters->FindParam(&connectivity,"connectivity");
|
---|
| 48 | parameters->FindParam(&numberofdofspernode,"numberofdofspernode");
|
---|
[1] | 49 |
|
---|
[2333] | 50 | FetchData(&analysis_type,ANALYSIS);
|
---|
| 51 | FetchData(&sub_analysis_type,SUBANALYSIS);
|
---|
| 52 |
|
---|
[1] | 53 | /*Fetch inputs: */
|
---|
[246] | 54 | inputs=new ParameterInputs;
|
---|
| 55 | inputs->Init(INPUTS);
|
---|
[1] | 56 |
|
---|
| 57 | /*!Generate internal degree of freedom numbers: */
|
---|
[3445] | 58 | SystemMatricesx(&Kgg, &pg,elements,nodes,vertices,loads,materials,parameters,kflag,pflag,connectivity,numberofdofspernode,inputs,analysis_type,sub_analysis_type);
|
---|
[1] | 59 |
|
---|
| 60 | /*write output datasets: */
|
---|
[2316] | 61 | WriteData(KGG,Kgg);
|
---|
| 62 | WriteData(PG,pg);
|
---|
[1] | 63 |
|
---|
| 64 |
|
---|
| 65 | /*Free ressources: */
|
---|
| 66 | delete elements;
|
---|
| 67 | delete nodes;
|
---|
[3445] | 68 | delete vertices;
|
---|
[1] | 69 | delete loads;
|
---|
| 70 | delete materials;
|
---|
[2333] | 71 | delete parameters;
|
---|
[246] | 72 | delete inputs;
|
---|
[1] | 73 | MatFree(&Kgg);
|
---|
| 74 | VecFree(&pg);
|
---|
| 75 |
|
---|
| 76 | /*end module: */
|
---|
| 77 | MODULEEND();
|
---|
| 78 | }
|
---|
| 79 |
|
---|
| 80 | void SystemMatricesUsage(void)
|
---|
| 81 | {
|
---|
| 82 | _printf_("\n");
|
---|
[3479] | 83 | _printf_(" usage: [Kgg,pg] = %s(elements,nodes,vertices,loads,materials,params,inputs,analysis_type);\n",__FUNCT__);
|
---|
[1] | 84 | _printf_("\n");
|
---|
| 85 | }
|
---|