| 1 | /*\file ComputeBasalStress.c | 
|---|
| 2 | *\brief: recover pressure from elements | 
|---|
| 3 | */ | 
|---|
| 4 |  | 
|---|
| 5 | #include "./ComputeBasalStress.h" | 
|---|
| 6 |  | 
|---|
| 7 | void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){ | 
|---|
| 8 |  | 
|---|
| 9 | /*input datasets: */ | 
|---|
| 10 | Elements* elements=NULL; | 
|---|
| 11 | Nodes* nodes=NULL; | 
|---|
| 12 | Vertices* vertices=NULL; | 
|---|
| 13 | Loads* loads=NULL; | 
|---|
| 14 | Materials* materials=NULL; | 
|---|
| 15 | Parameters* parameters=NULL; | 
|---|
| 16 | int      numberofnodes; | 
|---|
| 17 |  | 
|---|
| 18 | /* output datasets: */ | 
|---|
| 19 | Vec sigma_g=NULL; | 
|---|
| 20 |  | 
|---|
| 21 | /*Boot module: */ | 
|---|
| 22 | MODULEBOOT(); | 
|---|
| 23 |  | 
|---|
| 24 | /*checks on arguments on the matlab side: */ | 
|---|
| 25 | CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&ComputeBasalStressUsage); | 
|---|
| 26 |  | 
|---|
| 27 | /*Input datasets: */ | 
|---|
| 28 | FetchMatlabData((DataSet**)&elements,ELEMENTS); | 
|---|
| 29 | FetchMatlabData((DataSet**)&nodes,NODES); | 
|---|
| 30 | FetchMatlabData((DataSet**)&vertices,VERTICES); | 
|---|
| 31 | FetchMatlabData((DataSet**)&loads,LOADS); | 
|---|
| 32 | FetchMatlabData((DataSet**)&materials,MATERIALS); | 
|---|
| 33 | FetchMatlabData(¶meters,PARAMETERS); | 
|---|
| 34 |  | 
|---|
| 35 | /*configure: */ | 
|---|
| 36 | elements->  Configure(elements,loads, nodes,vertices, materials,parameters); | 
|---|
| 37 | nodes->     Configure(elements,loads, nodes,vertices, materials,parameters); | 
|---|
| 38 | loads->     Configure(elements, loads, nodes,vertices, materials,parameters); | 
|---|
| 39 |  | 
|---|
| 40 | /*!Generate internal degree of freedom numbers: */ | 
|---|
| 41 | ComputeBasalStressx(&sigma_g, elements,nodes,vertices,loads,materials,parameters); | 
|---|
| 42 |  | 
|---|
| 43 | /*write output datasets: */ | 
|---|
| 44 | WriteMatlabData(SIGMA,sigma_g); | 
|---|
| 45 |  | 
|---|
| 46 | /*Free ressources: */ | 
|---|
| 47 | delete nodes; | 
|---|
| 48 | delete vertices; | 
|---|
| 49 | delete elements; | 
|---|
| 50 | delete materials; | 
|---|
| 51 | delete loads; | 
|---|
| 52 | delete parameters; | 
|---|
| 53 | VecFree(&sigma_g); | 
|---|
| 54 |  | 
|---|
| 55 | /*end module: */ | 
|---|
| 56 | MODULEEND(); | 
|---|
| 57 | } | 
|---|
| 58 |  | 
|---|
| 59 | void ComputeBasalStressUsage(void) { | 
|---|
| 60 | printf("\n"); | 
|---|
| 61 | printf("   usage: [p_g] = %s(elements, nodes, vertices, loads, materials, params);\n",__FUNCT__); | 
|---|
| 62 | printf("\n"); | 
|---|
| 63 | } | 
|---|