Changeset 5254


Ignore:
Timestamp:
08/13/10 15:50:20 (15 years ago)
Author:
seroussi
Message:

added doftype in DofIndexing

Location:
issm/trunk/src/c/objects
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/objects/DofIndexing.cpp

    r5135 r5254  
    2727        this->s_set=NULL;
    2828        this->doflist=NULL;
     29        this->doftype=NULL;
    2930}
    3031/*}}}*/
    3132/*FUNCTION DofIndexing::DofIndexing(int numberofdofs){{{1*/
    3233DofIndexing::DofIndexing(int in_numberofdofs){
    33         this->Init(in_numberofdofs);
     34        this->Init(in_numberofdofs,NULL);
    3435}
    3536/*}}}*/
     
    4445        this->s_set=(int*)xmalloc(this->numberofdofs*sizeof(int));
    4546        this->doflist=(int*)xmalloc(this->numberofdofs*sizeof(int));
     47        if (in->doftype) this->doftype=(int*)xmalloc(this->numberofdofs*sizeof(int));
     48        else this->doftype=NULL;
    4649
    4750        for(i=0;i<this->numberofdofs;i++){
     
    4952                this->s_set[i]=in->s_set[i];
    5053                this->doflist[i]=in->doflist[i];
     54                if (in->doftype) this->doftype[i]=in->doftype[i];
    5155        }
    5256}
     
    5862        xfree((void**)&s_set);
    5963        xfree((void**)&doflist);
     64        xfree((void**)&doftype);
    6065
    6166}
    6267/*}}}*/
    6368/*FUNCTION DofIndexing::Init{{{1*/
    64 void DofIndexing::Init(int in_numberofdofs){
     69void DofIndexing::Init(int in_numberofdofs,int* in_doftype){
    6570
    6671        int i;
     
    7277        this->s_set=(int*)xmalloc(this->numberofdofs*sizeof(int));
    7378        this->doflist=(int*)xmalloc(this->numberofdofs*sizeof(int));
    74 
     79        if (in_doftype) this->doftype=(int*)xmalloc(this->numberofdofs*sizeof(int));
    7580
    7681        for (i=0;i<this->numberofdofs;i++){
     
    7984                this->s_set[i]=0;
    8085                this->doflist[i]=UNDEF;
     86                if(in_doftype) this->doftype[i]=in_doftype[i];
    8187        }
    8288}
     
    115121        printf("\n");
    116122
     123        if(doftype){
     124                printf("   doftype: |");
     125                for(i=0;i<numberofdofs;i++){
     126                        printf(" %i |",doftype[i]);
     127                }
     128                printf("\n");
     129        }
     130        else printf("   NULL doftype");
     131
    117132}               
    118133/*}}}*/
     
    122137        char* marshalled_dataset=NULL;
    123138        int   enum_type;
     139        int   flagdoftype;
    124140
    125141        /*recover marshalled_dataset: */
     
    141157        memcpy(doflist,marshalled_dataset,numberofdofs*sizeof(int));marshalled_dataset+=numberofdofs*sizeof(int);
    142158       
     159        memcpy(&flagdoftype,marshalled_dataset,sizeof(flagdoftype));marshalled_dataset+=sizeof(flagdoftype);
     160        if(flagdoftype){ // there is a hook so demarshall it
     161                this->doftype=(int*)xmalloc(this->numberofdofs*sizeof(int));
     162                memcpy(doftype,marshalled_dataset,numberofdofs*sizeof(int));marshalled_dataset+=numberofdofs*sizeof(int);
     163        }
     164        else this->doftype=NULL; //There is no coupling, so doftype is NULL
     165
    143166        /*return: */
    144167        *pmarshalled_dataset=marshalled_dataset;
     
    151174        char* marshalled_dataset=NULL;
    152175        int   enum_type=0;
     176        int   flagdoftype; //to indicate if there are some doftype or if NULL
    153177
    154178        /*recover marshalled_dataset: */
     
    168192        memcpy(marshalled_dataset,doflist,numberofdofs*sizeof(int));marshalled_dataset+=numberofdofs*sizeof(int);
    169193
     194        /*marshall doftype if there are some and add a flag*/
     195        if(this->doftype){
     196                flagdoftype=1;
     197                memcpy(marshalled_dataset,&flagdoftype,sizeof(flagdoftype));marshalled_dataset+=sizeof(flagdoftype);
     198                memcpy(marshalled_dataset,doftype,numberofdofs*sizeof(int));marshalled_dataset+=numberofdofs*sizeof(int);
     199        }
     200        else{
     201                flagdoftype=0;
     202                memcpy(marshalled_dataset,&flagdoftype,sizeof(flagdoftype));marshalled_dataset+=sizeof(flagdoftype);
     203        }
     204
    170205        *pmarshalled_dataset=marshalled_dataset;
    171206        return;
     
    174209/*FUNCTION DofIndexing::MarshallSize{{{1*/
    175210int   DofIndexing::MarshallSize(){
     211
     212        int doftype_size=0;
     213       
     214        /*FInd size of doftype*/
     215        doftype_size+=sizeof(int); //Flag 0 or 1
     216        if (this->doftype){
     217                doftype_size+=numberofdofs*sizeof(int);
     218        }
    176219
    177220        return sizeof(numberofdofs)+
     
    180223                numberofdofs*sizeof(int)+
    181224                numberofdofs*sizeof(int)+
     225                doftype_size+
    182226                sizeof(int); //sizeof(int) for enum type
    183227}
  • issm/trunk/src/c/objects/DofIndexing.h

    r5096 r5254  
    2121                /*list of degrees of freedom: */
    2222                int*     doflist; //dof list on which we solve
     23                int*     doftype; //approximation type of the dofs (used only for coupling)
    2324
    2425                /*DofIndexing constructors, destructors {{{1*/
    2526                DofIndexing();
    2627                DofIndexing(int numberofdofs);
    27                 void Init(int numberofdofs);
     28                void Init(int numberofdofs,int* doftype);
    2829                DofIndexing(DofIndexing* properties);
    2930                ~DofIndexing();
  • issm/trunk/src/c/objects/Node.cpp

    r5152 r5254  
    2323/*FUNCTION Node::Node() default constructor {{{1*/
    2424Node::Node(){
    25         this->inputs=NULL;
    26         this->hvertex=NULL;
    27         return;
     25                 this->inputs=NULL;
     26                 this->hvertex=NULL;
     27                 return;
    2828}
    2929/*}}}*/
     
    7171
    7272        /*indexing:*/
    73         DistributeNumDofs(&numdofs,analysis_type,iomodel->vertices_type+2*io_index); //number of dofs per node
    74         this->indexing.Init(numdofs);
     73        DistributeNumDofs(&this->indexing,analysis_type,iomodel->vertices_type+2*io_index); //number of dofs per node
     74        numdofs=this->indexing.numberofdofs;
    7575
    7676        /*Hooks*/
Note: See TracChangeset for help on using the changeset viewer.