Changeset 4887
- Timestamp:
- 07/29/10 14:58:36 (15 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp
r4611 r4887 65 65 count=0; 66 66 67 if(iomodel->numpenalties){68 69 for (i=0;i<iomodel->numpenalties;i++){70 71 for(j=1;j<iomodel->numlayers;j++){72 73 /*We are pairing nodes along a vertical profile.*/74 node1=(int)*(iomodel->penalties+iomodel->numlayers*i)+iomodel->nodecounter;75 node2=(int)*(iomodel->penalties+iomodel->numlayers*i+j)+iomodel->nodecounter;76 77 constraints->AddObject(new Rgb(iomodel->constraintcounter+count+1,node1,node2,1,DiagnosticHorizAnalysisEnum)); //add count'th Rgb on dof 1 between node1 and node278 79 count++;80 81 constraints->AddObject(new Rgb(iomodel->constraintcounter+count+1,node1,node2,2,DiagnosticHorizAnalysisEnum)); //add count'th Rgb on dof 1 between node1 and node282 83 }84 }85 }67 // if(iomodel->numpenalties){ 68 // 69 // for (i=0;i<iomodel->numpenalties;i++){ 70 // 71 // for(j=1;j<iomodel->numlayers;j++){ 72 // 73 // /*We are pairing nodes along a vertical profile.*/ 74 // node1=(int)*(iomodel->penalties+iomodel->numlayers*i)+iomodel->nodecounter; 75 // node2=(int)*(iomodel->penalties+iomodel->numlayers*i+j)+iomodel->nodecounter; 76 // 77 // constraints->AddObject(new Rgb(iomodel->constraintcounter+count+1,node1,node2,1,DiagnosticHorizAnalysisEnum)); //add count'th Rgb on dof 1 between node1 and node2 78 // 79 // count++; 80 // 81 // constraints->AddObject(new Rgb(iomodel->constraintcounter+count+1,node1,node2,2,DiagnosticHorizAnalysisEnum)); //add count'th Rgb on dof 1 between node1 and node2 82 // 83 // } 84 // } 85 // } 86 86 87 87 /*Free data: */ -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp
r4236 r4887 23 23 int i; 24 24 int count=0; 25 int penpair_ids[2]; 25 26 26 27 /*Recover pointer: */ … … 69 70 xfree((void**)&iomodel->bed); 70 71 72 /*Create Penpair for penalties: */ 73 IoModelFetchData(&iomodel->penalties,&iomodel->numpenalties,NULL,iomodel_handle,"penalties"); 74 75 if(iomodel->numpenalties){ 76 for(i=0;i<iomodel->numpenalties;i++){ 77 78 //if((iomodel->my_vertices[iomodel->penalties[2*i+0]]==1)){ 79 penpair_ids[0]=(int)iomodel->penalties[2*i+0]; 80 penpair_ids[1]=(int)iomodel->penalties[2*i+1]; 81 82 loads->AddObject(new Penpair(iomodel->loadcounter+count+1,&penpair_ids[0],DiagnosticHorizAnalysisEnum)); 83 count++; 84 //} 85 } 86 } 87 88 /*free ressources: */ 89 xfree((void**)&iomodel->penalties); 90 71 91 /*Create Riffront loads for rifts: */ 72 92 IoModelFetchData(&iomodel->riftinfo,&iomodel->numrifts,NULL,iomodel_handle,"riftinfo"); -
issm/trunk/src/c/objects/Loads/Penpair.cpp
r4575 r4887 22 22 23 23 this->hnodes=NULL; 24 this->parameters=NULL; 24 25 return; 25 26 } … … 27 28 /*FUNCTION Penpair::creation {{{1*/ 28 29 Penpair::Penpair(int penpair_id, int* penpair_node_ids,int in_analysis_type){ 29 30 30 31 31 this->id=penpair_id; 32 32 this->analysis_type=in_analysis_type; 33 33 this->hnodes=new Hook(penpair_node_ids,2); 34 35 return; 36 } 37 /*}}}1*/ 38 /*FUNCTION Penpair::creation {{{1*/ 39 Penpair::Penpair(int penpair_id, Hook* penpair_hnodes,int in_analysis_type){ 40 41 /*all the initialization has been done by the initializer, just fill in the id: */ 42 this->id=penpair_id; 43 this->analysis_type=in_analysis_type; 44 this->hnodes=penpair_hnodes; 34 this->parameters=NULL; 45 35 46 36 return; … … 140 130 hnodes=new Hook(); hnodes->Demarshall(&marshalled_dataset); 141 131 132 /*parameters: may not exist even yet, so let Configure handle it: */ 133 this->parameters=NULL; 134 142 135 /*return: */ 143 136 *pmarshalled_dataset=marshalled_dataset; … … 164 157 /*now deal with hooks and objects: */ 165 158 penpair->hnodes=(Hook*)this->hnodes->copy(); 159 160 /*point parameters: */ 161 penpair->parameters=this->parameters; 166 162 167 163 return penpair; … … 177 173 * datasets, using internal ids and offsets hidden in hooks: */ 178 174 hnodes->configure(nodesin); 175 /*point parameters to real dataset: */ 176 this->parameters=parametersin; 179 177 180 178 } … … 187 185 hnodes->configure(nodesin); 188 186 187 /*point parameters to real dataset: */ 188 this->parameters=parametersin; 189 189 } 190 190 /*}}}1*/ 191 191 /*FUNCTION Penpair::CreateKMatrix {{{1*/ 192 192 void Penpair::CreateKMatrix(Mat Kgg){ 193 193 /*If you code this piece, don't forget that a penalty will be inactive if it is dealing with clone nodes*/ 194 194 /*No loads applied, do nothing: */ 195 195 return; … … 207 207 /*FUNCTION Penpair::PenaltyCreateKMatrix {{{1*/ 208 208 void Penpair::PenaltyCreateKMatrix(Mat Kgg,double kmax){ 209 210 /*If you code this piece, don't forget that a penalty will be inactive if it is dealing with clone nodes*/ 211 /*No loads applied, do nothing: */ 212 return; 209 int analysis_type; 210 211 /*Retrieve parameters: */ 212 this->parameters->FindParam(&analysis_type,AnalysisTypeEnum); 213 214 if (analysis_type==DiagnosticHorizAnalysisEnum){ 215 PenaltyCreateKMatrixDiagnosticHoriz(Kgg,kmax); 216 } 217 else{ 218 ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumAsString(analysis_type)); 219 } 213 220 } 214 221 /*}}}1*/ … … 225 232 } 226 233 /*}}}*/ 234 235 /*Update virtual functions definitions:*/ 236 /*FUNCTION Penpair::InputUpdateFromConstant(double constant, int name) {{{1*/ 237 void Penpair::InputUpdateFromConstant(double constant, int name){ 238 /*Nothing updated yet*/ 239 } 240 /*}}}*/ 241 /*FUNCTION Penpair::InputUpdateFromConstant(int constant, int name) {{{1*/ 242 void Penpair::InputUpdateFromConstant(int constant, int name){ 243 /*Nothing updated yet*/ 244 } 245 /*}}}*/ 246 /*FUNCTION Penpair::InputUpdateFromConstant(bool constant, int name) {{{1*/ 247 void Penpair::InputUpdateFromConstant(bool constant, int name){ 248 /*Nothing updated yet*/ 249 } 250 /*}}}*/ 251 252 /*Penpair management:*/ 253 /*FUNCTION Penpair::PenaltyCreateKMatrixDiagnosticHoriz {{{1*/ 254 void Penpair::PenaltyCreateKMatrixDiagnosticHoriz(Mat Kgg,double kmax){ 255 256 const int numgrids=2; 257 const int NDOF2=2; 258 const int numdof=numgrids*NDOF2; 259 int doflist[numdof]; 260 int numberofdofspernode; 261 262 double Ke[4][4]={0.0}; 263 double penalty_offset; 264 265 /*pointers: */ 266 Node** nodes=NULL; 267 268 /*Get dof list: */ 269 GetDofList(&doflist[0],&numberofdofspernode); 270 271 /*recover pointers: */ 272 nodes=(Node**)hnodes->deliverp(); 273 274 /*recover parameters: */ 275 parameters->FindParam(&penalty_offset,PenaltyOffsetEnum); 276 277 //Create elementary matrix: add penalty to 278 Ke[0][0]=kmax*pow((double)10.0,penalty_offset); 279 Ke[0][2]=-kmax*pow((double)10.0,penalty_offset); 280 Ke[2][0]=-kmax*pow((double)10.0,penalty_offset); 281 Ke[2][2]=kmax*pow((double)10.0,penalty_offset); 282 283 Ke[1][1]=kmax*pow((double)10.0,penalty_offset); 284 Ke[1][3]=-kmax*pow((double)10.0,penalty_offset); 285 Ke[3][1]=-kmax*pow((double)10.0,penalty_offset); 286 Ke[3][3]=kmax*pow((double)10.0,penalty_offset); 287 288 /*Add Ke to global matrix Kgg: */ 289 MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke,ADD_VALUES); 290 } 291 /*}}}1*/ 292 /*FUNCTION Penpair::GetDofList {{{1*/ 293 void Penpair::GetDofList(int* doflist,int* pnumberofdofspernode){ 294 295 int i,j; 296 int doflist_per_node[MAXDOFSPERNODE]; 297 int numberofdofspernode; 298 299 /*pointers: */ 300 Node** nodes=NULL; 301 302 /*recover pointers: */ 303 nodes=(Node**)hnodes->deliverp(); 304 305 /*Some checks for debugging*/ 306 ISSMASSERT(doflist); 307 ISSMASSERT(pnumberofdofspernode); 308 ISSMASSERT(nodes); 309 310 /*Build doflist from nodes*/ 311 for(i=0;i<2;i++){ 312 nodes[i]->GetDofList(&doflist_per_node[0],&numberofdofspernode); 313 for(j=0;j<numberofdofspernode;j++){ 314 doflist[i*numberofdofspernode+j]=doflist_per_node[j]; 315 } 316 } 317 318 /*Assign output pointers:*/ 319 *pnumberofdofspernode=numberofdofspernode; 320 321 } 322 /*}}}*/ -
issm/trunk/src/c/objects/Loads/Penpair.h
r4575 r4887 22 22 Hook* hnodes; //hook to 2 nodes 23 23 24 Parameters* parameters; //pointer to solution parameters 25 24 26 public: 25 27 … … 27 29 Penpair(); 28 30 Penpair(int penpair_id,int* penpair_node_ids,int analysis_type); 29 Penpair(int penpair_id,Hook* penpair_hnodes,int analysis_type);30 31 ~Penpair(); 31 32 /*}}}*/ … … 45 46 void InputUpdateFromVector(int* vector, int name, int type){ISSMERROR("Not implemented yet!");} 46 47 void InputUpdateFromVector(bool* vector, int name, int type){ISSMERROR("Not implemented yet!");} 47 void InputUpdateFromConstant(double constant, int name) {ISSMERROR("Not implemented yet!");}48 void InputUpdateFromConstant(int constant, int name) {ISSMERROR("Not implemented yet!");}49 void InputUpdateFromConstant(bool constant, int name) {ISSMERROR("Not implemented yet!");}48 void InputUpdateFromConstant(double constant, int name); 49 void InputUpdateFromConstant(int constant, int name); 50 void InputUpdateFromConstant(bool constant, int name); 50 51 void InputUpdateFromSolution(double* solution){ISSMERROR("Not implemented yet!");} 51 52 /*}}}*/ … … 59 60 bool InAnalysis(int analysis_type); 60 61 /*}}}*/ 62 /*Penpair management: {{{1*/ 63 void PenaltyCreateKMatrixDiagnosticHoriz(Mat Kgg,double kmax); 64 void GetDofList(int* doflist,int* pnumberofdofspernode); 65 /*}}}*/ 61 66 }; 62 67
Note:
See TracChangeset
for help on using the changeset viewer.