Changeset 5250


Ignore:
Timestamp:
08/13/10 14:54:02 (15 years ago)
Author:
Eric.Larour
Message:

New Response module, to centralize all response management.
Now used by DakotaResponsesx. Will be used by CostFunctionx.
Corrected parametercontrolB for new naming conventions.

Location:
issm/trunk/src
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/Makefile.am

    r5247 r5250  
    525525                                        ./modules/PenaltySystemMatricesx/PenaltySystemMatricesx.cpp\
    526526                                        ./modules/PenaltySystemMatricesx/PenaltySystemMatricesx.h\
     527                                        ./modules/Responsex/Responsex.h\
     528                                        ./modules/Responsex/Responsex.cpp\
    527529                                        ./modules/Scotchx/Scotchx.cpp\
    528530                                        ./modules/Scotchx/Scotchx.h\
     
    10521054                                        ./modules/PenaltySystemMatricesx/PenaltySystemMatricesx.cpp\
    10531055                                        ./modules/PenaltySystemMatricesx/PenaltySystemMatricesx.h\
     1056                                        ./modules/Responsex/Responsex.h\
     1057                                        ./modules/Responsex/Responsex.cpp\
    10541058                                        ./modules/Solverx/Solverx.cpp\
    10551059                                        ./modules/Solverx/Solverx.h\
  • issm/trunk/src/c/modules/DakotaResponsesx/DakotaResponsesx.cpp

    r4974 r5250  
    3535
    3636                /*Compute response for this response_descriptor:*/
    37 
    38                 if(strcmp(response_descriptor,"MinVel")==0){
    39                         MinVelx( &femmodel_response, elements,nodes, vertices, loads, materials, parameters,process_units);
    40                 }
    41                 else if(strcmp(response_descriptor,"MaxVel")==0){
    42                         MaxVelx( &femmodel_response, elements,nodes, vertices, loads, materials, parameters,process_units);
    43                 }
    44                 else if(strcmp(response_descriptor,"MinVx")==0){
    45                         MinVxx( &femmodel_response, elements,nodes, vertices, loads, materials, parameters,process_units);
    46                 }
    47                 else if(strcmp(response_descriptor,"MaxVx")==0){
    48                         MaxVxx( &femmodel_response, elements,nodes, vertices, loads, materials, parameters,process_units);
    49                 }
    50                 else if(strcmp(response_descriptor,"MaxAbsVx")==0){
    51                         MaxAbsVxx( &femmodel_response, elements,nodes, vertices, loads, materials, parameters,process_units);
    52                 }
    53                 else if(strcmp(response_descriptor,"MinVy")==0){
    54                         MinVyx( &femmodel_response, elements,nodes, vertices, loads, materials, parameters,process_units);
    55                 }
    56                 else if(strcmp(response_descriptor,"MaxVy")==0){
    57                         MaxVyx( &femmodel_response, elements,nodes, vertices, loads, materials, parameters,process_units);
    58                 }
    59                 else if(strcmp(response_descriptor,"MaxAbsVy")==0){
    60                         MaxAbsVyx( &femmodel_response, elements,nodes, vertices, loads, materials, parameters,process_units);
    61                 }
    62                 else if(strcmp(response_descriptor,"MinVz")==0){
    63                         MinVzx( &femmodel_response, elements,nodes, vertices, loads, materials, parameters,process_units);
    64                 }
    65                 else if(strcmp(response_descriptor,"MaxVz")==0){
    66                         MaxVzx( &femmodel_response, elements,nodes, vertices, loads, materials, parameters,process_units);
    67                 }
    68                 else if(strcmp(response_descriptor,"MaxAbsVz")==0){
    69                         MaxAbsVzx( &femmodel_response, elements,nodes, vertices, loads, materials, parameters,process_units);
    70                 }
    71                 else if(strcmp(response_descriptor,"Misfit")==0){
    72                         Misfitx( &femmodel_response, elements,nodes, vertices, loads, materials, parameters,process_units);
    73                 }
    74                 else if(strlen(response_descriptor)>=8){
    75                         if(strncmp(response_descriptor,"MassFlux",8)==0){
    76 
    77                                 /*Deal with several mass flux computations: {{{1*/
    78                                 double** array=NULL;
    79                                 int      M;
    80                                 int*     mdims_array=NULL;
    81                                 int*     ndims_array=NULL;
    82 
    83                                 double*  segments=NULL;
    84                                 int      num_segments;
    85 
    86                                 /*retrieve qmu_mass_flux_segments: */
    87                                 parameters->FindParam(&array,&M,&mdims_array,&ndims_array,QmuMassFluxSegmentsEnum);
    88        
    89                                 /*figure out counter after MassFlux: */
    90                                 sscanf(response_descriptor,"MassFlux%i",&counter);
    91 
    92                                 /*retrieve segments from array: */
    93                                 segments=array[counter-1]; //matlab to "C" indexing
    94                                 num_segments=mdims_array[counter-1];
    95 
    96                                 /*call mass flux module: */
    97                                 MassFluxx(&femmodel_response,elements,nodes,vertices,loads,materials,parameters,segments,num_segments,process_units);
    98 
    99                                 /*Free ressources:*/
    100                                 for(j=0;j<M;j++){
    101                                         double* matrix=array[j];
    102                                         xfree((void**)&matrix);
    103                                 }
    104                                 xfree((void**)&mdims_array);
    105                                 xfree((void**)&ndims_array);
    106                                 xfree((void**)&array);
    107                                 /*}}}*/
    108                         }
    109                 }
    110                 else{
    111                         ISSMERROR("%s%s%s"," response descriptor : ",response_descriptor," not supported yet!");
    112                 }
     37                Responsex(&femmodel_response,elements,nodes, vertices,loads,materials, parameters,response_descriptor,process_units);
    11338
    11439                #ifdef _DEBUG_
  • issm/trunk/src/c/modules/MassFluxx/MassFluxx.cpp

    r4974 r5250  
    1010#include "../../EnumDefinitions/EnumDefinitions.h"
    1111
    12 void MassFluxx(double* pmass_flux, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,  double* segments,int num_segments,bool process_units){
     12void MassFluxx(double* pmass_flux, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,char* descriptor,bool process_units){
    1313
    1414        int i,j;
     
    2323        double all_mass_flux=0;
    2424
     25        int  counter;
     26
     27        /*all segments: */
     28        double** array=NULL;
     29        int      M;
     30        int*     mdims_array=NULL;
     31        int*     ndims_array=NULL;
     32
     33        /*our segments of interest: */
     34        double*  segments=NULL;
     35        int      num_segments;
     36
     37        /*First, figure out which segment to compute our mass flux on. Start with retrieving qmu_mass_flux_segments: */
     38        parameters->FindParam(&array,&M,&mdims_array,&ndims_array,QmuMassFluxSegmentsEnum);
     39
     40        /*figure out counter in the descriptor: */
     41        sscanf(descriptor,"MassFlux%i",&counter);
     42
     43        /*retrieve segments from array: */
     44        segments=array[counter-1]; //matlab to "C" indexing
     45        num_segments=mdims_array[counter-1];
     46
    2547        /*Go through segments, and then elements, and figure out which elements belong to a segment.
    2648         * When we find one, use the element to compute the mass flux on the segment: */
    27 
    2849        for(i=0;i<num_segments;i++){
    2950                element_id=(int)*(segments+5*i+4);
     
    4364        #endif
    4465
     66        /*Free ressources:*/
     67        for(j=0;j<M;j++){
     68                double* matrix=array[j];
     69                xfree((void**)&matrix);
     70        }
     71        xfree((void**)&mdims_array);
     72        xfree((void**)&ndims_array);
     73        xfree((void**)&array);
     74
    4575        /*Assign output pointers: */
    4676        *pmass_flux=mass_flux;
  • issm/trunk/src/c/modules/MassFluxx/MassFluxx.h

    r4974 r5250  
    1010
    1111/* local prototypes: */
    12 void MassFluxx(double* pmass_flux, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,double* segments,int num_segments,bool process_units);
     12void MassFluxx(double* pmass_flux, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,char* descriptor,bool process_units);
    1313
    1414
  • issm/trunk/src/c/modules/modules.h

    r5057 r5250  
    7070#include "./Reducevectorgtosx/Reducevectorgtosx.h"
    7171#include "./Reducevectorgtofx/Reducevectorgtofx.h"
     72#include "./Responsex/Responsex.h"
    7273#include "./Scotchx/Scotchx.h"
    7374#include "./Solverx/Solverx.h"
  • issm/trunk/src/m/classes/public/parameterization/parametercontrolB.m

    r3337 r5250  
    2222
    2323%control type
    24 md.control_type='B';
     24md.control_type='rheology_B';
    2525
    2626%weights
Note: See TracChangeset for help on using the changeset viewer.