Changeset 4042


Ignore:
Timestamp:
06/14/10 08:25:32 (15 years ago)
Author:
Eric.Larour
Message:

Revamping the Qmu module

Location:
issm/trunk/src/c
Files:
6 added
48 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/DataSet/Inputs.cpp

    r3956 r4042  
    543543                }
    544544        }
    545         ISSMERROR("input with enum %i (%s) not found",enum_name,EnumAsString(enum_name));
     545        return NULL;
    546546}
    547547/*}}}*/
  • issm/trunk/src/c/DataSet/Results.cpp

    r4037 r4042  
    6262
    6363                /*Add result to new results*/
    64                 newresults->AddObject(resultout);
     64                newresults->AddObject((Object*)resultout);
    6565        }
    6666
     
    8888
    8989                /*Add result to new results*/
    90                 newresults->AddObject(resultout);
     90                newresults->AddObject((Object*)resultout);
    9191        }
    9292
     
    114114
    115115                /*Add result to new results*/
    116                 newresults->AddObject(resultout);
     116                newresults->AddObject((Object*)resultout);
    117117        }
    118118
  • issm/trunk/src/c/Makefile.am

    r4039 r4042  
    329329                                        ./modules/ModelProcessorx/SlopeCompute/UpdateElementsSlopeCompute.cpp\
    330330                                        ./modules/ModelProcessorx/SlopeCompute/CreateNodesSlopeCompute.cpp \
    331                                         ./modules/ModelProcessorx/SlopeCompute/CreateConstraintsSlopeCompute.cpp \
     331                                        ./modules/ModelProcessorx/SlopeCompute/CreateConstraintsSlopeCompute.cpp\
    332332                                        ./modules/ModelProcessorx/SlopeCompute/CreateLoadsSlopeCompute.cpp\
    333333                                        ./modules/ModelProcessorx/Control/CreateParametersControl.cpp\
     
    367367                                        ./modules/Dux/Dux.h\
    368368                                        ./modules/Dux/Dux.cpp\
     369                                        ./modules/MinVelx/MinVelx.h\
     370                                        ./modules/MinVelx/MinVelx.cpp\
     371                                        ./modules/MaxVelx/MaxVelx.h\
     372                                        ./modules/MaxVelx/MaxVelx.cpp\
    369373                                        ./modules/ControlConstrainx/ControlConstrainx.h\
    370374                                        ./modules/ControlConstrainx/ControlConstrainx.cpp\
     
    524528                                        ./objects/Bamg/GeometricalVertex.cpp\
    525529                                        ./objects/Bamg/Geometry.h\
     530                                        ./objects/Bamg/Geometry.cpp\
    526531                                        ./objects/Bamg/ListofIntersectionTriangles.cpp\
    527532                                        ./objects/Bamg/ListofIntersectionTriangles.h\
     
    541546                                        ./objects/Bamg/Triangle.h\
    542547                                        ./objects/Bamg/Triangles.h\
     548                                        ./objects/Bamg/Triangles.cpp\
    543549                                        ./objects/Bamg/MeshVertex.cpp\
    544550                                        ./objects/Bamg/MeshVertex.h\
     
    770776                                        ./EnumDefinitions/StringAsEnum.cpp\
    771777                                        ./modules/ModelProcessorx/ModelProcessorx.h\
    772                                         ./modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp
    773                                         ./modules/ModelProcessorx/NodesPartitioning.cpp
    774                                         ./modules/ModelProcessorx/Partitioning.cpp\
     778                                        ./modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp\
     779                                        ./modules/ModelProcessorx/NodesPartitioning.cpp\
    775780                                        ./modules/ModelProcessorx/SortDataSets.cpp\
    776781                                        ./modules/ModelProcessorx/UpdateCounters.cpp\
     
    781786                                        ./modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp\
    782787                                        ./modules/ModelProcessorx/DiagnosticHoriz/UpdateElementsDiagnosticHoriz.cpp\
     788                                        ./modules/ModelProcessorx/DiagnosticHoriz/CreateNodesDiagnosticHoriz.cpp \
    783789                                        ./modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp \
    784790                                        ./modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp\
    785                                         ./modules/ModelProcessorx/DiagnosticHoriz/CreateNodesDiagnosticHoriz.cpp\
    786                                         ./modules/ModelProcessorx/DiagnosticVert/CreateElementsNodesAndMaterialsDiagnosticVert.cpp\
     791                                        ./modules/ModelProcessorx/DiagnosticVert/UpdateElementsDiagnosticVert.cpp\
     792                                        ./modules/ModelProcessorx/DiagnosticVert/CreateNodesDiagnosticVert.cpp \
    787793                                        ./modules/ModelProcessorx/DiagnosticVert/CreateConstraintsDiagnosticVert.cpp \
    788794                                        ./modules/ModelProcessorx/DiagnosticVert/CreateLoadsDiagnosticVert.cpp\
    789                                         ./modules/ModelProcessorx/DiagnosticVert/CreateNodesDiagnosticVert.cpp\
    790                                         ./modules/ModelProcessorx/DiagnosticHutter/CreateElementsNodesAndMaterialsDiagnosticHutter.cpp\
     795                                        ./modules/ModelProcessorx/DiagnosticHutter/UpdateElementsDiagnosticHutter.cpp\
     796                                        ./modules/ModelProcessorx/DiagnosticHutter/CreateNodesDiagnosticHutter.cpp \
    791797                                        ./modules/ModelProcessorx/DiagnosticHutter/CreateConstraintsDiagnosticHutter.cpp \
    792798                                        ./modules/ModelProcessorx/DiagnosticHutter/CreateLoadsDiagnosticHutter.cpp\
    793                                         ./modules/ModelProcessorx/DiagnosticHutter/CreateNodesDiagnosticHutter.cpp\
    794                                         ./modules/ModelProcessorx/DiagnosticStokes/CreateElementsNodesAndMaterialsDiagnosticStokes.cpp\
     799                                        ./modules/ModelProcessorx/DiagnosticStokes/UpdateElementsDiagnosticStokes.cpp\
     800                                        ./modules/ModelProcessorx/DiagnosticStokes/CreateNodesDiagnosticStokes.cpp \
    795801                                        ./modules/ModelProcessorx/DiagnosticStokes/CreateConstraintsDiagnosticStokes.cpp \
    796802                                        ./modules/ModelProcessorx/DiagnosticStokes/CreateLoadsDiagnosticStokes.cpp\
    797                                         ./modules/ModelProcessorx/DiagnosticStokes/CreateNodesDiagnosticStokes.cpp\
    798                                         ./modules/ModelProcessorx/SlopeCompute/CreateElementsNodesAndMaterialsSlopeCompute.cpp\
    799                                         ./modules/ModelProcessorx/SlopeCompute/CreateConstraintsSlopeCompute.cpp \
     803                                        ./modules/ModelProcessorx/SlopeCompute/UpdateElementsSlopeCompute.cpp\
     804                                        ./modules/ModelProcessorx/SlopeCompute/CreateNodesSlopeCompute.cpp \
     805                                        ./modules/ModelProcessorx/SlopeCompute/CreateConstraintsSlopeCompute.cpp\
    800806                                        ./modules/ModelProcessorx/SlopeCompute/CreateLoadsSlopeCompute.cpp\
    801                                         ./modules/ModelProcessorx/SlopeCompute/CreateNodesSlopeCompute.cpp\
    802807                                        ./modules/ModelProcessorx/Control/CreateParametersControl.cpp\
    803                                         ./modules/ModelProcessorx/Thermal/CreateElementsNodesAndMaterialsThermal.cpp\
     808                                        ./modules/ModelProcessorx/Thermal/UpdateElementsThermal.cpp\
     809                                        ./modules/ModelProcessorx/Thermal/CreateNodesThermal.cpp\
    804810                                        ./modules/ModelProcessorx/Thermal/CreateConstraintsThermal.cpp\
    805811                                        ./modules/ModelProcessorx/Thermal/CreateLoadsThermal.cpp\
    806                                         ./modules/ModelProcessorx/Thermal/CreateNodesThermal.cpp\
    807                                         ./modules/ModelProcessorx/Melting/CreateElementsNodesAndMaterialsMelting.cpp\
     812                                        ./modules/ModelProcessorx/Melting/UpdateElementsMelting.cpp\
     813                                        ./modules/ModelProcessorx/Melting/CreateNodesMelting.cpp\
    808814                                        ./modules/ModelProcessorx/Melting/CreateConstraintsMelting.cpp\
    809815                                        ./modules/ModelProcessorx/Melting/CreateLoadsMelting.cpp\
    810                                         ./modules/ModelProcessorx/Melting/CreateNodesMelting.cpp\
    811                                         ./modules/ModelProcessorx/Prognostic/CreateElementsNodesAndMaterialsPrognostic.cpp\
     816                                        ./modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp\
     817                                        ./modules/ModelProcessorx/Prognostic/CreateNodesPrognostic.cpp\
    812818                                        ./modules/ModelProcessorx/Prognostic/CreateConstraintsPrognostic.cpp\
    813819                                        ./modules/ModelProcessorx/Prognostic/CreateLoadsPrognostic.cpp\
    814                                         ./modules/ModelProcessorx/Prognostic/CreateNodesPrognostic.cpp\
    815                                         ./modules/ModelProcessorx/Prognostic2/CreateElementsNodesAndMaterialsPrognostic2.cpp\
     820                                        ./modules/ModelProcessorx/Prognostic2/UpdateElementsPrognostic2.cpp\
     821                                        ./modules/ModelProcessorx/Prognostic2/CreateNodesPrognostic2.cpp\
    816822                                        ./modules/ModelProcessorx/Prognostic2/CreateConstraintsPrognostic2.cpp\
    817823                                        ./modules/ModelProcessorx/Prognostic2/CreateLoadsPrognostic2.cpp\
    818                                         ./modules/ModelProcessorx/Prognostic2/CreateNodesPrognostic2.cpp\
    819                                         ./modules/ModelProcessorx/Balancedthickness/CreateElementsNodesAndMaterialsBalancedthickness.cpp\
     824                                        ./modules/ModelProcessorx/Balancedthickness/UpdateElementsBalancedthickness.cpp\
     825                                        ./modules/ModelProcessorx/Balancedthickness/CreateNodesBalancedthickness.cpp\
    820826                                        ./modules/ModelProcessorx/Balancedthickness/CreateConstraintsBalancedthickness.cpp\
    821827                                        ./modules/ModelProcessorx/Balancedthickness/CreateLoadsBalancedthickness.cpp\
    822                                         ./modules/ModelProcessorx/Balancedthickness/CreateNodesBalancedthickness.cpp\
    823                                         ./modules/ModelProcessorx/Balancedthickness2/CreateElementsNodesAndMaterialsBalancedthickness2.cpp\
     828                                        ./modules/ModelProcessorx/Balancedthickness2/UpdateElementsBalancedthickness2.cpp\
     829                                        ./modules/ModelProcessorx/Balancedthickness2/CreateNodesBalancedthickness2.cpp\
    824830                                        ./modules/ModelProcessorx/Balancedthickness2/CreateConstraintsBalancedthickness2.cpp\
    825831                                        ./modules/ModelProcessorx/Balancedthickness2/CreateLoadsBalancedthickness2.cpp\
    826                                         ./modules/ModelProcessorx/Balancedthickness2/CreateNodesBalancedthickness2.cpp\
    827                                         ./modules/ModelProcessorx/Balancedvelocities/CreateElementsNodesAndMaterialsBalancedvelocities.cpp\
     832                                        ./modules/ModelProcessorx/Balancedvelocities/UpdateElementsBalancedvelocities.cpp\
     833                                        ./modules/ModelProcessorx/Balancedvelocities/CreateNodesBalancedvelocities.cpp\
    828834                                        ./modules/ModelProcessorx/Balancedvelocities/CreateConstraintsBalancedvelocities.cpp\
    829835                                        ./modules/ModelProcessorx/Balancedvelocities/CreateLoadsBalancedvelocities.cpp\
    830                                         ./modules/ModelProcessorx/Balancedvelocities/CreateNodesBalancedvelocities.cpp\
    831836                                        ./modules/ModelProcessorx/Qmu/CreateParametersQmu.cpp\
    832837                                        ./modules/VerticesDofx/VerticesDofx.h\
     
    838843                                        ./modules/Dux/Dux.h\
    839844                                        ./modules/Dux/Dux.cpp\
     845                                        ./modules/MinVelx/MinVelx.h\
     846                                        ./modules/MinVelx/MinVelx.cpp\
     847                                        ./modules/MaxVelx/MaxVelx.h\
     848                                        ./modules/MaxVelx/MaxVelx.cpp\
    840849                                        ./modules/ControlConstrainx/ControlConstrainx.h\
    841850                                        ./modules/ControlConstrainx/ControlConstrainx.cpp\
  • issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp

    r4039 r4042  
    1515#include "../../objects/objects.h"
    1616               
    17 void OutputResults(FemModel* femmodel, char* filename){
     17void OutputResults(DataSet* elements, DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials, Parameters* parameters, char* filename){
     18
     19        int i;
     20
     21        Patch* patch=NULL;
    1822
    1923        int solutiontype;
     24        int count;
    2025        int numrows;
    2126        int numvertices;
     
    2328        int max_numvertices;
    2429        int max_numnodes;
     30        int element_numvertices;
     31        int element_numrows;
     32        int element_numnodes;
    2533
    2634        /*First, configure elements*/
    27         femmodel->elements->Configure(elements,loads, nodes,vertices, materials,parameters);
     35        elements->Configure(elements,loads, nodes,vertices, materials,parameters);
    2836
    2937        //Recover solutiontype which will be output to disk:
    30         femmodel->parameters->FindParam(&solutiontype,SolutionTypeEnum);
     38        parameters->FindParam(&solutiontype,SolutionTypeEnum);
    3139
    3240        //Process results to be output in the correct units
    33         for(i=0;i<femmodel->elements->Size();i++){
    34                 Element* element=femmodel->elements->GetObjectByOffset(i);
     41        for(i=0;i<elements->Size();i++){
     42                Element* element=(Element*)elements->GetObjectByOffset(i);
    3543                element->ProcessResultsUnits();
    3644        }
     
    5866        numnodes=0;
    5967
    60         for(i=0;i<femmodel->elements->Size();i++){
    61                 Element* element=femmodel->elements->GetObjectByOffset(i);
     68        for(i=0;i<elements->Size();i++){
     69                Element* element=(Element*)elements->GetObjectByOffset(i);
    6270                element->PatchSize(&element_numrows,&element_numvertices,&element_numnodes);
    6371
     
    94102        patch->WriteToDisk(solutiontype,filename);
    95103
     104        /*Free ressources:*/
     105        delete patch;
     106
    96107}
  • issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.h

    r4039 r4042  
    99
    1010/* local prototypes: */
    11 void OutputResults(FemModel* femmodel, char* filename);
     11void OutputResults(DataSet* elements, DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials, Parameters* parameters, char* filename);
    1212
    1313#endif  /* _OUTPUTRESULTS_H */
  • issm/trunk/src/c/modules/Qmux/DakotaResponses.cpp

    r3938 r4042  
    1717#include "../modules.h"
    1818
    19 void DakotaResponses(double* responses,char** responses_descriptors,int numresponses,Model* model,Results* results,Results* processed_results,int analysis_type,int sub_analysis_type){
     19void DakotaResponses(double* responses,char** responses_descriptors,int numresponses,FemModel* femmodel){
    2020
    21         int i,j;
    22         int found=0;
     21        int i;
     22        extern int my_rank;
     23       
     24        /*intermediary: */
    2325        char* response_descriptor=NULL;
    24         int numberofnodes;
    25         extern int my_rank;
    26 
    27         /*some data needed across the responses: */
    28         model->FindParam(&numberofnodes,NumberOfNodesEnum);
    29 
     26        double femmodel_response;
     27                       
    3028
    3129        for(i=0;i<numresponses;i++){
     
    3331                response_descriptor=responses_descriptors[i];
    3432
    35                 //'min_vx' 'max_vx' 'max_abs_vx' 'min_vy' 'max_vy' 'max_abs_vy' 'min_vel' 'max_vel, mass_flux'
     33                /*Compute response for this response_descriptor:*/
    3634
    3735                if(strcmp(response_descriptor,"min_vel")==0){
    38                         double* vel=NULL;
    39                         double min_vel=0;
    40                
    41                         found=processed_results->FindResult((void*)&vel,"vel");
    42                         if(!found)ISSMERROR(" could not find vel to compute min_vel");
    43 
    44                         min_vel=vel[0];
    45                         for(j=1;j<numberofnodes;j++){
    46                                 if (vel[j]<min_vel)min_vel=vel[j];
    47                         }
    48 
    49                         if(my_rank==0)responses[i]=min_vel;
    50                        
    51                         /*Free ressources:*/
    52                         xfree((void**)&vel);
    53 
    54                        
     36                        MinVelx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters);
    5537                }
    5638                else if(strcmp(response_descriptor,"max_vel")==0){
    57                         double* vel=NULL;
    58                         double max_vel=0;
    59 
    60                         found=processed_results->FindResult((void*)&vel,"vel");
    61                         if(!found)ISSMERROR(" could not find vel to compute max_vel");
    62 
    63                         max_vel=vel[0];
    64                         for(j=1;j<numberofnodes;j++){
    65                                 if (vel[j]>max_vel)max_vel=vel[j];
    66                         }
    67                         if(my_rank==0)responses[i]=max_vel;
    68                        
    69                         /*Free ressources:*/
    70                         xfree((void**)&vel);
    71 
     39                        MaxVelx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters);
    7240                }
    7341                else if(strcmp(response_descriptor,"min_vx")==0){
    74                         double* vx=NULL;
    75                         double min_vx=0;
    76                        
    77                         found=processed_results->FindResult((void*)&vx,"vx");
    78                         if(!found)ISSMERROR(" could not find vx to compute min_vx");
    79 
    80                         min_vx=vx[0];
    81                         for(j=1;j<numberofnodes;j++){
    82                                 if (vx[j]<min_vx)min_vx=vx[j];
    83                         }
    84                         if(my_rank==0)responses[i]=min_vx;
    85                        
    86                         /*Free ressources:*/
    87                         xfree((void**)&vx);
    88 
     42                        MinVxx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters);
    8943                }
    9044                else if(strcmp(response_descriptor,"max_vx")==0){
    91                         double* vx=NULL;
    92                         double max_vx=0;
    93                        
    94                         found=processed_results->FindResult((void*)&vx,"vx");
    95                         if(!found)ISSMERROR(" could not find vx to compute max_vx");
    96 
    97                         max_vx=vx[0];
    98                         for(j=1;j<numberofnodes;j++){
    99                                 if (vx[j]>max_vx)max_vx=vx[j];
    100                         }
    101                         if(my_rank==0)responses[i]=max_vx;
    102                        
    103                         /*Free ressources:*/
    104                         xfree((void**)&vx);
    105 
     45                        MaxVxx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters);
    10646                }
    10747                else if(strcmp(response_descriptor,"max_abs_vx")==0){
    108                         double* vx=NULL;
    109                         double max_abs_vx=0;
    110                        
    111                         found=processed_results->FindResult((void*)&vx,"vx");
    112                         if(!found)ISSMERROR(" could not find vx to compute max_abs_vx");
    113 
    114                         max_abs_vx=fabs(vx[0]);
    115                         for(j=1;j<numberofnodes;j++){
    116                                 if (fabs(vx[j])>max_abs_vx)max_abs_vx=fabs(vx[j]);
    117                         }
    118                         if(my_rank==0)responses[i]=max_abs_vx;
    119                        
    120                         /*Free ressources:*/
    121                         xfree((void**)&vx);
    122 
     48                        MaxAbsVxx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters);
    12349                }
    12450                else if(strcmp(response_descriptor,"min_vy")==0){
    125                         double* vy=NULL;
    126                         double min_vy=0;
    127                        
    128                         found=processed_results->FindResult((void*)&vy,"vy");
    129                         if(!found)ISSMERROR(" could not find vy to compute min_vy");
    130 
    131                         min_vy=vy[0];
    132                         for(j=1;j<numberofnodes;j++){
    133                                 if (vy[j]<min_vy)min_vy=vy[j];
    134                         }
    135                         if(my_rank==0)responses[i]=min_vy;
    136                        
    137                         /*Free ressources:*/
    138                         xfree((void**)&vy);
    139 
     51                        MinVyx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters);
    14052                }
    14153                else if(strcmp(response_descriptor,"max_vy")==0){
    142                         double* vy=NULL;
    143                         double max_vy=0;
    144                        
    145                         found=processed_results->FindResult((void*)&vy,"vy");
    146                         if(!found)ISSMERROR(" could not find vy to compute max_vy");
    147 
    148                         max_vy=vy[0];
    149                         for(j=1;j<numberofnodes;j++){
    150                                 if (vy[j]>max_vy)max_vy=vy[j];
    151                         }
    152                         if(my_rank==0)responses[i]=max_vy;
    153                        
    154                         /*Free ressources:*/
    155                         xfree((void**)&vy);
    156 
     54                        MaxVyx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters);
    15755                }
    15856                else if(strcmp(response_descriptor,"max_abs_vy")==0){
    159                         double* vy=NULL;
    160                         double max_abs_vy=0;
    161                        
    162                         found=processed_results->FindResult((void*)&vy,"vy");
    163                         if(!found)ISSMERROR(" could not find vy to compute max_abs_vy");
    164 
    165                         max_abs_vy=fabs(vy[0]);
    166                         for(j=1;j<numberofnodes;j++){
    167                                 if (fabs(vy[j])>max_abs_vy)max_abs_vy=fabs(vy[j]);
    168                         }
    169                         if(my_rank==0)responses[i]=max_abs_vy;
    170                        
    171                         /*Free ressources:*/
    172                         xfree((void**)&vy);
    173 
     57                        MaxAbsVyx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters);
    17458                }
    17559                else if(strcmp(response_descriptor,"min_vz")==0){
    176                         double* vz=NULL;
    177                         double min_vz=0;
    178                        
    179                         found=processed_results->FindResult((void*)&vz,"vz");
    180                         if(!found)ISSMERROR(" could not find vz to compute min_vz");
    181 
    182                         min_vz=vz[0];
    183                         for(j=1;j<numberofnodes;j++){
    184                                 if (vz[j]<min_vz)min_vz=vz[j];
    185                         }
    186                         if(my_rank==0)responses[i]=min_vz;
    187                        
    188                         /*Free ressources:*/
    189                         xfree((void**)&vz);
    190 
     60                        MinVzx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters);
    19161                }
    19262                else if(strcmp(response_descriptor,"max_vz")==0){
    193                         double* vz=NULL;
    194                         double max_vz=0;
    195                        
    196                         found=processed_results->FindResult((void*)&vz,"vz");
    197                         if(!found)ISSMERROR(" could not find vz to compute max_vz");
    198 
    199                         max_vz=vz[0];
    200                         for(j=1;j<numberofnodes;j++){
    201                                 if (vz[j]>max_vz)max_vz=vz[j];
    202                         }
    203                         if(my_rank==0)responses[i]=max_vz;
    204                        
    205                         /*Free ressources:*/
    206                         xfree((void**)&vz);
    207 
     63                        MaxVzx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters);
    20864                }
    20965                else if(strcmp(response_descriptor,"max_abs_vz")==0){
    210                         double* vz=NULL;
    211                         double max_abs_vz=0;
    212                        
    213                         found=processed_results->FindResult((void*)&vz,"vz");
    214                         if(!found)ISSMERROR(" could not find vz to compute max_abs_vz");
    215 
    216                         max_abs_vz=fabs(vz[0]);
    217                         for(j=1;j<numberofnodes;j++){
    218                                 if (fabs(vz[j])>max_abs_vz)max_abs_vz=fabs(vz[j]);
    219                         }
    220                         if(my_rank==0)responses[i]=max_abs_vz;
    221                        
    222                         /*Free ressources:*/
    223                         xfree((void**)&vz);
     66                        MaxAbsVzx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters);
    22467                }
    22568                else if(strcmp(response_descriptor,"misfit")==0){
    226                        
    227                         int isstokes,ismacayealpattyn,ishutter;
    228                         FemModel* femmodel=NULL;
    229                         double J=0;
    230                         int numberofdofspernode,numberofnodes;
    231                         Vec u_g=NULL;
    232                         double* u_g_double=NULL;
    233                         double* vx=NULL;
    234                         double* vy=NULL;
    235                         double* vz=NULL;
    236                         double* fit=NULL;
    237 
    238                         /*retrieve active fem model: */
    239                         model->FindParam(&isstokes,IsStokesEnum);
    240                         model->FindParam(&ismacayealpattyn,IsMacAyealPattynEnum);
    241                         model->FindParam(&ishutter,IsHutterEnum);
    242 
    243                         if(isstokes){
    244                                 femmodel=model->GetFormulation(DiagnosticAnalysisEnum,StokesAnalysisEnum);
    245                         }
    246                         if(ismacayealpattyn){
    247                                 femmodel=model->GetFormulation(DiagnosticAnalysisEnum,HorizAnalysisEnum);
    248                         }
    249                         if(ishutter){
    250                                 femmodel=model->GetFormulation(DiagnosticAnalysisEnum,HutterAnalysisEnum);
    251                         }       
    252 
    253 
    254                         /*Recover some parameters: */
    255                         femmodel->parameters->FindParam(&numberofdofspernode,NumberOfDofsPerNodeEnum);
    256                         femmodel->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
    257                         femmodel->parameters->FindParam(&fit,NULL,NULL,FitEnum);
    258 
    259                         /*Recover velocity: */
    260                         found=results->FindResult(&u_g,"u_g");
    261                         VecToMPISerial(&u_g_double,u_g);
    262                         if(!found)ISSMERROR(" could not find velocity to compute misfit");
    263 
    264                         SplitSolutionVectorx(u_g,numberofnodes,numberofdofspernode,&vx,&vy,&vz);
    265 
    266                         /*Add to inputs: */
    267                         femmodel->elements->UpdateInputsFromVector(vx,VxEnum,VertexEnum);
    268                         femmodel->elements->UpdateInputsFromVector(vy,VyEnum,VertexEnum);
    269                         femmodel->elements->UpdateInputsFromVector(vz,VzEnum,VertexEnum);
    270                         femmodel->elements->UpdateInputsFromVector(&fit[0],FitEnum,ConstantEnum);
    271 
    272                         /*Compute misfit: */
    273                         Misfitx( &J, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,analysis_type,sub_analysis_type);
    274                        
    275 
    276                         if(my_rank==0)responses[i]=J;
    277 
    278                         /*Some cleanup: */
    279                         VecFree(&u_g);
    280                         xfree((void**)&u_g_double);
    281                         xfree((void**)&fit);
    282 
     69                        Misfitx( &femmodel_response, femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters);
    28370                }
    28471                else if(strcmp(response_descriptor,"mass_flux")==0){
    285 
    286                         int isstokes,ismacayealpattyn,ishutter;
    287                         Vec       ug=NULL;
    288                         double*   ug_serial=NULL;
    289                         double    mass_flux=0;
    290                         double*   segments=NULL;
    291                         int       num_segments;
    292                         DataSet*  elements=NULL;
    293                         DataSet*  nodes=NULL;
    294                         DataSet*  materials=NULL;
    295                         DataSet*  parameters=NULL;
    296                         FemModel* femmodel=NULL;
    297                         Param*    param=NULL;
    298 
    299                         /*retrieve velocities: */
    300                         found=results->FindResult(&ug,"u_g");
    301                         if(!found)ISSMERROR(" could not find velocity to compute mass_flux");
    302                         VecToMPISerial(&ug_serial,ug);
    303                
    304                         /*retrieve active fem model: */
    305                         model->FindParam(&isstokes,IsStokesEnum);
    306                         model->FindParam(&ismacayealpattyn,IsMacAyealPattynEnum);
    307                         model->FindParam(&ishutter,IsHutterEnum);
    308 
    309                         if(isstokes){
    310                                 femmodel=model->GetFormulation(DiagnosticAnalysisEnum,StokesAnalysisEnum);
    311                         }
    312                         if(ismacayealpattyn){
    313                                 femmodel=model->GetFormulation(DiagnosticAnalysisEnum,HorizAnalysisEnum);
    314                         }
    315                         if(ishutter){
    316                                 femmodel=model->GetFormulation(DiagnosticAnalysisEnum,HutterAnalysisEnum);
    317                         }
    318 
    319                         /*retrieve qmu_mass_flux_segments: */
    320                         femmodel->parameters->FindParam(&segments,&num_segments,QmuMassFluxSegmentsEnum);
    321 
    322                         /*call mass flux module: */
    323                         MassFluxx(&mass_flux,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,segments,num_segments,ug_serial);
    324                        
    325                         if(my_rank==0)responses[i]=mass_flux;
    326                        
    327                         /*Free ressources:*/
    328                         VecFree(&ug);
    329                         xfree((void**)&ug_serial);
    330                         xfree((void**)&segments);
     72                        MassFlux(&femmodel_response,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
    33173                }
    33274                else{
    333                         if(my_rank==0)printf("%s%s%s"," response descriptor : ",response_descriptor," not supported yet!");
    33475                        ISSMERROR("%s%s%s"," response descriptor : ",response_descriptor," not supported yet!");
    33576                }
     77                       
     78                /*send response back to Dakota only on cpu 0: */
     79                if(my_rank==0)responses[i]=femmodel_response;
    33680        }
    33781
  • issm/trunk/src/c/modules/Qmux/Qmux.cpp

    r3913 r4042  
    5151
    5252#ifdef _SERIAL_
    53 void Qmux(mxArray* model,int analysis_type,int sub_analysis_type,char* dakota_input_file,char* dakota_output_file,char* dakota_error_file){
     53void Qmux(mxArray* femmodel,char* dakota_input_file,char* dakota_output_file,char* dakota_error_file){
    5454#else
    55 void Qmux(Model* model,int analysis_type,int sub_analysis_type){
     55void Qmux(FemModel* femmodel){
    5656#endif
    5757
     
    111111
    112112                        // Serial case: plug in derived Interface object without an analysisComm
    113                         interface.assign_rep(new SIM::DakotaPlugin(problem_db,(void*)model,analysis_type,sub_analysis_type), false);
     113                        interface.assign_rep(new SIM::DakotaPlugin(problem_db,(void*)femmodel), false);
    114114                }
    115115       
     
    120120                #ifdef _PARALLEL_
    121121                //Warn other cpus that we are done running the dakota iterator, by setting the counter to -1:
    122                 SpawnCore(NULL,0, NULL,NULL,0,model,analysis_type,sub_analysis_type,-1);
     122                SpawnCore(NULL,0, NULL,NULL,0,femmodel,-1);
    123123                #endif
    124124
     
    128128
    129129                for(;;){
    130                         if(!SpawnCore(NULL,0, NULL,NULL,0,model,analysis_type,sub_analysis_type,0))break; //counter came in at -1 on cpu0, bail out.
     130                        if(!SpawnCore(NULL,0, NULL,NULL,0,femmodel,0))break; //counter came in at -1 on cpu0, bail out.
    131131                }
    132132        }
  • issm/trunk/src/c/modules/Qmux/Qmux.h

    r3913 r4042  
    1010
    1111/* local prototypes: */
    12 int SpawnCore(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, void* model,int analysis_type,int sub_analysis_type,int counter);
     12int SpawnCore(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, void* femmodel,int analysis_type,int sub_analysis_type,int counter);
    1313#ifdef _SERIAL_
    14 void Qmux(mxArray* model,int analysis_type,int sub_analysis_type,char* dakota_input_file,char* dakota_output_file,char* dakota_error_file);
    15 void SpawnCoreSerial(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, mxArray* model,int analysis_type,int sub_analysis_type,int counter);
     14void Qmux(mxArray* femmodel,int analysis_type,int sub_analysis_type,char* dakota_input_file,char* dakota_output_file,char* dakota_error_file);
     15void SpawnCoreSerial(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, mxArray* femmodel,int analysis_type,int sub_analysis_type,int counter);
    1616#else
    17 void Qmux(Model* model,int analysis_type,int sub_analysis_type);
    18 void SpawnCoreParallel(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, Model* model,int analysis_type,int sub_analysis_type,int counter);
    19 void DakotaResponses(double* responses,char** responses_descriptors,int numresponses,Model* model, DataSet* results,DataSet* processed_results,int analysis_type,int sub_analysis_type);
     17void Qmux(FemModel* femmodel,int analysis_type,int sub_analysis_type);
     18void SpawnCoreParallel(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, FemModel* femmodel,int analysis_type,int sub_analysis_type,int counter);
     19void DakotaResponses(double* responses,char** responses_descriptors,int numresponses,FemModel* femmodel,int analysis_type,int sub_analysis_type);
    2020#endif
    2121
  • issm/trunk/src/c/modules/Qmux/SpawnCore.cpp

    r3913 r4042  
    1717#include "../../include/include.h"
    1818
    19 int SpawnCore(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, void* model,int analysis_type,int sub_analysis_type,int counter){
     19int SpawnCore(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, void* femmodel,int counter){
    2020
    2121        /*Branch into a serial SpawnCore and a parallel SpawnCore: */
    2222        #ifdef _SERIAL_
    23         SpawnCoreSerial(responses, numresponses, variables, variables_descriptors,numvariables, (mxArray*)model, analysis_type,sub_analysis_type,counter);
     23        SpawnCoreSerial(responses, numresponses, variables, variables_descriptors,numvariables, (mxArray*)femmodel, counter);
    2424        #else
    2525        /*Call SpawnCoreParallel unless counter=-1 on cpu0, in which case, bail out and return 0: */
    2626        MPI_Bcast(&counter,1,MPI_INT,0,MPI_COMM_WORLD); if(counter==-1)return 0;
    2727       
    28         SpawnCoreParallel(responses, numresponses, variables, variables_descriptors,numvariables, (Model*)model, analysis_type,sub_analysis_type,counter);
     28        SpawnCoreParallel(responses, numresponses, variables, variables_descriptors,numvariables, (FemModel*)femmodel);
    2929        #endif
    3030
  • issm/trunk/src/c/modules/Qmux/SpawnCoreParallel.cpp

    r3938 r4042  
    3434#include "../../solutions/solutions.h"
    3535
    36 void SpawnCoreParallel(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, Model* model,int analysis_type,int sub_analysis_type,int counter){
     36void SpawnCoreParallel(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, FemModel* femmodel,int counter){
    3737
    3838        int i;
     39        extern int my_rank;
    3940       
    40         /*output from core solutions: */
    41         Results* results=NULL;
    42         Results* processed_results=NULL;
     41        char   **responses_descriptors     = NULL;
     42        int      num_responses_descriptors;
     43        char    *string                    = NULL;
     44        int      string_length;
     45        double  *qmu_part                  = NULL;
     46        int      qmu_npart;
     47        int      verbose                   = 0;
     48        int      dummy;
     49        int      solution_type;
    4350
    44         char** responses_descriptors=NULL;
    45         int    num_responses_descriptors;
    46         char*  string=NULL;
    47         int    string_length;
    48         double* qmu_part=NULL;
    49         int     qmu_npart;
    50         int     verbose=0;
    51         int     dummy;
    52 
    53         extern int my_rank;
    5451       
    5552       
     
    5855       
    5956        /*some parameters needed: */
    60         model->FindParam(&verbose,VerboseEnum);
     57        femmodel->parameters->FindParam(&verbose,VerboseEnum);
     58        femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
    6159               
    62         /*First off, recover the response descriptors for the response functions: */
    63         model->GetFormulation(DiagnosticAnalysisEnum,HorizAnalysisEnum)->parameters->FindParam(&responses_descriptors,&num_responses_descriptors,ResponseDescriptorsEnum);
    64 
    6560        /*Recover partitioning for dakota: */
    66         model->FindParam(&qmu_npart,QmuNPartEnum);
    67         model->FindParam(&qmu_part,&dummy,QmuPartEnum);
     61        femmodel->FindParam(&qmu_npart,QmuNPartEnum);
     62        femmodel->FindParam(&qmu_part,&dummy,QmuPartEnum);
    6863
    6964        /*broadcast variables: only cpu 0 has correct values*/
     
    9287        _printf_("qmu iteration: %i\n",counter);
    9388
    94         /*Modify core inputs in objects contained in model, to reflect the dakota variables inputs: */
    95         model->UpdateFromDakota(variables,variables_descriptors,numvariables,model->GetFormulation(DiagnosticAnalysisEnum,HorizAnalysisEnum)->parameters,qmu_part,qmu_npart); //diagnostic horiz model is the one holding the parameters for Dakota.
     89        /*Modify core inputs in objects contained in femmodel, to reflect the dakota variables inputs: */
     90        UpdateFromDakota(variables,variables_descriptors,numvariables,femmodel,qmu_part,qmu_npart);
    9691
    9792        /*Run the analysis core solution sequence: */
    98         if(analysis_type==DiagnosticAnalysisEnum){
     93        if(solution_type==DiagnosticAnalysisEnum){
    9994                       
    10095                if(verbose)_printf_("Starting diagnostic core\n");
    10196
    102                 results=diagnostic_core(model);
     97                diagnostic_core(femmodel);
    10398
    10499        }
    105         else if(analysis_type==ThermalAnalysisEnum){
     100        else if(solution_type==ThermalAnalysisEnum){
    106101               
    107102                if(verbose)_printf_("Starting thermal core\n");
    108                 results=thermal_core(model);
     103                thermal_core(femmodel);
    109104
    110105        }
    111         else if(analysis_type==PrognosticAnalysisEnum){
     106        else if(solution_type==PrognosticAnalysisEnum){
    112107
    113108                if(verbose)_printf_("Starting prognostic core\n");
    114                 results=prognostic_core(model);
     109                prognostic_core(femmodel);
    115110
    116111        }
    117         else if(analysis_type==TransientAnalysisEnum){
     112        else if(solution_type==TransientAnalysisEnum){
    118113
    119114                if(verbose)_printf_("Starting transient core\n");
    120                 results=transient_core(model);
     115                transient_core(femmodel);
    121116
    122117        }
    123         else ISSMERROR("%s%i%s%i%s"," analysis_type ",analysis_type," and sub_analysis_type ",sub_analysis_type," not supported yet!");
     118        else ISSMERROR("%s%s%s"," solution_type: ",EnumAsString(solution_type),", not supported yet!");
    124119       
    125120        /*compute responses on cpu 0: dummy for now! */
    126121        if(verbose)_printf_("compute dakota responses:\n");
    127         DakotaResponses(responses,responses_descriptors,numresponses,model,results,processed_results,analysis_type,sub_analysis_type);
     122        DakotaResponses(responses,responses_descriptors,numresponses,femmodel,results,processed_results);
    128123
    129124        /*Free ressources:*/
    130         delete results;
    131         delete processed_results;
    132 
    133125        //variables only on cpu != 0
    134126        if(my_rank!=0){
     
    148140        xfree((void**)&responses_descriptors);
    149141        xfree((void**)&qmu_part);
     142
     143
    150144}
    151145
  • issm/trunk/src/c/modules/SpcNodesx/SpcNodesx.cpp

    r4034 r4042  
    1717
    1818        /*output: */
    19         Vec* yg=NULL;
     19        Vec yg=NULL;
    2020
    2121        /*First, recover number of dofs from nodes: */
     
    3131
    3232                /*Specify numentries: */
    33                 VecGetSize(yg->vector,&gsize);
     33                VecGetSize(yg,&gsize);
    3434        }
    3535
  • issm/trunk/src/c/modules/UpdateInputsFromSolutionx/UpdateInputsFromSolutionx.cpp

    r4037 r4042  
    99#include "../../EnumDefinitions/EnumDefinitions.h"
    1010
    11 void UpdateInputsFromSolutionx( DataSet* elements,DataSet* nodes, DataSet* vertices, DataSet* loads, DataSet* materials, Parameters* parameters,Vec solution, int analysis_type, int sub_analysis_type,int step=0){
     11void UpdateInputsFromSolutionx( DataSet* elements,DataSet* nodes, DataSet* vertices, DataSet* loads, DataSet* materials, Parameters* parameters,Vec solution, int analysis_type, int sub_analysis_type){
    1212
    1313        double* serial_solution=NULL;
     
    1717
    1818        /*Call overloaded form of UpdateInputsFromSolutionx: */
    19         UpdateInputsFromSolutionx( elements, nodes,  vertices,  loads,  materials,  parameters,serial_solution, analysis_type, sub_analysis_type,step);
     19        UpdateInputsFromSolutionx( elements, nodes,  vertices,  loads,  materials,  parameters,serial_solution, analysis_type, sub_analysis_type);
    2020
    2121        /*Free ressources:*/
     
    4444
    4545}
    46 
    47 /*Same routines, with additional timestep argument: */
    48 void UpdateInputsFromSolutionx( DataSet* elements,DataSet* nodes, DataSet* vertices, DataSet* loads, DataSet* materials, Parameters* parameters,Vec solution, int analysis_type, int sub_analysis_type,int timestep){
    49        
    50        
    51         double* serial_solution=NULL;
    52 
    53         /*Serialize solution, so that elements can index into it on every CPU: */
    54         VecToMPISerial(&serial_solution,solution);
    55 
    56         /*Call overloaded form of UpdateInputsFromSolutionx: */
    57         UpdateInputsFromSolutionx( elements, nodes,  vertices,  loads,  materials,  parameters,serial_solution, analysis_type, sub_analysis_type,int timestep);
    58 
    59         /*Free ressources:*/
    60         xfree((void**)&serial_solution);
    61 
    62 }
    63 
    64 
    65 
    66 void UpdateInputsFromSolutionx( DataSet* elements,DataSet* nodes, DataSet* vertices, DataSet* loads, DataSet* materials, Parameters* parameters,double* solution, int analysis_type, int sub_analysis_type,int timestep){
    67 
    68         /*Intermediary*/
    69         int i;
    70         Element* element=NULL;
    71 
    72         /*First, get elements and loads configured: */
    73         elements->  Configure(elements,loads, nodes,vertices, materials,parameters);
    74         loads->     Configure(elements,loads, nodes,vertices, materials,parameters);
    75         nodes->     Configure(elements,loads, nodes,vertices, materials,parameters);
    76         parameters->Configure(elements,loads, nodes,vertices, materials,parameters);
    77        
    78         /*Elements drive the update: */
    79         for (i=0;i<elements->Size();i++){
    80                 element=(Element*)elements->GetObjectByOffset(i);
    81                 element->UpdateInputsFromSolution(solution,analysis_type,sub_analysis_type,timestep);
    82         }
    83 
    84 }
  • issm/trunk/src/c/modules/modules.h

    r4002 r4042  
    6666#include "./GetSolutionFromInputsx/GetSolutionFromInputsx.h"
    6767#include "./OutputResultsx/OutputResultsx.h"
     68#include "./MinVelx/MinVelx.h"
     69#include "./MaxVelx/MaxVelx.h"
    6870#endif
  • issm/trunk/src/c/objects/DakotaPlugin.cpp

    r3913 r4042  
    4444
    4545//constructor
    46 DakotaPlugin::DakotaPlugin(const Dakota::ProblemDescDB& problem_db,void* in_model, int in_analysis_type, int in_sub_analysis_type):Dakota::DirectApplicInterface(problem_db){
     46DakotaPlugin::DakotaPlugin(const Dakota::ProblemDescDB& problem_db,void* in_femmodel):Dakota::DirectApplicInterface(problem_db){
    4747
    4848
    49         model=in_model;
    50         analysis_type=in_analysis_type;
    51         sub_analysis_type=in_sub_analysis_type;
     49        femmodel=in_femmodel;
    5250        counter=0;
    5351}
     
    8987
    9088        /*run core solution: */
    91         SpawnCore(responses,numFns, variables,variable_descriptors,numACV,model,analysis_type,sub_analysis_type,counter);
     89        SpawnCore(responses,numFns, variables,variable_descriptors,numACV,model,counter);
    9290
    9391        /*populate responses: */
  • issm/trunk/src/c/objects/DakotaPlugin.h

    r3673 r4042  
    2424public:
    2525
    26         DakotaPlugin(const Dakota::ProblemDescDB& problem_db,void* model, int analysis_type, int sub_analysis_type);
     26        DakotaPlugin(const Dakota::ProblemDescDB& problem_db,void* model);
    2727        ~DakotaPlugin();
    2828
    2929        /*these fields are used by core solutions: */
    30         void* model;
     30        void* femmodel;
    3131
    32         int analysis_type;
    33         int sub_analysis_type;
    3432        int counter;
    3533
  • issm/trunk/src/c/objects/Elements/Beam.cpp

    r4039 r4042  
    626626void  Beam::PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes){
    627627
    628         int     i;
    629        
    630         /*output: */
    631         int     numrows     = 0;
    632         int     numvertices = 0;
    633         int     numnodes    = 0;
    634 
    635         /*Go through all the results objects, and update the counters: */
    636         for (i=0;i<this->results->Size();i++){
    637                 Result* result=(Result*)this->results->GetObjectByOffset(i);
    638                 /*first, we have one more result: */
    639                 numrows++;
    640                 /*now, how many vertices and how many nodal values for this result? :*/
    641                 numvertices=2; //this is a beam element, with 2 vertices
    642                 numnodes=result->NumberOfNodalValues(); //ask result object.
    643         }
    644 
    645         /*Assign output pointers:*/
    646         *pnumrows=numrows;
    647         *pnumvertices=numvertices;
    648         *pnumnodes=numnodes;
     628        ISSMERROR(" not supported yet!");
    649629       
    650630}
     
    653633void  Beam::PatchFill(int* pcount, Patch* patch){
    654634
    655         int i;
    656         int count;
    657         int vertices_ids[2];
    658 
    659 
    660         /*recover pointer: */
    661         count=*pcount;
    662                
    663         /*will be needed later: */
    664         for(i=0;i<2;i++) vertices_ids[i]=nodes[i]->GetVertexId(); //vertices id start at column 3 of the patch.
    665 
    666         for(i=0;i<this->results->Size();i++){
    667                 Result* result=(Result*)this->results->GetObjectByOffset(i);
    668 
    669                 /*For this result,fill the information in the Patch object (element id + vertices ids), and then hand
    670                  *it to the result object, to fill the rest: */
    671                 patch->fillelementinfo(count,this->id,vertices_ids,2);
    672                 result->PatchFill(count,patch);
    673 
    674                 /*increment counter: */
    675                 count++;
     635        ISSMERROR(" not supported yet!");
     636}
     637/*}}}*/
     638/*FUNCTION Beam::MinVel(double* pminvel, bool process_units);{{{1*/
     639void  Beam::MinVel(double* pminvel, bool process_units){
     640
     641        const int numgrids=2;
     642        double  gaussgrids[numgrids][2]={{0,1},{1,0}};
     643        double  vx_values[numgrids];
     644        double  vy_values[numgrids];
     645        double  vz_values[numgrids];
     646        double  vel_values[numgrids];
     647        double  minvel;
     648
     649        /*retrieve dim parameter: */
     650        parameters->FindParam(&dim,DimEnum);
     651
     652        /*retrive velocity values at nodes */
     653        inputs->GetParameterValues(&vx_values[0],&gaussgrids[0][0],numgrids,VxEnum);
     654        inputs->GetParameterValues(&vy_values[0],&gaussgrids[0][0],numgrids,VyEnum);
     655        if(dim==3) inputs->GetParameterValues(&vz_values[0],&gaussgrids[0][0],numgrids,VzEnum);
     656
     657        /*now, compute minimum of velocity :*/
     658        if(dim==2){
     659                for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2));
     660        }
     661        else{
     662                for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)+pow(vz_values[i],2));
     663        }
     664
     665        /*now, compute minimum:*/
     666        minvel=vel_values[0];
     667        for(i=1;i<numgrids;i++){
     668                if (vel_values[i]<minvel)minvel=vel_values[i];
    676669        }
    677670
    678671        /*Assign output pointers:*/
    679         *pcount=count;
    680 }
     672        *pminvel=minvel;
     673
     674}
     675/*}}}*/
     676/*FUNCTION Beam::MaxVel(double* pmaxvel, bool process_units);{{{1*/
     677void  Beam::MaxVel(double* pmaxvel, bool process_units){
     678
     679        const int numgrids=2;
     680        double  gaussgrids[numgrids][2]={{0,1},{1,0}};
     681        double  vx_values[numgrids];
     682        double  vy_values[numgrids];
     683        double  vz_values[numgrids];
     684        double  vel_values[numgrids];
     685        double  maxvel;
     686
     687        /*retrieve dim parameter: */
     688        parameters->FindParam(&dim,DimEnum);
     689
     690        /*retrive velocity values at nodes */
     691        inputs->GetParameterValues(&vx_values[0],&gaussgrids[0][0],numgrids,VxEnum);
     692        inputs->GetParameterValues(&vy_values[0],&gaussgrids[0][0],numgrids,VyEnum);
     693        if(dim==3) inputs->GetParameterValues(&vz_values[0],&gaussgrids[0][0],numgrids,VzEnum);
     694
     695        /*now, compute maximum of velocity :*/
     696        if(dim==2){
     697                for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2));
     698        }
     699        else{
     700                for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)+pow(vz_values[i],2));
     701        }
     702
     703        /*now, compute maximum:*/
     704        maxvel=vel_values[0];
     705        for(i=1;i<numgrids;i++){
     706                if (vel_values[i]>maxvel)maxvel=vel_values[i];
     707        }
     708
     709        /*Assign output pointers:*/
     710        *pmaxvel=maxvel;
     711
     712}
     713/*}}}*/
  • issm/trunk/src/c/objects/Elements/Beam.h

    r4039 r4042  
    8383                void  PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes);
    8484                void  PatchFill(int* pcount, Patch* patch);
    85 
     85                void  MinVel(double* pminvel, bool process_units);
     86                void  MaxVel(double* pmaxvel, bool process_units);
    8687                /*}}}*/
    8788                /*not implemented: {{{1*/
  • issm/trunk/src/c/objects/Elements/Element.h

    r4039 r4042  
    5353                virtual void   InputToResult(int enum_type,int step,double time)=0;
    5454                virtual void   ProcessResultsUnits(void)=0;
     55                virtual void   MinVel(double* pminvel, bool process_units)=0;
     56                virtual void   MaxVel(double* pmaxvel, bool process_units)=0;
    5557
    5658                /*Implementation: */
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r4039 r4042  
    504504        Parameters *beam_parameters = NULL;
    505505        Inputs     *beam_inputs     = NULL;
    506         Results     *beam_results     = NULL;
    507506
    508507        indices[0]=g0;
     
    511510        beam_parameters=this->parameters;
    512511        beam_inputs=(Inputs*)this->inputs->SpawnBeamInputs(indices);
    513         beam_results=(Results*)this->results->SpawnBeamResults(indices);
    514512
    515513        beam=new Beam();
    516514        beam->id=this->id;
    517515        beam->inputs=beam_inputs;
    518         beam->results=beam_results;
    519516        beam->parameters=beam_parameters;
    520517
     
    535532        Parameters *sing_parameters = NULL;
    536533        Inputs     *sing_inputs     = NULL;
    537         Results     *sing_results     = NULL;
    538534
    539535        sing_parameters=this->parameters;
    540536        sing_inputs=(Inputs*)this->inputs->SpawnSingInputs(index);
    541         sing_results=(Results*)this->results->SpawnSingResults(index);
    542537
    543538        sing=new Sing();
    544539        sing->id=this->id;
    545540        sing->inputs=sing_inputs;
    546         sing->results=sing_results;
    547541        sing->parameters=sing_parameters;
    548542
     
    612606        /*If we don't find it, no big deal, just don't do the transfer. Otherwise, build a new Result
    613607         * object out of the input, with the additional step and time information: */
    614         this->results->AddObject(input->SpawnResult(step,time));
     608        this->results->AddObject((Object*)input->SpawnResult(step,time));
    615609
    616610}
     
    622616
    623617        for(i=0;i<this->results->Size();i++){
    624                 Result* result=this->results->GetObjectByOffset(i);
     618                Result* result=(Result*)this->results->GetObjectByOffset(i);
    625619                result->ProcessUnits(this->parameters);
    626620        }
     
    33873381
    33883382        Penta* penta=NULL;
     3383        Input* this_input=NULL;
    33893384
    33903385        /*recover parameters: */
     
    33993394
    34003395                penta=this;
     3396                this_input=this->inputs->GetInput(enum_type);
     3397                if(!this_input)ISSMERROR("%s%s"," could not find input with enum:",EnumAsString(enum_type));
    34013398
    34023399                for(;;){
     
    34063403
    34073404                        /*Add input of the basal element*/
    3408                         penta->inputs->AddInput(this->inputs->GetInput(enum_type));
     3405                        penta->inputs->AddInput(this_input);
    34093406
    34103407                        /*Stop if we have reached the surface*/
     
    49534950        *pcount=count;
    49544951}
     4952/*FUNCTION Penta::MinVel(double* pminvel, bool process_units);{{{1*/
     4953void  Penta::MinVel(double* pminvel, bool process_units){
     4954
     4955        const int numgrids=6;
     4956        double  gaussgrids[numgrids][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}};
     4957        double  vx_values[numgrids];
     4958        double  vy_values[numgrids];
     4959        double  vz_values[numgrids];
     4960        double  vel_values[numgrids];
     4961        double  minvel;
     4962
     4963        /*retrieve dim parameter: */
     4964        parameters->FindParam(&dim,DimEnum);
     4965
     4966        /*retrive velocity values at nodes */
     4967        inputs->GetParameterValues(&vx_values[0],&gaussgrids[0][0],numgrids,VxEnum);
     4968        inputs->GetParameterValues(&vy_values[0],&gaussgrids[0][0],numgrids,VyEnum);
     4969        if(dim==3) inputs->GetParameterValues(&vz_values[0],&gaussgrids[0][0],numgrids,VzEnum);
     4970
     4971        /*now, compute minimum of velocity :*/
     4972        if(dim==2){
     4973                for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2));
     4974        }
     4975        else{
     4976                for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)+pow(vz_values[i],2));
     4977        }
     4978
     4979        /*now, compute minimum:*/
     4980        minvel=vel_values[0];
     4981        for(i=1;i<numgrids;i++){
     4982                if (vel_values[i]<minvel)minvel=vel_values[i];
     4983        }
     4984
     4985        /*Assign output pointers:*/
     4986        *pminvel=minvel;
     4987
     4988}
     4989/*}}}*/
     4990/*FUNCTION Penta::MaxVel(double* pmaxvel, bool process_units);{{{1*/
     4991void  Penta::MaxVel(double* pmaxvel, bool process_units){
     4992
     4993        const int numgrids=6;
     4994        double  gaussgrids[numgrids][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}};
     4995        double  vx_values[numgrids];
     4996        double  vy_values[numgrids];
     4997        double  vz_values[numgrids];
     4998        double  vel_values[numgrids];
     4999        double  maxvel;
     5000
     5001        /*retrieve dim parameter: */
     5002        parameters->FindParam(&dim,DimEnum);
     5003
     5004        /*retrive velocity values at nodes */
     5005        inputs->GetParameterValues(&vx_values[0],&gaussgrids[0][0],numgrids,VxEnum);
     5006        inputs->GetParameterValues(&vy_values[0],&gaussgrids[0][0],numgrids,VyEnum);
     5007        if(dim==3) inputs->GetParameterValues(&vz_values[0],&gaussgrids[0][0],numgrids,VzEnum);
     5008
     5009        /*now, compute maximum of velocity :*/
     5010        if(dim==2){
     5011                for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2));
     5012        }
     5013        else{
     5014                for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)+pow(vz_values[i],2));
     5015        }
     5016
     5017        /*now, compute maximum:*/
     5018        maxvel=vel_values[0];
     5019        for(i=1;i<numgrids;i++){
     5020                if (vel_values[i]>maxvel)maxvel=vel_values[i];
     5021        }
     5022
     5023        /*Assign output pointers:*/
     5024        *pmaxvel=maxvel;
     5025
     5026}
     5027/*}}}*/
  • issm/trunk/src/c/objects/Elements/Penta.h

    r4039 r4042  
    152152                void  PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes);
    153153                void  PatchFill(int* pcount, Patch* patch);
     154                void  MinVel(double* pminvel, bool process_units);
     155                void  MaxVel(double* pmaxvel, bool process_units);
    154156
    155157                /*updates: */
  • issm/trunk/src/c/objects/Elements/Sing.cpp

    r4039 r4042  
    450450void  Sing::PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes){
    451451
    452         int     i;
    453        
    454         /*output: */
    455         int     numrows     = 0;
    456         int     numvertices = 0;
    457         int     numnodes    = 0;
    458 
    459         /*Go through all the results objects, and update the counters: */
    460         for (i=0;i<this->results->Size();i++){
    461                 Result* result=(Result*)this->results->GetObjectByOffset(i);
    462                 /*first, we have one more result: */
    463                 numrows++;
    464                 /*now, how many vertices and how many nodal values for this result? :*/
    465                 numvertices=1; //this is a sing element, with 1 vertex
    466                 numnodes=result->NumberOfNodalValues(); //ask result object.
    467         }
    468 
    469         /*Assign output pointers:*/
    470         *pnumrows=numrows;
    471         *pnumvertices=numvertices;
    472         *pnumnodes=numnodes;
     452        ISSMERROR(" not supported yet!");
    473453       
    474454}
     
    476456/*FUNCTION Sing::PatchFill(int* pcount, Patch* patch){{{1*/
    477457void  Sing::PatchFill(int* pcount, Patch* patch){
    478 
    479         int i;
    480         int count;
    481         int vertices_ids[1];
    482 
    483 
    484         /*recover pointer: */
    485         count=*pcount;
    486                
    487         /*will be needed later: */
    488         for(i=0;i<1;i++) vertices_ids[i]=nodes[i]->GetVertexId(); //vertices id start at column 3 of the patch.
    489 
    490         for(i=0;i<this->results->Size();i++){
    491                 Result* result=(Result*)this->results->GetObjectByOffset(i);
    492 
    493                 /*For this result,fill the information in the Patch object (element id + vertices ids), and then hand
    494                  *it to the result object, to fill the rest: */
    495                 patch->fillelementinfo(count,this->id,vertices_ids,1);
    496                 result->PatchFill(count,patch);
    497 
    498                 /*increment counter: */
    499                 count++;
     458       
     459        ISSMERROR(" not supported yet!");
     460}
     461/*}}}*/
     462/*FUNCTION Sing::MinVel(double* pminvel, bool process_units);{{{1*/
     463void  Sing::MinVel(double* pminvel, bool process_units){
     464
     465        double  vx;
     466        double  vy;
     467        double  vz;
     468        double  minvel;
     469
     470        /*retrive velocity values at nodes */
     471        inputs->GetParameterValue(&vx,VxEnum);
     472        inputs->GetParameterValue(&vy,VyEnum);
     473        if(dim==3)inputs->GetParameterValue(&vz,VzEnum);
     474
     475        /*now, compute minimum of velocity :*/
     476        if(dim==2){
     477                minvel=sqrt(pow(vx,2)+pow(vy,2));
     478        }
     479        else{
     480                minvel=sqrt(pow(vx,2)+pow(vy,2)+pow(vz,2));
    500481        }
    501482
    502483        /*Assign output pointers:*/
    503         *pcount=count;
    504 }
     484        *pminvel=minvel;
     485
     486}
     487/*}}}*/
     488/*FUNCTION Sing::MaxVel(double* pmaxvel, bool process_units);{{{1*/
     489void  Sing::MaxVel(double* pmaxvel, bool process_units){
     490
     491        double  vx;
     492        double  vy;
     493        double  vz;
     494        double  maxvel;
     495
     496        /*retrive velocity values at nodes */
     497        inputs->GetParameterValue(&vx,VxEnum);
     498        inputs->GetParameterValue(&vy,VyEnum);
     499        if(dim==3)inputs->GetParameterValue(&vz,VzEnum);
     500
     501        /*now, compute maximum of velocity :*/
     502        if(dim==2){
     503                maxvel=sqrt(pow(vx,2)+pow(vy,2));
     504        }
     505        else{
     506                maxvel=sqrt(pow(vx,2)+pow(vy,2)+pow(vz,2));
     507        }
     508
     509        /*Assign output pointers:*/
     510        *pmaxvel=maxvel;
     511
     512}
     513/*}}}*/
  • issm/trunk/src/c/objects/Elements/Sing.h

    r4039 r4042  
    8282                void  PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes);
    8383                void  PatchFill(int* pcount, Patch* patch);
     84                void  MinVel(double* pminvel, bool process_units);
     85                void  MaxVel(double* pmaxvel, bool process_units);
    8486
    8587                /*}}}*/
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r4039 r4042  
    438438        Parameters *beam_parameters = NULL;
    439439        Inputs     *beam_inputs     = NULL;
    440         Results     *beam_results     = NULL;
    441440
    442441        indices[0]=g0;
     
    445444        beam_parameters=this->parameters;
    446445        beam_inputs=(Inputs*)this->inputs->SpawnBeamInputs(indices);
    447         beam_results=(Results*)this->results->SpawnBeamResults(indices);
    448446
    449447        beam=new Beam();
    450448        beam->id=this->id;
    451449        beam->inputs=beam_inputs;
    452         beam->results=beam_results;
    453450        beam->parameters=beam_parameters;
    454451
     
    470467        Parameters *sing_parameters = NULL;
    471468        Inputs     *sing_inputs     = NULL;
    472         Results     *sing_results     = NULL;
    473469
    474470        sing_parameters=this->parameters;
    475471        sing_inputs=(Inputs*)this->inputs->SpawnSingInputs(index);
    476         sing_results=(Results*)this->results->SpawnSingResults(index);
    477472
    478473        sing=new Sing();
    479474        sing->id=this->id;
    480475        sing->inputs=sing_inputs;
    481         sing->results=sing_results;
    482476        sing->parameters=sing_parameters;
    483477
     
    508502        /*If we don't find it, no big deal, just don't do the transfer. Otherwise, build a new Result
    509503         * object out of the input, with the additional step and time information: */
    510         this->results->AddObject(input->SpawnResult(step,time));
     504        this->results->AddObject((Object*)input->SpawnResult(step,time));
    511505
    512506}
     
    518512
    519513        for(i=0;i<this->results->Size();i++){
    520                 Result* result=this->results->GetObjectByOffset(i);
     514                Result* result=(Result*)this->results->GetObjectByOffset(i);
    521515                result->ProcessUnits(this->parameters);
    522516        }
     
    49874981        /*copy input of enum_type*/
    49884982        oldinput=this->inputs->GetInput(enum_type);
     4983        if(!oldinput)ISSMERROR("%s%s"," could not find old input with enum: ",EnumAsString(enum_type));
    49894984        newinput=(Input*)oldinput->copy();
    49904985
     
    50655060        *prow=row;
    50665061}
     5062/*FUNCTION Tria::MinVel(double* pminvel, bool process_units);{{{1*/
     5063void  Tria::MinVel(double* pminvel, bool process_units){
     5064
     5065        const int numgrids=3;
     5066        double  gaussgrids[numgrids][3]={{1,0,0},{0,1,0},{0,0,1}};
     5067        double  vx_values[numgrids];
     5068        double  vy_values[numgrids];
     5069        double  vz_values[numgrids];
     5070        double  vel_values[numgrids];
     5071        double  minvel;
     5072
     5073        /*retrieve dim parameter: */
     5074        parameters->FindParam(&dim,DimEnum);
     5075
     5076        /*retrive velocity values at nodes */
     5077        inputs->GetParameterValues(&vx_values[0],&gaussgrids[0][0],numgrids,VxEnum);
     5078        inputs->GetParameterValues(&vy_values[0],&gaussgrids[0][0],numgrids,VyEnum);
     5079        if(dim==3) inputs->GetParameterValues(&vz_values[0],&gaussgrids[0][0],numgrids,VzEnum);
     5080
     5081        /*now, compute minimum of velocity :*/
     5082        if(dim==2){
     5083                for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2));
     5084        }
     5085        else{
     5086                for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)+pow(vz_values[i],2));
     5087        }
     5088
     5089        /*now, compute minimum:*/
     5090        minvel=vel_values[0];
     5091        for(i=1;i<numgrids;i++){
     5092                if (vel_values[i]<minvel)minvel=vel_values[i];
     5093        }
     5094
     5095        /*Assign output pointers:*/
     5096        *pminvel=minvel;
     5097
     5098}
     5099/*}}}*/
     5100/*FUNCTION Tria::MaxVel(double* pmaxvel, bool process_units);{{{1*/
     5101void  Tria::MaxVel(double* pmaxvel, bool process_units){
     5102
     5103        const int numgrids=3;
     5104        double  gaussgrids[numgrids][3]={{1,0,0},{0,1,0},{0,0,1}};
     5105        double  vx_values[numgrids];
     5106        double  vy_values[numgrids];
     5107        double  vz_values[numgrids];
     5108        double  vel_values[numgrids];
     5109        double  maxvel;
     5110
     5111        /*retrieve dim parameter: */
     5112        parameters->FindParam(&dim,DimEnum);
     5113
     5114        /*retrive velocity values at nodes */
     5115        inputs->GetParameterValues(&vx_values[0],&gaussgrids[0][0],numgrids,VxEnum);
     5116        inputs->GetParameterValues(&vy_values[0],&gaussgrids[0][0],numgrids,VyEnum);
     5117        if(dim==3) inputs->GetParameterValues(&vz_values[0],&gaussgrids[0][0],numgrids,VzEnum);
     5118
     5119        /*now, compute maximum of velocity :*/
     5120        if(dim==2){
     5121                for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2));
     5122        }
     5123        else{
     5124                for(i=0;i<numgrids;i++)vel_values=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)+pow(vz_values[i],2));
     5125        }
     5126
     5127        /*now, compute maximum:*/
     5128        maxvel=vel_values[0];
     5129        for(i=1;i<numgrids;i++){
     5130                if (vel_values[i]>maxvel)maxvel=vel_values[i];
     5131        }
     5132
     5133        /*Assign output pointers:*/
     5134        *pmaxvel=maxvel;
     5135
     5136}
     5137/*}}}*/
  • issm/trunk/src/c/objects/Elements/Tria.h

    r4039 r4042  
    128128                void  PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes);
    129129                void  PatchFill(int* pcount, Patch* patch);
     130                void  MinVel(double* pminvel, bool process_units);
     131                void  MaxVel(double* pmaxvel, bool process_units);
    130132
    131133                /*}}}*/
  • issm/trunk/src/c/objects/Inputs/BeamVertexInput.cpp

    r4039 r4042  
    227227}
    228228/*}}}*/
     229/*FUNCTION BeamVertexInput::SquareMin(double* psquaremin, bool process_units){{{1*/
     230void BeamVertexInput::SquareMin(double* psquaremin, bool process_units,Parameters* parameters){
     231
     232        int i;
     233        const int numnodes=2;
     234        double valuescopy[numnodes];
     235        double squaremin;
     236
     237        /*First,  copy values, to process units if requested: */
     238        for(i=0;i<numnodes;i++)valuescopy[i]=this->values[i];
     239
     240        /*Process units if requested: */
     241        if(process)NodalValuesUnitConversion(&valuescopy[0],numnodes,enum_type,parameters);
     242
     243        /*Now, figure out minimum of valuescopy: */
     244        squaremin=pow(valuescopy[0],2);
     245        for(i=1;i<numnodes;i++){
     246                if(pow(valuescopy[i],2)<squaremin)squaremin=pow(valuescopy[i],2);
     247        }
     248        /*Assign output pointers:*/
     249        *psquaremin=squaremin;
     250}
     251/*}}}*/
  • issm/trunk/src/c/objects/Inputs/BeamVertexInput.h

    r4039 r4042  
    7373                void GetVyStrainRate3dPattyn(double* epsilonvy,double* xyz_list, double* gauss){ISSMERROR("not implemented yet");};
    7474                void ChangeEnum(int newenumtype);
     75                void SquareMin(double* psquaremin, bool process_units,Parameters* parameters);
    7576                /*}}}*/
    7677
  • issm/trunk/src/c/objects/Inputs/BoolInput.cpp

    r4039 r4042  
    177177Result* BoolInput::SpawnResult(int step, double time){
    178178
    179         return new BoolResult(this->enum_type,this->value,step,time);
     179        ISSMERROR(" not supported yet!");
    180180
    181181}
     
    217217}
    218218/*}}}*/
     219/*FUNCTION BoolInput::SquareMin(double* psquaremin, bool process_units){{{1*/
     220void BoolInput::SquareMin(double* psquaremin, bool process_units,Parameters* parameters){
     221        /*square of a bool is the bool itself: */
     222        *psquaremin=value;
     223}
     224/*}}}*/
  • issm/trunk/src/c/objects/Inputs/BoolInput.h

    r4039 r4042  
    7373                void GetVyStrainRate3dPattyn(double* epsilonvy,double* xyz_list, double* gauss){ISSMERROR("not implemented yet");};
    7474                void ChangeEnum(int newenumtype);
     75                void SquareMin(double* psquaremin, bool process_units,Parameters* parameters);
    7576                /*}}}*/
    7677
  • issm/trunk/src/c/objects/Inputs/DoubleInput.cpp

    r4039 r4042  
    227227}
    228228/*}}}*/
     229/*FUNCTION DoubleInput::SquareMin(double* psquaremin, bool process_units){{{1*/
     230void DoubleInput::SquareMin(double* psquaremin, bool process_units,Parameters* parameters){
     231
     232        /*square min of a double is the square of the double itself: */
     233        *psquaremin=pow(value,2);
     234}
     235/*}}}*/
  • issm/trunk/src/c/objects/Inputs/DoubleInput.h

    r4039 r4042  
    7474                void GetVyStrainRate3dPattyn(double* epsilonvy,double* xyz_list, double* gauss){ISSMERROR("not implemented yet");};
    7575                void ChangeEnum(int newenumtype);
     76                void SquareMin(double* psquaremin, bool process_units,Parameters* parameters);
    7677                /*}}}*/
    7778
  • issm/trunk/src/c/objects/Inputs/Input.h

    r4039 r4042  
    5050                virtual Input* SpawnTriaInput(int* indices)=0;
    5151                virtual Result* SpawnResult(int step, double time)=0;
    52 
    53 
     52                virtual void   SquareMin(double* psquaremin, bool process_units,Parameters* parameters)=0;
    5453                /*}}}*/
    5554
  • issm/trunk/src/c/objects/Inputs/IntInput.cpp

    r4039 r4042  
    173173/*FUNCTION IntInput::SpawnResult{{{1*/
    174174Result* IntInput::SpawnResult(int step, double time){
    175 
    176         return new IntResult(this->enum_type,this->value,step,time);
     175       
     176        ISSMERROR(" not supported yet!");
    177177
    178178}
     
    214214}
    215215/*}}}*/
     216/*FUNCTION IntInput::SquareMin(double* psquaremin, bool process_units){{{1*/
     217void IntInput::SquareMin(double* psquaremin, bool process_units,Parameters* parameters){
     218
     219        /*square min of an integer is the square of the integer itself: */
     220        *psquaremin=pow(value,2);
     221}
     222/*}}}*/
  • issm/trunk/src/c/objects/Inputs/IntInput.h

    r4039 r4042  
    7373                void GetVyStrainRate3dPattyn(double* epsilonvy,double* xyz_list, double* gauss){ISSMERROR("not implemented yet");};
    7474                void ChangeEnum(int newenumtype);
     75                void SquareMin(double* psquaremin, bool process_units,Parameters* parameters);
    7576                /*}}}*/
    7677
  • issm/trunk/src/c/objects/Inputs/PentaVertexInput.cpp

    r4039 r4042  
    876876}
    877877/*}}}*/
     878/*FUNCTION PentaVertexInput::SquareMin(double* psquaremin, bool process_units){{{1*/
     879void PentaVertexInput::SquareMin(double* psquaremin, bool process_units,Parameters* parameters){
     880
     881        int i;
     882        const int numnodes=6;
     883        double valuescopy[numnodes];
     884        double squaremin;
     885
     886        /*First,  copy values, to process units if requested: */
     887        for(i=0;i<numnodes;i++)valuescopy[i]=this->values[i];
     888
     889        /*Process units if requested: */
     890        if(process)NodalValuesUnitConversion(&valuescopy[0],numnodes,enum_type,parameters);
     891
     892        /*Now, figure out minimum of valuescopy: */
     893        squaremin=pow(valuescopy[0],2);
     894        for(i=1;i<numnodes;i++){
     895                if(pow(valuescopy[i],2)<squaremin)squaremin=pow(valuescopy[i],2);
     896        }
     897        /*Assign output pointers:*/
     898        *psquaremin=squaremin;
     899}
     900/*}}}*/
  • issm/trunk/src/c/objects/Inputs/PentaVertexInput.h

    r4039 r4042  
    8282                void GetBPattyn(double* B, double* xyz_list, double* gauss_coord);
    8383                void GetBStokes(double* B, double* xyz_list, double* gauss_coord);
     84                void SquareMin(double* psquaremin, bool process_units,Parameters* parameters);
    8485                /*}}}*/
    8586
  • issm/trunk/src/c/objects/Inputs/SingVertexInput.cpp

    r4039 r4042  
    205205}
    206206/*}}}*/
     207/*FUNCTION SingVertexInput::SquareMin(double* psquaremin, bool process_units){{{1*/
     208void SingVertexInput::SquareMin(double* psquaremin, bool process_units,Parameters* parameters){
     209
     210        double valuecopy;
     211        double squaremin;
     212
     213        /*First,  copy value, to process units if requested: */
     214        valuecopy=value;
     215
     216        /*Process units if requested: */
     217        if(process)NodalValuesUnitConversion(&valuecopy,1,enum_type,parameters);
     218
     219        /*Now, return square of value, because it is the minimum: */
     220        squaremin=pow(valuecopy,2);
     221       
     222        /*Assign output pointers:*/
     223        *psquaremin=squaremin;
     224}
     225/*}}}*/
  • issm/trunk/src/c/objects/Inputs/SingVertexInput.h

    r4039 r4042  
    7272                void GetVyStrainRate3dPattyn(double* epsilonvy,double* xyz_list, double* gauss){ISSMERROR("not implemented yet");};
    7373                void ChangeEnum(int newenumtype);
     74                void SquareMin(double* psquaremin, bool process_units,Parameters* parameters);
    7475                /*}}}*/
    7576
  • issm/trunk/src/c/objects/Inputs/TriaVertexInput.cpp

    r4039 r4042  
    450450}
    451451/*}}}*/
     452/*FUNCTION TriaVertexInput::SquareMin(double* psquaremin, bool process_units){{{1*/
     453void TriaVertexInput::SquareMin(double* psquaremin, bool process_units,Parameters* parameters){
     454
     455        int i;
     456        const int numnodes=3;
     457        double valuescopy[numnodes];
     458        double squaremin;
     459
     460        /*First,  copy values, to process units if requested: */
     461        for(i=0;i<numnodes;i++)valuescopy[i]=this->values[i];
     462
     463        /*Process units if requested: */
     464        if(process)NodalValuesUnitConversion(&valuescopy[0],numnodes,enum_type,parameters);
     465
     466        /*Now, figure out minimum of valuescopy: */
     467        squaremin=pow(valuescopy[0],2);
     468        for(i=1;i<numnodes;i++){
     469                if(pow(valuescopy[i],2)<squaremin)squaremin=pow(valuescopy[i],2);
     470        }
     471        /*Assign output pointers:*/
     472        *psquaremin=squaremin;
     473}
     474/*}}}*/
  • issm/trunk/src/c/objects/Inputs/TriaVertexInput.h

    r4039 r4042  
    7979                void GetJacobian(double* J, double* xyz_list,double* gauss);
    8080                void GetJacobianInvert(double*  Jinv, double* xyz_list,double* gauss);
     81                void SquareMin(double* psquaremin, bool process_units,Parameters* parameters);
    8182                /*}}}*/
    8283
  • issm/trunk/src/c/objects/Patch.cpp

    r4039 r4042  
    5959}
    6060/*}}}*/
    61 /*FUNCTION Patch::fillelementinfo(int row, int element_id, int vertices_ids, int num_vertices);{{{1*/
    62 void Patch::fillelementinfo(int count, int element_id, int vertices_ids, int num_vertices){
     61/*FUNCTION Patch::fillelementinfo(int row, int element_id, int* vertices_ids, int num_vertices);{{{1*/
     62void Patch::fillelementinfo(int count, int element_id, int* vertices_ids, int num_vertices){
    6363
    6464        int i;
  • issm/trunk/src/c/objects/Patch.h

    r4039 r4042  
    4040                Patch(int numrows, int maxvertices, int maxnodes);
    4141                ~Patch();
    42                 void fillelementinfo(int row, int element_id, int vertices_ids, int num_vertices);
     42                void fillelementinfo(int row, int element_id, int* vertices_ids, int num_vertices);
    4343                void fillresultinfo(int row,int enum_type,int step, double time, int interpolation, double* nodal_values, int num_nodes);
    4444                void MPI_Gather(void);
  • issm/trunk/src/c/objects/Results/BeamVertexResult.cpp

    r4039 r4042  
    141141/*Result functions*/
    142142/*FUNCTION BeamVertexResult::ProcessUnits(Parameters* parameters){{{1*/
    143 Result* BeamVertexResult::ProcessUnits(Parameters* parameters){
     143void BeamVertexResult::ProcessUnits(Parameters* parameters){
    144144       
    145145        NodalValuesUnitConversion(this->values,2,this->enum_type,parameters);
  • issm/trunk/src/c/objects/Results/PentaVertexResult.cpp

    r4039 r4042  
    206206/*}}}*/
    207207/*FUNCTION PentaVertexResult::ProcessUnits(Parameters* parameters){{{1*/
    208 Result* PentaVertexResult::ProcessUnits(Parameters* parameters){
     208void PentaVertexResult::ProcessUnits(Parameters* parameters){
    209209       
    210210        NodalValuesUnitConversion(this->values,6,this->enum_type,parameters);
  • issm/trunk/src/c/objects/Results/SingVertexResult.cpp

    r4039 r4042  
    141141/*Result functions*/
    142142/*FUNCTION SingVertexResult::ProcessUnits(Parameters* parameters){{{1*/
    143 Result* SingVertexResult::ProcessUnits(Parameters* parameters){
     143void SingVertexResult::ProcessUnits(Parameters* parameters){
    144144       
    145         NodalValuesUnitConversion(this->value,1,this->enum_type,parameters);
     145        NodalValuesUnitConversion(&this->value,1,this->enum_type,parameters);
    146146
    147147}
     
    158158          * of the patch object: enum_type step time element_id interpolation vertices_ids nodal_values
    159159          * Here, we will supply the enum_type, step, time, interpolation and nodal_values: */
    160         patch->fillresultinfo(row,this->enum_type,this->step,this->time,P0Enum,this->value,1);
     160        patch->fillresultinfo(row,this->enum_type,this->step,this->time,P0Enum,&this->value,1);
    161161
    162162}
  • issm/trunk/src/c/objects/Results/TriaVertexResult.cpp

    r4039 r4042  
    195195/*}}}*/
    196196/*FUNCTION TriaVertexResult::ProcessUnits(Parameters* parameters){{{1*/
    197 Result* TriaVertexResult::ProcessUnits(Parameters* parameters){
     197void TriaVertexResult::ProcessUnits(Parameters* parameters){
    198198       
    199199        NodalValuesUnitConversion(this->values,3,this->enum_type,parameters);
  • issm/trunk/src/c/objects/objects.h

    r4039 r4042  
    5757#include "./Results/SingVertexResult.h"
    5858#include "./Results/BeamVertexResult.h"
     59#include "./Results/NodalValuesUnitConversion.h"
    5960
    6061/*Materials: */
  • issm/trunk/src/c/solutions/diagnostic.cpp

    r4039 r4042  
    9494
    9595                _printf_("write results to disk:\n");
    96                 OutputResults(femmodel,outputfilename);
     96                OutputResults(femmodel->elements, femmodel->loads, femmodel->nodes, femmodel->vertices, femmodel->materials, femmodel->parameters, outputfilename);
    9797        }
    9898        else{
  • issm/trunk/src/c/solutions/thermal.cpp

    r4039 r4042  
    8585               
    8686                _printf_("write results to disk:\n");
    87                 OutputResults(femmodel,outputfilename);
     87                OutputResults(femmodel->elements, femmodel->loads, femmodel->nodes, femmodel->vertices, femmodel->materials, femmodel->parameters, outputfilename);
    8888
    8989        }
Note: See TracChangeset for help on using the changeset viewer.