Changeset 5254
- Timestamp:
- 08/13/10 15:50:20 (15 years ago)
- Location:
- issm/trunk/src/c/objects
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/DofIndexing.cpp
r5135 r5254 27 27 this->s_set=NULL; 28 28 this->doflist=NULL; 29 this->doftype=NULL; 29 30 } 30 31 /*}}}*/ 31 32 /*FUNCTION DofIndexing::DofIndexing(int numberofdofs){{{1*/ 32 33 DofIndexing::DofIndexing(int in_numberofdofs){ 33 this->Init(in_numberofdofs );34 this->Init(in_numberofdofs,NULL); 34 35 } 35 36 /*}}}*/ … … 44 45 this->s_set=(int*)xmalloc(this->numberofdofs*sizeof(int)); 45 46 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; 46 49 47 50 for(i=0;i<this->numberofdofs;i++){ … … 49 52 this->s_set[i]=in->s_set[i]; 50 53 this->doflist[i]=in->doflist[i]; 54 if (in->doftype) this->doftype[i]=in->doftype[i]; 51 55 } 52 56 } … … 58 62 xfree((void**)&s_set); 59 63 xfree((void**)&doflist); 64 xfree((void**)&doftype); 60 65 61 66 } 62 67 /*}}}*/ 63 68 /*FUNCTION DofIndexing::Init{{{1*/ 64 void DofIndexing::Init(int in_numberofdofs ){69 void DofIndexing::Init(int in_numberofdofs,int* in_doftype){ 65 70 66 71 int i; … … 72 77 this->s_set=(int*)xmalloc(this->numberofdofs*sizeof(int)); 73 78 this->doflist=(int*)xmalloc(this->numberofdofs*sizeof(int)); 74 79 if (in_doftype) this->doftype=(int*)xmalloc(this->numberofdofs*sizeof(int)); 75 80 76 81 for (i=0;i<this->numberofdofs;i++){ … … 79 84 this->s_set[i]=0; 80 85 this->doflist[i]=UNDEF; 86 if(in_doftype) this->doftype[i]=in_doftype[i]; 81 87 } 82 88 } … … 115 121 printf("\n"); 116 122 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 117 132 } 118 133 /*}}}*/ … … 122 137 char* marshalled_dataset=NULL; 123 138 int enum_type; 139 int flagdoftype; 124 140 125 141 /*recover marshalled_dataset: */ … … 141 157 memcpy(doflist,marshalled_dataset,numberofdofs*sizeof(int));marshalled_dataset+=numberofdofs*sizeof(int); 142 158 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 143 166 /*return: */ 144 167 *pmarshalled_dataset=marshalled_dataset; … … 151 174 char* marshalled_dataset=NULL; 152 175 int enum_type=0; 176 int flagdoftype; //to indicate if there are some doftype or if NULL 153 177 154 178 /*recover marshalled_dataset: */ … … 168 192 memcpy(marshalled_dataset,doflist,numberofdofs*sizeof(int));marshalled_dataset+=numberofdofs*sizeof(int); 169 193 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 170 205 *pmarshalled_dataset=marshalled_dataset; 171 206 return; … … 174 209 /*FUNCTION DofIndexing::MarshallSize{{{1*/ 175 210 int 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 } 176 219 177 220 return sizeof(numberofdofs)+ … … 180 223 numberofdofs*sizeof(int)+ 181 224 numberofdofs*sizeof(int)+ 225 doftype_size+ 182 226 sizeof(int); //sizeof(int) for enum type 183 227 } -
issm/trunk/src/c/objects/DofIndexing.h
r5096 r5254 21 21 /*list of degrees of freedom: */ 22 22 int* doflist; //dof list on which we solve 23 int* doftype; //approximation type of the dofs (used only for coupling) 23 24 24 25 /*DofIndexing constructors, destructors {{{1*/ 25 26 DofIndexing(); 26 27 DofIndexing(int numberofdofs); 27 void Init(int numberofdofs );28 void Init(int numberofdofs,int* doftype); 28 29 DofIndexing(DofIndexing* properties); 29 30 ~DofIndexing(); -
issm/trunk/src/c/objects/Node.cpp
r5152 r5254 23 23 /*FUNCTION Node::Node() default constructor {{{1*/ 24 24 Node::Node(){ 25 this->inputs=NULL;26 this->hvertex=NULL;27 return;25 this->inputs=NULL; 26 this->hvertex=NULL; 27 return; 28 28 } 29 29 /*}}}*/ … … 71 71 72 72 /*indexing:*/ 73 DistributeNumDofs(& numdofs,analysis_type,iomodel->vertices_type+2*io_index); //number of dofs per node74 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; 75 75 76 76 /*Hooks*/
Note:
See TracChangeset
for help on using the changeset viewer.