Changeset 6005


Ignore:
Timestamp:
09/23/10 16:16:14 (15 years ago)
Author:
Eric.Larour
Message:

Implementing a new petscoptions class, that pulls together option strings
for each analysis type, that will be fed to the Petsc library on a per analysis
basis. Everthing implemented up to marshall. Still need to update ModelProcessor,
and SetConfigurationType, etc ...

Location:
issm/trunk/src
Files:
4 added
13 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/modules/ModelProcessorx/CreateParameters.cpp

    r5903 r6005  
    6464        parameters->AddObject(new DoubleParam(ViscosityOvershootEnum,iomodel->viscosity_overshoot));
    6565        parameters->AddObject(new BoolParam(WaitOnLockEnum,iomodel->waitonlock));
    66         parameters->AddObject(new StringParam(PetscRcEnum,iomodel->petscrc));
    6766        parameters->AddObject(new IntParam(NumberOfElementsEnum,iomodel->numberofelements));
    6867        parameters->AddObject(new BoolParam(KffEnum,iomodel->kff));
  • issm/trunk/src/c/objects/IoModel.cpp

    r5903 r6005  
    4848                xfree((void**)&this->gridonpattyn);
    4949        }
    50         xfree((void**)&this->petscrc);
     50        xfree((void**)&this->numpetscoptions);
    5151        xfree((void**)&this->elementonbed);
    5252        xfree((void**)&this->elementonsurface);
     
    182182        IoModelFetchData(&this->connectivity,iomodel_handle,"connectivity");
    183183        IoModelFetchData(&this->lowmem,iomodel_handle,"lowmem");
    184         IoModelFetchData(&this->petscrc,iomodel_handle,"petscrc");
     184        IoModelFetchData(&this->numpetscoptions,iomodel_handle,"numpetscoptions");
    185185        IoModelFetchData(&this->viscosity_overshoot,iomodel_handle,"viscosity_overshoot");
    186186        IoModelFetchData(&this->artdiff,iomodel_handle,"artificial_diffusivity");
     
    227227        this->control_analysis=0;
    228228        this->control_parameter=NULL;
    229         this->petscrc=NULL;
     229        this->numpetscoptions=NULL;
    230230        this->numberofvariables=0;
    231231        this->numvariabledescriptors=0;
  • issm/trunk/src/c/objects/IoModel.h

    r5903 r6005  
    2222                int     qmu_analysis;
    2323                int     control_analysis;
    24                 char*   petscrc;
     24                char*   numpetscoptions;
    2525
    2626                /*2d mesh: */
  • issm/trunk/src/c/objects/Loads/Icefront.h

    r5935 r6005  
    8888                /*}}}*/
    8989};
    90 
    9190#endif  /* _ICEFRONT_H_ */
  • issm/trunk/src/c/toolkits/petsc/patches/NewMat.cpp

    r5895 r6005  
    9494        /*preallocation  according to type: */
    9595        MatGetType(outmatrix,&type);
    96         if(strcmp(type,"mpiaij")==0){
     96        if((strcmp(type,"mpiaij")==0) || (strcmp(type,"aijmumps")==0)){
     97                printf("here\n");
    9798                MatMPIAIJSetPreallocation(outmatrix,d_nz,NULL,o_nz,NULL);
    9899        }
  • issm/trunk/src/m/classes/@model/model.m

    r5961 r6005  
    266266        %PETSc and MATLAB solver string
    267267        md.petscoptions=NaN;
    268         md.petscrc='';
     268        md.numpetscoptions=1;
    269269
    270270        %Analysis and sub_analysis
  • issm/trunk/src/m/classes/@model/setdefaultparameters.m

    r5991 r6005  
    235235md.alloc_cleanup=1;
    236236
    237 %set petsc options cell array, so that PETSC uses the correct solvers
    238 md=solversettomumps(md);
     237%set petsc options for different analysis
     238md.petscoptions=petscoptions;
     239md.petscoptions=addoptions(md.petscoptions,DiagnosticHorizAnalysisEnum,asmoptions);
     240md.petscoptions=addoptions(md.petscoptions,DiagnosticVertAnalysisEnum,mumpsoptions);
     241md.numpetscoptions=3; %don't forget the default analysis!
    239242
    240243%solution speed-up
  • issm/trunk/src/m/clusters/astrid.m

    r5985 r6005  
    99    properties (SetAccess=public)
    1010                 % {{{1
    11                  name='astrid'
     11                 name='astrid';
    1212                 login='larour';
    1313                 np=15;
  • issm/trunk/src/m/model/PetscOptions2PetscRc.m

    r5903 r6005  
    33%
    44% Usage:     petscstring=PetscOptions2PetscRc(petscoptions,filename);
     5%            petscstring=PetscOptions2PetscRc(petscoptions);
    56%
    67% Example:   md.petscsrc=PetscOptions2PetscRc(md.petscoptions,'petsc.rc');
     
    910
    1011
    11 %open file for writing
    12 fid=fopen(filename,'w');
    13 if fid==-1,
    14         error(['PetscOptions2PetscRc error: could not open ' filename ' for writing']);
     12if nargin==2,
     13        %open file for writing
     14        fid=fopen(filename,'w');
     15        if fid==-1,
     16                error(['PetscOptions2PetscRc error: could not open ' filename ' for writing']);
     17        end
     18
     19        %write header
     20        fprintf(fid,'%s%s%s\n\n','%Petsc options file: ',filename,' written from Matlab petscoptions array');
    1521end
    16 
    17 %write header
    18 fprintf(fid,'%s%s%s\n\n','%Petsc options file: ',filename,' written from Matlab petscoptions array');
    1922
    2023%initialize petscstring:
     
    2831        elseif length(option)==1,
    2932                %this option has only one argument
    30                 fprintf(fid,'-%s\n',option{1});
     33                if(nargin==2),
     34                        fprintf(fid,'-%s\n',option{1});
     35                end
    3136                petscstring=[petscstring ' -' option{1}];
    3237        elseif length(option)==2,
    3338                %option with value. value can be string or scalar
    3439                if isscalar(option{2}),
    35                         fprintf(fid,'-%s %g\n',option{1},option{2});
     40                        if(nargin==2),
     41                                fprintf(fid,'-%s %g\n',option{1},option{2});
     42                        end
    3643                        petscstring=[petscstring ' -' option{1} ' ' num2str(option{2})];
    3744                elseif ischar(option{2}),
    38                         fprintf(fid,'-%s %s\n',option{1},option{2});
     45                        if(nargin==2),
     46                                fprintf(fid,'-%s %s\n',option{1},option{2});
     47                        end
    3948                        petscstring=[petscstring ' -' option{1} ' ' option{2}];
    4049                else
     
    4453                error(['PetscOptions2PetscRc error: option #' num2str(i) ' is not well formatted']);
    4554        end
    46 
    4755end
  • issm/trunk/src/m/model/marshall.m

    r5903 r6005  
    180180WriteData(fid,md.outputfilename,'String','outputfilename');
    181181
     182%petsc options:
     183WriteData(fid,md.numpetscoptions,'Integer','numpetscoptions');
     184WriteData(fid,md.petscoptions.analyses,'Mat','petscoptionsanalyses');
     185for i=1:md.numpetscoptions,
     186        WriteData(fid,md.petscoptions.strings{i},'String',['petscoptionsstrings_' num2str(i-1)]);
     187end
     188
    182189%close file
    183190st=fclose(fid);
  • issm/trunk/src/m/model/presolve.m

    r5963 r6005  
    3434end
    3535
    36 %deal with petsc options
    37 md.petscrc=PetscOptions2PetscRc(md.petscoptions,[md.name '.petsc']);
     36%package together petscoptions:
     37md.petscoptions=marshall(md.petscoptions);
     38md.numpetscoptions=size(md.petscoptions.analyses,1);
  • issm/trunk/src/m/utils/OS/oshostname.m

    r2953 r6005  
    2121        hostname=ddewhite(hostname);
    2222end
     23
     24hostname='ericmac';
  • issm/trunk/src/mex/SystemMatrices/SystemMatrices.h

    r5775 r6005  
    3636#define PF   (mxArray**)&plhs[4]
    3737#define KMAX (mxArray**)&plhs[5]
     38#define KMAX (mxArray**)&plhs[2]
    3839
    3940/* serial arg counts: */
Note: See TracChangeset for help on using the changeset viewer.