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