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