Changeset 23158
- Timestamp:
- 08/22/18 09:12:40 (7 years ago)
- Location:
- issm/trunk-jpl/src/c/modules/SetActiveNodesLSMx
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp
r23066 r23158 13 13 /* activate/deactivate nodes for levelset method according to IceMaskNodeActivation */ 14 14 15 /* intermediaries */16 bool solvein2d=false;17 int i,in,domaintype,analysis_type;18 Elements* elements = femmodel->elements;19 20 15 /* find parameters */ 16 int domaintype; 21 17 femmodel->parameters->FindParam(&domaintype,DomainTypeEnum); 22 18 23 for(i =0;i<elements->Size();i++){24 Element *element = xDynamicCast<Element*>( elements->GetObjectByOffset(i));19 for(int i=0;i<femmodel->elements->Size();i++){ 20 Element *element = xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i)); 25 21 int numnodes = element->GetNumberOfNodes(); 26 22 IssmDouble *mask = xNew<IssmDouble>(numnodes); 27 // include switch for elements with multiple different sets of nodes 23 24 /*include switch for elements with multiple different sets of nodes*/ 28 25 switch(element->GetElementType()){ 29 26 case MINIEnum:case MINIcondensedEnum: … … 51 48 } 52 49 53 for(in =0;in<numnodes;in++){50 for(int in=0;in<numnodes;in++){ 54 51 Node* node=element->GetNode(in); 55 if(mask[in]==1.){ 56 node->Activate(); 57 } 58 else { 59 node->Deactivate(); 60 } 52 if(mask[in]==1.) node->Activate(); 53 else node->Deactivate(); 61 54 } 62 63 55 xDelete<IssmDouble>(mask); 64 56 } … … 66 58 void GetMaskOfIceVerticesLSMx(FemModel* femmodel){/*{{{*/ 67 59 68 /* Intermediaries */ 69 int i; 60 /*Initialize vector with number of vertices*/ 61 int numvertices=femmodel->vertices->NumberOfVertices(); 62 if(numvertices==0) return; 63 Vector<IssmDouble>* vec_mask_ice=new Vector<IssmDouble>(numvertices); 70 64 71 /*Initialize vector with number of vertices*/72 int numvertices=femmodel->vertices->NumberOfVertices(); if (numvertices==0)return;73 Vector<IssmDouble>* vec_mask_ice=new Vector<IssmDouble>(numvertices); //vertices that have ice at next time step74 65 /*Fill vector with values: */ 75 for(i =0;i<femmodel->elements->Size();i++){66 for(int i=0;i<femmodel->elements->Size();i++){ 76 67 Element* element=xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i)); 77 SetMaskOfIceElement(vec_mask_ice, element); 68 if(element->IsIceInElement()){ 69 int nbv = element->GetNumberOfVertices(); 70 for(int iv=0;iv<nbv;iv++){ 71 vec_mask_ice->SetValue(element->vertices[iv]->Sid(),1.,INS_VAL); 72 } 73 } 78 74 } 79 75 … … 86 82 delete vec_mask_ice; 87 83 xDelete<IssmDouble>(mask_ice); 88 89 84 }/*}}}*/ 90 void SetMaskOfIceElement(Vector<IssmDouble>* vec_mask_ice, Element* element){/*{{{*/91 92 /* Intermediaries */93 int numvertices = element->GetNumberOfVertices();94 95 if(element->IsIceInElement()){96 for(int i = 0;i<numvertices;i++){97 vec_mask_ice->SetValue(element->vertices[i]->Sid(),1.,INS_VAL);98 }99 }100 }/*}}}*/ -
issm/trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.h
r17430 r23158 10 10 void SetActiveNodesLSMx(FemModel* femmodel); 11 11 void GetMaskOfIceVerticesLSMx(FemModel* femmodel); 12 void SetMaskOfIceElement(Vector<IssmDouble>* vec_mask_ice, Element* element);13 12 #endif /* _UPDATESPCSX_H */
Note:
See TracChangeset
for help on using the changeset viewer.