Changeset 5474


Ignore:
Timestamp:
08/23/10 00:26:02 (15 years ago)
Author:
Eric.Larour
Message:

We now have a different number of responses and responses descriptors. Same thing
for variables. Makes processing of Qmu inputs a lot simpler.
Had to adapt InputUpdateFromDakotax to this new scenario. We now have DescriptorIndex
that tells us whether a variable is scaled, indexed, nodal or regular.

File:
1 edited

Legend:

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

    r5330 r5474  
    2525        double* parameter_serial=NULL;
    2626        char*   descriptor=NULL;
    27         char*   root=NULL; //root name of distributed variable, ex: thickness, drag, etc ...
     27        char    root[50]; //root name of variable, ex: DragCoefficent, RhoIce, etc ...
    2828        double* partition=NULL; //serial version of vec_partition
    2929
     
    4848                descriptor=variables_descriptors[i];
    4949
    50                 /*From descriptor, figure out if the variable is distributed (distributed implies there is a numeric value at the
    51                  * end of the descriptor, for ex: thickness1, thickness10, etc .... If it is distributed, the next qmu_npart (number
    52                  * of partitions in the distributed variable) variable are the values for each partition of the distributed variable: */
    53                 if (!isdistributed(&root,descriptor)){
     50                /*From descriptor, figure out if the variable is scaled, indexed, nodal, or just a simple variable: */
     51                if (strncmp(descriptor,"scaled_",7)==0){
    5452                       
    55                         /*Ok, variable is not distributed, just update inputs using the variable: */
    56                         InputUpdateFromConstantx( elements,nodes, vertices,loads, materials,  parameters, variables[i],StringToEnum(descriptor));
    57 
    58                 }
    59                 else{
    60 
    61                         /*Ok, variable is distributed. Root name of variable is also known. Now, allocate distributed_values and fill the
     53                        /*Variable is scaled. Determine root name of variable (ex: scaled_DragCoefficient_1 -> DragCoefficient). Allocate distributed_values and fill the
    6254                         * distributed_values with the next qmu_npart variables: */
     55                       
     56                        strcpy(root,strstr(descriptor,"_")+1); *strstr(root,"_")='\0';
    6357
    6458                        distributed_values=(double*)xmalloc(qmu_npart*sizeof(double));
     
    6761                        }
    6862
    69                
    7063                        /*Now, pick up the parameter corresponding to root: */
    7164                        if(!parameters->FindParam(&parameter_serial,NULL,StringToEnum(root))){
     
    10497                        xfree((void**)&parameter_serial);
    10598                        xfree((void**)&distributed_values);
    106 
    10799                }
    108                 xfree((void**)&root);
     100                else if (strncmp(descriptor,"indexed_",8)==0){
     101                        ISSMERROR(" indexed variables not supported yet!");
     102                }
     103                else if (strncmp(descriptor,"nodal_",8)==0){
     104                        ISSMERROR(" nodal variables not supported yet!");
     105                }
     106                else{
     107                        /*Ok, standard variable, just update inputs using the variable: */
     108                        InputUpdateFromConstantx( elements,nodes, vertices,loads, materials,  parameters, variables[i],StringToEnum(descriptor));
     109                }
    109110        }
    110111
Note: See TracChangeset for help on using the changeset viewer.