Changeset 5474
- Timestamp:
- 08/23/10 00:26:02 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp
r5330 r5474 25 25 double* parameter_serial=NULL; 26 26 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 ... 28 28 double* partition=NULL; //serial version of vec_partition 29 29 … … 48 48 descriptor=variables_descriptors[i]; 49 49 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){ 54 52 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 62 54 * distributed_values with the next qmu_npart variables: */ 55 56 strcpy(root,strstr(descriptor,"_")+1); *strstr(root,"_")='\0'; 63 57 64 58 distributed_values=(double*)xmalloc(qmu_npart*sizeof(double)); … … 67 61 } 68 62 69 70 63 /*Now, pick up the parameter corresponding to root: */ 71 64 if(!parameters->FindParam(¶meter_serial,NULL,StringToEnum(root))){ … … 104 97 xfree((void**)¶meter_serial); 105 98 xfree((void**)&distributed_values); 106 107 99 } 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 } 109 110 } 110 111
Note:
See TracChangeset
for help on using the changeset viewer.