source: issm/trunk/src/mex/SystemMatrices/SystemMatrices.cpp@ 1649

Last change on this file since 1649 was 1649, checked in by Mathieu Morlighem, 16 years ago

Analysis_types are now always Enums not strings

File size: 2.3 KB
Line 
1/*\file SystemMatrices.c
2 *\brief: build system matrices (stiffness matrix, loads vector)
3 */
4
5#include "./SystemMatrices.h"
6
7void 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 int kflag,pflag;
18 int connectivity;
19 int numberofdofspernode;
20 ParameterInputs* inputs=NULL;
21 int analysis_type;
22 int sub_analysis_type;
23
24 /* output datasets: */
25 Mat Kgg=NULL;
26 Vec pg=NULL;
27
28 /*Boot module: */
29 MODULEBOOT();
30
31 /*checks on arguments on the matlab side: */
32 CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&SystemMatricesUsage);
33
34 /*Input datasets: */
35 FetchData((void**)&elements,NULL,NULL,ELEMENTS,"DataSet",NULL);
36 FetchData((void**)&nodes,NULL,NULL,NODES,"DataSet",NULL);
37 FetchData((void**)&loads,NULL,NULL,LOADS,"DataSet",NULL);
38 FetchData((void**)&materials,NULL,NULL,MATERIALS,"DataSet",NULL);
39 /*parameters: */
40 FetchData((void**)&kflag,NULL,NULL,mxGetField(PARAMETERS,0,"kflag"),"Integer",NULL);
41 FetchData((void**)&pflag,NULL,NULL,mxGetField(PARAMETERS,0,"pflag"),"Integer",NULL);
42 FetchData((void**)&connectivity,NULL,NULL,mxGetField(PARAMETERS,0,"connectivity"),"Integer",NULL);
43 FetchData((void**)&numberofdofspernode,NULL,NULL,mxGetField(PARAMETERS,0,"numberofdofspernode"),"Integer",NULL);
44 FetchData((void**)&analysis_type,NULL,NULL,ANALYSIS,"Integer",NULL);
45 FetchData((void**)&sub_analysis_type,NULL,NULL,SUBANALYSIS,"Integer",NULL);
46
47 /*Fetch inputs: */
48 inputs=new ParameterInputs;
49 inputs->Init(INPUTS);
50
51 /*!Generate internal degree of freedom numbers: */
52 SystemMatricesx(&Kgg, &pg,elements,nodes,loads,materials,kflag,pflag,connectivity,numberofdofspernode,inputs,analysis_type,sub_analysis_type);
53
54 /*write output datasets: */
55 WriteData(KGG,Kgg,0,0,"Matrix",NULL);
56 WriteData(PG,pg,0,0,"Vector",NULL);
57
58
59 /*Free ressources: */
60 delete elements;
61 delete nodes;
62 delete loads;
63 delete materials;
64 delete inputs;
65 MatFree(&Kgg);
66 VecFree(&pg);
67
68 /*end module: */
69 MODULEEND();
70}
71
72void SystemMatricesUsage(void)
73{
74 _printf_("\n");
75 _printf_(" usage: [Kgg,pg] = %s(eleemnts,nodes,loads,materials,params,inputs,analysis_type);\n",__FUNCT__);
76 _printf_("\n");
77}
Note: See TracBrowser for help on using the repository browser.