Changeset 16400


Ignore:
Timestamp:
10/11/13 15:07:56 (11 years ago)
Author:
Eric.Larour
Message:

CHG: trying autodiff output definition responses

Location:
issm/trunk-jpl/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/DependentObject.cpp

    r16314 r16400  
    1515/*FUNCTION DependentObject::DependentObject(){{{*/
    1616DependentObject::DependentObject(){
    17         this->name=NoneEnum;
     17        this->name=NulL;
    1818        this->type=0;
    1919        this->index=-1;
     
    2323DependentObject::DependentObject(int in_name, int in_type,int in_index){
    2424
    25         this->name=in_name;
     25        this->name=xNew<char>(strlen(in_name)+1); xMemCpy<char>(this->name,in_name,strlen(in_name)+1);
    2626        this->type=in_type;
    2727        this->index=in_index;
     
    3333/*FUNCTION DependentObject::~DependentObject() {{{*/
    3434DependentObject::~DependentObject(){ //destructor
     35        xDelete<char>(this->name);
    3536}
    3637/*}}}*/
     
    4142
    4243        _printf_("DependentObject:\n");
    43         _printf_("   name: " << EnumToStringx(this->name) << "\n");
     44        _printf_("   name: " << this->name << "\n");
    4445        if(this->type==0)
    4546                _printf_("   type: scalar\n");
     
    8889void  DependentObject::Responsex(IssmDouble* poutput_value,FemModel* femmodel){
    8990
    90         if(this->name==MassFluxEnum){
    91 
    92                 /*to identify the mass flux that will be computed, we need the index of the profile: */
    93                 femmodel->parameters->SetParam(this->index,IndexEnum);
     91        /*Is this some special type of response for which we need to go in the output definitions? :*/
     92        if (StringToEnumx(this->name,false)==-1){
     93                *poutput_value=OutputDefinitionsResponsex(femmodel,this->name);
    9494        }
    95 
    96         femmodel->Responsex(poutput_value,this->name);
     95        else femmodel->Responsex(poutput_value,this->name);
    9796
    9897}
  • issm/trunk-jpl/src/c/classes/DependentObject.h

    r15067 r16400  
    1717        public:
    1818
    19                 int name;
     19                char* name;
    2020                int type;  /*0: scalar, 1: vertex*/
    2121                int index;  /*0: scalar, 1: vertex*/
     
    2323                /*DependentObject constructors, destructors {{{*/
    2424                DependentObject();
    25                 DependentObject(int name, int type,int index);
     25                DependentObject(char* name, int type,int index);
    2626                ~DependentObject();
    2727                /*}}}*/
  • issm/trunk-jpl/src/c/modules/ModelProcessorx/Autodiff/CreateParametersAutodiff.cpp

    r16252 r16400  
    1515        int         num_dependent_objects;
    1616        int         num_dep=0;
    17         int*        names=NULL;
     17        char**      names=NULL;
    1818        int*        types=NULL;
    1919        int         dummy;
     
    7171
    7272                if(num_dependent_objects){
    73                         iomodel->FetchData(&names,&dummy,&dummy,AutodiffDependentObjectNamesEnum);
     73                        iomodel->FetchData(&names,&dummy,AutodiffDependentObjectNamesEnum);
    7474                        iomodel->FetchData(&types,&dummy,&dummy,AutodiffDependentObjectTypesEnum);
    7575                        iomodel->FetchData(&indices,&dummy,&dummy,AutodiffDependentObjectIndicesEnum);
  • issm/trunk-jpl/src/m/classes/autodiff.m

    r16304 r16400  
    101101
    102102                        if(num_dependent_objects),
    103                                 names=zeros(num_dependent_objects,1);
     103                                names={};
    104104                                types=zeros(num_dependent_objects,1);
    105105                                indices=zeros(num_dependent_objects,1);
     
    108108                                        dep=obj.dependents{i};
    109109
    110                                         names(i)=StringToEnum(dep.name);
     110                                        names{i}=dep.name;
    111111                                        types(i)=dep.typetoscalar();
    112112                                        indices(i)=dep.index;
    113113                                end
    114                                 WriteData(fid,'data',names,'enum',AutodiffDependentObjectNamesEnum(),'format','IntMat','mattype',3);
     114                                WriteData(fid,'data',names,'enum',AutodiffDependentObjectNamesEnum(),'format','StringArray');
    115115                                WriteData(fid,'data',types,'enum',AutodiffDependentObjectTypesEnum(),'format','IntMat','mattype',3);
    116116                                WriteData(fid,'data',indices,'enum',AutodiffDependentObjectIndicesEnum(),'format','IntMat','mattype',3);
  • issm/trunk-jpl/src/m/classes/autodiff.py

    r16304 r16400  
    103103
    104104                if num_dependent_objects:
    105                         names=numpy.zeros(num_dependent_objects)
     105                        names=[]
    106106                        types=numpy.zeros(num_dependent_objects)
    107107                        indices=numpy.zeros(num_dependent_objects)
    108108
    109109                        for i,dep in enumerate(self.dependents):
    110                                 names[i]=StringToEnum(dep.name)[0]
     110                                names[i]=dep.name
    111111                                types[i]=dep.typetoscalar()
    112112                                indices[i]=dep.index
    113113
    114                         WriteData(fid,'data',names,'enum',AutodiffDependentObjectNamesEnum(),'format','IntMat','mattype',3)
     114                        WriteData(fid,'data',names,'enum',AutodiffDependentObjectNamesEnum(),'format','StringArray')
    115115                        WriteData(fid,'data',types,'enum',AutodiffDependentObjectTypesEnum(),'format','IntMat','mattype',3)
    116116                        WriteData(fid,'data',indices,'enum',AutodiffDependentObjectIndicesEnum(),'format','IntMat','mattype',3)
Note: See TracChangeset for help on using the changeset viewer.