source: issm/trunk/src/mex/InputToResult/InputToResult.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: 2.1 KB
Line 
1/*\file InputToResult.c
2 *\brief: duplicate input
3 */
4
5#include "./InputToResult.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 enum_type,step;
17 double time;
18
19 /*Boot module: */
20 MODULEBOOT();
21
22 /*checks on arguments on the matlab side: */
23 //CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&InputToResultUsage); Cant' use it here, as we have variable inputs.
24 if((nlhs!=NLHS) || (nrhs!=7 && nrhs!=9)){
25 InputToResultUsage();
26 _error_(" usage. See above");
27 }
28
29 /*Input datasets: */
30 FetchMatlabData((DataSet**)&elements,ELEMENTS);
31 FetchMatlabData((DataSet**)&nodes,NODES);
32 FetchMatlabData((DataSet**)&vertices,VERTICES);
33 FetchMatlabData((DataSet**)&loads,LOADS);
34 FetchMatlabData((DataSet**)&materials,MATERIALS);
35 FetchMatlabData(&parameters,PARAMETERS);
36
37 FetchMatlabData(&enum_type,ENUMTYPE);
38
39 /*configure: */
40 elements-> Configure(elements,loads, nodes,vertices, materials,parameters);
41 nodes-> Configure(elements,loads, nodes,vertices, materials,parameters);
42 loads-> Configure(elements, loads, nodes,vertices, materials,parameters);
43
44 if(nrhs==9){
45 FetchMatlabData(&step,STEP);
46 FetchMatlabData(&time,TIME);
47
48 /*!Call core code: */
49 InputToResultx( elements, nodes, vertices, loads, materials,parameters,enum_type, step,time);
50 }
51 else{
52
53 /*!Call core code: */
54 InputToResultx( elements, nodes, vertices, loads, materials,parameters,enum_type);
55 }
56
57 /*write output : */
58 WriteMatlabData(ELEMENTSOUT,elements);
59
60 /*Free ressources: */
61 delete elements;
62 delete nodes;
63 delete vertices;
64 delete loads;
65 delete materials;
66 delete parameters;
67
68 /*end module: */
69 MODULEEND();
70
71}
72
73void InputToResultUsage(void)
74{
75 _printf_(true,"\n");
76 _printf_(true," usage: [elements] = %s(elements, nodes, vertices, loads, materials, parameters, enum_type,step,time);\n",__FUNCT__);
77 _printf_(true," usage: [elements] = %s(elements, nodes, vertices, loads, materials, parameters, enum_type);\n",__FUNCT__);
78 _printf_(true,"\n");
79}
Note: See TracBrowser for help on using the repository browser.