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