Changeset 3430
- Timestamp:
- 04/07/10 16:14:35 (15 years ago)
- Location:
- issm/trunk/src/c/objects
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk/src/c/objects/Icefront.cpp ¶
r3359 r3430 16 16 #include "../include/typedefs.h" 17 17 #include "../include/macros.h" 18 #include "./ objects.h"18 #include "./Icefront.h" 19 19 20 20 … … 25 25 } 26 26 /*}}}*/ 27 /*FUNCTION Icefront c reation{{{1*/27 /*FUNCTION Icefront constructor {{{1*/ 28 28 Icefront::Icefront(char icefront_type[ICEFRONTSTRING],int icefront_fill,int icefront_sid, int icefront_mparid, int icefront_eid, int icefront_element_type, 29 int icefront_node_ids[MAX_ICEFRONT_GRIDS],double icefront_h[MAX_ICEFRONT_GRIDS],double icefront_b[MAX_ICEFRONT_GRIDS]){ 30 31 this->Init(icefront_type,icefront_fill,icefront_sid, icefront_mparid, icefront_eid, icefront_element_type, 32 icefront_node_ids,icefront_h,icefront_b); 33 34 } 35 /*}}}*/ 36 /*FUNCTION Init: used by constructor {{{1*/ 37 void Icefront::Init(char icefront_type[ICEFRONTSTRING],int icefront_fill,int icefront_sid, int icefront_mparid, int icefront_eid, int icefront_element_type, 29 38 int icefront_node_ids[MAX_ICEFRONT_GRIDS],double icefront_h[MAX_ICEFRONT_GRIDS],double icefront_b[MAX_ICEFRONT_GRIDS]){ 30 39 … … 52 61 element=NULL; 53 62 element_offset=UNDEF; 54 55 return; 56 } 63 } 64 /*}}}*/ 65 /*FUNCTION Icefront constructor from iomodel {{{1*/ 66 Icefront::Icefront(int i, IoModel* iomodel){ 67 68 int segment_width; 69 int element_type; 70 int i1,i2,i3,i4; 71 int element; 72 73 /*icefront intermediary data: */ 74 char icefront_type[ICEFRONTSTRING]; 75 int icefront_fill; 76 int icefront_element_type; 77 int icefront_sid; 78 int icefront_eid; 79 int icefront_mparid; 80 int icefront_node_ids[MAX_ICEFRONT_GRIDS]; 81 double icefront_h[MAX_ICEFRONT_GRIDS]; 82 double icefront_b[MAX_ICEFRONT_GRIDS]; 83 84 /*First, retrieve element index and element type: */ 85 if (strcmp(iomodel->meshtype,"2d")==0){ 86 segment_width=4; 87 element_type=TriaEnum(); 88 } 89 else{ 90 segment_width=6; 91 element_type=PentaEnum(); 92 } 93 element=(int)(*(iomodel->pressureload+segment_width*i+segment_width-2)-1); //element is in the penultimate column (grid1 grid2 ... elem fill) 94 95 icefront_mparid=iomodel->numberofelements+1; //matlab indexing 96 icefront_mparid=iomodel->numberofelements+1; //matlab indexing 97 icefront_sid=i+1; //matlab indexing 98 icefront_fill=(int)*(iomodel->pressureload+segment_width*i+segment_width-1); 99 icefront_eid=(int) *(iomodel->pressureload+segment_width*i+segment_width-2); //matlab indexing 100 icefront_element_type=element_type; 101 102 i1=(int)*(iomodel->pressureload+segment_width*i+0); 103 i2=(int)*(iomodel->pressureload+segment_width*i+1); 104 105 icefront_node_ids[0]=i1; 106 icefront_node_ids[1]=i2; 107 108 icefront_h[0]=iomodel->thickness[i1-1]; 109 icefront_h[1]=iomodel->thickness[i2-1]; 110 111 icefront_b[0]=iomodel->bed[i1-1]; 112 icefront_b[1]=iomodel->bed[i2-1]; 113 114 if ((int)*(iomodel->elements_type+2*element+0)==MacAyealFormulationEnum()){ //this is a collapsed 3d element, icefront will be 2d 115 strcpy(icefront_type,"segment"); 116 } 117 else if ((int)*(iomodel->elements_type+2*element+0)==PattynFormulationEnum()){ //this is a real 3d element, icefront will be 3d. 118 strcpy(icefront_type,"quad"); 119 i3=(int)*(iomodel->pressureload+segment_width*i+2); 120 i4=(int)*(iomodel->pressureload+segment_width*i+3); 121 icefront_node_ids[2]=i3; 122 icefront_node_ids[3]=i4; 123 124 icefront_h[2]=iomodel->thickness[i3-1]; 125 icefront_h[3]=iomodel->thickness[i4-1]; 126 127 icefront_b[2]=iomodel->bed[i3-1]; 128 icefront_b[3]=iomodel->bed[i4-1]; 129 } 130 else{ 131 ISSMERROR(exprintf(" element type %i not supported yet",(int)*(iomodel->elements_type+2*element+0))); 132 } 133 134 this->Init(icefront_type,icefront_fill,icefront_sid,icefront_mparid,icefront_eid,icefront_element_type,icefront_node_ids,icefront_h,icefront_b); 135 } 136 137 57 138 /*}}}*/ 58 139 /*FUNCTION Icefront destructor {{{1*/ -
TabularUnified issm/trunk/src/c/objects/Icefront.h ¶
r3420 r3430 16 16 #include "./Element.h" 17 17 #include "./Node.h" 18 #include "../ModelProcessorx/IoModel.h" 18 19 19 20 #define MAX_ICEFRONT_GRIDS 4 //max number of grids for a certain load … … 23 24 24 25 private: 25 char 26 char type[ICEFRONTSTRING]; 26 27 int fill; 27 int sid;28 int sid; 28 29 29 30 /*material: */ … … 49 50 public: 50 51 52 /*constructors: {{{1*/ 51 53 Icefront(); 52 54 Icefront(char type[ICEFRONTSTRING],int fill,int sid, int mparid, int eid, int element_type, int node_ids[MAX_ICEFRONT_GRIDS],double h[MAX_ICEFRONT_GRIDS],double b[MAX_ICEFRONT_GRIDS]); 55 void Init(char type[ICEFRONTSTRING],int fill,int sid, int mparid, int eid, int element_type, int node_ids[MAX_ICEFRONT_GRIDS],double h[MAX_ICEFRONT_GRIDS],double b[MAX_ICEFRONT_GRIDS]); 56 Icefront(int i, IoModel* iomodel); 53 57 ~Icefront(); 54 58 /*}}}*/ 59 /*object management: {{{1*/ 60 void Configure(void* elements,void* nodes,void* materials); 61 Object* copy(); 62 void DeepEcho(); 63 void Demarshall(char** pmarshalled_dataset); 55 64 void Echo(); 56 void DeepEcho(); 65 int Enum(); 66 int GetId(); 67 char* GetName(); 57 68 void Marshall(char** pmarshalled_dataset); 58 69 int MarshallSize(); 59 char* GetName();60 void Demarshall(char** pmarshalled_dataset);61 int Enum();62 int GetId();63 70 int MyRank(); 71 /*}}}*/ 72 /*numerics: {{{1*/ 64 73 void DistributeNumDofs(int* numdofspernode,int analysis_type,int sub_analysis_type); 65 void Configure(void* elements,void* nodes,void* materials);66 74 void CreateKMatrix(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type); 67 75 void UpdateFromInputs(void* inputs); 68 69 76 void CreatePVector(Vec pg, void* inputs, int analysis_type,int sub_analysis_type); 70 77 void CreatePVectorDiagnosticHoriz( Vec pg, void* inputs, int analysis_type,int sub_analysis_type); … … 80 87 void PenaltyCreateKMatrix(Mat Kgg,void* inputs,double kmax,int analysis_type,int sub_analysis_type); 81 88 void PenaltyCreatePVector(Vec pg,void* inputs,double kmax,int analysis_type,int sub_analysis_type); 82 Object* copy();89 /*}}}*/ 83 90 }; 84 91 -
TabularUnified issm/trunk/src/c/objects/Node.cpp ¶
r3427 r3430 52 52 } 53 53 /*}}}*/ 54 /*FUNCTION Node constructor from iomodel continuous Galerkin{{{2*/54 /*FUNCTION Node constructor from iomodel{{{2*/ 55 55 Node::Node(int i, IoModel* iomodel){ //i is the node index 56 56 … … 98 98 99 99 /*set single point constraints.: */ 100 /*FROM DIAGNOSTICHORIZ*/101 100 if (strcmp(iomodel->meshtype,"3d")==0){ 102 101 /*We have a 3d mesh, we may have collapsed elements, hence dead grids. Freeze them out: */ … … 112 111 } 113 112 } 114 /*FROM DIAGNOSTICSTOKES*/115 113 /*On a 3d mesh, in stokes formualtions, only stokes grids are free, the others are frozen: */ 116 114 if (iomodel->borderstokes[i]){ 117 115 //freeze everything except pressure 118 node->FreezeDof(1);119 node->FreezeDof(2);120 node->FreezeDof(3);116 this->FreezeDof(1); 117 this->FreezeDof(2); 118 this->FreezeDof(3); 121 119 } 122 120 else if (iomodel->gridonstokes[i]==0){ … … 125 123 } 126 124 } 127 /*FROM DIAGNOSTICHUTTER*/128 if (!iomodel->gridonhutter[i]){129 for(k=1;k<=numdofs;k++){130 node->FreezeDof(k);131 }132 }133 }134 /*}}}*/135 /*FUNCTION Node constructor from iomodel discontinuous Galerkin{{{2*/136 Node::Node(int i,int j,IoModel* iomodel){137 /* i -> index of the vertex in C indexing138 * j -> index of the node in C indexing*/139 140 int numdofs;141 int partitionborder;142 int vertex_id;143 int upper_node_id;144 145 /*id: */146 this->id=j+1; //matlab indexing147 148 /*indexing:*/149 DistributeNumDofs(&numdofs,iomodel->analysis_type,iomodel->sub_analysis_type); //number of dofs per node150 if(iomodel->my_bordervertices[i])partitionborder=1; else partitionborder=0;//is this node on a partition border?151 152 this->indexing.Init(numdofs,partitionborder);153 154 /*properties (come from vertex number i): */155 this->properties.Init(156 (int)iomodel->gridonbed[i],157 (int)iomodel->gridonsurface[i],158 (int)iomodel->gridoniceshelf[i],159 (int)iomodel->gridonicesheet[i]);160 161 /*hooks: */162 vertex_id=i+1; //matlab indexing163 164 if (strcmp(iomodel->meshtype,"3d")==0){165 if (isnan(iomodel->uppernodes[i])){166 upper_node_id=this->id; //nodes on surface do not have upper nodes, only themselves.167 }168 else{169 upper_node_id=(int)iomodel->uppernodes[i];170 }171 }172 else{173 /*If we are running 2d, upper_node does not mean much. Just point towards itself!:*/174 upper_node_id=this->id;175 }176 177 this->hvertex.Init(&vertex_id,1);178 this->hupper_node.Init(&upper_node_id,1);179 180 125 } 181 126 /*}}}*/ -
TabularUnified issm/trunk/src/c/objects/Node.h ¶
r3427 r3430 44 44 Node(int id,DofIndexing* indexing, NodeProperties* properties, Hook* vertex, Hook* upper_node); 45 45 Node(int i, IoModel* iomodel); 46 Node(int i,int j,IoModel* iomodel);47 46 ~Node(); 48 47 /*}}}*/ -
TabularUnified issm/trunk/src/c/objects/Penpair.cpp ¶
r3332 r3430 216 216 /*FUNCTION Penpair::PenaltyCreateKMatrix {{{1*/ 217 217 void Penpair::PenaltyCreateKMatrix(Mat Kgg,void* inputs,double kmax,int analysis_type,int sub_analysis_type){ 218 218 219 /*If you code this piece, don't forget that a penalty will be inactive if it is dealing with clone nodes*/ 219 220 /*No loads applied, do nothing: */ 220 221 return; -
TabularUnified issm/trunk/src/c/objects/Riftfront.cpp ¶
r3332 r3430 20 20 21 21 /*Object constructors and destructor*/ 22 /*FUNCTION Riftfront:: constructor {{{1*/22 /*FUNCTION Riftfront::default constructor {{{1*/ 23 23 Riftfront::Riftfront(){ 24 24 /*in case :*/ … … 27 27 } 28 28 /*}}}1*/ 29 /*FUNCTION Riftfront::c reation{{{1*/29 /*FUNCTION Riftfront::constructor {{{1*/ 30 30 Riftfront::Riftfront(char riftfront_type[RIFTFRONTSTRING],int riftfront_id, int riftfront_node_ids[MAX_RIFTFRONT_GRIDS], int riftfront_mparid, double riftfront_h[MAX_RIFTFRONT_GRIDS],double riftfront_b[MAX_RIFTFRONT_GRIDS],double riftfront_s[MAX_RIFTFRONT_GRIDS],double riftfront_normal[2],double riftfront_length,int riftfront_fill,double riftfront_friction, double riftfront_fraction,double riftfront_fractionincrement, double riftfront_penalty_offset, int riftfront_penalty_lock, bool riftfront_active,bool riftfront_frozen, int riftfront_counter,bool riftfront_prestable,bool riftfront_shelf){ 31 32 this->Init(riftfront_type,riftfront_id, riftfront_node_ids[MAX_RIFTFRONT_GRIDS], riftfront_mparid, riftfront_h[MAX_RIFTFRONT_GRIDS],riftfront_b[MAX_RIFTFRONT_GRIDS],riftfront_s[MAX_RIFTFRONT_GRIDS],riftfront_normal[2],riftfront_length,riftfront_fill,riftfront_friction, riftfront_fraction,riftfront_fractionincrement, riftfront_penalty_offset, riftfront_penalty_lock, griftfront_active,griftfront_frozen, riftfront_counter,riftfront_prestable,riftfront_shelf); 33 34 } 35 /*}}}1*/ 36 /*FUNCTION Riftfront::constructor from iomodel{{{1*/ 37 Riftfront::Riftfront(int i, IoModel* iomodel){ 38 39 /*rifts: */ 40 char riftfront_type[RIFTFRONTSTRING]; 41 int riftfront_id; 42 int riftfront_node_ids[2]; 43 int riftfront_mparid; 44 double riftfront_h[2]; 45 double riftfront_b[2]; 46 double riftfront_s[2]; 47 double riftfront_normal[2]; 48 double riftfront_length; 49 int riftfront_fill; 50 double riftfront_friction; 51 double riftfront_fraction; 52 double riftfront_fractionincrement; 53 bool riftfront_shelf; 54 double riftfront_penalty_offset; 55 int riftfront_penalty_lock; 56 bool riftfront_active; 57 bool riftfront_frozen; 58 int riftfront_counter; 59 bool riftfront_prestable; 60 int el1,el2; 61 int grid1,grid2; 62 double normal[2]; 63 double length; 64 int fill; 65 double friction; 66 double fraction; 67 double fractionincrement; 68 69 /*Ok, retrieve all the data needed to add a penalty between the two grids: */ 70 el1=(int)*(iomodel->riftinfo+RIFTINFOSIZE*i+2); 71 el2=(int)*(iomodel->riftinfo+RIFTINFOSIZE*i+3); 72 73 grid1=(int)*(iomodel->riftinfo+RIFTINFOSIZE*i+0); 74 grid2=(int)*(iomodel->riftinfo+RIFTINFOSIZE*i+1); 75 76 normal[0]=*(iomodel->riftinfo+RIFTINFOSIZE*i+4); 77 normal[1]=*(iomodel->riftinfo+RIFTINFOSIZE*i+5); 78 length=*(iomodel->riftinfo+RIFTINFOSIZE*i+6); 79 80 fill = (int)*(iomodel->riftinfo+RIFTINFOSIZE*i+7); 81 friction=*(iomodel->riftinfo+RIFTINFOSIZE*i+8); 82 fraction=*(iomodel->riftinfo+RIFTINFOSIZE*i+9); 83 fractionincrement=*(iomodel->riftinfo+RIFTINFOSIZE*i+10); 84 85 strcpy(riftfront_type,"2d"); 86 riftfront_id=i+1; //matlab indexing 87 riftfront_node_ids[0]=grid1; 88 riftfront_node_ids[1]=grid2; 89 riftfront_mparid=iomodel->numberofelements+1; //matlab indexing 90 91 riftfront_h[0]=iomodel->thickness[grid1-1]; 92 riftfront_h[1]=iomodel->thickness[grid2-1]; 93 94 riftfront_b[0]=iomodel->bed[grid1-1]; 95 riftfront_b[1]=iomodel->bed[grid2-1]; 96 97 riftfront_s[0]=iomodel->surface[grid1-1]; 98 riftfront_s[1]=iomodel->surface[grid2-1]; 99 100 riftfront_normal[0]=normal[0]; 101 riftfront_normal[1]=normal[1]; 102 riftfront_length=length; 103 104 riftfront_fill=fill; 105 riftfront_friction=friction; 106 riftfront_fraction=fraction; 107 riftfront_fractionincrement=fractionincrement; 108 riftfront_shelf=(bool)iomodel->gridoniceshelf[grid1-1]; 109 110 riftfront_penalty_offset=iomodel->penalty_offset; 111 riftfront_penalty_lock=iomodel->penalty_lock; 112 113 riftfront_active=0; 114 riftfront_frozen=0; 115 riftfront_counter=0; 116 riftfront_prestable=0; 117 118 this->Init(riftfront_type,riftfront_id, riftfront_node_ids[MAX_RIFTFRONT_GRIDS], riftfront_mparid, riftfront_h[MAX_RIFTFRONT_GRIDS],riftfront_b[MAX_RIFTFRONT_GRIDS],riftfront_s[MAX_RIFTFRONT_GRIDS],riftfront_normal[2],riftfront_length,riftfront_fill,riftfront_friction, riftfront_fraction,riftfront_fractionincrement, riftfront_penalty_offset, riftfront_penalty_lock, griftfront_active,griftfront_frozen, riftfront_counter,riftfront_prestable,riftfront_shelf); 119 120 } 121 /*}}}1*/ 122 /*FUNCTION Riftfront::Init, used by constructor {{{1*/ 123 void Riftfront::Init(char riftfront_type[RIFTFRONTSTRING],int riftfront_id, int riftfront_node_ids[MAX_RIFTFRONT_GRIDS], int riftfront_mparid, double riftfront_h[MAX_RIFTFRONT_GRIDS],double riftfront_b[MAX_RIFTFRONT_GRIDS],double riftfront_s[MAX_RIFTFRONT_GRIDS],double riftfront_normal[2],double riftfront_length,int riftfront_fill,double riftfront_friction, double riftfront_fraction,double riftfront_fractionincrement, double riftfront_penalty_offset, int riftfront_penalty_lock, bool riftfront_active,bool riftfront_frozen, int riftfront_counter,bool riftfront_prestable,bool riftfront_shelf){ 31 124 32 125 int i; -
TabularUnified issm/trunk/src/c/objects/Riftfront.h ¶
r3201 r3430 58 58 public: 59 59 60 /*constructors,destructors: {{{1*/ 60 61 Riftfront(); 62 void Init(char type[RIFTFRONTSTRING],int id, int node_ids[MAX_RIFTFRONT_GRIDS], int mparid, double h[MAX_RIFTFRONT_GRIDS],double b[MAX_RIFTFRONT_GRIDS],double s[MAX_RIFTFRONT_GRIDS],double normal[2],double length,int fill,double friction, double fraction, double fractionincrement, double penalty_offset, int penalty_lock,bool active,bool frozen, int counter,bool prestable,bool shelf); 61 63 Riftfront(char type[RIFTFRONTSTRING],int id, int node_ids[MAX_RIFTFRONT_GRIDS], int mparid, double h[MAX_RIFTFRONT_GRIDS],double b[MAX_RIFTFRONT_GRIDS],double s[MAX_RIFTFRONT_GRIDS],double normal[2],double length,int fill,double friction, double fraction, double fractionincrement, double penalty_offset, int penalty_lock,bool active,bool frozen, int counter,bool prestable,bool shelf); 62 64 ~Riftfront(); 63 65 /*}}}*/ 66 /*object management: {{{1*/ 64 67 void Echo(); 65 68 void DeepEcho(); … … 72 75 int MyRank(); 73 76 void Configure(void* elements,void* nodes,void* materials); 77 Object* copy(); 78 /*}}}*/ 79 /*numerics: {{{1*/ 74 80 void UpdateFromInputs(void* inputs); 75 81 void GetDofList(int* doflist,int* pnumberofdofs); … … 89 95 int IsMaterialStable(void* inputs, int analysis_type); 90 96 void OutputProperties(Vec riftproperties); 91 Object* copy();97 /*}}}*/ 92 98 }; 93 99
Note:
See TracChangeset
for help on using the changeset viewer.