| 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* vertices=NULL;
|
|---|
| 16 | DataSet* loads=NULL;
|
|---|
| 17 | DataSet* materials=NULL;
|
|---|
| 18 | Parameters* parameters=NULL;
|
|---|
| 19 | int kflag,pflag;
|
|---|
| 20 | int connectivity;
|
|---|
| 21 | int numberofdofspernode;
|
|---|
| 22 | int analysis_type;
|
|---|
| 23 | int sub_analysis_type;
|
|---|
| 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: */
|
|---|
| 36 | FetchData(&elements,ELEMENTS);
|
|---|
| 37 | FetchData(&nodes,NODES);
|
|---|
| 38 | FetchData(&vertices,VERTICES);
|
|---|
| 39 | FetchData(&loads,LOADS);
|
|---|
| 40 | FetchData(&materials,MATERIALS);
|
|---|
| 41 | FetchParams(¶meters,PARAMETERS);
|
|---|
| 42 |
|
|---|
| 43 | /*parameters: */
|
|---|
| 44 | parameters->FindParam(&kflag,KflagEnum);
|
|---|
| 45 | parameters->FindParam(&pflag,PflagEnum);
|
|---|
| 46 | parameters->FindParam(&connectivity,ConnectivityEnum);
|
|---|
| 47 | parameters->FindParam(&numberofdofspernode,NumberOfDofsPerNodeEnum);
|
|---|
| 48 |
|
|---|
| 49 | FetchData(&analysis_type,ANALYSIS);
|
|---|
| 50 | FetchData(&sub_analysis_type,SUBANALYSIS);
|
|---|
| 51 |
|
|---|
| 52 | /*!Generate internal degree of freedom numbers: */
|
|---|
| 53 | SystemMatricesx(&Kgg, &pg,elements,nodes,vertices,loads,materials,parameters,kflag,pflag,connectivity,numberofdofspernode,analysis_type,sub_analysis_type);
|
|---|
| 54 |
|
|---|
| 55 | /*write output datasets: */
|
|---|
| 56 | WriteData(KGG,Kgg);
|
|---|
| 57 | WriteData(PG,pg);
|
|---|
| 58 |
|
|---|
| 59 | /*Free ressources: */
|
|---|
| 60 | delete elements;
|
|---|
| 61 | delete nodes;
|
|---|
| 62 | delete vertices;
|
|---|
| 63 | delete loads;
|
|---|
| 64 | delete materials;
|
|---|
| 65 | delete parameters;
|
|---|
| 66 | MatFree(&Kgg);
|
|---|
| 67 | VecFree(&pg);
|
|---|
| 68 |
|
|---|
| 69 | /*end module: */
|
|---|
| 70 | MODULEEND();
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | void SystemMatricesUsage(void)
|
|---|
| 74 | {
|
|---|
| 75 | _printf_("\n");
|
|---|
| 76 | _printf_(" usage: [Kgg,pg] = %s(elements,nodes,vertices,loads,materials,params,analysis_type);\n",__FUNCT__);
|
|---|
| 77 | _printf_("\n");
|
|---|
| 78 | }
|
|---|