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
RevLine 
[4138]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: */
[4215]10 Elements* elements=NULL;
[4211]11 Nodes* nodes=NULL;
[4213]12 Vertices* vertices=NULL;
[4214]13 Loads* loads=NULL;
[4218]14 Materials* materials=NULL;
[4138]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: */
[5019]23 //CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&InputToResultUsage); Cant' use it here, as we have variable inputs.
[4228]24 if((nlhs!=NLHS) || (nrhs!=7 && nrhs!=9)){
25 InputToResultUsage();
[6412]26 _error_(" usage. See above");
[4228]27 }
[4138]28
29 /*Input datasets: */
[8910]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);
[4138]36
[8910]37 FetchMatlabData(&enum_type,ENUMTYPE);
[4138]38
[4573]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
[4228]44 if(nrhs==9){
[8910]45 FetchMatlabData(&step,STEP);
46 FetchMatlabData(&time,TIME);
[4138]47
[4228]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
[4138]57 /*write output : */
[8910]58 WriteMatlabData(ELEMENTSOUT,elements);
[4138]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{
[6412]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");
[4138]79}
Note: See TracBrowser for help on using the repository browser.