source: issm/branches/trunk-jpl-damage/src/mex/ParsePetscOptions/ParsePetscOptions.cpp@ 11427

Last change on this file since 11427 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.2 KB
Line 
1/*\file ParsePetscOptions.c
2 *\brief: add petsc options to parameters
3 */
4
5#include "./ParsePetscOptions.h"
6
7void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){
8
9 /*input datasets: */
10 Parameters *parameters = NULL;
11 char* petscoptionsfilename=NULL;
12 FILE* petscoptionsfid=NULL;
13
14 /*Boot module: */
15 MODULEBOOT();
16
17 /*checks on arguments on the matlab side: */
18 CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&ParsePetscOptionsUsage);
19
20 /*Input datasets: */
21 FetchMatlabData(&parameters,PARAMETERS);
22 FetchMatlabData(&petscoptionsfilename,PETSCOPTIONSFILENAME);
23
24 petscoptionsfid=fopen(petscoptionsfilename,"r");
25 if(petscoptionsfid==NULL)_error_("could not open petsc solver options file for reading\n");
26
27 ParsePetscOptionsx(parameters,petscoptionsfid);
28
29 /*write output datasets: */
30 WriteMatlabData(PARAMETERSOUT,parameters);
31
32 /*Free ressources: */
33 delete parameters;
34 xfree((void**)&petscoptionsfilename);
35 fclose(petscoptionsfid);
36
37 /*end module: */
38 MODULEEND();
39}
40
41void ParsePetscOptionsUsage(void)
42{
43 _printf_(true,"\n");
44 _printf_(true," usage: [parameters] = %s(parameters,petscoptionsfilename);\n",__FUNCT__);
45 _printf_(true,"\n");
46}
Note: See TracBrowser for help on using the repository browser.