Changeset 23960
- Timestamp:
- 05/29/19 22:26:27 (6 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/HydrologyGlaDSAnalysis.cpp
r23954 r23960 26 26 if(hydrology_model!=HydrologyGlaDSEnum) return; 27 27 28 /*No extra loads*/ 28 /*Add channels?*/ 29 bool ischannels; 30 iomodel->FindConstant(&ischannels,"md.hydrology.ischannels"); 31 if(ischannels){ 32 /*Get faces (edges in 2d)*/ 33 CreateFaces(iomodel); 34 for(int i=0;i<iomodel->numberoffaces;i++){ 35 /*Get left and right elements*/ 36 int element=iomodel->faces[4*i+2]-1; //faces are [node1 node2 elem1 elem2] 37 38 /*Now, if this element is not in the partition*/ 39 if(!iomodel->my_elements[element]) continue; 40 41 /* Add load */ 42 loads->AddObject(new Channel(i+1,i,i,iomodel)); 43 } 44 45 /*Free data: */ 46 } 29 47 }/*}}}*/ 30 48 void HydrologyGlaDSAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel,bool isamr){/*{{{*/ -
issm/trunk-jpl/src/c/classes/Loads/Channel.cpp
r23946 r23960 28 28 Channel::Channel(int channel_id,int i,int index,IoModel* iomodel){/*{{{*/ 29 29 30 /* Intermediary */ 31 int j; 32 int pos1,pos2,pos3,pos4; 33 int num_nodes; 34 35 /*channel constructor data: */ 36 int channel_elem_ids[2]; 37 int channel_vertex_ids[2]; 38 int channel_node_ids[4]; 39 int channel_type; 40 41 /*Get edge*/ 30 this->id=channel_id; 31 this->parameters = NULL; 32 this->element = NULL; 33 this->nodes = NULL; 34 35 /*Get edge info*/ 42 36 int i1 = iomodel->faces[4*index+0]; 43 37 int i2 = iomodel->faces[4*index+1]; … … 45 39 int e2 = iomodel->faces[4*index+3]; 46 40 47 /*First, see wether this is an internal or boundary edge (if e2=-1)*/ 48 if(e2==-1){ 49 /* Boundary edge, only one element */ 50 num_nodes=2; 51 channel_type=BoundaryEnum; 52 channel_elem_ids[0]=e1; 53 } 54 else{ 55 /* internal edge: connected to 2 elements */ 56 num_nodes=4; 57 channel_type=InternalEnum; 58 channel_elem_ids[0]=e1; 59 channel_elem_ids[1]=e2; 60 } 61 62 /*1: Get vertices ids*/ 41 /*Set Element hook (4th column may be -1 for boundary edges)*/ 42 this->helement = new Hook(&e1,1); 43 44 /*Set Vertices hooks (4th column may be -1 for boundary edges)*/ 45 int channel_vertex_ids[2]; 63 46 channel_vertex_ids[0]=i1; 64 47 channel_vertex_ids[1]=i2; 65 66 /*2: Get node ids*/67 if (channel_type==InternalEnum){68 69 /*Now, we must get the nodes of the 4 nodes located on the edge*/70 71 /*2: Get the column where these ids are located in the index*/72 pos1=pos2=pos3=pos4=UNDEF;73 for(j=0;j<3;j++){74 if(iomodel->elements[3*(e1-1)+j]==i1) pos1=j+1;75 if(iomodel->elements[3*(e1-1)+j]==i2) pos2=j+1;76 if(iomodel->elements[3*(e2-1)+j]==i1) pos3=j+1;77 if(iomodel->elements[3*(e2-1)+j]==i2) pos4=j+1;78 }79 _assert_(pos1!=UNDEF && pos2!=UNDEF && pos3!=UNDEF && pos4!=UNDEF);80 81 /*3: We have the id of the elements and the position of the vertices in the index82 * we can compute their dofs!*/83 channel_node_ids[0]=3*(e1-1)+pos1;84 channel_node_ids[1]=3*(e1-1)+pos2;85 channel_node_ids[2]=3*(e2-1)+pos3;86 channel_node_ids[3]=3*(e2-1)+pos4;87 }88 else{89 90 /*2: Get the column where these ids are located in the index*/91 pos1=pos2=UNDEF;92 for(j=0;j<3;j++){93 if(iomodel->elements[3*(e1-1)+j]==i1) pos1=j+1;94 if(iomodel->elements[3*(e1-1)+j]==i2) pos2=j+1;95 }96 _assert_(pos1!=UNDEF && pos2!=UNDEF);97 98 /*3: We have the id of the elements and the position of the vertices in the index99 * we can compute their dofs!*/100 channel_node_ids[0]=3*(e1-1)+pos1;101 channel_node_ids[1]=3*(e1-1)+pos2;102 }103 104 /*Ok, we have everything to build the object: */105 this->id=channel_id;106 107 /*Hooks: */108 this->hnodes =new Hook(channel_node_ids,num_nodes);109 48 this->hvertices =new Hook(&channel_vertex_ids[0],2); 110 this->helement =new Hook(channel_elem_ids,1); // take only the first element for now 111 112 //this->parameters: we still can't point to it, it may not even exist. Configure will handle this.113 this->parameters=NULL;114 this->element=NULL;115 this-> nodes=NULL;116 } 117 /*}}}*/49 50 /*Set Nodes hooks (!! Assumes P1 CG)*/ 51 int channel_node_ids[2]; 52 channel_node_ids[0]=i1; 53 channel_node_ids[1]=i2; 54 this->hnodes=new Hook(&channel_node_ids[0],2); 55 56 }/*}}}*/ 118 57 Channel::~Channel(){/*{{{*/ 119 58 this->parameters=NULL; … … 121 60 delete hnodes; 122 61 delete hvertices; 123 } 124 /*}}}*/ 62 }/*}}}*/ 125 63 126 64 /*Object virtual functions definitions:*/ … … 234 172 this->parameters->FindParam(&analysis_type,AnalysisTypeEnum); 235 173 236 if(analysis_type != HydrologyGlaDSAnalysisEnum) _error_("Analysis not supported!!"); 237 _error_("STOP"); 174 switch(analysis_type){ 175 case HydrologyGlaDSAnalysisEnum: 176 Ke = this->CreateKMatrixHydrologyGlaDS(); 177 break; 178 default: 179 _error_("Don't know why we should be here"); 180 } 238 181 239 182 /*Add to global matrix*/ … … 251 194 int analysis_type; 252 195 this->parameters->FindParam(&analysis_type,AnalysisTypeEnum); 253 if(analysis_type != HydrologyGlaDSAnalysisEnum) _error_("Analysis not supported!!"); 254 _error_("STOP"); 196 197 switch(analysis_type){ 198 case HydrologyGlaDSAnalysisEnum: 199 pe = this->CreatePVectorHydrologyGlaDS(); 200 break; 201 default: 202 _error_("Don't know why we should be here"); 203 } 255 204 256 205 /*Add to global matrix*/ … … 372 321 } 373 322 /*}}}*/ 323 324 /*Channel specific functions*/ 325 ElementVector* Channel::CreatePVectorHydrologyGlaDS(void){/*{{{*/ 326 327 _error_("not implemented :( "); 328 329 /*Initialize Element matrix and return if necessary*/ 330 Tria* tria=(Tria*)element; 331 if(!tria->IsIceInElement()) return NULL; 332 ElementVector* pe=new ElementVector(nodes,NUMNODES,this->parameters); 333 334 /*Clean up and return*/ 335 return pe; 336 } 337 /*}}}*/ 338 ElementMatrix* Channel::CreateKMatrixHydrologyGlaDS(void){/*{{{*/ 339 340 _error_("not implemented :( "); 341 342 /*Initialize Element matrix and return if necessary*/ 343 Tria* tria=(Tria*)element; 344 if(!tria->IsIceInElement()) return NULL; 345 ElementMatrix* Ke=new ElementMatrix(nodes,NUMNODES,this->parameters); 346 347 /*Clean up and return*/ 348 return Ke; 349 } 350 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Loads/Channel.h
r23946 r23960 72 72 /*Channel management:{{{*/ 73 73 void GetNormal(IssmDouble* normal,IssmDouble xyz_list[4][3]); 74 ElementVector* CreatePVectorHydrologyGlaDS(void); 75 ElementMatrix* CreateKMatrixHydrologyGlaDS(void); 74 76 /*}}}*/ 75 77 -
issm/trunk-jpl/src/c/classes/Loads/Moulin.cpp
r23959 r23960 159 159 160 160 switch(analysis_type){ 161 162 case HydrologyShaktiAnalysisEnum: 163 pe = this->CreatePVectorHydrologyShakti(); 164 break; 165 case HydrologyDCInefficientAnalysisEnum: 166 pe = CreatePVectorHydrologyDCInefficient(); 167 break; 168 case HydrologyDCEfficientAnalysisEnum: 169 pe = CreatePVectorHydrologyDCEfficient(); 170 break; 171 default: 172 _error_("Don't know why we should be here"); 173 /*No loads applied, do nothing: */ 174 return; 161 case HydrologyShaktiAnalysisEnum: 162 pe = this->CreatePVectorHydrologyShakti(); 163 break; 164 case HydrologyDCInefficientAnalysisEnum: 165 pe = CreatePVectorHydrologyDCInefficient(); 166 break; 167 case HydrologyDCEfficientAnalysisEnum: 168 pe = CreatePVectorHydrologyDCEfficient(); 169 break; 170 default: 171 _error_("Don't know why we should be here"); 172 /*No loads applied, do nothing: */ 173 return; 175 174 } 176 175 if(pe){
Note:
See TracChangeset
for help on using the changeset viewer.