Changeset 4854


Ignore:
Timestamp:
07/28/10 18:36:07 (15 years ago)
Author:
Eric.Larour
Message:

New processing of qmu segments in ModelProcessor

Location:
issm/trunk/src
Files:
4 edited

Legend:

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

    r4853 r4854  
    2727        char**  variabledescriptors=NULL;
    2828        char*   descriptor=NULL;
    29         char*   tag=NULL;
    3029        double* dakota_parameter=NULL;
    3130
     
    3534        char* qmuoutname=NULL;
    3635        extern int my_rank;
    37                                
     36       
     37        //tags
     38        char variabledescriptors_tag[30]; //strlen("variabledescriptor"+number)+1
     39        char responsedescriptors_tag[30]; //strlen("responsedescriptors"+number)+1
     40        char massflux_tag[35];            //strlen("qmu_mass_flux_segments"+number)+1
    3841       
    3942        /*parameters for mass flux: */
    4043        bool     qmu_mass_flux_present=false;
    41         double* qmu_mass_flux_segments=NULL;
    42         double* my_qmu_mass_flux_segments=NULL;
    43         double* qmu_mass_flux_num_segments=NULL;
    44         double* my_qmu_mass_flux_num_segments=NULL;
    45         int tot_qmu_mass_flux_segments=0;
    46         int my_tot_qmu_mass_flux_segments=0;
    47         int tot_qmu_mass_flux_num_segments=0;
    48         int my_tot_qmu_mass_flux_num_segments=0;
     44        double** array=NULL;
     45        double*  matrix=NULL;
     46        int*     mdims_array=NULL;
     47        int*     ndims_array=NULL;
     48        int      M;
    4949
    5050        #ifdef _SERIAL_
     
    9090                }
    9191                #else
    92                 tag=(char*)xmalloc((strlen("variabledescriptori")+1)*sizeof(char));
    93                 for(i=0;i<iomodel->numberofvariables;i++){
    94                         sprintf(tag,"%s%i","variabledescriptor",i);
    95                         IoModelFetchData(&descriptor,iomodel_handle,tag);
     92                for(i=0;i<iomodel->numberofvariables;i++){
     93                        sprintf(variabledescriptors_tag,"%s%i","variabledescriptor",i);
     94                        IoModelFetchData(&descriptor,iomodel_handle,variabledescriptors_tag);
    9695                        variabledescriptors[i]=descriptor;
    9796                }
     
    115114                }
    116115                #else
    117                 xfree((void**)&tag);
    118                 tag=(char*)xmalloc((strlen("responsedescriptori")+1)*sizeof(char));
    119 
    120                 for(i=0;i<iomodel->numberofresponses;i++){
    121                         sprintf(tag,"%s%i","responsedescriptor",i);
    122                         IoModelFetchData(&descriptor,iomodel_handle,tag);
     116                for(i=0;i<iomodel->numberofresponses;i++){
     117                        sprintf(responsedescriptors_tag,"%s%i","responsedescriptor",i);
     118                        IoModelFetchData(&descriptor,iomodel_handle,responsedescriptors_tag);
    123119                        responsedescriptors[i]=descriptor;
    124120                }
     
    186182                         *responses. Let's build a DoubleMatArrayParam object with the array of segments: */
    187183                       
     184                        if(iomodel->qmu_mass_flux_num_profiles==0)ISSMERROR(" qmu_mass_flux_num_profiles is 0, when MassFlux computations were requested!");
     185                        array=(double**)xmalloc(iomodel->qmu_mass_flux_num_profiles*sizeof(double*));
     186                        mdims_array=(int*)xmalloc(iomodel->qmu_mass_flux_num_profiles*sizeof(int));
     187                        ndims_array=(int*)xmalloc(iomodel->qmu_mass_flux_num_profiles*sizeof(int));
     188                        M=iomodel->qmu_mass_flux_num_profiles;
     189
     190                        #ifdef _SERIAL_
     191                        pfield=mxGetField(iomodel_handle,0,"qmu_mass_flux_segments");
     192                        for(i=0;i<iomodel->qmu_mass_flux_num_profiles;i++){
     193                                pfield2=mxGetCell(pfield,i);
     194                                FetchData(&matrix,mdims_array+i,ndims_array+i,pfield2);
     195                                array[i]=matrix;
     196                        }
     197                        #else
     198                        for(i=0;i<iomodel->qmu_mass_flux_num_profiles;i++){
     199                                sprintf(massflux_tag,"%s%i","qmu_mass_flux_segmentsi",i);
     200                                IoModelFetchData(&tot_matrix,tot_mdims_array+i,NULL,iomodel_handle,"qmu_mass_flux_segments");
     201                                variabledescriptors[i]=descriptor;
     202                        }
     203                        #endif
     204
    188205                        #ifdef _PARALLEL_
    189206                        IoModelFetchData(&qmu_mass_flux_segments,&tot_qmu_mass_flux_segments,NULL,iomodel_handle,"qmu_mass_flux_segments");
     
    234251
    235252                /*Free data: {{{1*/
    236                 xfree((void**)&tag);
    237253                for(i=0;i<iomodel->numberofresponses;i++){
    238254                        char* descriptor=responsedescriptors[i];
  • issm/trunk/src/c/objects/IoModel.cpp

    r4739 r4854  
    216216                IoModelFetchData(&this->numberofresponses,iomodel_handle,"numberofresponses");
    217217                IoModelFetchData(&this->qmu_npart,iomodel_handle,"npart");
     218                IoModelFetchData(&this->qmu_mass_flux_num_profiles,iomodel_handle,"qmu_mass_flux_num_profiles");
    218219        }
    219220       
  • issm/trunk/src/c/objects/IoModel.h

    r4739 r4854  
    179179                int      numoutput;
    180180
     181                /*qmu: */
     182                int      qmu_mass_flux_num_profiles;
     183
    181184                /*exterior partitioning data, to be carried around: */
    182185                bool*   my_elements;
  • issm/trunk/src/m/qmu/qmumarshall.m

    r4852 r4854  
    8888                WriteData(fid,md.qmu_mass_flux_segments{i},'Mat',['qmu_mass_flux_segments' num2str(i)]);
    8989        end
     90else
     91        md.qmu_mass_flux_num_profiles=0;
     92        WriteData(fid,md.qmu_mass_flux_num_profiles,'Integer','qmu_mass_flux_num_profiles');
    9093end
     94
    9195
    9296%write part and npart to disk
Note: See TracChangeset for help on using the changeset viewer.