source: issm/trunk/src/mex/ControlInputGetGradient/ControlInputGetGradient.cpp@ 8910

Last change on this file since 8910 was 8910, checked in by Eric.Larour, 14 years ago

Reorganized io/ directory quite a bit.
Separated Matlab io from the other Disk related io.
Renamed WriteData to WriteMatlabData and FetchData to FetchMatlabData.
Folded WriteParams and FetchParams into FetchMatlabData and WriteMatlabData.

File size: 1.9 KB
RevLine 
[6200]1/*\file ControlInputGetGradient.c
2 *\brief: recover velocity ug from inputs
3 */
4
5#include "./ControlInputGetGradient.h"
6
7void 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 control_type;
17 Vec gradient = NULL;
18
19 /* output datasets: elements and loads*/
20
21 /*Boot module: */
22 MODULEBOOT();
23
24 /*checks on arguments on the matlab side: */
25 CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&ControlInputGetGradientUsage);
26
27 /*Input datasets: */
[8910]28 FetchMatlabData((DataSet**)&elements,ELEMENTSIN);
29 FetchMatlabData((DataSet**)&nodes,NODES);
30 FetchMatlabData((DataSet**)&vertices,VERTICES);
31 FetchMatlabData((DataSet**)&loads,LOADSIN);
32 FetchMatlabData((DataSet**)&materials,MATERIALS);
33 FetchMatlabData(&parameters,PARAMETERS);
34 FetchMatlabData(&control_type,CONTROLTYPE);
[6200]35
36 /*configure: */
37 elements-> Configure(elements,loads, nodes,vertices, materials,parameters);
38 nodes-> Configure(elements,loads, nodes,vertices, materials,parameters);
39 loads-> Configure(elements, loads, nodes,vertices, materials,parameters);
[8595]40 materials-> Configure(elements, loads, nodes,vertices, materials,parameters);
[6200]41
42 /*!core code:*/
43 ControlInputGetGradientx(&gradient,elements, nodes,vertices,loads, materials,parameters,control_type);
44
45 /*write output datasets: */
[8910]46 WriteMatlabData(GRADIENT,gradient);
[6200]47
48 /*Free ressources: */
49 delete elements;
50 delete nodes;
51 delete vertices;
52 delete loads;
53 delete materials;
54 delete parameters;
55
56 /*end module: */
57 MODULEEND();
58}
59
60void ControlInputGetGradientUsage(void)
61{
[6412]62 _printf_(true,"\n");
63 _printf_(true," usage: [gradient] = %s(elements,nodes,vertices,loads, materials,parameters,control_type);\n",__FUNCT__);
64 _printf_(true,"\n");
[6200]65}
Note: See TracBrowser for help on using the repository browser.