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