Changeset 4852


Ignore:
Timestamp:
07/28/10 17:52:32 (15 years ago)
Author:
Eric.Larour
Message:

New DoubleMatArrayParam object, to hold the qmu segments.

Location:
issm/trunk/src
Files:
2 added
16 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h

    r4784 r4852  
    135135        BoolParamEnum,
    136136        DoubleMatParamEnum,
     137        DoubleMatArrayParamEnum,
    137138        DoubleParamEnum,
    138139        DoubleVecParamEnum,
  • issm/trunk/src/c/io/FetchParams.cpp

    r4189 r4852  
    3232        double* matrix=NULL;
    3333        char**  stringarray=NULL;
     34        double** array=NULL;
     35        int*     mdims_array=NULL;
     36        int*     ndims_array=NULL;
    3437        int nfields;
    3538        char* name=NULL;
     
    113116                }
    114117                else if (mxIsCell(pfield)){
    115                         /*string array: */
    116                         M=mxGetM(pfield);
    117                         stringarray=(char**)xmalloc(M*sizeof(char*));
    118118
    119                         for(i=0;i<M;i++){
    120                                 char* descriptor=NULL;
    121                                 pfield2=mxGetCell(pfield,i);
    122                                 FetchData(&descriptor,pfield2);
    123                                 stringarray[i]=descriptor;
     119                        /*This can be a string array, or a matrix array. Check the first
     120                         *element type to decide: */
     121                        pfield2=mxGetCell(pfield,0);
     122                        if (mxIsChar(pfield2)){
     123                               
     124                                /*string array: */
     125                                M=mxGetM(pfield);
     126                                stringarray=(char**)xmalloc(M*sizeof(char*));
     127
     128                                for(i=0;i<M;i++){
     129                                        char* descriptor=NULL;
     130                                        pfield2=mxGetCell(pfield,i);
     131                                        FetchData(&descriptor,pfield2);
     132                                        stringarray[i]=descriptor;
     133                                }
     134
     135                                param= new StringArrayParam(enum_type,stringarray,M);
     136                                parameters->AddObject(param);
     137
     138                                /*Free ressources:*/
     139                                for(i=0;i<M;i++){
     140                                        char* descriptor=stringarray[i];
     141                                        xfree((void**)&descriptor);
     142                                }
     143                                xfree((void**)&stringarray);
     144
    124145                        }
    125                
    126                         param= new StringArrayParam(enum_type,stringarray,M);
    127                         parameters->AddObject(param);
     146                        else{
     147                               
     148                                /*matrix array: */
     149                                M=mxGetM(pfield);
     150                                array=(double**)xmalloc(M*sizeof(double*));
     151                                mdims_array=(int*)xmalloc(M*sizeof(int));
     152                                ndims_array=(int*)xmalloc(M*sizeof(int));
    128153
    129                         /*Free ressources:*/
    130                         for(i=0;i<M;i++){
    131                                 char* descriptor=stringarray[i];
    132                                 xfree((void**)&descriptor);
     154                                for(i=0;i<M;i++){
     155                                        double* matrix=NULL;
     156                                        int     m,n;
     157                                        pfield2=mxGetCell(pfield,i);
     158                                        FetchData(&matrix,&m,&n,pfield2);
     159                                        array[i]=matrix;
     160                                        mdims_array[i]=m;
     161                                        ndims_array[i]=n;
     162                                }
     163
     164                                param= new DoubleMatArrayParam(enum_type,array,M,mdims_array,ndims_array);
     165                                parameters->AddObject(param);
     166
     167                                /*Free ressources:*/
     168                                for(i=0;i<M;i++){
     169                                        double* matrix=array[i];
     170                                        xfree((void**)&matrix);
     171                                }
     172                                xfree((void**)&array);
     173                                xfree((void**)&mdims_array);
     174                                xfree((void**)&ndims_array);
    133175                        }
    134                         xfree((void**)&stringarray);
    135 
    136176                }
    137177                else ISSMERROR("%s%i","unknow type in parameters structure field ",i);
  • issm/trunk/src/c/modules/MeshProfileIntersectionx/ElementSegment.cpp

    r4785 r4852  
    2424        /*edge 1: */
    2525        xel[0]=xgrids[0];  yel[0]=ygrids[0]; xel[1]=xgrids[1];  yel[1]=ygrids[1];
    26         edge1=SegmentIntersect(&alpha1,&alpha2, xel,yel,xsegment,ysegment);
     26        edge1=SegmentIntersect(&alpha1,&alpha2, xel,yel,xsegment,ysegment); //alpha1: segment coordinate of intersection. alpha2: same thing for second interesection if it exists (colinear edges)
    2727
    2828        /*edge 2: */
     
    3333        xel[0]=xgrids[2];  yel[0]=ygrids[2]; xel[1]=xgrids[0];  yel[1]=ygrids[0];
    3434        edge3=SegmentIntersect(&gamma1,&gamma2, xel,yel,xsegment,ysegment);
     35
     36        /*edge can be either IntersectEnum (one iand only one intersection between the edge and the segment), ColinearEnum (edge and segment are collinear) and SeparateEnum (no intersection): */
    3537
    3638        if(    (edge1==IntersectEnum) && (edge2==IntersectEnum) && (edge3==IntersectEnum)   ){
     
    5456
    5557                        segments_dataset->AddObject(new  Segment(el+1,xfinal[0],yfinal[0],xfinal[1],yfinal[1]));
     58                }
     59                else{
     60                        /*the segment intersected at the vertex, do not bother with this "0" length segment!:*/
    5661                }
    5762        }
  • issm/trunk/src/c/modules/ModelProcessorx/Qmu/CreateParametersQmu.cpp

    r4670 r4852  
    1414
    1515void CreateParametersQmu(Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle,int analysis_type){
    16        
     16
     17        /*variable declarations: {{{1*/
    1718        int i,j,k;
    1819       
     
    3738       
    3839        /*parameters for mass flux: */
     40        bool     qmu_mass_flux_present=false;
    3941        double* qmu_mass_flux_segments=NULL;
    4042        double* my_qmu_mass_flux_segments=NULL;
     
    5052                mxArray* pfield2=NULL;
    5153        #endif
     54        /*}}}*/
    5255       
    5356        /*recover parameters : */
     
    5760        if(iomodel->qmu_analysis){
    5861
    59                 //name of qmu input, error and output files
     62                /*name of qmu input, error and output files:{{{1*/
    6063                qmuinname=(char*)xmalloc((strlen(iomodel->name)+strlen(".qmu.in")+1)*sizeof(char));
    6164                sprintf(qmuinname,"%s%s",iomodel->name,".qmu.in");
     
    6972                sprintf(qmuerrname,"%s%s",iomodel->name,".qmu.err");
    7073                parameters->AddObject(new   StringParam(QmuErrNameEnum,qmuerrname));
    71                
    72                 parameters->AddObject(new    IntParam(QmuNPartEnum,iomodel->qmu_npart));
    73 
    74                 /*Deal with variables for qmu iomodeling: */
     74                /*}}}*/
     75               
     76                /*Deal with variable descriptors: {{{1*/
    7577                variabledescriptors=(char**)xmalloc(iomodel->numberofvariables*sizeof(char*));
    7678
     
    99101                parameters->AddObject(new StringArrayParam(VariableDescriptorsEnum,variabledescriptors,iomodel->numberofvariables));
    100102
    101                 /*Deal with responses and partition for qmu iomodeling: */
     103                /*}}}*/
     104
     105                /*Deal with responses: {{{1*/
    102106                responsedescriptors=(char**)xmalloc(iomodel->numberofresponses*sizeof(char*));
    103107
     
    123127                /*Ok, we have all the response descriptors. Build a parameter with it: */
    124128                parameters->AddObject(new StringArrayParam(ResponseDescriptorsEnum,responsedescriptors,iomodel->numberofresponses));
    125 
     129                /*}}}}*/
     130
     131                /*Deal with partitioning: {{{1*/
    126132                /*partition vertices in iomodel->qmu_npart parts, unless a partition is already present: */
     133                parameters->AddObject(new    IntParam(QmuNPartEnum,iomodel->qmu_npart));
     134               
    127135                IoModelFetchData(&dpart,NULL,NULL,iomodel_handle,"part");
    128136
     
    136144                }
    137145                parameters->AddObject(new DoubleVecParam(QmuPartEnum,dpart,iomodel->numberofvertices));
    138 
    139                 /*Ok, now if any of the variables input from Dakota are distributed, we are going to need the parameters: */
     146                /*}}}*/
     147
     148                /*Deal with data needed because of qmu variable inputs: {{{1*/
    140149                for(i=0;i<iomodel->numberofvariables;i++){
    141150
     
    151160                        }
    152161                }
    153 
    154                 /*Deal with data needed for some responses: */
     162                /*}}}*/
     163
     164                /*Deal with data needed to compute qmu responses: {{{1*/
    155165                for(i=0;i<iomodel->numberofresponses;i++){
    156166                        char* descriptor=responsedescriptors[i];
    157                         if (strcmp(descriptor,"mass_flux")==0){
    158 
    159                                 /*We need the qmu_mass_flux_segments to be able to compute the mass flux: */
    160                                 IoModelFetchData(&qmu_mass_flux_segments,&tot_qmu_mass_flux_segments,NULL,iomodel_handle,"qmu_mass_flux_segments");
    161                                 IoModelFetchData(&qmu_mass_flux_num_segments,&tot_qmu_mass_flux_num_segments,NULL,iomodel_handle,"qmu_mass_flux_num_segments");
    162 
    163                                 #ifdef _PARALLEL_
    164 
    165                                         /*Only if partitioning exist do we care about the segments: */
    166                                         if(iomodel->my_elements){
    167 
    168                                                 /*Use the element partitioning vector from the iomodel to down select qmu_mass_flux_segments to only segments that are relevant
    169                                                  * to this cpu: */
    170                                                 my_tot_qmu_mass_flux_segments=0;
    171                                                 for(j=0;j<tot_qmu_mass_flux_segments;j++){
    172                                                         if (  iomodel->my_elements[(int)(*(qmu_mass_flux_segments+5*j+4))-1])my_tot_qmu_mass_flux_segments++;
    173                                                 }
    174 
    175                                        
    176                                                 if(my_tot_qmu_mass_flux_segments){
    177                                                         my_qmu_mass_flux_segments=(double*)xcalloc(5*my_tot_qmu_mass_flux_segments,sizeof(double));
    178                                                         second_count=0;
    179                                                         for(j=0;j<tot_qmu_mass_flux_segments;j++){
    180                                                                 if (iomodel->my_elements[(int)*(qmu_mass_flux_segments+5*j+4)-1]){
    181                                                                         for(k=0;k<5;k++)*(my_qmu_mass_flux_segments+5*second_count+k)=*(qmu_mass_flux_segments+5*j+k);
    182                                                                         second_count++;
    183                                                                 }
    184                                                         }
    185                                                 }
    186 
    187                                                 parameters->AddObject(new DoubleMatParam(QmuMassFluxSegmentsEnum,my_qmu_mass_flux_segments,my_tot_qmu_mass_flux_segments,5));
    188 
    189                                         }
    190                                        
    191                                 #else
    192 
    193                                         parameters->AddObject(new DoubleMatParam(QmuMassFluxSegmentsEnum,qmu_mass_flux_segments,tot_qmu_mass_flux_segments,5));
    194                                         parameters->AddObject(new DoubleVecParam(QmuMassFluxNumSegmentsEnum,qmu_mass_flux_num_segments,tot_qmu_mass_flux_num_segments));
    195 
    196                                 #endif
    197 
    198                                 xfree((void**)&qmu_mass_flux_segments);
    199                                 xfree((void**)&my_qmu_mass_flux_segments);
    200                                 xfree((void**)&qmu_mass_flux_num_segments);
    201                                 xfree((void**)&my_qmu_mass_flux_num_segments);
    202                         }
     167                       
     168                        if(strncmp(response_descriptor,"MassFlux",8)==0){
     169                                qmu_mass_flux_present=true;
     170                        }
     171
    203172                        if (strcmp(descriptor,"misfit")==0){
    204173
     
    210179                        }
    211180                }
    212 
    213                 /*Free data: */
     181               
     182               
     183                if(qmu_mass_flux_present){
     184                       
     185                        /*We need the segments to be able to compute the mass flux. We have as many groups of segments as we have MassFlux
     186                         *responses. Let's build a DoubleMatArrayParam object with the array of segments: */
     187                       
     188                        #ifdef _PARALLEL_
     189                        IoModelFetchData(&qmu_mass_flux_segments,&tot_qmu_mass_flux_segments,NULL,iomodel_handle,"qmu_mass_flux_segments");
     190                        IoModelFetchData(&qmu_mass_flux_num_segments,&tot_qmu_mass_flux_num_segments,NULL,iomodel_handle,"qmu_mass_flux_num_segments");
     191
     192
     193                        /*Only if partitioning exist do we care about the segments: */
     194                        if(iomodel->my_elements){
     195
     196                                /*Use the element partitioning vector from the iomodel to down select qmu_mass_flux_segments to only segments that are relevant
     197                                 * to this cpu: */
     198                                my_tot_qmu_mass_flux_segments=0;
     199                                for(j=0;j<tot_qmu_mass_flux_segments;j++){
     200                                        if (  iomodel->my_elements[(int)(*(qmu_mass_flux_segments+5*j+4))-1])my_tot_qmu_mass_flux_segments++;
     201                                }
     202
     203
     204                                if(my_tot_qmu_mass_flux_segments){
     205                                        my_qmu_mass_flux_segments=(double*)xcalloc(5*my_tot_qmu_mass_flux_segments,sizeof(double));
     206                                        second_count=0;
     207                                        for(j=0;j<tot_qmu_mass_flux_segments;j++){
     208                                                if (iomodel->my_elements[(int)*(qmu_mass_flux_segments+5*j+4)-1]){
     209                                                        for(k=0;k<5;k++)*(my_qmu_mass_flux_segments+5*second_count+k)=*(qmu_mass_flux_segments+5*j+k);
     210                                                        second_count++;
     211                                                }
     212                                        }
     213                                }
     214
     215                                parameters->AddObject(new DoubleMatParam(QmuMassFluxSegmentsEnum,my_qmu_mass_flux_segments,my_tot_qmu_mass_flux_segments,5));
     216
     217                        }
     218                                       
     219                        #else
     220                        IoModelFetchData(&qmu_mass_flux_segments,&tot_qmu_mass_flux_segments,NULL,iomodel_handle,"qmu_mass_flux_segments");
     221                        IoModelFetchData(&qmu_mass_flux_num_segments,&tot_qmu_mass_flux_num_segments,NULL,iomodel_handle,"qmu_mass_flux_num_segments");
     222
     223                        parameters->AddObject(new DoubleMatParam(QmuMassFluxSegmentsEnum,qmu_mass_flux_segments,tot_qmu_mass_flux_segments,5));
     224                        parameters->AddObject(new DoubleVecParam(QmuMassFluxNumSegmentsEnum,qmu_mass_flux_num_segments,tot_qmu_mass_flux_num_segments));
     225
     226                        #endif
     227
     228                        xfree((void**)&qmu_mass_flux_segments);
     229                        xfree((void**)&my_qmu_mass_flux_segments);
     230                        xfree((void**)&qmu_mass_flux_num_segments);
     231                        xfree((void**)&my_qmu_mass_flux_num_segments);
     232                }
     233                /*}}}*/
     234
     235                /*Free data: {{{1*/
    214236                xfree((void**)&tag);
    215237                for(i=0;i<iomodel->numberofresponses;i++){
     
    232254                xfree((void**)&qmuerrname);
    233255                xfree((void**)&qmuoutname);
    234         }
     256                /*}}}*/
     257        } //if(iomodel->qmu_analysis)
    235258
    236259        /*Assign output pointer: */
  • issm/trunk/src/c/objects/Params/BoolParam.h

    r4248 r4852  
    6060                void  GetParameterValue(double** pdoublearray,int* pM){ISSMERROR("Bool param of enum %i (%s) cannot return a double array",enum_type,EnumAsString(enum_type));}
    6161                void  GetParameterValue(double** pdoublearray,int* pM, int* pN){ISSMERROR("Bool param of enum %i (%s) cannot return a double array",enum_type,EnumAsString(enum_type));}
     62                void  GetParameterValue(double*** parray, int* pM,int** pmdims, int** pndims){ISSMERROR("Bool param of enum %i (%s) cannot return a matrix array",enum_type,EnumAsString(enum_type));}
    6263                void  GetParameterValue(Vec* pvec){ISSMERROR("Bool param of enum %i (%s) cannot return a Vec",enum_type,EnumAsString(enum_type));}
    6364                void  GetParameterValue(Mat* pmat){ISSMERROR("Bool param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));}
     
    7273                void  SetValue(Vec vec){ISSMERROR("Bool param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));}
    7374                void  SetValue(Mat mat){ISSMERROR("Bool param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));}
     75                void  SetValue(double** array, int M, int* mdim_array, int* ndim_array){ISSMERROR("Bool param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumAsString(enum_type));}
     76
    7477               
    7578                char* GetParameterName(void);
  • issm/trunk/src/c/objects/Params/DoubleMatParam.h

    r4248 r4852  
    3131
    3232        private:
    33                 /*just hold 3 values for 3 vertices: */
    3433                int enum_type;
    35                 IssmDouble* value;
     34                double* value;
    3635                int M;
    3736                int N;
     
    6362                void  GetParameterValue(double** pdoublearray,int* pM){ISSMERROR("DoubleMat param of enum %i (%s) cannot return a double array",enum_type,EnumAsString(enum_type));}
    6463                void  GetParameterValue(double** pdoublearray,int* pM,int* pN);
     64                void  GetParameterValue(double*** parray, int* pM,int** pmdims, int** pndims){ISSMERROR("DoubleMat param of enum %i (%s) cannot return a matrix array",enum_type,EnumAsString(enum_type));}
    6565                void  GetParameterValue(Vec* pvec){ISSMERROR("DoubleMat param of enum %i (%s) cannot return a Vec",enum_type,EnumAsString(enum_type));}
    6666                void  GetParameterValue(Mat* pmat){ISSMERROR("DoubleMat param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));}
     
    7575                void  SetValue(Vec vec){ISSMERROR("DoubleMat param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));}
    7676                void  SetValue(Mat mat){ISSMERROR("DoubleMat param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));}
     77                void  SetValue(double** array, int M, int* mdim_array, int* ndim_array){ISSMERROR("DoubleMat param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumAsString(enum_type));}
    7778
    7879                char* GetParameterName(void);
  • issm/trunk/src/c/objects/Params/DoubleParam.h

    r4248 r4852  
    6161                void  GetParameterValue(double** pdoublearray,int* pM){ISSMERROR("Double param of enum %i (%s) cannot return a double array",enum_type,EnumAsString(enum_type));}
    6262                void  GetParameterValue(double** pdoublearray,int* pM, int* pN){ISSMERROR("Double param of enum %i (%s) cannot return a double array",enum_type,EnumAsString(enum_type));}
     63                void  GetParameterValue(double*** parray, int* pM,int** pmdims, int** pndims){ISSMERROR("Double param of enum %i (%s) cannot return a matrix array",enum_type,EnumAsString(enum_type));}
    6364                void  GetParameterValue(Vec* pvec){ISSMERROR("Double param of enum %i (%s) cannot return a Vec",enum_type,EnumAsString(enum_type));}
    6465                void  GetParameterValue(Mat* pmat){ISSMERROR("Double param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));}
     
    7374                void  SetValue(Vec vec){ISSMERROR("Double param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));}
    7475                void  SetValue(Mat mat){ISSMERROR("Double param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));}
     76                void  SetValue(double** array, int M, int* mdim_array, int* ndim_array){ISSMERROR("Double param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumAsString(enum_type));}
    7577
    7678                char* GetParameterName(void);
  • issm/trunk/src/c/objects/Params/DoubleVecParam.h

    r4248 r4852  
    6161                void  GetParameterValue(double** pdoublearray,int* pM);
    6262                void  GetParameterValue(double** pdoublearray,int* pM, int* pN){ISSMERROR("DoubleVec param of enum %i (%s) cannot return a double array",enum_type,EnumAsString(enum_type));}
     63                void  GetParameterValue(double*** parray, int* pM,int** pmdims, int** pndims){ISSMERROR("DoubleVec param of enum %i (%s) cannot return a matrix array",enum_type,EnumAsString(enum_type));}
    6364                void  GetParameterValue(Vec* pvec){ISSMERROR("DoubleVec param of enum %i (%s) cannot return a Vec",enum_type,EnumAsString(enum_type));}
    6465                void  GetParameterValue(Mat* pmat){ISSMERROR("DoubleVec param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));}
     
    7374                void  SetValue(Vec vec){ISSMERROR("DoubleVec param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));}
    7475                void  SetValue(Mat mat){ISSMERROR("DoubleVec param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));}
     76                void  SetValue(double** array, int M, int* mdim_array, int* ndim_array){ISSMERROR("DoubleVec param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumAsString(enum_type));}
    7577               
    7678                char* GetParameterName(void);
  • issm/trunk/src/c/objects/Params/IntParam.h

    r4248 r4852  
    6060                void  GetParameterValue(double** pdoublearray,int* pM){ISSMERROR("Int param of enum %i (%s) cannot return a double array",enum_type,EnumAsString(enum_type));}
    6161                void  GetParameterValue(double** pdoublearray,int* pM, int* pN){ISSMERROR("Int param of enum %i (%s) cannot return a double array",enum_type,EnumAsString(enum_type));}
     62                void  GetParameterValue(double*** parray, int* pM,int** pmdims, int** pndims){ISSMERROR("Int param of enum %i (%s) cannot return a matrix array",enum_type,EnumAsString(enum_type));}
    6263                void  GetParameterValue(Vec* pvec){ISSMERROR("Int param of enum %i (%s) cannot return a Vec",enum_type,EnumAsString(enum_type));}
    6364                void  GetParameterValue(Mat* pmat){ISSMERROR("Int param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));}
     
    7273                void  SetValue(Vec vec){ISSMERROR("Int param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));}
    7374                void  SetValue(Mat mat){ISSMERROR("Int param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));}
     75                void  SetValue(double** array, int M, int* mdim_array, int* ndim_array){ISSMERROR("Int param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumAsString(enum_type));}
    7476
    7577                char* GetParameterName(void);
  • issm/trunk/src/c/objects/Params/Param.h

    r4248 r4852  
    3939                virtual void  GetParameterValue(double** pdoublearray,int* pM)=0;
    4040                virtual void  GetParameterValue(double** pdoublearray,int* pM,int* pN)=0;
     41                virtual void  GetParameterValue(double*** parray, int* pM,int** pmdims, int** pndims)=0;
    4142                virtual void  GetParameterValue(Vec* pvec)=0;
    4243                virtual void  GetParameterValue(Mat* pmat)=0;
     
    5152                virtual void  SetValue(Vec vec)=0;
    5253                virtual void  SetValue(Mat mat)=0;
     54                virtual void  SetValue(double** array, int M, int* mdim_array, int* ndim_array)=0;
    5355
    5456                virtual char* GetParameterName(void)=0;
  • issm/trunk/src/c/objects/Params/PetscMatParam.h

    r4248 r4852  
    6161                void  GetParameterValue(double** pdoublearray,int* pM){ISSMERROR("PetscMat param of enum %i (%s) cannot return a double array",enum_type,EnumAsString(enum_type));}
    6262                void  GetParameterValue(double** pdoublearray,int* pM, int* pN){ISSMERROR("PetscMat param of enum %i (%s) cannot return a double array",enum_type,EnumAsString(enum_type));}
     63                void  GetParameterValue(double*** parray, int* pM,int** pmdims, int** pndims){ISSMERROR("PetscMat param of enum %i (%s) cannot return a matrix array",enum_type,EnumAsString(enum_type));}
    6364                void  GetParameterValue(Vec* pvec){ISSMERROR("PetscMat param of enum %i (%s) cannot return a vec",enum_type,EnumAsString(enum_type));}
    6465                void  GetParameterValue(Mat* poutput);
     
    7374                void  SetValue(Vec vec){ISSMERROR("PetscMat param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));}
    7475                void  SetValue(Mat mat);
     76                void  SetValue(double** array, int M, int* mdim_array, int* ndim_array){ISSMERROR("PetscMat param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumAsString(enum_type));}
    7577
    7678                char* GetParameterName(void);
  • issm/trunk/src/c/objects/Params/PetscVecParam.h

    r4248 r4852  
    6161                void  GetParameterValue(double** pdoublearray,int* pM){ISSMERROR("PetscVec param of enum %i (%s) cannot return a double array",enum_type,EnumAsString(enum_type));}
    6262                void  GetParameterValue(double** pdoublearray,int* pM, int* pN){ISSMERROR("PetscVec param of enum %i (%s) cannot return a double array",enum_type,EnumAsString(enum_type));}
     63                void  GetParameterValue(double*** parray, int* pM,int** pmdims, int** pndims){ISSMERROR("PetscVec param of enum %i (%s) cannot return a matrix array",enum_type,EnumAsString(enum_type));}
    6364                void  GetParameterValue(Mat* pmat){ISSMERROR("PetscVec param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));}
    6465                void  GetParameterValue(Vec* poutput);
    6566
    66                 void  SetValue(bool boolean){ISSMERROR("Bool param of enum %i (%s) cannot hold a boolean",enum_type,EnumAsString(enum_type));}
    67                 void  SetValue(int integer){ISSMERROR("Bool param of enum %i (%s) cannot hold an integer",enum_type,EnumAsString(enum_type));}
    68                 void  SetValue(double scalar){ISSMERROR("Bool param of enum %i (%s) cannot hold a scalar",enum_type,EnumAsString(enum_type));}
    69                 void  SetValue(char* string){ISSMERROR("Bool param of enum %i (%s) cannot hold a string",enum_type,EnumAsString(enum_type));}
    70                 void  SetValue(char** stringarray,int M){ISSMERROR("Bool param of enum %i (%s) cannot hold a string array",enum_type,EnumAsString(enum_type));}
    71                 void  SetValue(double* doublearray,int M){ISSMERROR("Bool param of enum %i (%s) cannot hold a double array",enum_type,EnumAsString(enum_type));}
    72                 void  SetValue(double* pdoublearray,int M,int N){ISSMERROR("Bool param of enum %i (%s) cannot hold a double array",enum_type,EnumAsString(enum_type));}
     67                void  SetValue(bool boolean){ISSMERROR("PetscVec param of enum %i (%s) cannot hold a boolean",enum_type,EnumAsString(enum_type));}
     68                void  SetValue(int integer){ISSMERROR("PetscVec param of enum %i (%s) cannot hold an integer",enum_type,EnumAsString(enum_type));}
     69                void  SetValue(double scalar){ISSMERROR("PetscVec param of enum %i (%s) cannot hold a scalar",enum_type,EnumAsString(enum_type));}
     70                void  SetValue(char* string){ISSMERROR("PetscVec param of enum %i (%s) cannot hold a string",enum_type,EnumAsString(enum_type));}
     71                void  SetValue(char** stringarray,int M){ISSMERROR("PetscVec param of enum %i (%s) cannot hold a string array",enum_type,EnumAsString(enum_type));}
     72                void  SetValue(double* doublearray,int M){ISSMERROR("PetscVec param of enum %i (%s) cannot hold a double array",enum_type,EnumAsString(enum_type));}
     73                void  SetValue(double* pdoublearray,int M,int N){ISSMERROR("PetscVec param of enum %i (%s) cannot hold a double array",enum_type,EnumAsString(enum_type));}
    7374                void  SetValue(Vec vec);
    74                 void  SetValue(Mat mat){ISSMERROR("Bool param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));}
     75                void  SetValue(Mat mat){ISSMERROR("PetscVec param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));}
     76                void  SetValue(double** array, int M, int* mdim_array, int* ndim_array){ISSMERROR("PetscVec param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumAsString(enum_type));}
    7577
    7678                char* GetParameterName(void);
  • issm/trunk/src/c/objects/Params/StringArrayParam.h

    r4248 r4852  
    6363                void  GetParameterValue(double** pdoublearray,int* pM){ISSMERROR("StringArray param of enum %i (%s) cannot return a double array",enum_type,EnumAsString(enum_type));}
    6464                void  GetParameterValue(double** pdoublearray,int* pM, int* pN){ISSMERROR("StringArray param of enum %i (%s) cannot return a double array",enum_type,EnumAsString(enum_type));}
     65                void  GetParameterValue(double*** parray, int* pM,int** pmdims, int** pndims){ISSMERROR("Vec param of enum %i (%s) cannot return a matrix array",enum_type,EnumAsString(enum_type));}
    6566                void  GetParameterValue(Vec* pvec){ISSMERROR("StringArray param of enum %i (%s) cannot return a Vec",enum_type,EnumAsString(enum_type));}
    6667                void  GetParameterValue(Mat* pmat){ISSMERROR("StringArray param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));}
     
    7576                void  SetValue(Vec vec){ISSMERROR("StringArray param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));}
    7677                void  SetValue(Mat mat){ISSMERROR("StringArray param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));}
     78                void  SetValue(double** array, int M, int* mdim_array, int* ndim_array){ISSMERROR("StringArray param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumAsString(enum_type));}
    7779
    7880                char* GetParameterName(void);
  • issm/trunk/src/c/objects/Params/StringParam.h

    r4248 r4852  
    6161                void  GetParameterValue(double** pdoublearray,int* pM){ISSMERROR("String param of enum %i (%s) cannot return a double array",enum_type,EnumAsString(enum_type));}
    6262                void  GetParameterValue(double** pdoublearray,int* pM, int* pN){ISSMERROR("String param of enum %i (%s) cannot return a double array",enum_type,EnumAsString(enum_type));}
     63                void  GetParameterValue(double*** parray, int* pM,int** pmdims, int** pndims){ISSMERROR("String param of enum %i (%s) cannot return a matrix array",enum_type,EnumAsString(enum_type));}
    6364                void  GetParameterValue(Vec* pvec){ISSMERROR("String param of enum %i (%s) cannot return a Vec",enum_type,EnumAsString(enum_type));}
    6465                void  GetParameterValue(Mat* pmat){ISSMERROR("String param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));}
     
    7374                void  SetValue(Vec vec){ISSMERROR("String param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));}
    7475                void  SetValue(Mat mat){ISSMERROR("String param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));}
     76                void  SetValue(double** array, int M, int* mdim_array, int* ndim_array){ISSMERROR("String param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumAsString(enum_type));}
    7577
    7678                char* GetParameterName(void);
  • issm/trunk/src/m/qmu/process_qmu_response_data.m

    r4791 r4852  
    1010process_mass_flux_profiles=0;
    1111
     12num_mass_flux=0;
    1213
    1314%loop through response descriptors, and act accordingly
     
    1617        %Do we have to process  mass flux profiles?
    1718        if strncmpi(md.responsedescriptors{i},'MassFlux',8),
     19                num_mass_flux=num_mass_flux+1;
    1820                process_mass_flux_profiles=1;
    1921        end
     
    3739        end
    3840
     41        if num_mass_flux~=numel(md.qmu_mass_flux_profiles),
     42                error('process_qmu_response_data error message: qmu_mass_flux_profiles should be of the same size as the number of MassFlux responses asked for in the Qmu analysis');
     43        end
     44
    3945        %ok, process the domains named in qmu_mass_flux_profiles,  to build a list of segments
    40         md.qmu_mass_flux_segments=cell(numel(md.qmu_mass_flux_profiles),1);
     46        md.qmu_mass_flux_segments=cell(num_mass_flux,1);
    4147
    42         for i=1:numel(md.qmu_mass_flux_profiles),
    43                 md.qmu_mass_flux_segments{i}=MassFluxProcessProfile(md,md.qmu_mass_flux_profile_directory,md.qmu_mass_flux_profiles{i});
     48        for i=1:num_mass_flux,
     49                md.qmu_mass_flux_segments{i}=MeshProfileIntersection(md.elements,md.x,md.y,[md.qmu_mass_flux_profile_directory/md.qmu_mass_flux_profiles{i}]);
    4450        end
     51
     52        %finally, set qmu_mass_flux_num_profiles, for future marshalling
     53        md.qmu_mass_flux_num_profiles=num_mass_flux;
    4554end
  • issm/trunk/src/m/qmu/qmumarshall.m

    r2110 r4852  
    7070
    7171%write response specific data
     72qmu_segments=0;
    7273count=0;
    7374for i=1:length(response_fieldnames),
     
    7677        for j=1:length(fieldresponses),
    7778                descriptor=fieldresponses(j).descriptor;
    78                 if strcmpi(descriptor,'mass_flux'),
    79                         WriteData(fid,md.qmu_mass_flux_segments,'Mat','qmu_mass_flux_segments');
     79                if strncmpi(descriptor,'MassFlux',8),
     80                        qmu_segments=1;
    8081                end
     82        end
     83end
     84                       
     85if qmu_segments,
     86        WriteData(fid,md.qmu_mass_flux_num_profiles,'Integer','qmu_mass_flux_num_profiles');
     87        for i=1:md.qmu_mass_flux_num_profiles,
     88                WriteData(fid,md.qmu_mass_flux_segments{i},'Mat',['qmu_mass_flux_segments' num2str(i)]);
    8189        end
    8290end
Note: See TracChangeset for help on using the changeset viewer.