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

Last change on this file since 6412 was 6412, checked in by Mathieu Morlighem, 14 years ago

moved ISSMERROR to _error_, ISSMASSERT to _assert_ and ISSMPRINTF to _printf_

File size: 1.7 KB
Line 
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: */
28 FetchData((DataSet**)&elements,ELEMENTSIN);
29 FetchData((DataSet**)&nodes,NODES);
30 FetchData((DataSet**)&vertices,VERTICES);
31 FetchData((DataSet**)&loads,LOADSIN);
32 FetchData((DataSet**)&materials,MATERIALS);
33 FetchData(&control_type,CONTROLTYPE);
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 /*!core code:*/
41 ControlInputGetGradientx(&gradient,elements, nodes,vertices,loads, materials,parameters,control_type);
42
43 /*write output datasets: */
44 WriteData(GRADIENT,gradient);
45
46 /*Free ressources: */
47 delete elements;
48 delete nodes;
49 delete vertices;
50 delete loads;
51 delete materials;
52 delete parameters;
53
54 /*end module: */
55 MODULEEND();
56}
57
58void ControlInputGetGradientUsage(void)
59{
60 _printf_(true,"\n");
61 _printf_(true," usage: [gradient] = %s(elements,nodes,vertices,loads, materials,parameters,control_type);\n",__FUNCT__);
62 _printf_(true,"\n");
63}
Note: See TracBrowser for help on using the repository browser.