Changeset 18877


Ignore:
Timestamp:
11/28/14 09:48:01 (10 years ago)
Author:
Eric.Larour
Message:

CHG: new overloaded response function, as now output definitions can be computed either according to their
name, or their associated enum.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk-jpl/src/c/modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.cpp ΒΆ

    r18522 r18877  
    3838
    3939}
     40
     41IssmDouble OutputDefinitionsResponsex(FemModel* femmodel,int output_enum){
     42
     43        /*Ok, go find the output definitions dataset in the parameters, where our responses are hiding: */
     44        DataSet* output_definitions=((DataSetParam*)femmodel->parameters->FindParamObject(OutputdefinitionEnum))->value;
     45
     46        /*Now, go through the output definitions, and retrieve the object which corresponds to our requested response, output_enum: */
     47        for(int i=0;i<output_definitions->Size();i++){
     48               
     49                //Definition* definition=xDynamicCast<Definition*>(output_definitions->GetObjectByOffset(i));
     50                Definition* definition=dynamic_cast<Definition*>(output_definitions->GetObjectByOffset(i));
     51
     52                int en = definition->DefinitionEnum();
     53                if(en==output_enum){
     54
     55                        /*This is the object that we have been chasing for. compute the response and return: */
     56                        IssmDouble return_value=definition->Response(femmodel);
     57               
     58                        /*return:*/
     59                        return return_value;
     60                }
     61        }
     62       
     63        /*If we are here, did not find the definition for this response, not good!: */
     64        _error_("Could not find the response for output definition " << output_enum << " because could not find the definition itself!");
     65
     66}
Note: See TracChangeset for help on using the changeset viewer.