Changeset 15317


Ignore:
Timestamp:
06/22/13 10:59:15 (12 years ago)
Author:
Eric.Larour
Message:

CHG: some modifications to the IndependentObject so as to allow an arbitrary number of independent variable
types. The goal is to start introducing forcings.

Location:
issm/trunk-jpl/src/c/classes
Files:
2 edited

Legend:

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

    r15104 r15317  
    1818        this->name=NoneEnum;
    1919        this->type=0;
    20         this->numberofvertices=0;
    21 }
    22 /*}}}*/
    23 /*FUNCTION IndependentObject::IndependentObject(int in_name, int in_type,int in_numberofvertices){{{*/
    24 IndependentObject::IndependentObject(int in_name, int in_type,int in_numberofvertices){
    25 
    26         this->numberofvertices=0;
     20        this->numberofindependents=0;
     21}
     22/*}}}*/
     23/*FUNCTION IndependentObject::IndependentObject(int in_name, int in_type){{{*/
     24IndependentObject::IndependentObject(int in_name, int in_type){
     25
     26        this->numberofindependents=0;
    2727        this->name=in_name;
    2828        this->type=in_type;
    2929        if(in_type!=0 && in_type!=1)_error_("cannot create an IndependentObject of type " << in_type);
    30         if(this->type==1)this->numberofvertices=in_numberofvertices;
    3130
    3231}
     
    4948        else
    5049                _error_(" unknown type: " << this->type);
    51         _printf_("   numberofvertices: " << this->numberofvertices << "\n");
     50        _printf_("   numberofindependents: " << this->numberofindependents << "\n");
    5251}
    5352/*}}}*/
     
    6968/*FUNCTION IndependentObject::copy{{{*/
    7069Object* IndependentObject::copy(void) {
    71         return new IndependentObject(name,type,numberofvertices);
     70        return new IndependentObject(name,type,numberofindependents);
    7271} /*}}}*/
    7372
     
    118117                iomodel->data[name]=scalar_slot;
    119118                iomodel->independents[name]=true;
     119
     120                //finally, record the number of independents:
     121                this->numberofindependents=1;
    120122
    121123        } /*}}}*/
     
    173175                iomodel->data[name]=matrix;
    174176                iomodel->independents[name]=true;
     177               
     178                //Finally, record the number of independents created:
     179                this->numberofindependents=M*N;
     180
    175181        }/*}}}*/
    176182        else _error_("should not have a type of " << type);
     
    182188int  IndependentObject::NumIndependents(void){
    183189
    184         /*Branch according to the type of variable: */
    185         if(type==0){ /*scalar:*/
    186                 return 1;
    187         }
    188         else if(type==1){ /* vector:*/
    189                 return this->numberofvertices;
    190         }
    191         else _error_("should not have a type of " << type);
     190        return this->numberofindependents;;
    192191}
    193192/*}}}*/
     
    203202        else if(type==1){ /* vector:*/
    204203                IssmDouble* values=data[name];
    205                 for(i=0;i<this->numberofvertices;i++){
     204                for(i=0;i<this->numberofindependents;i++){
    206205                        xp[i]=values[i];
    207206                }
  • issm/trunk-jpl/src/c/classes/IndependentObject.h

    r15067 r15317  
    1818                int name;
    1919                int type;  /*0: scalar, 1: vertex*/
    20                 int numberofvertices;
     20                int numberofindependents;
    2121
    2222                /*IndependentObject constructors, destructors {{{*/
Note: See TracChangeset for help on using the changeset viewer.