source: issm/trunk-jpl/src/mex/ControlInputGetGradient/ControlInputGetGradient.cpp@ 11695

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

Completed separation of Petsc from ISSM. Matrix and Vector
are now the vehicles for Mat and Vec objects when running with
Petsc, or double* when running with a custom made type of matrix (still
to be finished).

File size: 1.8 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;
[11695]16 Vector* gradient = NULL;
[6200]17
18 /* output datasets: elements and loads*/
19
20 /*Boot module: */
21 MODULEBOOT();
22
23 /*checks on arguments on the matlab side: */
24 CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&ControlInputGetGradientUsage);
25
26 /*Input datasets: */
[8910]27 FetchMatlabData((DataSet**)&elements,ELEMENTSIN);
28 FetchMatlabData((DataSet**)&nodes,NODES);
29 FetchMatlabData((DataSet**)&vertices,VERTICES);
30 FetchMatlabData((DataSet**)&loads,LOADSIN);
31 FetchMatlabData((DataSet**)&materials,MATERIALS);
32 FetchMatlabData(&parameters,PARAMETERS);
[6200]33
34 /*configure: */
35 elements-> Configure(elements,loads, nodes,vertices, materials,parameters);
36 nodes-> Configure(elements,loads, nodes,vertices, materials,parameters);
37 loads-> Configure(elements, loads, nodes,vertices, materials,parameters);
[8595]38 materials-> Configure(elements, loads, nodes,vertices, materials,parameters);
[6200]39
40 /*!core code:*/
[11313]41 ControlInputGetGradientx(&gradient,elements, nodes,vertices,loads, materials,parameters);
[6200]42
43 /*write output datasets: */
[8910]44 WriteMatlabData(GRADIENT,gradient);
[6200]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{
[6412]60 _printf_(true,"\n");
[11313]61 _printf_(true," usage: [gradient] = %s(elements,nodes,vertices,loads, materials,parameters);\n",__FUNCT__);
[6412]62 _printf_(true,"\n");
[6200]63}
Note: See TracBrowser for help on using the repository browser.