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