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 | Nodes* nodes=NULL;
|
---|
15 | DataSet* vertices=NULL;
|
---|
16 | DataSet* loads=NULL;
|
---|
17 | DataSet* materials=NULL;
|
---|
18 | Parameters* parameters=NULL;
|
---|
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: */
|
---|
32 | FetchData(&elements,ELEMENTS);
|
---|
33 | FetchData((DataSet**)&nodes,NODES);
|
---|
34 | FetchData(&vertices,VERTICES);
|
---|
35 | FetchData(&loads,LOADS);
|
---|
36 | FetchData(&materials,MATERIALS);
|
---|
37 | FetchParams(¶meters,PARAMETERS);
|
---|
38 |
|
---|
39 | /*parameters: */
|
---|
40 | parameters->FindParam(&kflag,KflagEnum);
|
---|
41 | parameters->FindParam(&pflag,PflagEnum);
|
---|
42 |
|
---|
43 | /*!Generate internal degree of freedom numbers: */
|
---|
44 | SystemMatricesx(&Kgg, &pg,elements,nodes,vertices,loads,materials,parameters,kflag,pflag);
|
---|
45 |
|
---|
46 | /*write output datasets: */
|
---|
47 | WriteData(KGG,Kgg);
|
---|
48 | WriteData(PG,pg);
|
---|
49 |
|
---|
50 | /*Free ressources: */
|
---|
51 | delete elements;
|
---|
52 | delete nodes;
|
---|
53 | delete vertices;
|
---|
54 | delete loads;
|
---|
55 | delete materials;
|
---|
56 | delete parameters;
|
---|
57 | MatFree(&Kgg);
|
---|
58 | VecFree(&pg);
|
---|
59 |
|
---|
60 | /*end module: */
|
---|
61 | MODULEEND();
|
---|
62 | }
|
---|
63 |
|
---|
64 | void SystemMatricesUsage(void)
|
---|
65 | {
|
---|
66 | _printf_("\n");
|
---|
67 | _printf_(" usage: [Kgg,pg] = %s(elements,nodes,vertices,loads,materials,parameters);\n",__FUNCT__);
|
---|
68 | _printf_("\n");
|
---|
69 | }
|
---|