[16134] | 1 | Index: ../trunk-jpl/src/c/modules/ModelProcessorx/DiagnosticHutter/UpdateElementsDiagnosticHutter.cpp
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- ../trunk-jpl/src/c/modules/ModelProcessorx/DiagnosticHutter/UpdateElementsDiagnosticHutter.cpp (revision 15449)
|
---|
| 4 | +++ ../trunk-jpl/src/c/modules/ModelProcessorx/DiagnosticHutter/UpdateElementsDiagnosticHutter.cpp (revision 15450)
|
---|
| 5 | @@ -10,11 +10,8 @@
|
---|
| 6 |
|
---|
| 7 | void UpdateElementsDiagnosticHutter(Elements* elements, IoModel* iomodel,int analysis_counter,int analysis_type){
|
---|
| 8 |
|
---|
| 9 | - int numberofelements;
|
---|
| 10 | + /*Fetch data needed: */
|
---|
| 11 | bool ishutter;
|
---|
| 12 | -
|
---|
| 13 | - /*Fetch data needed: */
|
---|
| 14 | - iomodel->Constant(&numberofelements,MeshNumberofelementsEnum);
|
---|
| 15 | iomodel->Constant(&ishutter,FlowequationIshutterEnum);
|
---|
| 16 |
|
---|
| 17 | /*Now, is the flag hutter on? otherwise, do nothing: */
|
---|
| 18 | @@ -24,7 +21,7 @@
|
---|
| 19 |
|
---|
| 20 | /*Update elements: */
|
---|
| 21 | int counter=0;
|
---|
| 22 | - for(int i=0;i<numberofelements;i++){
|
---|
| 23 | + for(int i=0;i<iomodel->numberofelements;i++){
|
---|
| 24 | if(iomodel->my_elements[i]){
|
---|
| 25 | Element* element=(Element*)elements->GetObjectByOffset(counter);
|
---|
| 26 | element->Update(i,iomodel,analysis_counter,analysis_type); //we need i to index into elements.
|
---|
| 27 | Index: ../trunk-jpl/src/c/modules/ModelProcessorx/Enthalpy/UpdateElementsEnthalpy.cpp
|
---|
| 28 | ===================================================================
|
---|
| 29 | --- ../trunk-jpl/src/c/modules/ModelProcessorx/Enthalpy/UpdateElementsEnthalpy.cpp (revision 15449)
|
---|
| 30 | +++ ../trunk-jpl/src/c/modules/ModelProcessorx/Enthalpy/UpdateElementsEnthalpy.cpp (revision 15450)
|
---|
| 31 | @@ -10,11 +10,6 @@
|
---|
| 32 |
|
---|
| 33 | void UpdateElementsEnthalpy(Elements* elements, IoModel* iomodel,int analysis_counter,int analysis_type){
|
---|
| 34 |
|
---|
| 35 | - int numberofelements;
|
---|
| 36 | -
|
---|
| 37 | - /*Fetch parameters: */
|
---|
| 38 | - iomodel->Constant(&numberofelements,MeshNumberofelementsEnum);
|
---|
| 39 | -
|
---|
| 40 | /*Now, is the model 3d? otherwise, do nothing: */
|
---|
| 41 | if(iomodel->dim==2)return;
|
---|
| 42 |
|
---|
| 43 | @@ -23,7 +18,7 @@
|
---|
| 44 |
|
---|
| 45 | /*Update elements: */
|
---|
| 46 | int counter=0;
|
---|
| 47 | - for(int i=0;i<numberofelements;i++){
|
---|
| 48 | + for(int i=0;i<iomodel->numberofelements;i++){
|
---|
| 49 | if(iomodel->my_elements[i]){
|
---|
| 50 | Element* element=(Element*)elements->GetObjectByOffset(counter);
|
---|
| 51 | element->Update(i,iomodel,analysis_counter,analysis_type); //we need i to index into elements.
|
---|
| 52 | Index: ../trunk-jpl/src/c/modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp
|
---|
| 53 | ===================================================================
|
---|
| 54 | --- ../trunk-jpl/src/c/modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp (revision 15449)
|
---|
| 55 | +++ ../trunk-jpl/src/c/modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp (revision 15450)
|
---|
| 56 | @@ -10,7 +10,6 @@
|
---|
| 57 |
|
---|
| 58 | void UpdateElementsPrognostic(Elements* elements, IoModel* iomodel,int analysis_counter,int analysis_type){
|
---|
| 59 |
|
---|
| 60 | - int numberofelements;
|
---|
| 61 | int stabilization;
|
---|
| 62 | bool dakota_analysis;
|
---|
| 63 | bool issmbgradients;
|
---|
| 64 | @@ -18,7 +17,6 @@
|
---|
| 65 | bool isdelta18o;
|
---|
| 66 |
|
---|
| 67 | /*Fetch data needed: */
|
---|
| 68 | - iomodel->Constant(&numberofelements,MeshNumberofelementsEnum);
|
---|
| 69 | iomodel->Constant(&stabilization,PrognosticStabilizationEnum);
|
---|
| 70 | iomodel->Constant(&dakota_analysis,QmuIsdakotaEnum);
|
---|
| 71 | iomodel->Constant(&ispdd,SurfaceforcingsIspddEnum);
|
---|
| 72 | @@ -27,7 +25,7 @@
|
---|
| 73 |
|
---|
| 74 | /*Update elements: */
|
---|
| 75 | int counter=0;
|
---|
| 76 | - for(int i=0;i<numberofelements;i++){
|
---|
| 77 | + for(int i=0;i<iomodel->numberofelements;i++){
|
---|
| 78 | if(iomodel->my_elements[i]){
|
---|
| 79 | Element* element=(Element*)elements->GetObjectByOffset(counter);
|
---|
| 80 | element->Update(i,iomodel,analysis_counter,analysis_type); //we need i to index into elements.
|
---|
| 81 | Index: ../trunk-jpl/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp
|
---|
| 82 | ===================================================================
|
---|
| 83 | --- ../trunk-jpl/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp (revision 15449)
|
---|
| 84 | +++ ../trunk-jpl/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp (revision 15450)
|
---|
| 85 | @@ -15,12 +15,10 @@
|
---|
| 86 | int counter;
|
---|
| 87 | Element *element = NULL;
|
---|
| 88 | Material *material = NULL;
|
---|
| 89 | - int numberofelements;
|
---|
| 90 | int num_control_type;
|
---|
| 91 | bool control_analysis;
|
---|
| 92 |
|
---|
| 93 | /*Fetch parameters: */
|
---|
| 94 | - iomodel->Constant(&numberofelements,MeshNumberofelementsEnum);
|
---|
| 95 | iomodel->Constant(&control_analysis,InversionIscontrolEnum);
|
---|
| 96 | if(control_analysis) iomodel->Constant(&num_control_type,InversionNumControlParametersEnum);
|
---|
| 97 |
|
---|
| 98 | @@ -48,7 +46,7 @@
|
---|
| 99 |
|
---|
| 100 | /*Update elements and materials: */
|
---|
| 101 | counter=0;
|
---|
| 102 | - for (i=0;i<numberofelements;i++){
|
---|
| 103 | + for (i=0;i<iomodel->numberofelements;i++){
|
---|
| 104 | if(iomodel->my_elements[i]){
|
---|
| 105 | element=(Element*)elements->GetObjectByOffset(counter);
|
---|
| 106 | element->InputUpdateFromIoModel(i,iomodel); //we need i to index into elements.
|
---|
| 107 | Index: ../trunk-jpl/src/c/classes/Loads/Icefront.cpp
|
---|
| 108 | ===================================================================
|
---|
| 109 | --- ../trunk-jpl/src/c/classes/Loads/Icefront.cpp (revision 15449)
|
---|
| 110 | +++ ../trunk-jpl/src/c/classes/Loads/Icefront.cpp (revision 15450)
|
---|
| 111 | @@ -42,18 +42,14 @@
|
---|
| 112 | int element;
|
---|
| 113 | int numnodes;
|
---|
| 114 | int numvertices;
|
---|
| 115 | - int numberofelements;
|
---|
| 116 |
|
---|
| 117 | /*icefront constructor data: */
|
---|
| 118 | int icefront_eid;
|
---|
| 119 | int icefront_mparid;
|
---|
| 120 | - int icefront_node_ids[NUMVERTICESQUA]; //initialize with largest size
|
---|
| 121 | - int icefront_vertex_ids[NUMVERTICESQUA]; //initialize with largest size
|
---|
| 122 | int icefront_fill;
|
---|
| 123 | + int *icefront_node_ids = NULL;
|
---|
| 124 | + int *icefront_vertex_ids = NULL;
|
---|
| 125 |
|
---|
| 126 | - /*find parameters: */
|
---|
| 127 | - iomodel->Constant(&numberofelements,MeshNumberofelementsEnum);
|
---|
| 128 | -
|
---|
| 129 | /*First, retrieve element index and element type: */
|
---|
| 130 | if(iomodel->dim==2){
|
---|
| 131 | segment_width=4;
|
---|
| 132 | @@ -62,19 +58,27 @@
|
---|
| 133 | segment_width=6;
|
---|
| 134 | }
|
---|
| 135 | _assert_(iomodel->Data(DiagnosticIcefrontEnum));
|
---|
| 136 | - element=reCast<int,IssmDouble>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+segment_width-2)-1); //element is in the penultimate column (node1 node2 ... elem fill)
|
---|
| 137 | + element=reCast<int,IssmDouble>(iomodel->Data(DiagnosticIcefrontEnum)[segment_width*i+segment_width-2]-1);
|
---|
| 138 |
|
---|
| 139 | /*Build ids for hook constructors: */
|
---|
| 140 | - icefront_eid=reCast<int,IssmDouble>( *(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+segment_width-2)); //matlab indexing
|
---|
| 141 | - icefront_mparid=numberofelements+1; //matlab indexing
|
---|
| 142 | + icefront_eid = reCast<int,IssmDouble>(iomodel->Data(DiagnosticIcefrontEnum)[segment_width*i+segment_width-2]); //matlab indexing
|
---|
| 143 | + icefront_mparid = iomodel->numberofelements+1;
|
---|
| 144 |
|
---|
| 145 | if (in_icefront_type==MacAyeal2dIceFrontEnum || in_icefront_type==MacAyeal3dIceFrontEnum){
|
---|
| 146 | + numnodes = 2;
|
---|
| 147 | + numvertices = 2;
|
---|
| 148 | + icefront_node_ids = xNew<int>(numnodes);
|
---|
| 149 | + icefront_vertex_ids = xNew<int>(numvertices);
|
---|
| 150 | icefront_node_ids[0]=iomodel->nodecounter+reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+0));
|
---|
| 151 | icefront_node_ids[1]=iomodel->nodecounter+reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+1));
|
---|
| 152 | icefront_vertex_ids[0]=reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+0));
|
---|
| 153 | icefront_vertex_ids[1]=reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+1));
|
---|
| 154 | }
|
---|
| 155 | else if (in_icefront_type==PattynIceFrontEnum || in_icefront_type==StokesIceFrontEnum){
|
---|
| 156 | + numnodes = 4;
|
---|
| 157 | + numvertices = 4;
|
---|
| 158 | + icefront_node_ids = xNew<int>(numnodes);
|
---|
| 159 | + icefront_vertex_ids = xNew<int>(numvertices);
|
---|
| 160 | icefront_node_ids[0]=iomodel->nodecounter+reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+0));
|
---|
| 161 | icefront_node_ids[1]=iomodel->nodecounter+reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+1));
|
---|
| 162 | icefront_node_ids[2]=iomodel->nodecounter+reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+2));
|
---|
| 163 | @@ -86,15 +90,6 @@
|
---|
| 164 | }
|
---|
| 165 | else _error_("in_icefront_type " << EnumToStringx(in_icefront_type) << " not supported yet!");
|
---|
| 166 |
|
---|
| 167 | - if (in_icefront_type==PattynIceFrontEnum || in_icefront_type==StokesIceFrontEnum){
|
---|
| 168 | - numnodes=4;
|
---|
| 169 | - numvertices=4;
|
---|
| 170 | - }
|
---|
| 171 | - else{
|
---|
| 172 | - numnodes=2;
|
---|
| 173 | - numvertices=2;
|
---|
| 174 | - }
|
---|
| 175 | -
|
---|
| 176 | /*Fill*/
|
---|
| 177 | icefront_fill=reCast<int>(iomodel->Data(DiagnosticIcefrontEnum)[segment_width*i+segment_width-1]);
|
---|
| 178 |
|
---|
| 179 | @@ -119,8 +114,11 @@
|
---|
| 180 | this->vertices = NULL;
|
---|
| 181 | this->element = NULL;
|
---|
| 182 | this->matpar = NULL;
|
---|
| 183 | +
|
---|
| 184 | + /*Clean up*/
|
---|
| 185 | + xDelete<int>(icefront_node_ids);
|
---|
| 186 | + xDelete<int>(icefront_vertex_ids);
|
---|
| 187 | }
|
---|
| 188 | -
|
---|
| 189 | /*}}}*/
|
---|
| 190 | /*FUNCTION Icefront::Icefront(const char* element_type_in,Inputs* inputs_in,Matpar* matpar_in, int icefront_type, int in_analysis_type) {{{*/
|
---|
| 191 | Icefront::Icefront(const char* element_type_in,Inputs* inputs_in,Matpar* matpar_in,int in_icefront_type, int in_analysis_type){
|
---|
| 192 | Index: ../trunk-jpl/src/c/classes/Loads/Riftfront.cpp
|
---|
| 193 | ===================================================================
|
---|
| 194 | --- ../trunk-jpl/src/c/classes/Loads/Riftfront.cpp (revision 15449)
|
---|
| 195 | +++ ../trunk-jpl/src/c/classes/Loads/Riftfront.cpp (revision 15450)
|
---|
| 196 | @@ -43,7 +43,6 @@
|
---|
| 197 | IssmDouble riftfront_friction;
|
---|
| 198 | IssmDouble riftfront_fractionincrement;
|
---|
| 199 | bool riftfront_shelf;
|
---|
| 200 | - int numberofelements;
|
---|
| 201 | int penalty_lock;
|
---|
| 202 |
|
---|
| 203 | /*intermediary: */
|
---|
| 204 | @@ -51,7 +50,6 @@
|
---|
| 205 | int node1 ,node2;
|
---|
| 206 |
|
---|
| 207 | /*Fetch parameters: */
|
---|
| 208 | - iomodel->Constant(&numberofelements,MeshNumberofelementsEnum);
|
---|
| 209 | iomodel->Constant(&penalty_lock,DiagnosticRiftPenaltyLockEnum);
|
---|
| 210 |
|
---|
| 211 | /*Ok, retrieve all the data needed to add a penalty between the two nodes: */
|
---|
| 212 | @@ -70,7 +68,7 @@
|
---|
| 213 | riftfront_node_ids[1]=iomodel->nodecounter+node2;
|
---|
| 214 | riftfront_elem_ids[0]=el1;
|
---|
| 215 | riftfront_elem_ids[1]=el2;
|
---|
| 216 | - riftfront_matpar_id=numberofelements+1; //matlab indexing
|
---|
| 217 | + riftfront_matpar_id=iomodel->numberofelements+1; //matlab indexing
|
---|
| 218 |
|
---|
| 219 | /*Hooks: */
|
---|
| 220 | this->hnodes=new Hook(riftfront_node_ids,2);
|
---|
| 221 | Index: ../trunk-jpl/src/c/classes/Elements/ElementHook.cpp
|
---|
| 222 | ===================================================================
|
---|
| 223 | --- ../trunk-jpl/src/c/classes/Elements/ElementHook.cpp (revision 15449)
|
---|
| 224 | +++ ../trunk-jpl/src/c/classes/Elements/ElementHook.cpp (revision 15450)
|
---|
| 225 | @@ -48,7 +48,7 @@
|
---|
| 226 | int material_id;
|
---|
| 227 |
|
---|
| 228 | /*retrieve material_id: */
|
---|
| 229 | - iomodel->Constant(&matpar_id,MeshNumberofelementsEnum); matpar_id++;
|
---|
| 230 | + matpar_id = iomodel->numberofelements+1;
|
---|
| 231 |
|
---|
| 232 | /*retrieve material_id*/
|
---|
| 233 | material_id = element_id;
|
---|