source: issm/oecreview/Archive/12321-12677/ISSM-12470-12471.diff

Last change on this file was 12679, checked in by Mathieu Morlighem, 13 years ago

Added 12321-12677

File size: 240.0 KB
RevLine 
[12679]1Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/Element.h
2===================================================================
3--- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/Element.h (revision 12470)
4+++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/Element.h (revision 12471)
5@@ -37,78 +37,78 @@
6 virtual int Sid()=0;
7 virtual bool IsFloating()=0;
8 virtual bool IsNodeOnShelf()=0;
9- virtual bool IsNodeOnShelfFromFlags(double* flags)=0;
10+ virtual bool IsNodeOnShelfFromFlags(IssmDouble* flags)=0;
11 virtual bool IsOnBed()=0;
12- virtual void GetInputListOnVertices(double* pvalue,int enumtype)=0;
13- virtual void GetInputListOnVertices(double* pvalue,int enumtype,double defaultvalue)=0;
14- virtual void GetInputValue(double* pvalue,Node* node,int enumtype)=0;
15+ virtual void GetInputListOnVertices(IssmDouble* pvalue,int enumtype)=0;
16+ virtual void GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue)=0;
17+ virtual void GetInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0;
18
19- virtual double SurfaceArea(void)=0;
20+ virtual IssmDouble SurfaceArea(void)=0;
21 virtual void InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum)=0;
22 virtual void ComputeBasalStress(Vector* sigma_b)=0;
23 virtual void ComputeStrainRate(Vector* eps)=0;
24 virtual void PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes)=0;
25 virtual void PatchFill(int* pcount, Patch* patch)=0;
26- virtual void ListResultsInfo(int** results_enums,int** results_size,double** results_times,int** results_steps,int* num_results)=0;
27+ virtual void ListResultsInfo(int** results_enums,int** results_size,IssmDouble** results_times,int** results_steps,int* num_results)=0;
28 virtual void DeleteResults(void)=0;
29 virtual void Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type)=0;
30- virtual void InputToResult(int enum_type,int step,double time)=0;
31+ virtual void InputToResult(int enum_type,int step,IssmDouble time)=0;
32 virtual void InputDuplicate(int original_enum,int new_enum)=0;
33- virtual void InputCreate(double scalar,int name,int code)=0;
34- virtual void InputCreate(double* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code)=0;
35+ virtual void InputCreate(IssmDouble scalar,int name,int code)=0;
36+ virtual void InputCreate(IssmDouble* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code)=0;
37 virtual void ProcessResultsUnits(void)=0;
38- virtual void RequestedOutput(int output_enum,int step,double time)=0;
39+ virtual void RequestedOutput(int output_enum,int step,IssmDouble time)=0;
40
41- virtual int NodalValue(double* pvalue, int index, int natureofdataenum,bool process_units)=0;
42- virtual void InputScale(int enum_type,double scale_factor)=0;
43+ virtual int NodalValue(IssmDouble* pvalue, int index, int natureofdataenum,bool process_units)=0;
44+ virtual void InputScale(int enum_type,IssmDouble scale_factor)=0;
45 virtual void GetVectorFromInputs(Vector* vector, int name_enum)=0;
46 virtual void GetVectorFromResults(Vector* vector,int id,int interp)=0;
47- virtual void InputArtificialNoise(int enum_type,double min,double max)=0;
48- virtual bool InputConvergence(double* eps, int* enums,int num_enums,int* criterionenums,double* criterionvalues,int num_criterionenums)=0;
49- virtual void AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas,double* vertex_response,double* qmu_part)=0;
50+ virtual void InputArtificialNoise(int enum_type,IssmDouble min,IssmDouble max)=0;
51+ virtual bool InputConvergence(IssmDouble* eps, int* enums,int num_enums,int* criterionenums,IssmDouble* criterionvalues,int num_criterionenums)=0;
52+ virtual void AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part)=0;
53 virtual int* GetHorizontalNeighboorSids(void)=0;
54- virtual double TimeAdapt()=0;
55- virtual void MigrateGroundingLine(double* old_floating_ice,double* sheet_ungrounding)=0;
56+ virtual IssmDouble TimeAdapt()=0;
57+ virtual void MigrateGroundingLine(IssmDouble* old_floating_ice,IssmDouble* sheet_ungrounding)=0;
58 virtual void PotentialSheetUngrounding(Vector* potential_sheet_ungrounding)=0;
59- virtual void PositiveDegreeDay(double* pdds,double* pds,double signorm)=0;
60- virtual int UpdatePotentialSheetUngrounding(double* potential_sheet_ungrounding,Vector* vec_nodes_on_iceshelf,double* nodes_on_iceshelf)=0;
61+ virtual void PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm)=0;
62+ virtual int UpdatePotentialSheetUngrounding(IssmDouble* potential_sheet_ungrounding,Vector* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf)=0;
63 virtual void ResetCoordinateSystem()=0;
64- virtual void SmearFunction(Vector* smearedvector,double (*WeightFunction)(double distance,double radius),double radius)=0;
65+ virtual void SmearFunction(Vector* smearedvector,IssmDouble (*WeightFunction)(IssmDouble distance,IssmDouble radius),IssmDouble radius)=0;
66
67 #ifdef _HAVE_RESPONSES_
68- virtual void MinVel(double* pminvel, bool process_units)=0;
69- virtual void MaxVel(double* pmaxvel, bool process_units)=0;
70- virtual void MinVx(double* pminvx, bool process_units)=0;
71- virtual void MaxVx(double* pmaxvx, bool process_units)=0;
72- virtual void MaxAbsVx(double* pmaxabsvx, bool process_units)=0;
73- virtual void MinVy(double* pminvy, bool process_units)=0;
74- virtual void MaxVy(double* pmaxvy, bool process_units)=0;
75- virtual void MaxAbsVy(double* pmaxabsvy, bool process_units)=0;
76- virtual void MinVz(double* pminvz, bool process_units)=0;
77- virtual void MaxVz(double* pmaxvz, bool process_units)=0;
78- virtual void MaxAbsVz(double* pmaxabsvz, bool process_units)=0;
79- virtual double MassFlux(double* segment,bool process_units)=0;
80- virtual void ElementResponse(double* presponse,int response_enum,bool process_units)=0;
81- virtual double IceVolume(void)=0;
82+ virtual void MinVel(IssmDouble* pminvel, bool process_units)=0;
83+ virtual void MaxVel(IssmDouble* pmaxvel, bool process_units)=0;
84+ virtual void MinVx(IssmDouble* pminvx, bool process_units)=0;
85+ virtual void MaxVx(IssmDouble* pmaxvx, bool process_units)=0;
86+ virtual void MaxAbsVx(IssmDouble* pmaxabsvx, bool process_units)=0;
87+ virtual void MinVy(IssmDouble* pminvy, bool process_units)=0;
88+ virtual void MaxVy(IssmDouble* pmaxvy, bool process_units)=0;
89+ virtual void MaxAbsVy(IssmDouble* pmaxabsvy, bool process_units)=0;
90+ virtual void MinVz(IssmDouble* pminvz, bool process_units)=0;
91+ virtual void MaxVz(IssmDouble* pmaxvz, bool process_units)=0;
92+ virtual void MaxAbsVz(IssmDouble* pmaxabsvz, bool process_units)=0;
93+ virtual IssmDouble MassFlux(IssmDouble* segment,bool process_units)=0;
94+ virtual void ElementResponse(IssmDouble* presponse,int response_enum,bool process_units)=0;
95+ virtual IssmDouble IceVolume(void)=0;
96 #endif
97
98 #ifdef _HAVE_CONTROL_
99 virtual void Gradj(Vector* gradient,int control_type,int control_index)=0;
100- virtual double ThicknessAbsMisfit(bool process_units ,int weight_index)=0;
101- virtual double SurfaceAbsVelMisfit(bool process_units ,int weight_index)=0;
102- virtual double SurfaceRelVelMisfit(bool process_units ,int weight_index)=0;
103- virtual double SurfaceLogVelMisfit(bool process_units ,int weight_index)=0;
104- virtual double SurfaceLogVxVyMisfit(bool process_units,int weight_index)=0;
105- virtual double SurfaceAverageVelMisfit(bool process_units,int weight_index)=0;
106- virtual double ThicknessAbsGradient(bool process_units,int weight_index)=0;
107- virtual double RheologyBbarAbsGradient(bool process_units,int weight_index)=0;
108- virtual double DragCoefficientAbsGradient(bool process_units,int weight_index)=0;
109+ virtual IssmDouble ThicknessAbsMisfit(bool process_units ,int weight_index)=0;
110+ virtual IssmDouble SurfaceAbsVelMisfit(bool process_units ,int weight_index)=0;
111+ virtual IssmDouble SurfaceRelVelMisfit(bool process_units ,int weight_index)=0;
112+ virtual IssmDouble SurfaceLogVelMisfit(bool process_units ,int weight_index)=0;
113+ virtual IssmDouble SurfaceLogVxVyMisfit(bool process_units,int weight_index)=0;
114+ virtual IssmDouble SurfaceAverageVelMisfit(bool process_units,int weight_index)=0;
115+ virtual IssmDouble ThicknessAbsGradient(bool process_units,int weight_index)=0;
116+ virtual IssmDouble RheologyBbarAbsGradient(bool process_units,int weight_index)=0;
117+ virtual IssmDouble DragCoefficientAbsGradient(bool process_units,int weight_index)=0;
118 virtual void ControlInputGetGradient(Vector* gradient,int enum_type,int control_index)=0;
119- virtual void ControlInputSetGradient(double* gradient,int enum_type,int control_index)=0;
120- virtual void ControlInputScaleGradient(int enum_type, double scale)=0;
121+ virtual void ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index)=0;
122+ virtual void ControlInputScaleGradient(int enum_type, IssmDouble scale)=0;
123 virtual void GetVectorFromControlInputs(Vector* gradient,int control_enum,int control_index,const char* data)=0;
124- virtual void SetControlInputsFromVector(double* vector,int control_enum,int control_index)=0;
125- virtual void InputControlUpdate(double scalar,bool save_parameter)=0;
126+ virtual void SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index)=0;
127+ virtual void InputControlUpdate(IssmDouble scalar,bool save_parameter)=0;
128 #endif
129 };
130 #endif
131Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/Tria.cpp
132===================================================================
133--- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/Tria.cpp (revision 12470)
134+++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/Tria.cpp (revision 12471)
135@@ -124,16 +124,16 @@
136
137 /*Other*/
138 /*FUNCTION Tria::AverageOntoPartition {{{*/
139-void Tria::AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas,double* vertex_response,double* qmu_part){
140+void Tria::AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){
141
142 bool already=false;
143 int i,j;
144 int partition[NUMVERTICES];
145 int offsetsid[NUMVERTICES];
146 int offsetdof[NUMVERTICES];
147- double area;
148- double mean;
149- double values[3];
150+ IssmDouble area;
151+ IssmDouble mean;
152+ IssmDouble values[3];
153
154 /*First, get the area: */
155 area=this->GetArea();
156@@ -231,10 +231,10 @@
157
158 /*Intermediaries */
159 int i,j,ig;
160- double heatcapacity,latentheat;
161- double Jdet,D_scalar;
162- double xyz_list[NUMVERTICES][3];
163- double L[3];
164+ IssmDouble heatcapacity,latentheat;
165+ IssmDouble Jdet,D_scalar;
166+ IssmDouble xyz_list[NUMVERTICES][3];
167+ IssmDouble L[3];
168 GaussTria *gauss=NULL;
169
170 /*Initialize Element matrix*/
171@@ -290,18 +290,18 @@
172 /*Intermediaries */
173 int stabilization;
174 int i,j,ig,dim;
175- double Jdettria,DL_scalar,dt,h;
176- double vel,vx,vy,dvxdx,dvydy;
177- double dvx[2],dvy[2];
178- double v_gauss[2]={0.0};
179- double xyz_list[NUMVERTICES][3];
180- double L[NUMVERTICES];
181- double B[2][NUMVERTICES];
182- double Bprime[2][NUMVERTICES];
183- double K[2][2] ={0.0};
184- double KDL[2][2] ={0.0};
185- double DL[2][2] ={0.0};
186- double DLprime[2][2] ={0.0};
187+ IssmDouble Jdettria,DL_scalar,dt,h;
188+ IssmDouble vel,vx,vy,dvxdx,dvydy;
189+ IssmDouble dvx[2],dvy[2];
190+ IssmDouble v_gauss[2]={0.0};
191+ IssmDouble xyz_list[NUMVERTICES][3];
192+ IssmDouble L[NUMVERTICES];
193+ IssmDouble B[2][NUMVERTICES];
194+ IssmDouble Bprime[2][NUMVERTICES];
195+ IssmDouble K[2][2] ={0.0};
196+ IssmDouble KDL[2][2] ={0.0};
197+ IssmDouble DL[2][2] ={0.0};
198+ IssmDouble DLprime[2][2] ={0.0};
199 GaussTria *gauss=NULL;
200
201 /*Initialize Element matrix*/
202@@ -409,14 +409,14 @@
203
204 /*Intermediaries */
205 int i,j,ig,dim;
206- double xyz_list[NUMVERTICES][3];
207- double Jdettria,dt,vx,vy;
208- double L[NUMVERTICES];
209- double B[2][NUMVERTICES];
210- double Bprime[2][NUMVERTICES];
211- double DL[2][2]={0.0};
212- double DLprime[2][2]={0.0};
213- double DL_scalar;
214+ IssmDouble xyz_list[NUMVERTICES][3];
215+ IssmDouble Jdettria,dt,vx,vy;
216+ IssmDouble L[NUMVERTICES];
217+ IssmDouble B[2][NUMVERTICES];
218+ IssmDouble Bprime[2][NUMVERTICES];
219+ IssmDouble DL[2][2]={0.0};
220+ IssmDouble DLprime[2][2]={0.0};
221+ IssmDouble DL_scalar;
222 GaussTria *gauss=NULL;
223
224 /*Initialize Element matrix*/
225@@ -484,9 +484,9 @@
226
227 /* Intermediaries */
228 int i,j,ig;
229- double DL_scalar,Jdet;
230- double xyz_list[NUMVERTICES][3];
231- double L[1][3];
232+ IssmDouble DL_scalar,Jdet;
233+ IssmDouble xyz_list[NUMVERTICES][3];
234+ IssmDouble L[1][3];
235 GaussTria *gauss = NULL;
236
237 /*Initialize Element matrix*/
238@@ -598,10 +598,10 @@
239
240 /*Intermediaries */
241 int i,j,ig;
242- double Jdettria,dt;
243- double surface_mass_balance_g,basal_melting_g,basal_melting_correction_g,thickness_g;
244- double xyz_list[NUMVERTICES][3];
245- double L[NUMVERTICES];
246+ IssmDouble Jdettria,dt;
247+ IssmDouble surface_mass_balance_g,basal_melting_g,basal_melting_correction_g,thickness_g;
248+ IssmDouble xyz_list[NUMVERTICES][3];
249+ IssmDouble L[NUMVERTICES];
250 GaussTria* gauss=NULL;
251
252 /*Initialize Element vector*/
253@@ -649,10 +649,10 @@
254
255 /*Intermediaries */
256 int i,j,ig;
257- double Jdettria,dt;
258- double surface_mass_balance_g,basal_melting_g,thickness_g;
259- double xyz_list[NUMVERTICES][3];
260- double L[NUMVERTICES];
261+ IssmDouble Jdettria,dt;
262+ IssmDouble surface_mass_balance_g,basal_melting_g,thickness_g;
263+ IssmDouble xyz_list[NUMVERTICES][3];
264+ IssmDouble L[NUMVERTICES];
265 GaussTria* gauss=NULL;
266
267 /*Initialize Element vector*/
268@@ -695,10 +695,10 @@
269 /*Intermediaries */
270 int i,j,ig;
271 int analysis_type;
272- double Jdet;
273- double xyz_list[NUMVERTICES][3];
274- double slope[2];
275- double basis[3];
276+ IssmDouble Jdet;
277+ IssmDouble xyz_list[NUMVERTICES][3];
278+ IssmDouble slope[2];
279+ IssmDouble basis[3];
280 GaussTria* gauss=NULL;
281
282 /*Initialize Element vector*/
283@@ -786,15 +786,15 @@
284 void Tria::ComputeStressTensor(){
285
286 int iv;
287- double xyz_list[NUMVERTICES][3];
288- double pressure,viscosity;
289- double epsilon[3]; /* epsilon=[exx,eyy,exy];*/
290- double sigma_xx[NUMVERTICES];
291- double sigma_yy[NUMVERTICES];
292- double sigma_zz[NUMVERTICES]={0,0,0};
293- double sigma_xy[NUMVERTICES];
294- double sigma_xz[NUMVERTICES]={0,0,0};
295- double sigma_yz[NUMVERTICES]={0,0,0};
296+ IssmDouble xyz_list[NUMVERTICES][3];
297+ IssmDouble pressure,viscosity;
298+ IssmDouble epsilon[3]; /* epsilon=[exx,eyy,exy];*/
299+ IssmDouble sigma_xx[NUMVERTICES];
300+ IssmDouble sigma_yy[NUMVERTICES];
301+ IssmDouble sigma_zz[NUMVERTICES]={0,0,0};
302+ IssmDouble sigma_xy[NUMVERTICES];
303+ IssmDouble sigma_xz[NUMVERTICES]={0,0,0};
304+ IssmDouble sigma_yz[NUMVERTICES]={0,0,0};
305 GaussTria* gauss=NULL;
306
307 /* Get node coordinates and dof list: */
308@@ -947,11 +947,11 @@
309 }
310 /*}}}*/
311 /*FUNCTION Tria::GetArea {{{*/
312-double Tria::GetArea(void){
313+IssmDouble Tria::GetArea(void){
314
315- double area=0;
316- double xyz_list[NUMVERTICES][3];
317- double x1,y1,x2,y2,x3,y3;
318+ IssmDouble area=0;
319+ IssmDouble xyz_list[NUMVERTICES][3];
320+ IssmDouble x1,y1,x2,y2,x3,y3;
321
322 /*Get xyz list: */
323 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);
324@@ -1021,11 +1021,11 @@
325 _error_("Node provided not found among element nodes");
326 }
327 /*}}}*/
328-/*FUNCTION Tria::GetInputListOnVertices(double* pvalue,int enumtype) {{{*/
329-void Tria::GetInputListOnVertices(double* pvalue,int enumtype){
330+/*FUNCTION Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype) {{{*/
331+void Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype){
332
333 /*Intermediaries*/
334- double value[NUMVERTICES];
335+ IssmDouble value[NUMVERTICES];
336 GaussTria *gauss = NULL;
337
338 /*Recover input*/
339@@ -1046,10 +1046,10 @@
340 delete gauss;
341 }
342 /*}}}*/
343-/*FUNCTION Tria::GetInputListOnVertices(double* pvalue,int enumtype,double defaultvalue) {{{*/
344-void Tria::GetInputListOnVertices(double* pvalue,int enumtype,double defaultvalue){
345+/*FUNCTION Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue) {{{*/
346+void Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){
347
348- double value[NUMVERTICES];
349+ IssmDouble value[NUMVERTICES];
350 GaussTria *gauss = NULL;
351 Input *input = inputs->GetInput(enumtype);
352
353@@ -1072,10 +1072,10 @@
354 delete gauss;
355 }
356 /*}}}*/
357-/*FUNCTION Tria::GetInputListOnVertices(double* pvalue,int enumtype,double defaultvalue,int index) TO BE REMOVED{{{*/
358-void Tria::GetInputListOnVertices(double* pvalue,int enumtype,double defaultvalue,int index){
359+/*FUNCTION Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue,int index) TO BE REMOVED{{{*/
360+void Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue,int index){
361
362- double value[NUMVERTICES];
363+ IssmDouble value[NUMVERTICES];
364 GaussTria *gauss = NULL;
365 Input *input = inputs->GetInput(enumtype);
366
367@@ -1098,8 +1098,8 @@
368 delete gauss;
369 }
370 /*}}}*/
371-/*FUNCTION Tria::GetInputValue(double* pvalue,Node* node,int enumtype) {{{*/
372-void Tria::GetInputValue(double* pvalue,Node* node,int enumtype){
373+/*FUNCTION Tria::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype) {{{*/
374+void Tria::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){
375
376 Input* input=inputs->GetInput(enumtype);
377 if(!input) _error_("No input of type %s found in tria",EnumToStringx(enumtype));
378@@ -1149,14 +1149,14 @@
379
380 }
381 /*}}}*/
382-/*FUNCTION Tria::GetStrainRate2d(double* epsilon,double* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input){{{*/
383-void Tria::GetStrainRate2d(double* epsilon,double* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input){
384+/*FUNCTION Tria::GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input){{{*/
385+void Tria::GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input){
386 /*Compute the 2d Strain Rate (3 components):
387 * epsilon=[exx eyy exy] */
388
389 int i;
390- double epsilonvx[3];
391- double epsilonvy[3];
392+ IssmDouble epsilonvx[3];
393+ IssmDouble epsilonvy[3];
394
395 /*Check that both inputs have been found*/
396 if (!vx_input || !vy_input){
397@@ -1225,7 +1225,7 @@
398 }
399 /*}}}*/
400 /*FUNCTION Tria::InputArtificialNoise{{{*/
401-void Tria::InputArtificialNoise(int enum_type,double min,double max){
402+void Tria::InputArtificialNoise(int enum_type,IssmDouble min,IssmDouble max){
403
404 Input* input=NULL;
405
406@@ -1238,7 +1238,7 @@
407 }
408 /*}}}*/
409 /*FUNCTION Tria::InputConvergence{{{*/
410-bool Tria::InputConvergence(double* eps, int* enums,int num_enums,int* criterionenums,double* criterionvalues,int num_criterionenums){
411+bool Tria::InputConvergence(IssmDouble* eps, int* enums,int num_enums,int* criterionenums,IssmDouble* criterionvalues,int num_criterionenums){
412
413 bool converged=true;
414 int i;
415@@ -1305,7 +1305,7 @@
416 }
417 /*}}}*/
418 /*FUNCTION Tria::InputScale{{{*/
419-void Tria::InputScale(int enum_type,double scale_factor){
420+void Tria::InputScale(int enum_type,IssmDouble scale_factor){
421
422 Input* input=NULL;
423
424@@ -1318,7 +1318,7 @@
425 }
426 /*}}}*/
427 /*FUNCTION Tria::InputToResult{{{*/
428-void Tria::InputToResult(int enum_type,int step,double time){
429+void Tria::InputToResult(int enum_type,int step,IssmDouble time){
430
431 int i;
432 Input *input = NULL;
433@@ -1349,8 +1349,8 @@
434 this->inputs->AddInput(new IntInput(name,constant));
435 }
436 /*}}}*/
437-/*FUNCTION Tria::InputUpdateFromConstant(double value, int name);{{{*/
438-void Tria::InputUpdateFromConstant(double constant, int name){
439+/*FUNCTION Tria::InputUpdateFromConstant(IssmDouble value, int name);{{{*/
440+void Tria::InputUpdateFromConstant(IssmDouble constant, int name){
441 /*Check that name is an element input*/
442 if (!IsInput(name)) return;
443
444@@ -1373,12 +1373,12 @@
445 /*Intermediaries*/
446 int i,j;
447 int tria_vertex_ids[3];
448- double nodeinputs[3];
449- double cmmininputs[3];
450- double cmmaxinputs[3];
451+ IssmDouble nodeinputs[3];
452+ IssmDouble cmmininputs[3];
453+ IssmDouble cmmaxinputs[3];
454 bool control_analysis=false;
455 int num_control_type;
456- double yts;
457+ IssmDouble yts;
458 int num_cm_responses;
459
460 /*Get parameters: */
461@@ -1454,7 +1454,7 @@
462 }
463 /*}}}*/
464 /*FUNCTION Tria::InputUpdateFromSolution {{{*/
465-void Tria::InputUpdateFromSolution(double* solution){
466+void Tria::InputUpdateFromSolution(IssmDouble* solution){
467
468 /*retrive parameters: */
469 int analysis_type;
470@@ -1509,12 +1509,12 @@
471 }
472 /*}}}*/
473 /*FUNCTION Tria::InputUpdateFromSolutionOneDof{{{*/
474-void Tria::InputUpdateFromSolutionOneDof(double* solution,int enum_type){
475+void Tria::InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type){
476
477 const int numdof = NDOF1*NUMVERTICES;
478
479 int* doflist=NULL;
480- double values[numdof];
481+ IssmDouble values[numdof];
482
483 /*Get dof list: */
484 GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
485@@ -1533,20 +1533,20 @@
486 }
487 /*}}}*/
488 /*FUNCTION Tria::InputUpdateFromSolutionPrognostic{{{*/
489-void Tria::InputUpdateFromSolutionPrognostic(double* solution){
490+void Tria::InputUpdateFromSolutionPrognostic(IssmDouble* solution){
491
492 /*Intermediaries*/
493 const int numdof = NDOF1*NUMVERTICES;
494
495 int i,hydroadjustment;
496 int* doflist=NULL;
497- double rho_ice,rho_water,minthickness;
498- double newthickness[numdof];
499- double newbed[numdof];
500- double newsurface[numdof];
501- double oldbed[NUMVERTICES];
502- double oldsurface[NUMVERTICES];
503- double oldthickness[NUMVERTICES];
504+ IssmDouble rho_ice,rho_water,minthickness;
505+ IssmDouble newthickness[numdof];
506+ IssmDouble newbed[numdof];
507+ IssmDouble newsurface[numdof];
508+ IssmDouble oldbed[NUMVERTICES];
509+ IssmDouble oldsurface[NUMVERTICES];
510+ IssmDouble oldthickness[NUMVERTICES];
511
512 /*Get dof list: */
513 GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
514@@ -1599,8 +1599,8 @@
515 xDelete<int>(doflist);
516 }
517 /*}}}*/
518-/*FUNCTION Tria::InputUpdateFromVector(double* vector, int name, int type);{{{*/
519-void Tria::InputUpdateFromVector(double* vector, int name, int type){
520+/*FUNCTION Tria::InputUpdateFromVector(IssmDouble* vector, int name, int type);{{{*/
521+void Tria::InputUpdateFromVector(IssmDouble* vector, int name, int type){
522
523 /*Check that name is an element input*/
524 if (!IsInput(name)) return;
525@@ -1610,7 +1610,7 @@
526 case VertexEnum:
527
528 /*New TriaP1Input*/
529- double values[3];
530+ IssmDouble values[3];
531
532 /*Get values on the 3 vertices*/
533 for (int i=0;i<3;i++){
534@@ -1641,8 +1641,8 @@
535 _error_(" not supported yet!");
536 }
537 /*}}}*/
538-/*FUNCTION Tria::InputCreate(double scalar,int enum,int code);{{{*/
539-void Tria::InputCreate(double scalar,int name,int code){
540+/*FUNCTION Tria::InputCreate(IssmDouble scalar,int enum,int code);{{{*/
541+void Tria::InputCreate(IssmDouble scalar,int name,int code){
542
543 /*Check that name is an element input*/
544 if (!IsInput(name)) return;
545@@ -1653,26 +1653,26 @@
546 else if ((code==6) || (code==2)){ //integer
547 this->inputs->AddInput(new IntInput(name,(int)scalar));
548 }
549- else if ((code==7) || (code==3)){ //double
550+ else if ((code==7) || (code==3)){ //IssmDouble
551 this->inputs->AddInput(new DoubleInput(name,(int)scalar));
552 }
553 else _error_("%s%i"," could not recognize nature of vector from code ",code);
554
555 }
556 /*}}}*/
557-/*FUNCTION Tria::InputCreate(double* vector,int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){{{*/
558-void Tria::InputCreate(double* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){//index into elements
559+/*FUNCTION Tria::InputCreate(IssmDouble* vector,int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){{{*/
560+void Tria::InputCreate(IssmDouble* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){//index into elements
561
562 /*Intermediaries*/
563 int i,j,t;
564 int tria_vertex_ids[3];
565 int row;
566- double nodeinputs[3];
567- double time;
568+ IssmDouble nodeinputs[3];
569+ IssmDouble time;
570 TransientInput* transientinput=NULL;
571 int numberofvertices;
572 int numberofelements;
573- double yts;
574+ IssmDouble yts;
575
576
577 /*Fetch parameters: */
578@@ -1692,7 +1692,7 @@
579 if(M==numberofvertices){
580
581 /*create input values: */
582- for(i=0;i<3;i++)nodeinputs[i]=(double)vector[tria_vertex_ids[i]-1];
583+ for(i=0;i<3;i++)nodeinputs[i]=(IssmDouble)vector[tria_vertex_ids[i]-1];
584
585 /*process units: */
586 UnitConversion(&nodeinputs[0], 3 ,ExtToIuEnum, vector_enum);
587@@ -1707,14 +1707,14 @@
588 /*create input values: */
589 for(i=0;i<3;i++){
590 row=tria_vertex_ids[i]-1;
591- nodeinputs[i]=(double)vector[N*row+t];
592+ nodeinputs[i]=(IssmDouble)vector[N*row+t];
593 }
594
595 /*process units: */
596 UnitConversion(&nodeinputs[0], 3 ,ExtToIuEnum, vector_enum);
597
598 /*time? :*/
599- time=(double)vector[(M-1)*N+t]*yts;
600+ time=(IssmDouble)vector[(M-1)*N+t]*yts;
601
602 if(t==0) transientinput=new TransientInput(vector_enum);
603 transientinput->AddTimeInput(new TriaP1Input(vector_enum,nodeinputs),time);
604@@ -1735,8 +1735,8 @@
605 else if (code==6){ //integer
606 this->inputs->AddInput(new IntInput(vector_enum,(int)vector[index]));
607 }
608- else if (code==7){ //double
609- this->inputs->AddInput(new DoubleInput(vector_enum,(double)vector[index]));
610+ else if (code==7){ //IssmDouble
611+ this->inputs->AddInput(new DoubleInput(vector_enum,(IssmDouble)vector[index]));
612 }
613 else _error_("%s%i"," could not recognize nature of vector from code ",code);
614 }
615@@ -1816,7 +1816,7 @@
616 }
617 /*}}}*/
618 /*FUNCTION Tria::IsNodeOnShelfFromFlags {{{*/
619-bool Tria::IsNodeOnShelfFromFlags(double* flags){
620+bool Tria::IsNodeOnShelfFromFlags(IssmDouble* flags){
621
622 int i;
623 bool shelf=false;
624@@ -1839,14 +1839,14 @@
625 }
626 /*}}}*/
627 /*FUNCTION Tria::ListResultsInfo{{{*/
628-void Tria::ListResultsInfo(int** in_resultsenums,int** in_resultssizes,double** in_resultstimes,int** in_resultssteps,int* in_num_results){
629+void Tria::ListResultsInfo(int** in_resultsenums,int** in_resultssizes,IssmDouble** in_resultstimes,int** in_resultssteps,int* in_num_results){
630
631 /*Intermediaries*/
632 int i;
633 int numberofresults = 0;
634 int *resultsenums = NULL;
635 int *resultssizes = NULL;
636- double *resultstimes = NULL;
637+ IssmDouble *resultstimes = NULL;
638 int *resultssteps = NULL;
639
640 /*Checks*/
641@@ -1863,7 +1863,7 @@
642 /*Allocate output*/
643 resultsenums=xNew<int>(numberofresults);
644 resultssizes=xNew<int>(numberofresults);
645- resultstimes=xNew<double>(numberofresults);
646+ resultstimes=xNew<IssmDouble>(numberofresults);
647 resultssteps=xNew<int>(numberofresults);
648
649 /*populate enums*/
650@@ -1890,14 +1890,14 @@
651
652 }/*}}}*/
653 /*FUNCTION Tria::MigrateGroundingLine{{{*/
654-void Tria::MigrateGroundingLine(double* old_floating_ice,double* sheet_ungrounding){
655+void Tria::MigrateGroundingLine(IssmDouble* old_floating_ice,IssmDouble* sheet_ungrounding){
656
657 int i,migration_style,unground;
658 bool elementonshelf = false;
659- double bed_hydro,yts,gl_melting_rate;
660- double rho_water,rho_ice,density;
661- double melting[NUMVERTICES];
662- double h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES];
663+ IssmDouble bed_hydro,yts,gl_melting_rate;
664+ IssmDouble rho_water,rho_ice,density;
665+ IssmDouble melting[NUMVERTICES];
666+ IssmDouble h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES];
667
668 /*Recover info at the vertices: */
669 parameters->FindParam(&migration_style,GroundinglineMigrationEnum);
670@@ -1972,11 +1972,11 @@
671 }
672 /*}}}*/
673 /*FUNCTION Tria::NodalValue {{{*/
674-int Tria::NodalValue(double* pvalue, int index, int natureofdataenum,bool process_units){
675+int Tria::NodalValue(IssmDouble* pvalue, int index, int natureofdataenum,bool process_units){
676
677 int i;
678 int found=0;
679- double value;
680+ IssmDouble value;
681 Input* data=NULL;
682 GaussTria *gauss = NULL;
683
684@@ -2057,9 +2057,9 @@
685 void Tria::PotentialSheetUngrounding(Vector* potential_sheet_ungrounding){
686
687 int i;
688- double h[NUMVERTICES],ba[NUMVERTICES];
689- double bed_hydro;
690- double rho_water,rho_ice,density;
691+ IssmDouble h[NUMVERTICES],ba[NUMVERTICES];
692+ IssmDouble bed_hydro;
693+ IssmDouble rho_water,rho_ice,density;
694 bool elementonshelf = false;
695
696 /*material parameters: */
697@@ -2083,58 +2083,58 @@
698 }
699 /*}}}*/
700 /*FUNCTION Tria::PositiveDegreeDay{{{*/
701-void Tria::PositiveDegreeDay(double* pdds,double* pds,double signorm){
702+void Tria::PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){
703
704 int i,iqj,imonth;
705- double agd[NUMVERTICES]; // surface mass balance
706- double saccu[NUMVERTICES] = {0}; // yearly surface accumulation
707- double smelt[NUMVERTICES] = {0}; // yearly melt
708- double precrunoff[NUMVERTICES]; // yearly runoff
709- double prect; // total precipitation during 1 year taking into account des. ef.
710- double water; //water=rain + snowmelt
711- double runoff; //meltwater only, does not include rain
712- double sconv; //rhow_rain/rhoi / 12 months
713+ IssmDouble agd[NUMVERTICES]; // surface mass balance
714+ IssmDouble saccu[NUMVERTICES] = {0}; // yearly surface accumulation
715+ IssmDouble smelt[NUMVERTICES] = {0}; // yearly melt
716+ IssmDouble precrunoff[NUMVERTICES]; // yearly runoff
717+ IssmDouble prect; // total precipitation during 1 year taking into account des. ef.
718+ IssmDouble water; //water=rain + snowmelt
719+ IssmDouble runoff; //meltwater only, does not include rain
720+ IssmDouble sconv; //rhow_rain/rhoi / 12 months
721
722- double rho_water,rho_ice,density;
723- double lapser=6.5/1000, sealev=0; // lapse rate. degrees per meter. 7.5 lev's 99 paper, 9 Marshall 99 paper
724- double desfac = 0.5; // desert elevation factor
725- double s0p[NUMVERTICES]={0}; // should be set to elevation from precip source
726- double s0t[NUMVERTICES]={0}; // should be set to elevation from temperature source
727- double st; // elevation between altitude of the temp record and current altitude
728- double sp; // elevation between altitude of the prec record and current altitude
729+ IssmDouble rho_water,rho_ice,density;
730+ IssmDouble lapser=6.5/1000, sealev=0; // lapse rate. degrees per meter. 7.5 lev's 99 paper, 9 Marshall 99 paper
731+ IssmDouble desfac = 0.5; // desert elevation factor
732+ IssmDouble s0p[NUMVERTICES]={0}; // should be set to elevation from precip source
733+ IssmDouble s0t[NUMVERTICES]={0}; // should be set to elevation from temperature source
734+ IssmDouble st; // elevation between altitude of the temp record and current altitude
735+ IssmDouble sp; // elevation between altitude of the prec record and current altitude
736
737 // PDD and PD constants and variables
738- double siglim; // sigma limit for the integration which is equal to 2.5 sigmanorm
739- double signormc = signorm - 0.5; // sigma of the temperature distribution for cloudy day
740- double siglimc, siglim0, siglim0c;
741- double PDup, pddsig, PDCUT = 2.0; // PDcut: rain/snow cutoff temperature (C)
742- double DT = 0.02;
743- double pddt, pd; // pd: snow/precip fraction, precipitation falling as snow
744+ IssmDouble siglim; // sigma limit for the integration which is equal to 2.5 sigmanorm
745+ IssmDouble signormc = signorm - 0.5; // sigma of the temperature distribution for cloudy day
746+ IssmDouble siglimc, siglim0, siglim0c;
747+ IssmDouble PDup, pddsig, PDCUT = 2.0; // PDcut: rain/snow cutoff temperature (C)
748+ IssmDouble DT = 0.02;
749+ IssmDouble pddt, pd; // pd: snow/precip fraction, precipitation falling as snow
750
751- double q, qmpt; // q is desert/elev. fact, hnpfac is huybrect fact, and pd is normal dist.
752- double qm[NUMVERTICES] = {0}; // snow part of the precipitation
753- double qmt[NUMVERTICES] = {0}; // precipitation without desertification effect adjustment
754- double qmp[NUMVERTICES] = {0}; // desertification taken into account
755- double pdd[NUMVERTICES] = {0};
756- double frzndd[NUMVERTICES] = {0};
757+ IssmDouble q, qmpt; // q is desert/elev. fact, hnpfac is huybrect fact, and pd is normal dist.
758+ IssmDouble qm[NUMVERTICES] = {0}; // snow part of the precipitation
759+ IssmDouble qmt[NUMVERTICES] = {0}; // precipitation without desertification effect adjustment
760+ IssmDouble qmp[NUMVERTICES] = {0}; // desertification taken into account
761+ IssmDouble pdd[NUMVERTICES] = {0};
762+ IssmDouble frzndd[NUMVERTICES] = {0};
763
764- double tstar; // monthly mean surface temp
765- double Tsum[NUMVERTICES]= {0}; // average summer (JJA) temperature
766- double Tsurf[NUMVERTICES] = {0}; // average annual temperature
767+ IssmDouble tstar; // monthly mean surface temp
768+ IssmDouble Tsum[NUMVERTICES]= {0}; // average summer (JJA) temperature
769+ IssmDouble Tsurf[NUMVERTICES] = {0}; // average annual temperature
770
771- double h[NUMVERTICES],s[NUMVERTICES],ttmp[NUMVERTICES],prectmp[NUMVERTICES]; // ,b[NUMVERTICES]
772- double t[NUMVERTICES+1][12],prec[NUMVERTICES+1][12];
773- double deltm=1/12;
774+ IssmDouble h[NUMVERTICES],s[NUMVERTICES],ttmp[NUMVERTICES],prectmp[NUMVERTICES]; // ,b[NUMVERTICES]
775+ IssmDouble t[NUMVERTICES+1][12],prec[NUMVERTICES+1][12];
776+ IssmDouble deltm=1/12;
777 int ismon[12]={12,1,2,3,4,5,6,7,8,9,10,11};
778
779- double snwm; // snow that could have been melted in a year.
780- double snwmf; // ablation factor for snow per positive degree day.
781- double smf; // ablation factor for ice per pdd (Braithwaite 1995 from tarasov 2002).
782+ IssmDouble snwm; // snow that could have been melted in a year.
783+ IssmDouble snwmf; // ablation factor for snow per positive degree day.
784+ IssmDouble smf; // ablation factor for ice per pdd (Braithwaite 1995 from tarasov 2002).
785
786- double dfrz=1.5, CovrLm=2009./3.35e+5, dCovrLm=dfrz*CovrLm; //m*J kg^-1 C^-1 /(J kg^-1)=m/C yr
787- double supice,supcap,diffndd;
788- double fsupT=0.5, fsupndd=0.5; // Tsurf mode factors for supice
789- double pddtj[NUMVERTICES], hmx2;
790+ IssmDouble dfrz=1.5, CovrLm=2009./3.35e+5, dCovrLm=dfrz*CovrLm; //m*J kg^-1 C^-1 /(J kg^-1)=m/C yr
791+ IssmDouble supice,supcap,diffndd;
792+ IssmDouble fsupT=0.5, fsupndd=0.5; // Tsurf mode factors for supice
793+ IssmDouble pddtj[NUMVERTICES], hmx2;
794
795 /*Recover info at the vertices: */
796 GetInputListOnVertices(&h[0],ThicknessEnum);
797@@ -2145,7 +2145,7 @@
798 /*Recover monthly temperatures*/
799 Input* input=inputs->GetInput(SurfaceforcingsMonthlytemperaturesEnum); _assert_(input);
800 GaussTria* gauss=new GaussTria();
801- double time,yts;
802+ IssmDouble time,yts;
803 this->parameters->FindParam(&time,TimeEnum);
804 this->parameters->FindParam(&yts,ConstantsYtsEnum);
805 for(int month=0;month<12;month++){
806@@ -2329,7 +2329,7 @@
807 }
808 /*}}}*/
809 /*FUNCTION Tria::RequestedOutput{{{*/
810-void Tria::RequestedOutput(int output_enum,int step,double time){
811+void Tria::RequestedOutput(int output_enum,int step,IssmDouble time){
812
813 if(IsInput(output_enum)){
814 /*just transfer this input to results, and we are done: */
815@@ -2363,7 +2363,7 @@
816 }
817 /*}}}*/
818 /*FUNCTION Tria::SmearFunction {{{*/
819-void Tria::SmearFunction(Vector* smearedvector,double (*WeightFunction)(double distance,double radius),double radius){
820+void Tria::SmearFunction(Vector* smearedvector,IssmDouble (*WeightFunction)(IssmDouble distance,IssmDouble radius),IssmDouble radius){
821 _error_("not implemented yet");
822
823 }
824@@ -2385,13 +2385,13 @@
825 }
826 /*}}}*/
827 /*FUNCTION Tria::SurfaceArea {{{*/
828-double Tria::SurfaceArea(void){
829+IssmDouble Tria::SurfaceArea(void){
830
831 int i;
832- double S;
833- double normal[3];
834- double v13[3],v23[3];
835- double xyz_list[NUMVERTICES][3];
836+ IssmDouble S;
837+ IssmDouble normal[3];
838+ IssmDouble v13[3],v23[3];
839+ IssmDouble xyz_list[NUMVERTICES][3];
840
841 /*If on water, return 0: */
842 if(IsOnWater())return 0;
843@@ -2407,19 +2407,19 @@
844 normal[1]=v13[2]*v23[0]-v13[0]*v23[2];
845 normal[2]=v13[0]*v23[1]-v13[1]*v23[0];
846
847- S = 0.5 * sqrt(pow(normal[0],(double)2)+pow(normal[1],(double)2)+pow(normal[2],(double)2));
848+ S = 0.5 * sqrt(pow(normal[0],(IssmDouble)2)+pow(normal[1],(IssmDouble)2)+pow(normal[2],(IssmDouble)2));
849
850 /*Return: */
851 return S;
852 }
853 /*}}}*/
854 /*FUNCTION Tria::SurfaceNormal{{{*/
855-void Tria::SurfaceNormal(double* surface_normal, double xyz_list[3][3]){
856+void Tria::SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]){
857
858 int i;
859- double v13[3],v23[3];
860- double normal[3];
861- double normal_norm;
862+ IssmDouble v13[3],v23[3];
863+ IssmDouble normal[3];
864+ IssmDouble normal_norm;
865
866 for (i=0;i<3;i++){
867 v13[i]=xyz_list[0][i]-xyz_list[2][i];
868@@ -2430,7 +2430,7 @@
869 normal[1]=v13[2]*v23[0]-v13[0]*v23[2];
870 normal[2]=v13[0]*v23[1]-v13[1]*v23[0];
871
872- normal_norm=sqrt( pow(normal[0],(double)2)+pow(normal[1],(double)2)+pow(normal[2],(double)2) );
873+ normal_norm=sqrt( pow(normal[0],(IssmDouble)2)+pow(normal[1],(IssmDouble)2)+pow(normal[2],(IssmDouble)2) );
874
875 *(surface_normal)=normal[0]/normal_norm;
876 *(surface_normal+1)=normal[1]/normal_norm;
877@@ -2438,16 +2438,16 @@
878 }
879 /*}}}*/
880 /*FUNCTION Tria::TimeAdapt{{{*/
881-double Tria::TimeAdapt(void){
882+IssmDouble Tria::TimeAdapt(void){
883
884 /*intermediary: */
885 int i;
886- double C,dt;
887- double dx,dy;
888- double maxx,minx;
889- double maxy,miny;
890- double maxabsvx,maxabsvy;
891- double xyz_list[NUMVERTICES][3];
892+ IssmDouble C,dt;
893+ IssmDouble dx,dy;
894+ IssmDouble maxx,minx;
895+ IssmDouble maxy,miny;
896+ IssmDouble maxabsvx,maxabsvy;
897+ IssmDouble xyz_list[NUMVERTICES][3];
898
899 /*get CFL coefficient:*/
900 this->parameters->FindParam(&C,TimesteppingCflCoefficientEnum);
901@@ -2491,8 +2491,8 @@
902 int tria_node_ids[3];
903 int tria_vertex_ids[3];
904 int tria_type;
905- double nodeinputs[3];
906- double yts;
907+ IssmDouble nodeinputs[3];
908+ IssmDouble yts;
909 int progstabilization,balancestabilization;
910 bool dakota_analysis;
911
912@@ -2584,7 +2584,7 @@
913 }
914 /*}}}*/
915 /*FUNCTION Tria::UpdatePotentialSheetUngrounding{{{*/
916-int Tria::UpdatePotentialSheetUngrounding(double* vertices_potentially_ungrounding,Vector* vec_nodes_on_iceshelf,double* nodes_on_iceshelf){
917+int Tria::UpdatePotentialSheetUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf){
918
919 int i;
920 int nflipped=0;
921@@ -2606,11 +2606,11 @@
922
923 #ifdef _HAVE_RESPONSES_
924 /*FUNCTION Tria::IceVolume {{{*/
925-double Tria::IceVolume(void){
926+IssmDouble Tria::IceVolume(void){
927
928 /*The volume of a troncated prism is base * 1/3 sum(length of edges)*/
929- double base,surface,bed;
930- double xyz_list[NUMVERTICES][3];
931+ IssmDouble base,surface,bed;
932+ IssmDouble xyz_list[NUMVERTICES][3];
933
934 if(IsOnWater())return 0;
935
936@@ -2632,17 +2632,17 @@
937 }
938 /*}}}*/
939 /*FUNCTION Tria::MassFlux {{{*/
940-double Tria::MassFlux( double* segment,bool process_units){
941+IssmDouble Tria::MassFlux( IssmDouble* segment,bool process_units){
942
943 const int numdofs=2;
944
945 int i,dim;
946- double mass_flux=0;
947- double xyz_list[NUMVERTICES][3];
948- double normal[2];
949- double length,rho_ice;
950- double x1,y1,x2,y2,h1,h2;
951- double vx1,vx2,vy1,vy2;
952+ IssmDouble mass_flux=0;
953+ IssmDouble xyz_list[NUMVERTICES][3];
954+ IssmDouble normal[2];
955+ IssmDouble length,rho_ice;
956+ IssmDouble x1,y1,x2,y2,h1,h2;
957+ IssmDouble vx1,vx2,vy1,vy2;
958 GaussTria* gauss_1=NULL;
959 GaussTria* gauss_2=NULL;
960
961@@ -2704,10 +2704,10 @@
962 }
963 /*}}}*/
964 /*FUNCTION Tria::MaxAbsVx{{{*/
965-void Tria::MaxAbsVx(double* pmaxabsvx, bool process_units){
966+void Tria::MaxAbsVx(IssmDouble* pmaxabsvx, bool process_units){
967
968 /*Get maximum:*/
969- double maxabsvx=this->inputs->MaxAbs(VxEnum);
970+ IssmDouble maxabsvx=this->inputs->MaxAbs(VxEnum);
971
972 /*process units if requested: */
973 if(process_units) maxabsvx=UnitConversion(maxabsvx,IuToExtEnum,VxEnum);
974@@ -2717,10 +2717,10 @@
975 }
976 /*}}}*/
977 /*FUNCTION Tria::MaxAbsVy{{{*/
978-void Tria::MaxAbsVy(double* pmaxabsvy, bool process_units){
979+void Tria::MaxAbsVy(IssmDouble* pmaxabsvy, bool process_units){
980
981 /*Get maximum:*/
982- double maxabsvy=this->inputs->MaxAbs(VyEnum);
983+ IssmDouble maxabsvy=this->inputs->MaxAbs(VyEnum);
984
985 /*process units if requested: */
986 if(process_units) maxabsvy=UnitConversion(maxabsvy,IuToExtEnum,VyEnum);
987@@ -2730,10 +2730,10 @@
988 }
989 /*}}}*/
990 /*FUNCTION Tria::MaxAbsVz{{{*/
991-void Tria::MaxAbsVz(double* pmaxabsvz, bool process_units){
992+void Tria::MaxAbsVz(IssmDouble* pmaxabsvz, bool process_units){
993
994 /*Get maximum:*/
995- double maxabsvz=this->inputs->MaxAbs(VzEnum);
996+ IssmDouble maxabsvz=this->inputs->MaxAbs(VzEnum);
997
998 /*process units if requested: */
999 if(process_units) maxabsvz=UnitConversion(maxabsvz,IuToExtEnum,VyEnum);
1000@@ -2743,10 +2743,10 @@
1001 }
1002 /*}}}*/
1003 /*FUNCTION Tria::MaxVel{{{*/
1004-void Tria::MaxVel(double* pmaxvel, bool process_units){
1005+void Tria::MaxVel(IssmDouble* pmaxvel, bool process_units){
1006
1007 /*Get maximum:*/
1008- double maxvel=this->inputs->Max(VelEnum);
1009+ IssmDouble maxvel=this->inputs->Max(VelEnum);
1010
1011 /*process units if requested: */
1012 if(process_units) maxvel=UnitConversion(maxvel,IuToExtEnum,VelEnum);
1013@@ -2756,10 +2756,10 @@
1014 }
1015 /*}}}*/
1016 /*FUNCTION Tria::MaxVx{{{*/
1017-void Tria::MaxVx(double* pmaxvx, bool process_units){
1018+void Tria::MaxVx(IssmDouble* pmaxvx, bool process_units){
1019
1020 /*Get maximum:*/
1021- double maxvx=this->inputs->Max(VxEnum);
1022+ IssmDouble maxvx=this->inputs->Max(VxEnum);
1023
1024 /*process units if requested: */
1025 if(process_units) maxvx=UnitConversion(maxvx,IuToExtEnum,VxEnum);
1026@@ -2769,10 +2769,10 @@
1027 }
1028 /*}}}*/
1029 /*FUNCTION Tria::MaxVy{{{*/
1030-void Tria::MaxVy(double* pmaxvy, bool process_units){
1031+void Tria::MaxVy(IssmDouble* pmaxvy, bool process_units){
1032
1033 /*Get maximum:*/
1034- double maxvy=this->inputs->Max(VyEnum);
1035+ IssmDouble maxvy=this->inputs->Max(VyEnum);
1036
1037 /*process units if requested: */
1038 if(process_units) maxvy=UnitConversion(maxvy,IuToExtEnum,VyEnum);
1039@@ -2783,10 +2783,10 @@
1040 }
1041 /*}}}*/
1042 /*FUNCTION Tria::MaxVz{{{*/
1043-void Tria::MaxVz(double* pmaxvz, bool process_units){
1044+void Tria::MaxVz(IssmDouble* pmaxvz, bool process_units){
1045
1046 /*Get maximum:*/
1047- double maxvz=this->inputs->Max(VzEnum);
1048+ IssmDouble maxvz=this->inputs->Max(VzEnum);
1049
1050 /*process units if requested: */
1051 if(process_units) maxvz=UnitConversion(maxvz,IuToExtEnum,VzEnum);
1052@@ -2796,10 +2796,10 @@
1053 }
1054 /*}}}*/
1055 /*FUNCTION Tria::MinVel{{{*/
1056-void Tria::MinVel(double* pminvel, bool process_units){
1057+void Tria::MinVel(IssmDouble* pminvel, bool process_units){
1058
1059 /*Get minimum:*/
1060- double minvel=this->inputs->Min(VelEnum);
1061+ IssmDouble minvel=this->inputs->Min(VelEnum);
1062
1063 /*process units if requested: */
1064 if(process_units) minvel=UnitConversion(minvel,IuToExtEnum,VelEnum);
1065@@ -2809,10 +2809,10 @@
1066 }
1067 /*}}}*/
1068 /*FUNCTION Tria::MinVx{{{*/
1069-void Tria::MinVx(double* pminvx, bool process_units){
1070+void Tria::MinVx(IssmDouble* pminvx, bool process_units){
1071
1072 /*Get minimum:*/
1073- double minvx=this->inputs->Min(VxEnum);
1074+ IssmDouble minvx=this->inputs->Min(VxEnum);
1075
1076 /*process units if requested: */
1077 if(process_units) minvx=UnitConversion(minvx,IuToExtEnum,VxEnum);
1078@@ -2822,10 +2822,10 @@
1079 }
1080 /*}}}*/
1081 /*FUNCTION Tria::MinVy{{{*/
1082-void Tria::MinVy(double* pminvy, bool process_units){
1083+void Tria::MinVy(IssmDouble* pminvy, bool process_units){
1084
1085 /*Get minimum:*/
1086- double minvy=this->inputs->Min(VyEnum);
1087+ IssmDouble minvy=this->inputs->Min(VyEnum);
1088
1089 /*process units if requested: */
1090 if(process_units) minvy=UnitConversion(minvy,IuToExtEnum,VyEnum);
1091@@ -2835,10 +2835,10 @@
1092 }
1093 /*}}}*/
1094 /*FUNCTION Tria::MinVz{{{*/
1095-void Tria::MinVz(double* pminvz, bool process_units){
1096+void Tria::MinVz(IssmDouble* pminvz, bool process_units){
1097
1098 /*Get minimum:*/
1099- double minvz=this->inputs->Min(VzEnum);
1100+ IssmDouble minvz=this->inputs->Min(VzEnum);
1101
1102 /*process units if requested: */
1103 if(process_units) minvz=UnitConversion(minvz,IuToExtEnum,VzEnum);
1104@@ -2848,7 +2848,7 @@
1105 }
1106 /*}}}*/
1107 /*FUNCTION Tria::ElementResponse{{{*/
1108-void Tria::ElementResponse(double* presponse,int response_enum,bool process_units){
1109+void Tria::ElementResponse(IssmDouble* presponse,int response_enum,bool process_units){
1110
1111 switch(response_enum){
1112 case MaterialsRheologyBbarEnum:
1113@@ -2857,7 +2857,7 @@
1114 case VelEnum:
1115
1116 /*Get input:*/
1117- double vel;
1118+ IssmDouble vel;
1119 Input* vel_input;
1120
1121 vel_input=this->inputs->GetInput(VelEnum); _assert_(vel_input);
1122@@ -2899,14 +2899,14 @@
1123
1124 /*Intermediaries*/
1125 int i,j,ig;
1126- double xyz_list[NUMVERTICES][3];
1127- double viscosity,newviscosity,oldviscosity;
1128- double viscosity_overshoot,thickness,Jdet;
1129- double epsilon[3],oldepsilon[3]; /* epsilon=[exx,eyy,exy]; */
1130- double B[3][numdof];
1131- double Bprime[3][numdof];
1132- double D[3][3] = {0.0};
1133- double D_scalar;
1134+ IssmDouble xyz_list[NUMVERTICES][3];
1135+ IssmDouble viscosity,newviscosity,oldviscosity;
1136+ IssmDouble viscosity_overshoot,thickness,Jdet;
1137+ IssmDouble epsilon[3],oldepsilon[3]; /* epsilon=[exx,eyy,exy]; */
1138+ IssmDouble B[3][numdof];
1139+ IssmDouble Bprime[3][numdof];
1140+ IssmDouble D[3][3] = {0.0};
1141+ IssmDouble D_scalar;
1142 GaussTria *gauss = NULL;
1143
1144 /*Initialize Element matrix*/
1145@@ -2964,15 +2964,15 @@
1146 /*Intermediaries*/
1147 int i,j,ig;
1148 int analysis_type;
1149- double MAXSLOPE = .06; // 6 %
1150- double MOUNTAINKEXPONENT = 10;
1151- double slope_magnitude,alpha2;
1152- double Jdet;
1153- double L[2][numdof];
1154- double DL[2][2] = {{ 0,0 },{0,0}};
1155- double DL_scalar;
1156- double slope[2] = {0.0,0.0};
1157- double xyz_list[NUMVERTICES][3];
1158+ IssmDouble MAXSLOPE = .06; // 6 %
1159+ IssmDouble MOUNTAINKEXPONENT = 10;
1160+ IssmDouble slope_magnitude,alpha2;
1161+ IssmDouble Jdet;
1162+ IssmDouble L[2][numdof];
1163+ IssmDouble DL[2][2] = {{ 0,0 },{0,0}};
1164+ IssmDouble DL_scalar;
1165+ IssmDouble slope[2] = {0.0,0.0};
1166+ IssmDouble xyz_list[NUMVERTICES][3];
1167 Friction *friction = NULL;
1168 GaussTria *gauss = NULL;
1169
1170@@ -3001,7 +3001,7 @@
1171 //velocity should be = 0. To achieve this result, we set alpha2_list to a very high value: */
1172 surface_input->GetInputDerivativeValue(&slope[0],&xyz_list[0][0],gauss);
1173 slope_magnitude=sqrt(pow(slope[0],2)+pow(slope[1],2));
1174- if(slope_magnitude>MAXSLOPE) alpha2=pow((double)10,MOUNTAINKEXPONENT);
1175+ if(slope_magnitude>MAXSLOPE) alpha2=pow((IssmDouble)10,MOUNTAINKEXPONENT);
1176 else friction->GetAlpha2(&alpha2, gauss,VxEnum,VyEnum,VzEnum);
1177
1178 GetL(&L[0][0], &xyz_list[0][0], gauss,NDOF2);
1179@@ -3037,8 +3037,8 @@
1180 /*Create Element matrix*/
1181 for(i=0;i<NUMVERTICES;i++){
1182 connectivity=nodes[i]->GetConnectivity();
1183- Ke->values[(2*i)*numdof +(2*i) ]=1/(double)connectivity;
1184- Ke->values[(2*i+1)*numdof+(2*i+1)]=1/(double)connectivity;
1185+ Ke->values[(2*i)*numdof +(2*i) ]=1/(IssmDouble)connectivity;
1186+ Ke->values[(2*i+1)*numdof+(2*i+1)]=1/(IssmDouble)connectivity;
1187 }
1188
1189 /*Clean up and return*/
1190@@ -3053,12 +3053,12 @@
1191
1192 /*Intermediaries */
1193 int i,j,ig;
1194- double driving_stress_baseline,thickness;
1195- double Jdet;
1196- double xyz_list[NUMVERTICES][3];
1197- double slope[2];
1198- double basis[3];
1199- double pe_g_gaussian[numdof];
1200+ IssmDouble driving_stress_baseline,thickness;
1201+ IssmDouble Jdet;
1202+ IssmDouble xyz_list[NUMVERTICES][3];
1203+ IssmDouble slope[2];
1204+ IssmDouble basis[3];
1205+ IssmDouble pe_g_gaussian[numdof];
1206 GaussTria* gauss=NULL;
1207
1208 /*Initialize Element vector*/
1209@@ -3104,10 +3104,10 @@
1210
1211 /*Intermediaries */
1212 int i,connectivity;
1213- double constant_part,ub,vb;
1214- double rho_ice,gravity,n,B;
1215- double slope2,thickness;
1216- double slope[2];
1217+ IssmDouble constant_part,ub,vb;
1218+ IssmDouble rho_ice,gravity,n,B;
1219+ IssmDouble slope2,thickness;
1220+ IssmDouble slope[2];
1221 GaussTria* gauss=NULL;
1222
1223 /*Initialize Element vector*/
1224@@ -3137,11 +3137,11 @@
1225
1226 constant_part=-2*pow(rho_ice*gravity,n)*pow(slope2,((n-1)/2));
1227
1228- ub=-1.58*pow((double)10.0,(double)-10.0)*rho_ice*gravity*thickness*slope[0];
1229- vb=-1.58*pow((double)10.0,(double)-10.0)*rho_ice*gravity*thickness*slope[1];
1230+ ub=-1.58*pow((IssmDouble)10.0,(IssmDouble)-10.0)*rho_ice*gravity*thickness*slope[0];
1231+ vb=-1.58*pow((IssmDouble)10.0,(IssmDouble)-10.0)*rho_ice*gravity*thickness*slope[1];
1232
1233- pe->values[2*i] =(ub-2.0*pow(rho_ice*gravity,n)*pow(slope2,((n-1)/2.0))*pow(thickness,n)/(pow(B,n)*(n+1))*slope[0])/(double)connectivity;
1234- pe->values[2*i+1]=(vb-2.0*pow(rho_ice*gravity,n)*pow(slope2,((n-1)/2.0))*pow(thickness,n)/(pow(B,n)*(n+1))*slope[1])/(double)connectivity;
1235+ pe->values[2*i] =(ub-2.0*pow(rho_ice*gravity,n)*pow(slope2,((n-1)/2.0))*pow(thickness,n)/(pow(B,n)*(n+1))*slope[0])/(IssmDouble)connectivity;
1236+ pe->values[2*i+1]=(vb-2.0*pow(rho_ice*gravity,n)*pow(slope2,((n-1)/2.0))*pow(thickness,n)/(pow(B,n)*(n+1))*slope[1])/(IssmDouble)connectivity;
1237 }
1238
1239 /*Clean up and return*/
1240@@ -3157,15 +3157,15 @@
1241
1242 /*Intermediaries */
1243 int i,j,ig;
1244- double xyz_list[NUMVERTICES][3];
1245- double Jdet,thickness;
1246- double eps1dotdphii,eps1dotdphij;
1247- double eps2dotdphii,eps2dotdphij;
1248- double mu_prime;
1249- double epsilon[3];/* epsilon=[exx,eyy,exy];*/
1250- double eps1[2],eps2[2];
1251- double phi[NUMVERTICES];
1252- double dphi[2][NUMVERTICES];
1253+ IssmDouble xyz_list[NUMVERTICES][3];
1254+ IssmDouble Jdet,thickness;
1255+ IssmDouble eps1dotdphii,eps1dotdphij;
1256+ IssmDouble eps2dotdphii,eps2dotdphij;
1257+ IssmDouble mu_prime;
1258+ IssmDouble epsilon[3];/* epsilon=[exx,eyy,exy];*/
1259+ IssmDouble eps1[2],eps2[2];
1260+ IssmDouble phi[NUMVERTICES];
1261+ IssmDouble dphi[2][NUMVERTICES];
1262 GaussTria *gauss=NULL;
1263
1264 /*Initialize Jacobian with regular MacAyeal (first part of the Gateau derivative)*/
1265@@ -3222,8 +3222,8 @@
1266
1267 int i;
1268 int* doflist=NULL;
1269- double vx,vy;
1270- double values[numdof];
1271+ IssmDouble vx,vy;
1272+ IssmDouble values[numdof];
1273 GaussTria* gauss=NULL;
1274
1275 /*Get dof list: */
1276@@ -3260,8 +3260,8 @@
1277 const int numdof=NDOF2*NUMVERTICES;
1278
1279 int i;
1280- double vx,vy;
1281- double values[numdof];
1282+ IssmDouble vx,vy;
1283+ IssmDouble values[numdof];
1284 int *doflist = NULL;
1285 GaussTria *gauss = NULL;
1286
1287@@ -3294,20 +3294,20 @@
1288 }
1289 /*}}}*/
1290 /*FUNCTION Tria::InputUpdateFromSolutionDiagnosticHoriz {{{*/
1291-void Tria::InputUpdateFromSolutionDiagnosticHoriz(double* solution){
1292+void Tria::InputUpdateFromSolutionDiagnosticHoriz(IssmDouble* solution){
1293
1294 const int numdof=NDOF2*NUMVERTICES;
1295
1296 int i;
1297 int* doflist=NULL;
1298- double rho_ice,g;
1299- double values[numdof];
1300- double vx[NUMVERTICES];
1301- double vy[NUMVERTICES];
1302- double vz[NUMVERTICES];
1303- double vel[NUMVERTICES];
1304- double pressure[NUMVERTICES];
1305- double thickness[NUMVERTICES];
1306+ IssmDouble rho_ice,g;
1307+ IssmDouble values[numdof];
1308+ IssmDouble vx[NUMVERTICES];
1309+ IssmDouble vy[NUMVERTICES];
1310+ IssmDouble vz[NUMVERTICES];
1311+ IssmDouble vel[NUMVERTICES];
1312+ IssmDouble pressure[NUMVERTICES];
1313+ IssmDouble thickness[NUMVERTICES];
1314
1315 /*Get dof list: */
1316 GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
1317@@ -3357,20 +3357,20 @@
1318 }
1319 /*}}}*/
1320 /*FUNCTION Tria::InputUpdateFromSolutionDiagnosticHutter {{{*/
1321-void Tria::InputUpdateFromSolutionDiagnosticHutter(double* solution){
1322+void Tria::InputUpdateFromSolutionDiagnosticHutter(IssmDouble* solution){
1323
1324 const int numdof=NDOF2*NUMVERTICES;
1325
1326 int i;
1327 int* doflist=NULL;
1328- double rho_ice,g;
1329- double values[numdof];
1330- double vx[NUMVERTICES];
1331- double vy[NUMVERTICES];
1332- double vz[NUMVERTICES];
1333- double vel[NUMVERTICES];
1334- double pressure[NUMVERTICES];
1335- double thickness[NUMVERTICES];
1336+ IssmDouble rho_ice,g;
1337+ IssmDouble values[numdof];
1338+ IssmDouble vx[NUMVERTICES];
1339+ IssmDouble vy[NUMVERTICES];
1340+ IssmDouble vz[NUMVERTICES];
1341+ IssmDouble vel[NUMVERTICES];
1342+ IssmDouble pressure[NUMVERTICES];
1343+ IssmDouble thickness[NUMVERTICES];
1344
1345 /*Get dof list: */
1346 GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
1347@@ -3419,7 +3419,7 @@
1348
1349 #ifdef _HAVE_CONTROL_
1350 /*FUNCTION Tria::InputControlUpdate{{{*/
1351-void Tria::InputControlUpdate(double scalar,bool save_parameter){
1352+void Tria::InputControlUpdate(IssmDouble scalar,bool save_parameter){
1353
1354 /*Intermediary*/
1355 int num_controls;
1356@@ -3473,7 +3473,7 @@
1357
1358 }/*}}}*/
1359 /*FUNCTION Tria::ControlInputScaleGradient{{{*/
1360-void Tria::ControlInputScaleGradient(int enum_type,double scale){
1361+void Tria::ControlInputScaleGradient(int enum_type,IssmDouble scale){
1362
1363 Input* input=NULL;
1364
1365@@ -3489,10 +3489,10 @@
1366 ((ControlInput*)input)->ScaleGradient(scale);
1367 }/*}}}*/
1368 /*FUNCTION Tria::ControlInputSetGradient{{{*/
1369-void Tria::ControlInputSetGradient(double* gradient,int enum_type,int control_index){
1370+void Tria::ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index){
1371
1372 int doflist1[NUMVERTICES];
1373- double grad_list[NUMVERTICES];
1374+ IssmDouble grad_list[NUMVERTICES];
1375 Input* grad_input=NULL;
1376 Input* input=NULL;
1377
1378@@ -3576,11 +3576,11 @@
1379
1380 int i,ig;
1381 int doflist1[NUMVERTICES];
1382- double Jdet,weight;
1383- double xyz_list[NUMVERTICES][3];
1384- double dbasis[NDOF2][NUMVERTICES];
1385- double dk[NDOF2];
1386- double grade_g[NUMVERTICES]={0.0};
1387+ IssmDouble Jdet,weight;
1388+ IssmDouble xyz_list[NUMVERTICES][3];
1389+ IssmDouble dbasis[NDOF2][NUMVERTICES];
1390+ IssmDouble dk[NDOF2];
1391+ IssmDouble grade_g[NUMVERTICES]={0.0};
1392 GaussTria *gauss=NULL;
1393
1394 /*Retrieve all inputs we will be needing: */
1395@@ -3617,12 +3617,12 @@
1396 /*Intermediaries*/
1397 int i,ig;
1398 int doflist[NUMVERTICES];
1399- double vx,vy,lambda,mu,thickness,Jdet;
1400- double viscosity_complement;
1401- double dvx[NDOF2],dvy[NDOF2],dadjx[NDOF2],dadjy[NDOF2],dB[NDOF2];
1402- double xyz_list[NUMVERTICES][3];
1403- double basis[3],epsilon[3];
1404- double grad[NUMVERTICES]={0.0};
1405+ IssmDouble vx,vy,lambda,mu,thickness,Jdet;
1406+ IssmDouble viscosity_complement;
1407+ IssmDouble dvx[NDOF2],dvy[NDOF2],dadjx[NDOF2],dadjy[NDOF2],dB[NDOF2];
1408+ IssmDouble xyz_list[NUMVERTICES][3];
1409+ IssmDouble basis[3],epsilon[3];
1410+ IssmDouble grad[NUMVERTICES]={0.0};
1411 GaussTria *gauss = NULL;
1412
1413 /* Get node coordinates and dof list: */
1414@@ -3675,14 +3675,14 @@
1415 int analysis_type;
1416 int doflist1[NUMVERTICES];
1417 int connectivity[NUMVERTICES];
1418- double vx,vy,lambda,mu,alpha_complement,Jdet;
1419- double bed,thickness,Neff,drag;
1420- double xyz_list[NUMVERTICES][3];
1421- double dk[NDOF2];
1422- double grade_g[NUMVERTICES]={0.0};
1423- double grade_g_gaussian[NUMVERTICES];
1424- double basis[3];
1425- double epsilon[3]; /* epsilon=[exx,eyy,exy];*/
1426+ IssmDouble vx,vy,lambda,mu,alpha_complement,Jdet;
1427+ IssmDouble bed,thickness,Neff,drag;
1428+ IssmDouble xyz_list[NUMVERTICES][3];
1429+ IssmDouble dk[NDOF2];
1430+ IssmDouble grade_g[NUMVERTICES]={0.0};
1431+ IssmDouble grade_g_gaussian[NUMVERTICES];
1432+ IssmDouble basis[3];
1433+ IssmDouble epsilon[3]; /* epsilon=[exx,eyy,exy];*/
1434 Friction* friction=NULL;
1435 GaussTria *gauss=NULL;
1436
1437@@ -3745,7 +3745,7 @@
1438 // adjointy_input->GetInputValue(&mu, gauss);
1439 // vx_input->GetInputValue(&vx,gauss);
1440 // vy_input->GetInputValue(&vy,gauss);
1441- // grade_g[iv] = -2*1.e+7*drag*alpha_complement*(lambda*vx+mu*vy)/((double)connectivity[iv]);
1442+ // grade_g[iv] = -2*1.e+7*drag*alpha_complement*(lambda*vx+mu*vy)/((IssmDouble)connectivity[iv]);
1443 //}
1444 /*End Analytical gradient*/
1445
1446@@ -3761,11 +3761,11 @@
1447
1448 int i,ig;
1449 int doflist1[NUMVERTICES];
1450- double Jdet,weight;
1451- double xyz_list[NUMVERTICES][3];
1452- double dbasis[NDOF2][NUMVERTICES];
1453- double dk[NDOF2];
1454- double grade_g[NUMVERTICES]={0.0};
1455+ IssmDouble Jdet,weight;
1456+ IssmDouble xyz_list[NUMVERTICES][3];
1457+ IssmDouble dbasis[NDOF2][NUMVERTICES];
1458+ IssmDouble dk[NDOF2];
1459+ IssmDouble grade_g[NUMVERTICES]={0.0};
1460 GaussTria *gauss=NULL;
1461
1462 /*Retrieve all inputs we will be needing: */
1463@@ -3805,8 +3805,8 @@
1464
1465 /*Intermediaries*/
1466 int doflist1[NUMVERTICES];
1467- double lambda[NUMVERTICES];
1468- double gradient_g[NUMVERTICES];
1469+ IssmDouble lambda[NUMVERTICES];
1470+ IssmDouble gradient_g[NUMVERTICES];
1471
1472 /*Compute Gradient*/
1473 GradientIndexing(&doflist1[0],control_index);
1474@@ -3822,11 +3822,11 @@
1475 /*Intermediaries*/
1476 int i,ig;
1477 int doflist1[NUMVERTICES];
1478- double thickness,Jdet;
1479- double basis[3];
1480- double Dlambda[2],dp[2];
1481- double xyz_list[NUMVERTICES][3];
1482- double grade_g[NUMVERTICES] = {0.0};
1483+ IssmDouble thickness,Jdet;
1484+ IssmDouble basis[3];
1485+ IssmDouble Dlambda[2],dp[2];
1486+ IssmDouble xyz_list[NUMVERTICES][3];
1487+ IssmDouble grade_g[NUMVERTICES] = {0.0};
1488 GaussTria *gauss = NULL;
1489
1490 /* Get node coordinates and dof list: */
1491@@ -3865,11 +3865,11 @@
1492 /*Intermediaries*/
1493 int i,ig;
1494 int doflist1[NUMVERTICES];
1495- double thickness,Jdet;
1496- double basis[3];
1497- double Dlambda[2],dp[2];
1498- double xyz_list[NUMVERTICES][3];
1499- double grade_g[NUMVERTICES] = {0.0};
1500+ IssmDouble thickness,Jdet;
1501+ IssmDouble basis[3];
1502+ IssmDouble Dlambda[2],dp[2];
1503+ IssmDouble xyz_list[NUMVERTICES][3];
1504+ IssmDouble grade_g[NUMVERTICES] = {0.0};
1505 GaussTria *gauss = NULL;
1506
1507 /* Get node coordinates and dof list: */
1508@@ -3916,15 +3916,15 @@
1509 }
1510 /*}}}*/
1511 /*FUNCTION Tria::RheologyBbarAbsGradient{{{*/
1512-double Tria::RheologyBbarAbsGradient(bool process_units,int weight_index){
1513+IssmDouble Tria::RheologyBbarAbsGradient(bool process_units,int weight_index){
1514
1515 /* Intermediaries */
1516 int ig;
1517- double Jelem = 0;
1518- double weight;
1519- double Jdet;
1520- double xyz_list[NUMVERTICES][3];
1521- double dp[NDOF2];
1522+ IssmDouble Jelem = 0;
1523+ IssmDouble weight;
1524+ IssmDouble Jdet;
1525+ IssmDouble xyz_list[NUMVERTICES][3];
1526+ IssmDouble dp[NDOF2];
1527 GaussTria *gauss = NULL;
1528
1529 /*retrieve parameters and inputs*/
1530@@ -3960,15 +3960,15 @@
1531 }
1532 /*}}}*/
1533 /*FUNCTION Tria::SurfaceAverageVelMisfit {{{*/
1534-double Tria::SurfaceAverageVelMisfit(bool process_units,int weight_index){
1535+IssmDouble Tria::SurfaceAverageVelMisfit(bool process_units,int weight_index){
1536
1537 const int numdof=2*NUMVERTICES;
1538
1539 int i,ig;
1540- double Jelem=0,S,Jdet;
1541- double misfit;
1542- double vx,vy,vxobs,vyobs,weight;
1543- double xyz_list[NUMVERTICES][3];
1544+ IssmDouble Jelem=0,S,Jdet;
1545+ IssmDouble misfit;
1546+ IssmDouble vx,vy,vxobs,vyobs,weight;
1547+ IssmDouble xyz_list[NUMVERTICES][3];
1548 GaussTria *gauss=NULL;
1549
1550 /*If on water, return 0: */
1551@@ -4021,18 +4021,18 @@
1552 }
1553 /*}}}*/
1554 /*FUNCTION Tria::SurfaceLogVelMisfit {{{*/
1555-double Tria::SurfaceLogVelMisfit(bool process_units,int weight_index){
1556+IssmDouble Tria::SurfaceLogVelMisfit(bool process_units,int weight_index){
1557
1558 const int numdof=NDOF2*NUMVERTICES;
1559
1560 int i,ig;
1561- double Jelem=0;
1562- double misfit,Jdet;
1563- double epsvel=2.220446049250313e-16;
1564- double meanvel=3.170979198376458e-05; /*1000 m/yr*/
1565- double velocity_mag,obs_velocity_mag;
1566- double xyz_list[NUMVERTICES][3];
1567- double vx,vy,vxobs,vyobs,weight;
1568+ IssmDouble Jelem=0;
1569+ IssmDouble misfit,Jdet;
1570+ IssmDouble epsvel=2.220446049250313e-16;
1571+ IssmDouble meanvel=3.170979198376458e-05; /*1000 m/yr*/
1572+ IssmDouble velocity_mag,obs_velocity_mag;
1573+ IssmDouble xyz_list[NUMVERTICES][3];
1574+ IssmDouble vx,vy,vxobs,vyobs,weight;
1575 GaussTria *gauss=NULL;
1576
1577 /*If on water, return 0: */
1578@@ -4086,18 +4086,18 @@
1579 }
1580 /*}}}*/
1581 /*FUNCTION Tria::SurfaceLogVxVyMisfit {{{*/
1582-double Tria::SurfaceLogVxVyMisfit(bool process_units,int weight_index){
1583+IssmDouble Tria::SurfaceLogVxVyMisfit(bool process_units,int weight_index){
1584
1585 const int numdof=NDOF2*NUMVERTICES;
1586
1587 int i,ig;
1588 int fit=-1;
1589- double Jelem=0, S=0;
1590- double epsvel=2.220446049250313e-16;
1591- double meanvel=3.170979198376458e-05; /*1000 m/yr*/
1592- double misfit, Jdet;
1593- double vx,vy,vxobs,vyobs,weight;
1594- double xyz_list[NUMVERTICES][3];
1595+ IssmDouble Jelem=0, S=0;
1596+ IssmDouble epsvel=2.220446049250313e-16;
1597+ IssmDouble meanvel=3.170979198376458e-05; /*1000 m/yr*/
1598+ IssmDouble misfit, Jdet;
1599+ IssmDouble vx,vy,vxobs,vyobs,weight;
1600+ IssmDouble xyz_list[NUMVERTICES][3];
1601 GaussTria *gauss=NULL;
1602
1603 /*If on water, return 0: */
1604@@ -4152,15 +4152,15 @@
1605 }
1606 /*}}}*/
1607 /*FUNCTION Tria::SurfaceAbsVelMisfit {{{*/
1608-double Tria::SurfaceAbsVelMisfit(bool process_units,int weight_index){
1609+IssmDouble Tria::SurfaceAbsVelMisfit(bool process_units,int weight_index){
1610
1611 const int numdof=NDOF2*NUMVERTICES;
1612
1613 int i,ig;
1614- double Jelem=0;
1615- double misfit,Jdet;
1616- double vx,vy,vxobs,vyobs,weight;
1617- double xyz_list[NUMVERTICES][3];
1618+ IssmDouble Jelem=0;
1619+ IssmDouble misfit,Jdet;
1620+ IssmDouble vx,vy,vxobs,vyobs,weight;
1621+ IssmDouble xyz_list[NUMVERTICES][3];
1622 GaussTria *gauss=NULL;
1623
1624 /*If on water, return 0: */
1625@@ -4213,17 +4213,17 @@
1626 }
1627 /*}}}*/
1628 /*FUNCTION Tria::SurfaceRelVelMisfit {{{*/
1629-double Tria::SurfaceRelVelMisfit(bool process_units,int weight_index){
1630+IssmDouble Tria::SurfaceRelVelMisfit(bool process_units,int weight_index){
1631 const int numdof=2*NUMVERTICES;
1632
1633 int i,ig;
1634- double Jelem=0;
1635- double scalex=1,scaley=1;
1636- double misfit,Jdet;
1637- double epsvel=2.220446049250313e-16;
1638- double meanvel=3.170979198376458e-05; /*1000 m/yr*/
1639- double vx,vy,vxobs,vyobs,weight;
1640- double xyz_list[NUMVERTICES][3];
1641+ IssmDouble Jelem=0;
1642+ IssmDouble scalex=1,scaley=1;
1643+ IssmDouble misfit,Jdet;
1644+ IssmDouble epsvel=2.220446049250313e-16;
1645+ IssmDouble meanvel=3.170979198376458e-05; /*1000 m/yr*/
1646+ IssmDouble vx,vy,vxobs,vyobs,weight;
1647+ IssmDouble xyz_list[NUMVERTICES][3];
1648 GaussTria *gauss=NULL;
1649
1650 /*If on water, return 0: */
1651@@ -4277,15 +4277,15 @@
1652 }
1653 /*}}}*/
1654 /*FUNCTION Tria::ThicknessAbsGradient{{{*/
1655-double Tria::ThicknessAbsGradient(bool process_units,int weight_index){
1656+IssmDouble Tria::ThicknessAbsGradient(bool process_units,int weight_index){
1657
1658 /* Intermediaries */
1659 int ig;
1660- double Jelem = 0;
1661- double weight;
1662- double Jdet;
1663- double xyz_list[NUMVERTICES][3];
1664- double dp[NDOF2];
1665+ IssmDouble Jelem = 0;
1666+ IssmDouble weight;
1667+ IssmDouble Jdet;
1668+ IssmDouble xyz_list[NUMVERTICES][3];
1669+ IssmDouble dp[NDOF2];
1670 GaussTria *gauss = NULL;
1671
1672 /*retrieve parameters and inputs*/
1673@@ -4321,16 +4321,16 @@
1674 }
1675 /*}}}*/
1676 /*FUNCTION Tria::ThicknessAbsMisfit {{{*/
1677-double Tria::ThicknessAbsMisfit(bool process_units,int weight_index){
1678+IssmDouble Tria::ThicknessAbsMisfit(bool process_units,int weight_index){
1679
1680 /*Intermediaries*/
1681 int i,ig;
1682- double thickness,thicknessobs,weight;
1683- double Jdet;
1684- double Jelem = 0;
1685- double xyz_list[NUMVERTICES][3];
1686+ IssmDouble thickness,thicknessobs,weight;
1687+ IssmDouble Jdet;
1688+ IssmDouble Jelem = 0;
1689+ IssmDouble xyz_list[NUMVERTICES][3];
1690 GaussTria *gauss = NULL;
1691- double dH[2];
1692+ IssmDouble dH[2];
1693
1694 /*If on water, return 0: */
1695 if(IsOnWater())return 0;
1696@@ -4373,14 +4373,14 @@
1697
1698 /*Intermediaries */
1699 int i,ig,resp;
1700- double Jdet;
1701- double thickness,thicknessobs,weight;
1702+ IssmDouble Jdet;
1703+ IssmDouble thickness,thicknessobs,weight;
1704 int *responses = NULL;
1705 int num_responses;
1706- double xyz_list[NUMVERTICES][3];
1707- double basis[3];
1708- double dbasis[NDOF2][NUMVERTICES];
1709- double dH[2];
1710+ IssmDouble xyz_list[NUMVERTICES][3];
1711+ IssmDouble basis[3];
1712+ IssmDouble dbasis[NDOF2][NUMVERTICES];
1713+ IssmDouble dH[2];
1714 GaussTria* gauss=NULL;
1715
1716 /*Initialize Element vector*/
1717@@ -4441,15 +4441,15 @@
1718 int i,resp,ig;
1719 int *responses=NULL;
1720 int num_responses;
1721- double Jdet;
1722- double obs_velocity_mag,velocity_mag;
1723- double dux,duy;
1724- double epsvel=2.220446049250313e-16;
1725- double meanvel=3.170979198376458e-05; /*1000 m/yr*/
1726- double scalex=0,scaley=0,scale=0,S=0;
1727- double vx,vy,vxobs,vyobs,weight;
1728- double xyz_list[NUMVERTICES][3];
1729- double basis[3];
1730+ IssmDouble Jdet;
1731+ IssmDouble obs_velocity_mag,velocity_mag;
1732+ IssmDouble dux,duy;
1733+ IssmDouble epsvel=2.220446049250313e-16;
1734+ IssmDouble meanvel=3.170979198376458e-05; /*1000 m/yr*/
1735+ IssmDouble scalex=0,scaley=0,scale=0,S=0;
1736+ IssmDouble vx,vy,vxobs,vyobs,weight;
1737+ IssmDouble xyz_list[NUMVERTICES][3];
1738+ IssmDouble basis[3];
1739 GaussTria* gauss=NULL;
1740
1741 /*Initialize Element vector*/
1742@@ -4617,15 +4617,15 @@
1743 int i,resp,ig;
1744 int *responses=NULL;
1745 int num_responses;
1746- double Jdet;
1747- double obs_velocity_mag,velocity_mag;
1748- double dux,duy;
1749- double epsvel=2.220446049250313e-16;
1750- double meanvel=3.170979198376458e-05; /*1000 m/yr*/
1751- double scalex=0,scaley=0,scale=0,S=0;
1752- double vx,vy,vxobs,vyobs,weight;
1753- double xyz_list[NUMVERTICES][3];
1754- double basis[3];
1755+ IssmDouble Jdet;
1756+ IssmDouble obs_velocity_mag,velocity_mag;
1757+ IssmDouble dux,duy;
1758+ IssmDouble epsvel=2.220446049250313e-16;
1759+ IssmDouble meanvel=3.170979198376458e-05; /*1000 m/yr*/
1760+ IssmDouble scalex=0,scaley=0,scale=0,S=0;
1761+ IssmDouble vx,vy,vxobs,vyobs,weight;
1762+ IssmDouble xyz_list[NUMVERTICES][3];
1763+ IssmDouble basis[3];
1764 GaussTria* gauss=NULL;
1765
1766 /*Initialize Element vector*/
1767@@ -4788,15 +4788,15 @@
1768 }
1769 /*}}}*/
1770 /*FUNCTION Tria::DragCoefficientAbsGradient{{{*/
1771-double Tria::DragCoefficientAbsGradient(bool process_units,int weight_index){
1772+IssmDouble Tria::DragCoefficientAbsGradient(bool process_units,int weight_index){
1773
1774 /* Intermediaries */
1775 int ig;
1776- double Jelem = 0;
1777- double weight;
1778- double Jdet;
1779- double xyz_list[NUMVERTICES][3];
1780- double dp[NDOF2];
1781+ IssmDouble Jelem = 0;
1782+ IssmDouble weight;
1783+ IssmDouble Jdet;
1784+ IssmDouble xyz_list[NUMVERTICES][3];
1785+ IssmDouble dp[NDOF2];
1786 GaussTria *gauss = NULL;
1787
1788 /*retrieve parameters and inputs*/
1789@@ -4862,15 +4862,15 @@
1790 /*Intermediaries */
1791 int i,j,ig;
1792 bool incomplete_adjoint;
1793- double xyz_list[NUMVERTICES][3];
1794- double Jdet,thickness;
1795- double eps1dotdphii,eps1dotdphij;
1796- double eps2dotdphii,eps2dotdphij;
1797- double mu_prime;
1798- double epsilon[3];/* epsilon=[exx,eyy,exy];*/
1799- double eps1[2],eps2[2];
1800- double phi[NUMVERTICES];
1801- double dphi[2][NUMVERTICES];
1802+ IssmDouble xyz_list[NUMVERTICES][3];
1803+ IssmDouble Jdet,thickness;
1804+ IssmDouble eps1dotdphii,eps1dotdphij;
1805+ IssmDouble eps2dotdphii,eps2dotdphij;
1806+ IssmDouble mu_prime;
1807+ IssmDouble epsilon[3];/* epsilon=[exx,eyy,exy];*/
1808+ IssmDouble eps1[2],eps2[2];
1809+ IssmDouble phi[NUMVERTICES];
1810+ IssmDouble dphi[2][NUMVERTICES];
1811 GaussTria *gauss=NULL;
1812
1813 /*Initialize Jacobian with regular MacAyeal (first part of the Gateau derivative)*/
1814@@ -4924,15 +4924,15 @@
1815 }
1816 /*}}}*/
1817 /*FUNCTION Tria::InputUpdateFromSolutionAdjointHoriz {{{*/
1818-void Tria::InputUpdateFromSolutionAdjointHoriz(double* solution){
1819+void Tria::InputUpdateFromSolutionAdjointHoriz(IssmDouble* solution){
1820
1821 const int numdof=NDOF2*NUMVERTICES;
1822
1823 int i;
1824 int* doflist=NULL;
1825- double values[numdof];
1826- double lambdax[NUMVERTICES];
1827- double lambday[NUMVERTICES];
1828+ IssmDouble values[numdof];
1829+ IssmDouble lambdax[NUMVERTICES];
1830+ IssmDouble lambday[NUMVERTICES];
1831
1832 /*Get dof list: */
1833 GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
1834@@ -4959,14 +4959,14 @@
1835 }
1836 /*}}}*/
1837 /*FUNCTION Tria::InputUpdateFromSolutionAdjointBalancethickness {{{*/
1838-void Tria::InputUpdateFromSolutionAdjointBalancethickness(double* solution){
1839+void Tria::InputUpdateFromSolutionAdjointBalancethickness(IssmDouble* solution){
1840
1841 const int numdof=NDOF1*NUMVERTICES;
1842
1843 int i;
1844 int* doflist=NULL;
1845- double values[numdof];
1846- double lambda[NUMVERTICES];
1847+ IssmDouble values[numdof];
1848+ IssmDouble lambda[NUMVERTICES];
1849
1850 /*Get dof list: */
1851 GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
1852@@ -5016,9 +5016,9 @@
1853 }
1854 /*}}}*/
1855 /*FUNCTION Tria::SetControlInputsFromVector{{{*/
1856-void Tria::SetControlInputsFromVector(double* vector,int control_enum,int control_index){
1857+void Tria::SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index){
1858
1859- double values[NUMVERTICES];
1860+ IssmDouble values[NUMVERTICES];
1861 int doflist1[NUMVERTICES];
1862 Input *input = NULL;
1863 Input *new_input = NULL;
1864@@ -5056,14 +5056,14 @@
1865 void Tria::CreateHydrologyWaterVelocityInput(void){
1866
1867 /*material parameters: */
1868- double mu_water;
1869- double VelocityFactor; // This factor represents the number 12 in laminar flow velocity which can vary by differnt hydrology.CR
1870- double n_man,CR;
1871- double w;
1872- double rho_ice, rho_water, g;
1873- double dsdx,dsdy,dbdx,dbdy;
1874- double vx[NUMVERTICES];
1875- double vy[NUMVERTICES];
1876+ IssmDouble mu_water;
1877+ IssmDouble VelocityFactor; // This factor represents the number 12 in laminar flow velocity which can vary by differnt hydrology.CR
1878+ IssmDouble n_man,CR;
1879+ IssmDouble w;
1880+ IssmDouble rho_ice, rho_water, g;
1881+ IssmDouble dsdx,dsdy,dbdx,dbdy;
1882+ IssmDouble vx[NUMVERTICES];
1883+ IssmDouble vy[NUMVERTICES];
1884 GaussTria *gauss = NULL;
1885
1886 /*Retrieve all inputs and parameters*/
1887@@ -5114,20 +5114,20 @@
1888 const int numdof=NDOF1*NUMVERTICES;
1889
1890 /*Intermediaries */
1891- double diffusivity;
1892+ IssmDouble diffusivity;
1893 int i,j,ig;
1894- double Jdettria,DL_scalar,dt,h;
1895- double vx,vy,vel,dvxdx,dvydy;
1896- double dvx[2],dvy[2];
1897- double v_gauss[2]={0.0};
1898- double xyz_list[NUMVERTICES][3];
1899- double L[NUMVERTICES];
1900- double B[2][NUMVERTICES];
1901- double Bprime[2][NUMVERTICES];
1902- double K[2][2] ={0.0};
1903- double KDL[2][2] ={0.0};
1904- double DL[2][2] ={0.0};
1905- double DLprime[2][2] ={0.0};
1906+ IssmDouble Jdettria,DL_scalar,dt,h;
1907+ IssmDouble vx,vy,vel,dvxdx,dvydy;
1908+ IssmDouble dvx[2],dvy[2];
1909+ IssmDouble v_gauss[2]={0.0};
1910+ IssmDouble xyz_list[NUMVERTICES][3];
1911+ IssmDouble L[NUMVERTICES];
1912+ IssmDouble B[2][NUMVERTICES];
1913+ IssmDouble Bprime[2][NUMVERTICES];
1914+ IssmDouble K[2][2] ={0.0};
1915+ IssmDouble KDL[2][2] ={0.0};
1916+ IssmDouble DL[2][2] ={0.0};
1917+ IssmDouble DLprime[2][2] ={0.0};
1918 GaussTria *gauss=NULL;
1919
1920 /*Skip if water or ice shelf element*/
1921@@ -5220,11 +5220,11 @@
1922
1923 /*Intermediaries */
1924 int i,j,ig;
1925- double Jdettria,dt;
1926- double basal_melting_g;
1927- double old_watercolumn_g;
1928- double xyz_list[NUMVERTICES][3];
1929- double basis[numdof];
1930+ IssmDouble Jdettria,dt;
1931+ IssmDouble basal_melting_g;
1932+ IssmDouble old_watercolumn_g;
1933+ IssmDouble xyz_list[NUMVERTICES][3];
1934+ IssmDouble basis[numdof];
1935 GaussTria* gauss=NULL;
1936
1937 /*Skip if water or ice shelf element*/
1938@@ -5268,8 +5268,8 @@
1939
1940 int i;
1941 int* doflist=NULL;
1942- double watercolumn;
1943- double values[numdof];
1944+ IssmDouble watercolumn;
1945+ IssmDouble values[numdof];
1946 GaussTria* gauss=NULL;
1947
1948 /*Get dof list: */
1949@@ -5298,14 +5298,14 @@
1950 }
1951 /*}}}*/
1952 /*FUNCTION Tria::InputUpdateFromSolutionHydrology{{{*/
1953-void Tria::InputUpdateFromSolutionHydrology(double* solution){
1954+void Tria::InputUpdateFromSolutionHydrology(IssmDouble* solution){
1955
1956 /*Intermediaries*/
1957 const int numdof = NDOF1*NUMVERTICES;
1958
1959 int i;
1960 int* doflist=NULL;
1961- double values[numdof];
1962+ IssmDouble values[numdof];
1963
1964 /*Get dof list: */
1965 GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
1966@@ -5314,7 +5314,7 @@
1967 for(i=0;i<numdof;i++){
1968 values[i]=solution[doflist[i]];
1969 if(isnan(values[i])) _error_("NaN found in solution vector");
1970- if (values[i]<pow((double)10,(double)-10))values[i]=pow((double)10,(double)-10); //correcting the water column to positive values
1971+ if (values[i]<pow((IssmDouble)10,(IssmDouble)-10))values[i]=pow((IssmDouble)10,(IssmDouble)-10); //correcting the water column to positive values
1972
1973 }
1974
1975@@ -5328,8 +5328,8 @@
1976 #endif
1977
1978 #ifdef _HAVE_DAKOTA_
1979-/*FUNCTION Tria::InputUpdateFromVectorDakota(double* vector, int name, int type);{{{*/
1980-void Tria::InputUpdateFromVectorDakota(double* vector, int name, int type){
1981+/*FUNCTION Tria::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type);{{{*/
1982+void Tria::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){
1983
1984 int i,j;
1985
1986@@ -5341,7 +5341,7 @@
1987 case VertexEnum:
1988
1989 /*New TriaP1Input*/
1990- double values[3];
1991+ IssmDouble values[3];
1992
1993 /*Get values on the 3 vertices*/
1994 for (i=0;i<3;i++){
1995@@ -5352,11 +5352,11 @@
1996 switch(name){
1997 case ThicknessEnum:
1998 /*Update thickness + surface: assume bed is constant. On ice shelves, takes hydrostatic equilibrium {{{*/
1999- double thickness[3];
2000- double thickness_init[3];
2001- double hydrostatic_ratio[3];
2002- double surface[3];
2003- double bed[3];
2004+ IssmDouble thickness[3];
2005+ IssmDouble thickness_init[3];
2006+ IssmDouble hydrostatic_ratio[3];
2007+ IssmDouble surface[3];
2008+ IssmDouble bed[3];
2009
2010 /*retrieve inputs: */
2011 GetInputListOnVertices(&thickness_init[0],ThicknessEnum);
2012@@ -5370,7 +5370,7 @@
2013 /*build new bed and surface: */
2014 if (this->IsFloating()){
2015 /*hydrostatic equilibrium: */
2016- double rho_ice,rho_water,di;
2017+ IssmDouble rho_ice,rho_water,di;
2018 rho_ice=this->matpar->GetRhoIce();
2019 rho_water=this->matpar->GetRhoWater();
2020
2021@@ -5440,15 +5440,15 @@
2022 _error_(" not supported yet!");
2023 }
2024 /*}}}*/
2025-/*FUNCTION Tria::InputUpdateFromMatrixDakota(double* matrix, int nrows, int ncols, int name, int type);{{{*/
2026-void Tria::InputUpdateFromMatrixDakota(double* matrix, int nrows, int ncols, int name, int type){
2027+/*FUNCTION Tria::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type);{{{*/
2028+void Tria::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type){
2029
2030 int i,j,t;
2031 TransientInput* transientinput=NULL;
2032- double values[3];
2033- double time;
2034+ IssmDouble values[3];
2035+ IssmDouble time;
2036 int row;
2037- double yts;
2038+ IssmDouble yts;
2039
2040 /*Check that name is an element input*/
2041 if (!IsInput(name)) return;
2042@@ -5465,11 +5465,11 @@
2043 /*create input values: */
2044 for(i=0;i<3;i++){
2045 row=this->nodes[i]->GetSidList();
2046- values[i]=(double)matrix[ncols*row+t];
2047+ values[i]=(IssmDouble)matrix[ncols*row+t];
2048 }
2049
2050 /*time? :*/
2051- time=(double)matrix[(nrows-1)*ncols+t]*yts;
2052+ time=(IssmDouble)matrix[(nrows-1)*ncols+t]*yts;
2053
2054 if(t==0) transientinput=new TransientInput(name);
2055 transientinput->AddTimeInput(new TriaP1Input(name,values),time);
2056@@ -5510,17 +5510,17 @@
2057 /*Intermediaries */
2058 int stabilization;
2059 int i,j,ig,dim;
2060- double Jdettria,vx,vy,dvxdx,dvydy,vel,h;
2061- double dvx[2],dvy[2];
2062- double xyz_list[NUMVERTICES][3];
2063- double L[NUMVERTICES];
2064- double B[2][NUMVERTICES];
2065- double Bprime[2][NUMVERTICES];
2066- double K[2][2] = {0.0};
2067- double KDL[2][2] = {0.0};
2068- double DL[2][2] = {0.0};
2069- double DLprime[2][2] = {0.0};
2070- double DL_scalar;
2071+ IssmDouble Jdettria,vx,vy,dvxdx,dvydy,vel,h;
2072+ IssmDouble dvx[2],dvy[2];
2073+ IssmDouble xyz_list[NUMVERTICES][3];
2074+ IssmDouble L[NUMVERTICES];
2075+ IssmDouble B[2][NUMVERTICES];
2076+ IssmDouble Bprime[2][NUMVERTICES];
2077+ IssmDouble K[2][2] = {0.0};
2078+ IssmDouble KDL[2][2] = {0.0};
2079+ IssmDouble DL[2][2] = {0.0};
2080+ IssmDouble DLprime[2][2] = {0.0};
2081+ IssmDouble DL_scalar;
2082 GaussTria *gauss = NULL;
2083
2084 /*Initialize Element matrix*/
2085@@ -5619,12 +5619,12 @@
2086
2087 /*Intermediaries*/
2088 int i,j,ig,dim;
2089- double vx,vy,Jdettria;
2090- double xyz_list[NUMVERTICES][3];
2091- double B[2][NUMVERTICES];
2092- double Bprime[2][NUMVERTICES];
2093- double DL[2][2]={0.0};
2094- double DL_scalar;
2095+ IssmDouble vx,vy,Jdettria;
2096+ IssmDouble xyz_list[NUMVERTICES][3];
2097+ IssmDouble B[2][NUMVERTICES];
2098+ IssmDouble Bprime[2][NUMVERTICES];
2099+ IssmDouble DL[2][2]={0.0};
2100+ IssmDouble DL_scalar;
2101 GaussTria *gauss=NULL;
2102
2103 /*Initialize Element matrix*/
2104@@ -5687,9 +5687,9 @@
2105
2106 /*Intermediaries */
2107 int i,j,ig;
2108- double xyz_list[NUMVERTICES][3];
2109- double dhdt_g,basal_melting_g,surface_mass_balance_g,Jdettria;
2110- double L[NUMVERTICES];
2111+ IssmDouble xyz_list[NUMVERTICES][3];
2112+ IssmDouble dhdt_g,basal_melting_g,surface_mass_balance_g,Jdettria;
2113+ IssmDouble L[NUMVERTICES];
2114 GaussTria* gauss=NULL;
2115
2116 /*Initialize Element vector*/
2117@@ -5730,9 +5730,9 @@
2118
2119 /*Intermediaries */
2120 int i,j,ig;
2121- double xyz_list[NUMVERTICES][3];
2122- double basal_melting_g,surface_mass_balance_g,dhdt_g,Jdettria;
2123- double L[NUMVERTICES];
2124+ IssmDouble xyz_list[NUMVERTICES][3];
2125+ IssmDouble basal_melting_g,surface_mass_balance_g,dhdt_g,Jdettria;
2126+ IssmDouble L[NUMVERTICES];
2127 GaussTria* gauss=NULL;
2128
2129 /*Initialize Element vector*/
2130Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/TriaRef.h
2131===================================================================
2132--- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/TriaRef.h (revision 12470)
2133+++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/TriaRef.h (revision 12471)
2134@@ -24,26 +24,26 @@
2135 void SetElementType(int type,int type_counter);
2136
2137 /*Numerics*/
2138- void GetBMacAyeal(double* B, double* xyz_list, GaussTria* gauss);
2139- void GetBMacAyealStokes(double* B , double* xyz_list, GaussTria* gauss);
2140- void GetBprimeMacAyeal(double* Bprime, double* xyz_list, GaussTria* gauss);
2141- void GetBprimeMacAyealStokes(double* Bprime, double* xyz_list, GaussTria* gauss);
2142- void GetBprimePrognostic(double* Bprime_prog, double* xyz_list, GaussTria* gauss);
2143- void GetBPrognostic(double* B_prog, double* xyz_list, GaussTria* gauss);
2144- void GetL(double* L, double* xyz_list,GaussTria* gauss,int numdof);
2145- void GetJacobian(double* J, double* xyz_list,GaussTria* gauss);
2146- void GetSegmentJacobianDeterminant(double* Jdet, double* xyz_list,GaussTria* gauss);
2147- void GetJacobianDeterminant2d(double* Jdet, double* xyz_list,GaussTria* gauss);
2148- void GetJacobianDeterminant3d(double* Jdet, double* xyz_list,GaussTria* gauss);
2149- void GetJacobianInvert(double* Jinv, double* xyz_list,GaussTria* gauss);
2150- void GetNodalFunctions(double* l1l2l3,GaussTria* gauss);
2151- void GetSegmentNodalFunctions(double* l1l2l3,GaussTria* gauss, int index1,int index2);
2152- void GetSegmentBFlux(double* B,GaussTria* gauss, int index1,int index2);
2153- void GetSegmentBprimeFlux(double* Bprime,GaussTria* gauss, int index1,int index2);
2154- void GetNodalFunctionsDerivatives(double* l1l2l3,double* xyz_list, GaussTria* gauss);
2155- void GetNodalFunctionsDerivativesReference(double* dl1dl3,GaussTria* gauss);
2156- void GetInputValue(double* pp, double* plist, GaussTria* gauss);
2157- void GetInputDerivativeValue(double* pp, double* plist,double* xyz_list, GaussTria* gauss);
2158+ void GetBMacAyeal(IssmDouble* B, IssmDouble* xyz_list, GaussTria* gauss);
2159+ void GetBMacAyealStokes(IssmDouble* B , IssmDouble* xyz_list, GaussTria* gauss);
2160+ void GetBprimeMacAyeal(IssmDouble* Bprime, IssmDouble* xyz_list, GaussTria* gauss);
2161+ void GetBprimeMacAyealStokes(IssmDouble* Bprime, IssmDouble* xyz_list, GaussTria* gauss);
2162+ void GetBprimePrognostic(IssmDouble* Bprime_prog, IssmDouble* xyz_list, GaussTria* gauss);
2163+ void GetBPrognostic(IssmDouble* B_prog, IssmDouble* xyz_list, GaussTria* gauss);
2164+ void GetL(IssmDouble* L, IssmDouble* xyz_list,GaussTria* gauss,int numdof);
2165+ void GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussTria* gauss);
2166+ void GetSegmentJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,GaussTria* gauss);
2167+ void GetJacobianDeterminant2d(IssmDouble* Jdet, IssmDouble* xyz_list,GaussTria* gauss);
2168+ void GetJacobianDeterminant3d(IssmDouble* Jdet, IssmDouble* xyz_list,GaussTria* gauss);
2169+ void GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussTria* gauss);
2170+ void GetNodalFunctions(IssmDouble* l1l2l3,GaussTria* gauss);
2171+ void GetSegmentNodalFunctions(IssmDouble* l1l2l3,GaussTria* gauss, int index1,int index2);
2172+ void GetSegmentBFlux(IssmDouble* B,GaussTria* gauss, int index1,int index2);
2173+ void GetSegmentBprimeFlux(IssmDouble* Bprime,GaussTria* gauss, int index1,int index2);
2174+ void GetNodalFunctionsDerivatives(IssmDouble* l1l2l3,IssmDouble* xyz_list, GaussTria* gauss);
2175+ void GetNodalFunctionsDerivativesReference(IssmDouble* dl1dl3,GaussTria* gauss);
2176+ void GetInputValue(IssmDouble* pp, IssmDouble* plist, GaussTria* gauss);
2177+ void GetInputDerivativeValue(IssmDouble* pp, IssmDouble* plist,IssmDouble* xyz_list, GaussTria* gauss);
2178
2179 };
2180 #endif
2181Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/PentaRef.cpp
2182===================================================================
2183--- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/PentaRef.cpp (revision 12470)
2184+++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/PentaRef.cpp (revision 12471)
2185@@ -57,7 +57,7 @@
2186
2187 /*Reference Element numerics*/
2188 /*FUNCTION PentaRef::GetBMacAyealPattyn {{{*/
2189-void PentaRef::GetBMacAyealPattyn(double* B, double* xyz_list, GaussPenta* gauss){
2190+void PentaRef::GetBMacAyealPattyn(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss){
2191 /*Compute B matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF2.
2192 * For node i, Bi can be expressed in the actual coordinate system
2193 * by:
2194@@ -69,7 +69,7 @@
2195 * We assume B has been allocated already, of size: 5x(NDOF2*NUMNODESP1)
2196 */
2197
2198- double dbasis[3][NUMNODESP1];
2199+ IssmDouble dbasis[3][NUMNODESP1];
2200
2201 /*Get dbasis in actual coordinate system: */
2202 GetNodalFunctionsP1Derivatives(&dbasis[0][0],xyz_list, gauss);
2203@@ -88,7 +88,7 @@
2204 }
2205 /*}}}*/
2206 /*FUNCTION PentaRef::GetBMacAyealStokes{{{*/
2207-void PentaRef::GetBMacAyealStokes(double* B, double* xyz_list, GaussPenta* gauss){
2208+void PentaRef::GetBMacAyealStokes(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss){
2209 /*Compute B matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF2.
2210 * For node i, Bi can be expressed in the actual coordinate system
2211 * by:
2212@@ -102,8 +102,8 @@
2213 */
2214
2215 int i;
2216- double dh1dh7[3][NUMNODESMINI];
2217- double l1l6[NUMNODESP1];
2218+ IssmDouble dh1dh7[3][NUMNODESMINI];
2219+ IssmDouble l1l6[NUMNODESP1];
2220
2221 /*Get dh1dh6 in actual coordinate system: */
2222 GetNodalFunctionsMINIDerivatives(&dh1dh7[0][0],xyz_list, gauss);
2223@@ -134,7 +134,7 @@
2224 }
2225 /*}}}*/
2226 /*FUNCTION PentaRef::GetBPattyn {{{*/
2227-void PentaRef::GetBPattyn(double* B, double* xyz_list, GaussPenta* gauss){
2228+void PentaRef::GetBPattyn(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss){
2229 /*Compute B matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF2.
2230 * For node i, Bi can be expressed in the actual coordinate system
2231 * by:
2232@@ -148,7 +148,7 @@
2233 * We assume B has been allocated already, of size: 5x(NDOF2*NUMNODESP1)
2234 */
2235
2236- double dbasis[3][NUMNODESP1];
2237+ IssmDouble dbasis[3][NUMNODESP1];
2238
2239 /*Get dbasis in actual coordinate system: */
2240 GetNodalFunctionsP1Derivatives(&dbasis[0][0],xyz_list, gauss);
2241@@ -174,7 +174,7 @@
2242 }
2243 /*}}}*/
2244 /*FUNCTION PentaRef::GetBprimePattyn {{{*/
2245-void PentaRef::GetBprimePattyn(double* B, double* xyz_list, GaussPenta* gauss_coord){
2246+void PentaRef::GetBprimePattyn(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss_coord){
2247 /*Compute B prime matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF2.
2248 * For node i, Bi can be expressed in the actual coordinate system
2249 * by:
2250@@ -187,7 +187,7 @@
2251 *
2252 * We assume B has been allocated already, of size: 5x(NDOF2*NUMNODESP1)
2253 */
2254- double dbasis[3][NUMNODESP1];
2255+ IssmDouble dbasis[3][NUMNODESP1];
2256
2257 /*Get dbasis in actual coordinate system: */
2258 GetNodalFunctionsP1Derivatives(&dbasis[0][0],xyz_list, gauss_coord);
2259@@ -212,7 +212,7 @@
2260 }
2261 /*}}}*/
2262 /*FUNCTION PentaRef::GetBprimeMacAyealStokes{{{*/
2263-void PentaRef::GetBprimeMacAyealStokes(double* Bprime, double* xyz_list, GaussPenta* gauss){
2264+void PentaRef::GetBprimeMacAyealStokes(IssmDouble* Bprime, IssmDouble* xyz_list, GaussPenta* gauss){
2265 /*Compute Bprime matrix. Bprime=[Bprime1 Bprime2 Bprime3 Bprime4 Bprime5 Bprime6] where Bprimei is of size 5*NDOF2.
2266 * For node i, Bprimei can be expressed in the actual coordinate system
2267 * by:
2268@@ -225,7 +225,7 @@
2269 */
2270
2271 int i;
2272- double dh1dh7[3][NUMNODESMINI];
2273+ IssmDouble dh1dh7[3][NUMNODESMINI];
2274
2275 /*Get dh1dh6 in actual coordinate system: */
2276 GetNodalFunctionsMINIDerivatives(&dh1dh7[0][0],xyz_list, gauss);
2277@@ -252,7 +252,7 @@
2278 }
2279 /*}}}*/
2280 /*FUNCTION PentaRef::GetBStokes {{{*/
2281-void PentaRef::GetBStokes(double* B, double* xyz_list, GaussPenta* gauss){
2282+void PentaRef::GetBStokes(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss){
2283
2284 /*Compute B matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 3*NDOF4.
2285 * For node i, Bi can be expressed in the actual coordinate system
2286@@ -270,8 +270,8 @@
2287
2288 int i;
2289
2290- double dh1dh7[3][NUMNODESMINI];
2291- double l1l6[NUMNODESP1];
2292+ IssmDouble dh1dh7[3][NUMNODESMINI];
2293+ IssmDouble l1l6[NUMNODESP1];
2294
2295 /*Get dh1dh7 in actual coordinate system: */
2296 GetNodalFunctionsMINIDerivatives(&dh1dh7[0][0],xyz_list, gauss);
2297@@ -319,7 +319,7 @@
2298 }
2299 /*}}}*/
2300 /*FUNCTION PentaRef::GetBprimeStokes {{{*/
2301-void PentaRef::GetBprimeStokes(double* B_prime, double* xyz_list, GaussPenta* gauss){
2302+void PentaRef::GetBprimeStokes(IssmDouble* B_prime, IssmDouble* xyz_list, GaussPenta* gauss){
2303 /* Compute B' matrix. B'=[B1' B2' B3' B4' B5' B6' Bb'] where Bi' is of size 3*NDOF2.
2304 * For node i, Bi' can be expressed in the actual coordinate system
2305 * by:
2306@@ -337,8 +337,8 @@
2307 */
2308
2309 int i;
2310- double dh1dh7[3][NUMNODESMINI];
2311- double l1l6[NUMNODESP1];
2312+ IssmDouble dh1dh7[3][NUMNODESMINI];
2313+ IssmDouble l1l6[NUMNODESP1];
2314
2315 /*Get dh1dh7 in actual coordinate system: */
2316 GetNodalFunctionsMINIDerivatives(&dh1dh7[0][0],xyz_list, gauss);
2317@@ -386,7 +386,7 @@
2318 }
2319 /*}}}*/
2320 /*FUNCTION PentaRef::GetBAdvec{{{*/
2321-void PentaRef::GetBAdvec(double* B_advec, double* xyz_list, GaussPenta* gauss){
2322+void PentaRef::GetBAdvec(IssmDouble* B_advec, IssmDouble* xyz_list, GaussPenta* gauss){
2323 /*Compute B matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1.
2324 * For node i, Bi' can be expressed in the actual coordinate system
2325 * by:
2326@@ -399,7 +399,7 @@
2327 */
2328
2329 /*Same thing in the actual coordinate system: */
2330- double l1l6[6];
2331+ IssmDouble l1l6[6];
2332
2333 /*Get dh1dh2dh3 in actual coordinates system : */
2334 GetNodalFunctionsP1(l1l6, gauss);
2335@@ -413,7 +413,7 @@
2336 }
2337 /*}}}*/
2338 /*FUNCTION PentaRef::GetBConduct{{{*/
2339-void PentaRef::GetBConduct(double* B_conduct, double* xyz_list, GaussPenta* gauss){
2340+void PentaRef::GetBConduct(IssmDouble* B_conduct, IssmDouble* xyz_list, GaussPenta* gauss){
2341 /*Compute B matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1.
2342 * For node i, Bi' can be expressed in the actual coordinate system
2343 * by:
2344@@ -426,7 +426,7 @@
2345 */
2346
2347 /*Same thing in the actual coordinate system: */
2348- double dh1dh6[3][NUMNODESP1];
2349+ IssmDouble dh1dh6[3][NUMNODESP1];
2350
2351 /*Get dh1dh2dh3 in actual coordinates system : */
2352 GetNodalFunctionsP1Derivatives(&dh1dh6[0][0],xyz_list,gauss);
2353@@ -440,12 +440,12 @@
2354 }
2355 /*}}}*/
2356 /*FUNCTION PentaRef::GetBVert{{{*/
2357-void PentaRef::GetBVert(double* B, double* xyz_list, GaussPenta* gauss){
2358+void PentaRef::GetBVert(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss){
2359 /* Compute B matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz];
2360 where hi is the interpolation function for node i.*/
2361
2362 int i;
2363- double dh1dh6[3][NUMNODESP1];
2364+ IssmDouble dh1dh6[3][NUMNODESP1];
2365
2366 /*Get dh1dh6 in actual coordinate system: */
2367 GetNodalFunctionsP1Derivatives(&dh1dh6[0][0],xyz_list, gauss);
2368@@ -458,7 +458,7 @@
2369 }
2370 /*}}}*/
2371 /*FUNCTION PentaRef::GetBprimeAdvec{{{*/
2372-void PentaRef::GetBprimeAdvec(double* Bprime_advec, double* xyz_list, GaussPenta* gauss){
2373+void PentaRef::GetBprimeAdvec(IssmDouble* Bprime_advec, IssmDouble* xyz_list, GaussPenta* gauss){
2374 /*Compute B matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1.
2375 * For node i, Bi' can be expressed in the actual coordinate system
2376 * by:
2377@@ -471,7 +471,7 @@
2378 */
2379
2380 /*Same thing in the actual coordinate system: */
2381- double dh1dh6[3][NUMNODESP1];
2382+ IssmDouble dh1dh6[3][NUMNODESP1];
2383
2384 /*Get dh1dh2dh3 in actual coordinates system : */
2385 GetNodalFunctionsP1Derivatives(&dh1dh6[0][0],xyz_list,gauss);
2386@@ -485,7 +485,7 @@
2387 }
2388 /*}}}*/
2389 /*FUNCTION PentaRef::GetBprimeVert{{{*/
2390-void PentaRef::GetBprimeVert(double* B, double* xyz_list, GaussPenta* gauss){
2391+void PentaRef::GetBprimeVert(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss){
2392 /* Compute Bprime matrix. Bprime=[L1 L2 L3 L4 L5 L6] where Li is the nodal function for node i*/
2393
2394 GetNodalFunctionsP1(B, gauss);
2395@@ -493,7 +493,7 @@
2396 }
2397 /*}}}*/
2398 /*FUNCTION PentaRef::GetL{{{*/
2399-void PentaRef::GetL(double* L, GaussPenta* gauss, int numdof){
2400+void PentaRef::GetL(IssmDouble* L, GaussPenta* gauss, int numdof){
2401 /*Compute L matrix. L=[L1 L2 L3] where Li is square and of size numdof.
2402 ** For node i, Li can be expressed in the actual coordinate system
2403 ** by:
2404@@ -508,7 +508,7 @@
2405 **/
2406
2407 int i;
2408- double l1l6[6];
2409+ IssmDouble l1l6[6];
2410
2411 /*Get l1l6 in actual coordinate system: */
2412 GetNodalFunctionsP1(l1l6,gauss);
2413@@ -530,7 +530,7 @@
2414 }
2415 /*}}}*/
2416 /*FUNCTION PentaRef::GetLStokes{{{*/
2417-void PentaRef::GetLStokes(double* LStokes, GaussPenta* gauss){
2418+void PentaRef::GetLStokes(IssmDouble* LStokes, GaussPenta* gauss){
2419 /*
2420 * Compute L matrix. L=[L1 L2 L3] where Li is square and of size numdof.
2421 * For node i, Li can be expressed in the actual coordinate system
2422@@ -543,7 +543,7 @@
2423 */
2424
2425 const int num_dof=4;
2426- double l1l2l3[NUMNODESP1_2d];
2427+ IssmDouble l1l2l3[NUMNODESP1_2d];
2428
2429 /*Get l1l2l3 in actual coordinate system: */
2430 l1l2l3[0]=gauss->coord1*(1-gauss->coord4)/2.0;
2431@@ -565,7 +565,7 @@
2432 }
2433 /*}}}*/
2434 /*FUNCTION PentaRef::GetLprimeStokes {{{*/
2435-void PentaRef::GetLprimeStokes(double* LprimeStokes, double* xyz_list, GaussPenta* gauss){
2436+void PentaRef::GetLprimeStokes(IssmDouble* LprimeStokes, IssmDouble* xyz_list, GaussPenta* gauss){
2437
2438 /*
2439 * Compute Lprime matrix. Lprime=[Lp1 Lp2 Lp3] where Lpi is square and of size numdof.
2440@@ -605,8 +605,8 @@
2441 int i;
2442 int num_dof=4;
2443
2444- double l1l2l3[NUMNODESP1_2d];
2445- double dh1dh6[3][NUMNODESP1];
2446+ IssmDouble l1l2l3[NUMNODESP1_2d];
2447+ IssmDouble dh1dh6[3][NUMNODESP1];
2448
2449 /*Get l1l2l3 in actual coordinate system: */
2450 l1l2l3[0]=gauss->coord1*(1-gauss->coord4)/2.0;
2451@@ -677,7 +677,7 @@
2452 }
2453 /*}}}*/
2454 /*FUNCTION PentaRef::GetLMacAyealStokes {{{*/
2455-void PentaRef::GetLMacAyealStokes(double* LStokes, GaussPenta* gauss){
2456+void PentaRef::GetLMacAyealStokes(IssmDouble* LStokes, GaussPenta* gauss){
2457 /*
2458 * Compute L matrix. L=[L1 L2 L3] where Li is square and of size numdof.
2459 * For node i, Li can be expressed in the actual coordinate system
2460@@ -696,7 +696,7 @@
2461 int i;
2462 int num_dof=2;
2463
2464- double l1l2l3[NUMNODESP1_2d];
2465+ IssmDouble l1l2l3[NUMNODESP1_2d];
2466
2467
2468 /*Get l1l2l3 in actual coordinate system: */
2469@@ -727,7 +727,7 @@
2470 }
2471 /*}}}*/
2472 /*FUNCTION PentaRef::GetLprimeMacAyealStokes {{{*/
2473-void PentaRef::GetLprimeMacAyealStokes(double* LprimeStokes, double* xyz_list, GaussPenta* gauss){
2474+void PentaRef::GetLprimeMacAyealStokes(IssmDouble* LprimeStokes, IssmDouble* xyz_list, GaussPenta* gauss){
2475
2476 /*
2477 * Compute Lprime matrix. Lprime=[Lp1 Lp2 Lp3] where Lpi is square and of size numdof.
2478@@ -746,8 +746,8 @@
2479 int i;
2480 int num_dof=4;
2481
2482- double l1l2l3[NUMNODESP1_2d];
2483- double dh1dh6[3][NUMNODESP1];
2484+ IssmDouble l1l2l3[NUMNODESP1_2d];
2485+ IssmDouble dh1dh6[3][NUMNODESP1];
2486
2487 /*Get l1l2l3 in actual coordinate system: */
2488 l1l2l3[0]=gauss->coord1*(1-gauss->coord4)/2.0;
2489@@ -794,7 +794,7 @@
2490 }
2491 /*}}}*/
2492 /*FUNCTION PentaRef::GetLStokesMacAyeal {{{*/
2493-void PentaRef::GetLStokesMacAyeal(double* LStokes, GaussPenta* gauss){
2494+void PentaRef::GetLStokesMacAyeal(IssmDouble* LStokes, GaussPenta* gauss){
2495 /*
2496 * Compute L matrix. L=[L1 L2 L3] where Li is square and of size numdof.
2497 * For node i, Li can be expressed in the actual coordinate system
2498@@ -809,7 +809,7 @@
2499 int i;
2500 int num_dof=4;
2501
2502- double l1l2l3[NUMNODESP1_2d];
2503+ IssmDouble l1l2l3[NUMNODESP1_2d];
2504
2505
2506 /*Get l1l2l3 in actual coordinate system: */
2507@@ -840,7 +840,7 @@
2508 }
2509 /*}}}*/
2510 /*FUNCTION PentaRef::GetLprimeStokesMacAyeal {{{*/
2511-void PentaRef::GetLprimeStokesMacAyeal(double* LprimeStokes, double* xyz_list, GaussPenta* gauss){
2512+void PentaRef::GetLprimeStokesMacAyeal(IssmDouble* LprimeStokes, IssmDouble* xyz_list, GaussPenta* gauss){
2513
2514 /*
2515 * Compute Lprime matrix. Lprime=[Lp1 Lp2 Lp3] where Lpi is square and of size numdof.
2516@@ -855,8 +855,8 @@
2517 int i;
2518 int num_dof=2;
2519
2520- double l1l2l3[NUMNODESP1_2d];
2521- double dh1dh6[3][NUMNODESP1];
2522+ IssmDouble l1l2l3[NUMNODESP1_2d];
2523+ IssmDouble dh1dh6[3][NUMNODESP1];
2524
2525 /*Get l1l2l3 in actual coordinate system: */
2526 l1l2l3[0]=gauss->coord1*(1-gauss->coord4)/2.0;
2527@@ -879,19 +879,19 @@
2528 }
2529 /*}}}*/
2530 /*FUNCTION PentaRef::GetJacobian {{{*/
2531-void PentaRef::GetJacobian(double* J, double* xyz_list,GaussPenta* gauss){
2532+void PentaRef::GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussPenta* gauss){
2533
2534 int i,j;
2535
2536 /*The Jacobian is constant over the element, discard the gaussian points.
2537 * J is assumed to have been allocated of size NDOF2xNDOF2.*/
2538
2539- double A1,A2,A3; //area coordinates
2540- double xi,eta,zi; //parametric coordinates
2541+ IssmDouble A1,A2,A3; //area coordinates
2542+ IssmDouble xi,eta,zi; //parametric coordinates
2543
2544- double x1,x2,x3,x4,x5,x6;
2545- double y1,y2,y3,y4,y5,y6;
2546- double z1,z2,z3,z4,z5,z6;
2547+ IssmDouble x1,x2,x3,x4,x5,x6;
2548+ IssmDouble y1,y2,y3,y4,y5,y6;
2549+ IssmDouble z1,z2,z3,z4,z5,z6;
2550
2551 /*Figure out xi,eta and zi (parametric coordinates), for this gaussian point: */
2552 A1=gauss->coord1;
2553@@ -938,10 +938,10 @@
2554 }
2555 /*}}}*/
2556 /*FUNCTION PentaRef::GetJacobianDeterminant {{{*/
2557-void PentaRef::GetJacobianDeterminant(double* Jdet, double* xyz_list,GaussPenta* gauss){
2558+void PentaRef::GetJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,GaussPenta* gauss){
2559 /*On a penta, Jacobian varies according to coordinates. We need to get the Jacobian, and take
2560 * the determinant of it: */
2561- double J[3][3];
2562+ IssmDouble J[3][3];
2563
2564 /*Get Jacobian*/
2565 GetJacobian(&J[0][0],xyz_list,gauss);
2566@@ -953,11 +953,11 @@
2567 }
2568 /*}}}*/
2569 /*FUNCTION PentaRef::GetTriaJacobianDeterminant{{{*/
2570-void PentaRef::GetTriaJacobianDeterminant(double* Jdet, double* xyz_list,GaussPenta* gauss){
2571+void PentaRef::GetTriaJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,GaussPenta* gauss){
2572 /*The Jacobian determinant is constant over the element, discard the gaussian points.
2573 * J is assumed to have been allocated of size NDOF2xNDOF2.*/
2574
2575- double x1,x2,x3,y1,y2,y3,z1,z2,z3;
2576+ IssmDouble x1,x2,x3,y1,y2,y3,z1,z2,z3;
2577
2578 x1=*(xyz_list+3*0+0);
2579 y1=*(xyz_list+3*0+1);
2580@@ -975,11 +975,11 @@
2581 }
2582 /*}}}*/
2583 /*FUNCTION PentaRef::GetSegmentJacobianDeterminant{{{*/
2584-void PentaRef::GetSegmentJacobianDeterminant(double* Jdet, double* xyz_list,GaussPenta* gauss){
2585+void PentaRef::GetSegmentJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,GaussPenta* gauss){
2586 /*The Jacobian determinant is constant over the element, discard the gaussian points.
2587 * J is assumed to have been allocated of size NDOF2xNDOF2.*/
2588
2589- double x1,x2,y1,y2,z1,z2;
2590+ IssmDouble x1,x2,y1,y2,z1,z2;
2591
2592 x1=*(xyz_list+3*0+0);
2593 y1=*(xyz_list+3*0+1);
2594@@ -994,10 +994,10 @@
2595 }
2596 /*}}}*/
2597 /*FUNCTION PentaRef::GetJacobianInvert {{{*/
2598-void PentaRef::GetJacobianInvert(double* Jinv, double* xyz_list,GaussPenta* gauss){
2599+void PentaRef::GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussPenta* gauss){
2600
2601 /*Jacobian*/
2602- double J[3][3];
2603+ IssmDouble J[3][3];
2604
2605 /*Call Jacobian routine to get the jacobian:*/
2606 GetJacobian(&J[0][0], xyz_list, gauss);
2607@@ -1007,7 +1007,7 @@
2608 }
2609 /*}}}*/
2610 /*FUNCTION PentaRef::GetNodalFunctionsMINI{{{*/
2611-void PentaRef::GetNodalFunctionsMINI(double* l1l7, GaussPenta* gauss){
2612+void PentaRef::GetNodalFunctionsMINI(IssmDouble* l1l7, GaussPenta* gauss){
2613 /*This routine returns the values of the nodal functions at the gaussian point.*/
2614
2615 l1l7[0]=gauss->coord1*(1.0-gauss->coord4)/2.0;
2616@@ -1021,14 +1021,14 @@
2617 }
2618 /*}}}*/
2619 /*FUNCTION PentaRef::GetNodalFunctionsMINIDerivatives{{{*/
2620-void PentaRef::GetNodalFunctionsMINIDerivatives(double* dh1dh7,double* xyz_list, GaussPenta* gauss){
2621+void PentaRef::GetNodalFunctionsMINIDerivatives(IssmDouble* dh1dh7,IssmDouble* xyz_list, GaussPenta* gauss){
2622
2623 /*This routine returns the values of the nodal functions derivatives (with respect to the
2624 * actual coordinate system): */
2625
2626 int i;
2627- double dh1dh7_ref[3][NUMNODESMINI];
2628- double Jinv[3][3];
2629+ IssmDouble dh1dh7_ref[3][NUMNODESMINI];
2630+ IssmDouble Jinv[3][3];
2631
2632 /*Get derivative values with respect to parametric coordinate system: */
2633 GetNodalFunctionsMINIDerivativesReference(&dh1dh7_ref[0][0], gauss);
2634@@ -1052,13 +1052,13 @@
2635 }
2636 /*}}}*/
2637 /*FUNCTION PentaRef::GetNodalFunctionsMINIDerivativesReference{{{*/
2638-void PentaRef::GetNodalFunctionsMINIDerivativesReference(double* dl1dl7,GaussPenta* gauss){
2639+void PentaRef::GetNodalFunctionsMINIDerivativesReference(IssmDouble* dl1dl7,GaussPenta* gauss){
2640
2641 /*This routine returns the values of the nodal functions derivatives (with respect to the
2642 * natural coordinate system) at the gaussian point. */
2643- double r=gauss->coord2-gauss->coord1;
2644- double s=-3.0/SQRT3*(gauss->coord1+gauss->coord2-2.0/3.0);
2645- double zeta=gauss->coord4;
2646+ IssmDouble r=gauss->coord2-gauss->coord1;
2647+ IssmDouble s=-3.0/SQRT3*(gauss->coord1+gauss->coord2-2.0/3.0);
2648+ IssmDouble zeta=gauss->coord4;
2649
2650 /*First nodal function: */
2651 *(dl1dl7+NUMNODESMINI*0+0)=-0.5*(1.0-zeta)/2.0;
2652@@ -1098,7 +1098,7 @@
2653 }
2654 /*}}}*/
2655 /*FUNCTION PentaRef::GetNodalFunctionsP1 {{{*/
2656-void PentaRef::GetNodalFunctionsP1(double* l1l6, GaussPenta* gauss){
2657+void PentaRef::GetNodalFunctionsP1(IssmDouble* l1l6, GaussPenta* gauss){
2658 /*This routine returns the values of the nodal functions at the gaussian point.*/
2659
2660 l1l6[0]=gauss->coord1*(1-gauss->coord4)/2.0;
2661@@ -1111,12 +1111,12 @@
2662 }
2663 /*}}}*/
2664 /*FUNCTION PentaRef::GetNodalFunctionsP1Derivatives {{{*/
2665-void PentaRef::GetNodalFunctionsP1Derivatives(double* dh1dh6,double* xyz_list, GaussPenta* gauss){
2666+void PentaRef::GetNodalFunctionsP1Derivatives(IssmDouble* dh1dh6,IssmDouble* xyz_list, GaussPenta* gauss){
2667
2668 /*This routine returns the values of the nodal functions derivatives (with respect to the
2669 * actual coordinate system): */
2670- double dh1dh6_ref[NDOF3][NUMNODESP1];
2671- double Jinv[NDOF3][NDOF3];
2672+ IssmDouble dh1dh6_ref[NDOF3][NUMNODESP1];
2673+ IssmDouble Jinv[NDOF3][NDOF3];
2674
2675 /*Get derivative values with respect to parametric coordinate system: */
2676 GetNodalFunctionsP1DerivativesReference(&dh1dh6_ref[0][0], gauss);
2677@@ -1140,12 +1140,12 @@
2678 }
2679 /*}}}*/
2680 /*FUNCTION PentaRef::GetNodalFunctionsP1DerivativesReference {{{*/
2681-void PentaRef::GetNodalFunctionsP1DerivativesReference(double* dl1dl6,GaussPenta* gauss){
2682+void PentaRef::GetNodalFunctionsP1DerivativesReference(IssmDouble* dl1dl6,GaussPenta* gauss){
2683
2684 /*This routine returns the values of the nodal functions derivatives (with respect to the
2685 * natural coordinate system) at the gaussian point. Those values vary along xi,eta,z */
2686
2687- double A1,A2,A3,z;
2688+ IssmDouble A1,A2,A3,z;
2689
2690 A1=gauss->coord1; _assert_(A1>=0 && A1<=1);//first area coordinate value. In term of xi and eta: A1=(1-xi)/2-eta/(2*SQRT3);
2691 A2=gauss->coord2; _assert_(A2>=0 && A2<=1);//second area coordinate value In term of xi and eta: A2=(1+xi)/2-eta/(2*SQRT3);
2692@@ -1184,10 +1184,10 @@
2693 }
2694 /*}}}*/
2695 /*FUNCTION PentaRef::GetQuadNodalFunctions {{{*/
2696-void PentaRef::GetQuadNodalFunctions(double* l1l4,GaussPenta* gauss,int index1,int index2,int index3,int index4){
2697+void PentaRef::GetQuadNodalFunctions(IssmDouble* l1l4,GaussPenta* gauss,int index1,int index2,int index3,int index4){
2698 /*This routine returns the values of the nodal functions at the gaussian point.*/
2699
2700- double BasisFunctions[6];
2701+ IssmDouble BasisFunctions[6];
2702
2703 GetNodalFunctionsP1(&BasisFunctions[0],gauss);
2704
2705@@ -1204,10 +1204,10 @@
2706 }
2707 /*}}}*/
2708 /*FUNCTION PentaRef::GetQuadJacobianDeterminant{{{*/
2709-void PentaRef::GetQuadJacobianDeterminant(double* Jdet,double xyz_list[4][3],GaussPenta* gauss){
2710+void PentaRef::GetQuadJacobianDeterminant(IssmDouble* Jdet,IssmDouble xyz_list[4][3],GaussPenta* gauss){
2711 /*This routine returns the values of the nodal functions at the gaussian point.*/
2712
2713- double x1,x2,x3,x4,y1,y2,y3,y4,z1,z2,z3,z4;
2714+ IssmDouble x1,x2,x3,x4,y1,y2,y3,y4,z1,z2,z3,z4;
2715
2716 x1=xyz_list[0][0];
2717 y1=xyz_list[0][1];
2718@@ -1230,11 +1230,11 @@
2719 }
2720 /*}}}*/
2721 /*FUNCTION PentaRef::GetInputValue{{{*/
2722-void PentaRef::GetInputValue(double* pvalue,double* plist,GaussPenta* gauss){
2723+void PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,GaussPenta* gauss){
2724 /*P1 interpolation on Gauss point*/
2725
2726 /*intermediary*/
2727- double l1l6[6];
2728+ IssmDouble l1l6[6];
2729
2730 /*nodal functions: */
2731 GetNodalFunctionsP1(&l1l6[0],gauss);
2732@@ -1245,7 +1245,7 @@
2733 }
2734 /*}}}*/
2735 /*FUNCTION PentaRef::GetInputDerivativeValue{{{*/
2736-void PentaRef::GetInputDerivativeValue(double* p, double* plist,double* xyz_list, GaussPenta* gauss){
2737+void PentaRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussPenta* gauss){
2738 /*From node values of parameter p (p_list[0], p_list[1], p_list[2], p_list[3], p_list[4] and p_list[4]), return parameter derivative value at gaussian point specified by gauss_coord:
2739 * dp/dx=p_list[0]*dh1/dx+p_list[1]*dh2/dx+p_list[2]*dh3/dx+p_list[3]*dh4/dx+p_list[4]*dh5/dx+p_list[5]*dh6/dx;
2740 * dp/dy=p_list[0]*dh1/dy+p_list[1]*dh2/dy+p_list[2]*dh3/dy+p_list[3]*dh4/dy+p_list[4]*dh5/dy+p_list[5]*dh6/dy;
2741@@ -1253,7 +1253,7 @@
2742 *
2743 * p is a vector of size 3x1 already allocated.
2744 */
2745- double dh1dh6[3][NUMNODESP1];
2746+ IssmDouble dh1dh6[3][NUMNODESP1];
2747
2748 /*Get nodal funnctions derivatives in actual coordinate system: */
2749 GetNodalFunctionsP1Derivatives(&dh1dh6[0][0],xyz_list, gauss);
2750Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/Tria.h
2751===================================================================
2752--- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/Tria.h (revision 12470)
2753+++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/Tria.h (revision 12471)
2754@@ -54,23 +54,23 @@
2755 Object* copy();
2756 /*}}}*/
2757 /*Update virtual functions resolution: {{{*/
2758- void InputUpdateFromSolution(double* solutiong);
2759- void InputUpdateFromVector(double* vector, int name, int type);
2760+ void InputUpdateFromSolution(IssmDouble* solutiong);
2761+ void InputUpdateFromVector(IssmDouble* vector, int name, int type);
2762 void InputUpdateFromVector(int* vector, int name, int type);
2763 void InputUpdateFromVector(bool* vector, int name, int type);
2764 #ifdef _HAVE_DAKOTA_
2765- void InputUpdateFromVectorDakota(double* vector, int name, int type);
2766+ void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type);
2767 void InputUpdateFromVectorDakota(int* vector, int name, int type);
2768 void InputUpdateFromVectorDakota(bool* vector, int name, int type);
2769- void InputUpdateFromMatrixDakota(double* matrix, int nows, int ncols, int name, int type);
2770+ void InputUpdateFromMatrixDakota(IssmDouble* matrix, int nows, int ncols, int name, int type);
2771 #endif
2772- void InputUpdateFromConstant(double constant, int name);
2773+ void InputUpdateFromConstant(IssmDouble constant, int name);
2774 void InputUpdateFromConstant(int constant, int name);
2775 void InputUpdateFromConstant(bool constant, int name);
2776 void InputUpdateFromIoModel(int index, IoModel* iomodel);
2777 /*}}}*/
2778 /*Element virtual functions definitions: {{{*/
2779- void AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas,double* vertex_response,double* qmu_part);
2780+ void AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part);
2781 void ComputeBasalStress(Vector* sigma_b);
2782 void ComputeStrainRate(Vector* eps);
2783 void ComputeStressTensor();
2784@@ -84,58 +84,58 @@
2785 bool IsOnBed();
2786 bool IsFloating();
2787 bool IsNodeOnShelf();
2788- bool IsNodeOnShelfFromFlags(double* flags);
2789+ bool IsNodeOnShelfFromFlags(IssmDouble* flags);
2790 bool IsOnWater();
2791 void GetSolutionFromInputs(Vector* solution);
2792 void GetVectorFromInputs(Vector* vector, int name_enum);
2793 void GetVectorFromResults(Vector* vector,int offset,int interp);
2794- void InputArtificialNoise(int enum_type,double min, double max);
2795- bool InputConvergence(double* eps, int* enums,int num_enums,int* criterionenums,double* criterionvalues,int num_criterionenums);
2796- void InputCreate(double scalar,int name,int code);
2797- void InputCreate(double* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
2798+ void InputArtificialNoise(int enum_type,IssmDouble min, IssmDouble max);
2799+ bool InputConvergence(IssmDouble* eps, int* enums,int num_enums,int* criterionenums,IssmDouble* criterionvalues,int num_criterionenums);
2800+ void InputCreate(IssmDouble scalar,int name,int code);
2801+ void InputCreate(IssmDouble* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
2802 void InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum=MeshElementsEnum);
2803 void InputDuplicate(int original_enum,int new_enum);
2804- void InputScale(int enum_type,double scale_factor);
2805- void InputToResult(int enum_type,int step,double time);
2806+ void InputScale(int enum_type,IssmDouble scale_factor);
2807+ void InputToResult(int enum_type,int step,IssmDouble time);
2808 void DeleteResults(void);
2809 void MaterialUpdateFromTemperature(void){_error_("not implemented yet");};
2810- void MigrateGroundingLine(double* oldfloating,double* sheet_ungrounding);
2811- int NodalValue(double* pvalue, int index, int natureofdataenum,bool process_units);
2812+ void MigrateGroundingLine(IssmDouble* oldfloating,IssmDouble* sheet_ungrounding);
2813+ int NodalValue(IssmDouble* pvalue, int index, int natureofdataenum,bool process_units);
2814 void PotentialSheetUngrounding(Vector* potential_sheet_ungrounding);
2815- void PositiveDegreeDay(double* pdds,double* pds,double signorm);
2816- void RequestedOutput(int output_enum,int step,double time);
2817- void ListResultsInfo(int** results_enums,int** results_size,double** results_times,int** results_steps,int* num_results);
2818+ void PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm);
2819+ void RequestedOutput(int output_enum,int step,IssmDouble time);
2820+ void ListResultsInfo(int** results_enums,int** results_size,IssmDouble** results_times,int** results_steps,int* num_results);
2821 void PatchFill(int* pcount, Patch* patch);
2822 void PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes);
2823 void ProcessResultsUnits(void);
2824 void ResetCoordinateSystem(void){_error_("not implemented yet");};
2825- double SurfaceArea(void);
2826+ IssmDouble SurfaceArea(void);
2827 void Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type);
2828- int UpdatePotentialSheetUngrounding(double* vertices_potentially_ungrounding,Vector* vec_nodes_on_iceshelf,double* nodes_on_iceshelf);
2829- double TimeAdapt();
2830+ int UpdatePotentialSheetUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf);
2831+ IssmDouble TimeAdapt();
2832 int* GetHorizontalNeighboorSids(void);
2833- void SmearFunction(Vector* smearedvector,double (*WeightFunction)(double distance,double radius),double radius);
2834+ void SmearFunction(Vector* smearedvector,IssmDouble (*WeightFunction)(IssmDouble distance,IssmDouble radius),IssmDouble radius);
2835
2836 #ifdef _HAVE_RESPONSES_
2837- double IceVolume(void);
2838- void MinVel(double* pminvel, bool process_units);
2839- void MinVx(double* pminvx, bool process_units);
2840- void MinVy(double* pminvy, bool process_units);
2841- void MinVz(double* pminvz, bool process_units);
2842- double MassFlux(double* segment,bool process_units);
2843- void MaxAbsVx(double* pmaxabsvx, bool process_units);
2844- void MaxAbsVy(double* pmaxabsvy, bool process_units);
2845- void MaxAbsVz(double* pmaxabsvz, bool process_units);
2846- void ElementResponse(double* presponse,int response_enum,bool process_units);
2847- void MaxVel(double* pmaxvel, bool process_units);
2848- void MaxVx(double* pmaxvx, bool process_units);
2849- void MaxVy(double* pmaxvy, bool process_units);
2850- void MaxVz(double* pmaxvz, bool process_units);
2851+ IssmDouble IceVolume(void);
2852+ void MinVel(IssmDouble* pminvel, bool process_units);
2853+ void MinVx(IssmDouble* pminvx, bool process_units);
2854+ void MinVy(IssmDouble* pminvy, bool process_units);
2855+ void MinVz(IssmDouble* pminvz, bool process_units);
2856+ IssmDouble MassFlux(IssmDouble* segment,bool process_units);
2857+ void MaxAbsVx(IssmDouble* pmaxabsvx, bool process_units);
2858+ void MaxAbsVy(IssmDouble* pmaxabsvy, bool process_units);
2859+ void MaxAbsVz(IssmDouble* pmaxabsvz, bool process_units);
2860+ void ElementResponse(IssmDouble* presponse,int response_enum,bool process_units);
2861+ void MaxVel(IssmDouble* pmaxvel, bool process_units);
2862+ void MaxVx(IssmDouble* pmaxvx, bool process_units);
2863+ void MaxVy(IssmDouble* pmaxvy, bool process_units);
2864+ void MaxVz(IssmDouble* pmaxvz, bool process_units);
2865 #endif
2866
2867
2868 #ifdef _HAVE_CONTROL_
2869- double DragCoefficientAbsGradient(bool process_units,int weight_index);
2870+ IssmDouble DragCoefficientAbsGradient(bool process_units,int weight_index);
2871 void GradientIndexing(int* indexing,int control_index);
2872 void Gradj(Vector* gradient,int control_type,int control_index);
2873 void GradjBGradient(Vector* gradient,int weight_index,int control_index);
2874@@ -147,19 +147,19 @@
2875 void GradjVxBalancedthickness(Vector* gradient,int control_index);
2876 void GradjVyBalancedthickness(Vector* gradient,int control_index);
2877 void GetVectorFromControlInputs(Vector* gradient,int control_enum,int control_index,const char* data);
2878- void SetControlInputsFromVector(double* vector,int control_enum,int control_index);
2879+ void SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index);
2880 void ControlInputGetGradient(Vector* gradient,int enum_type,int control_index);
2881- void ControlInputScaleGradient(int enum_type,double scale);
2882- void ControlInputSetGradient(double* gradient,int enum_type,int control_index);
2883- double RheologyBbarAbsGradient(bool process_units,int weight_index);
2884- double ThicknessAbsMisfit( bool process_units,int weight_index);
2885- double SurfaceAbsVelMisfit( bool process_units,int weight_index);
2886- double ThicknessAbsGradient(bool process_units,int weight_index);
2887- double SurfaceRelVelMisfit( bool process_units,int weight_index);
2888- double SurfaceLogVelMisfit( bool process_units,int weight_index);
2889- double SurfaceLogVxVyMisfit( bool process_units,int weight_index);
2890- double SurfaceAverageVelMisfit(bool process_units,int weight_index);
2891- void InputControlUpdate(double scalar,bool save_parameter);
2892+ void ControlInputScaleGradient(int enum_type,IssmDouble scale);
2893+ void ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index);
2894+ IssmDouble RheologyBbarAbsGradient(bool process_units,int weight_index);
2895+ IssmDouble ThicknessAbsMisfit( bool process_units,int weight_index);
2896+ IssmDouble SurfaceAbsVelMisfit( bool process_units,int weight_index);
2897+ IssmDouble ThicknessAbsGradient(bool process_units,int weight_index);
2898+ IssmDouble SurfaceRelVelMisfit( bool process_units,int weight_index);
2899+ IssmDouble SurfaceLogVelMisfit( bool process_units,int weight_index);
2900+ IssmDouble SurfaceLogVxVyMisfit( bool process_units,int weight_index);
2901+ IssmDouble SurfaceAverageVelMisfit(bool process_units,int weight_index);
2902+ void InputControlUpdate(IssmDouble scalar,bool save_parameter);
2903 #endif
2904
2905 /*}}}*/
2906@@ -179,22 +179,22 @@
2907 ElementVector* CreatePVectorPrognostic_CG(void);
2908 ElementVector* CreatePVectorPrognostic_DG(void);
2909 ElementVector* CreatePVectorSlope(void);
2910- double GetArea(void);
2911+ IssmDouble GetArea(void);
2912 int GetElementType(void);
2913 void GetDofList(int** pdoflist,int approximation_enum,int setenum);
2914 void GetDofList1(int* doflist);
2915 void GetSidList(int* sidlist);
2916 void GetConnectivityList(int* connectivity);
2917- void GetInputListOnVertices(double* pvalue,int enumtype);
2918- void GetInputListOnVertices(double* pvalue,int enumtype,double defaultvalue);
2919- void GetInputListOnVertices(double* pvalue,int enumtype,double defaultvalue,int index); //TO BE REMOVED
2920- void GetInputValue(double* pvalue,Node* node,int enumtype);
2921- void GetStrainRate2d(double* epsilon,double* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input);
2922- void InputUpdateFromSolutionOneDof(double* solution,int enum_type);
2923- void InputUpdateFromSolutionPrognostic(double* solution);
2924+ void GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
2925+ void GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
2926+ void GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue,int index); //TO BE REMOVED
2927+ void GetInputValue(IssmDouble* pvalue,Node* node,int enumtype);
2928+ void GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input);
2929+ void InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type);
2930+ void InputUpdateFromSolutionPrognostic(IssmDouble* solution);
2931 bool IsInput(int name);
2932 void SetClone(int* minranks);
2933- void SurfaceNormal(double* surface_normal, double xyz_list[3][3]);
2934+ void SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]);
2935
2936 #ifdef _HAVE_DIAGNOSTIC_
2937 ElementMatrix* CreateKMatrixDiagnosticMacAyeal(void);
2938@@ -206,8 +206,8 @@
2939 ElementMatrix* CreateJacobianDiagnosticMacayeal(void);
2940 void GetSolutionFromInputsDiagnosticHoriz(Vector* solution);
2941 void GetSolutionFromInputsDiagnosticHutter(Vector* solution);
2942- void InputUpdateFromSolutionDiagnosticHoriz( double* solution);
2943- void InputUpdateFromSolutionDiagnosticHutter( double* solution);
2944+ void InputUpdateFromSolutionDiagnosticHoriz( IssmDouble* solution);
2945+ void InputUpdateFromSolutionDiagnosticHutter( IssmDouble* solution);
2946 #endif
2947
2948 #ifdef _HAVE_CONTROL_
2949@@ -216,8 +216,8 @@
2950 ElementVector* CreatePVectorAdjointHoriz(void);
2951 ElementVector* CreatePVectorAdjointStokes(void);
2952 ElementVector* CreatePVectorAdjointBalancethickness(void);
2953- void InputUpdateFromSolutionAdjointBalancethickness( double* solution);
2954- void InputUpdateFromSolutionAdjointHoriz( double* solution);
2955+ void InputUpdateFromSolutionAdjointBalancethickness( IssmDouble* solution);
2956+ void InputUpdateFromSolutionAdjointHoriz( IssmDouble* solution);
2957 #endif
2958
2959 #ifdef _HAVE_HYDROLOGY_
2960@@ -225,7 +225,7 @@
2961 ElementVector* CreatePVectorHydrology(void);
2962 void CreateHydrologyWaterVelocityInput(void);
2963 void GetSolutionFromInputsHydrology(Vector* solution);
2964- void InputUpdateFromSolutionHydrology(double* solution);
2965+ void InputUpdateFromSolutionHydrology(IssmDouble* solution);
2966 #endif
2967 #ifdef _HAVE_BALANCED_
2968 #endif
2969Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/Penta.cpp
2970===================================================================
2971--- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/Penta.cpp (revision 12470)
2972+++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/Penta.cpp (revision 12471)
2973@@ -144,17 +144,17 @@
2974
2975 /*Other*/
2976 /*FUNCTION Penta::AverageOntoPartition {{{*/
2977-void Penta::AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas,double* vertex_response,double* qmu_part){
2978+void Penta::AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){
2979 _error_("Not supported yet!");
2980 }
2981 /*}}}*/
2982 /*FUNCTION Penta::BedNormal {{{*/
2983-void Penta::BedNormal(double* bed_normal, double xyz_list[3][3]){
2984+void Penta::BedNormal(IssmDouble* bed_normal, IssmDouble xyz_list[3][3]){
2985
2986 int i;
2987- double v13[3],v23[3];
2988- double normal[3];
2989- double normal_norm;
2990+ IssmDouble v13[3],v23[3];
2991+ IssmDouble normal[3];
2992+ IssmDouble normal_norm;
2993
2994 for (i=0;i<3;i++){
2995 v13[i]=xyz_list[0][i]-xyz_list[2][i];
2996@@ -180,8 +180,8 @@
2997
2998 /*Intermediaries */
2999 int count,ig;
3000- double basalfriction[NUMVERTICES]={0,0,0,0,0,0};
3001- double alpha2,vx,vy;
3002+ IssmDouble basalfriction[NUMVERTICES]={0,0,0,0,0,0};
3003+ IssmDouble alpha2,vx,vy;
3004 Friction* friction=NULL;
3005 GaussPenta* gauss=NULL;
3006
3007@@ -232,18 +232,18 @@
3008 int dofp[1]={3};
3009 int analysis_type,approximation;
3010 int doflist[NUMVERTICES];
3011- double xyz_list[NUMVERTICES][3];
3012- double xyz_list_tria[3][3];
3013- double rho_ice,gravity,stokesreconditioning;
3014- double pressure,viscosity,bed,Jdet2d;
3015- double bed_normal[3];
3016- double basalforce[3];
3017- double epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
3018- double devstresstensor[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
3019- double stresstensor[6]={0.0};
3020- double sigma_xx,sigma_yy,sigma_zz;
3021- double sigma_xy,sigma_xz,sigma_yz;
3022- double surface=0,value=0;
3023+ IssmDouble xyz_list[NUMVERTICES][3];
3024+ IssmDouble xyz_list_tria[3][3];
3025+ IssmDouble rho_ice,gravity,stokesreconditioning;
3026+ IssmDouble pressure,viscosity,bed,Jdet2d;
3027+ IssmDouble bed_normal[3];
3028+ IssmDouble basalforce[3];
3029+ IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
3030+ IssmDouble devstresstensor[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
3031+ IssmDouble stresstensor[6]={0.0};
3032+ IssmDouble sigma_xx,sigma_yy,sigma_zz;
3033+ IssmDouble sigma_xy,sigma_xz,sigma_yz;
3034+ IssmDouble surface=0,value=0;
3035 GaussPenta* gauss;
3036
3037 /*retrive parameters: */
3038@@ -325,15 +325,15 @@
3039 void Penta::ComputeStressTensor(){
3040
3041 int iv;
3042- double xyz_list[NUMVERTICES][3];
3043- double pressure,viscosity;
3044- double epsilon[6]; /* epsilon=[exx,eyy,exy];*/
3045- double sigma_xx[NUMVERTICES];
3046- double sigma_yy[NUMVERTICES];
3047- double sigma_zz[NUMVERTICES];
3048- double sigma_xy[NUMVERTICES];
3049- double sigma_xz[NUMVERTICES];
3050- double sigma_yz[NUMVERTICES];
3051+ IssmDouble xyz_list[NUMVERTICES][3];
3052+ IssmDouble pressure,viscosity;
3053+ IssmDouble epsilon[6]; /* epsilon=[exx,eyy,exy];*/
3054+ IssmDouble sigma_xx[NUMVERTICES];
3055+ IssmDouble sigma_yy[NUMVERTICES];
3056+ IssmDouble sigma_zz[NUMVERTICES];
3057+ IssmDouble sigma_xy[NUMVERTICES];
3058+ IssmDouble sigma_xz[NUMVERTICES];
3059+ IssmDouble sigma_yz[NUMVERTICES];
3060 GaussPenta* gauss=NULL;
3061
3062 /* Get node coordinates and dof list: */
3063@@ -763,11 +763,11 @@
3064 }
3065 /*}}}*/
3066 /*FUNCTION Penta::GetElementSizes{{{*/
3067-void Penta::GetElementSizes(double* hx,double* hy,double* hz){
3068+void Penta::GetElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){
3069
3070- double xyz_list[NUMVERTICES][3];
3071- double xmin,ymin,zmin;
3072- double xmax,ymax,zmax;
3073+ IssmDouble xyz_list[NUMVERTICES][3];
3074+ IssmDouble xmin,ymin,zmin;
3075+ IssmDouble xmax,ymax,zmax;
3076
3077 /*Get xyz list: */
3078 GetVerticesCoordinates(&xyz_list[0][0],nodes,NUMVERTICES);
3079@@ -819,11 +819,11 @@
3080
3081 }
3082 /*}}}*/
3083-/*FUNCTION Penta::GetInputListOnVertices(double* pvalue,int enumtype) {{{*/
3084-void Penta::GetInputListOnVertices(double* pvalue,int enumtype){
3085+/*FUNCTION Penta::GetInputListOnVertices(IssmDouble* pvalue,int enumtype) {{{*/
3086+void Penta::GetInputListOnVertices(IssmDouble* pvalue,int enumtype){
3087
3088 /*Intermediaries*/
3089- double value[NUMVERTICES];
3090+ IssmDouble value[NUMVERTICES];
3091 GaussPenta *gauss = NULL;
3092
3093 /*Recover input*/
3094@@ -844,11 +844,11 @@
3095 delete gauss;
3096 }
3097 /*}}}*/
3098-/*FUNCTION Penta::GetInputListOnVertices(double* pvalue,int enumtype,double defaultvalue) {{{*/
3099-void Penta::GetInputListOnVertices(double* pvalue,int enumtype,double defaultvalue){
3100+/*FUNCTION Penta::GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue) {{{*/
3101+void Penta::GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){
3102
3103 /*Intermediaries*/
3104- double value[NUMVERTICES];
3105+ IssmDouble value[NUMVERTICES];
3106 GaussPenta *gauss = NULL;
3107
3108 /*Recover input*/
3109@@ -873,8 +873,8 @@
3110 delete gauss;
3111 }
3112 /*}}}*/
3113-/*FUNCTION Penta::GetInputValue(double* pvalue,Node* node,int enumtype) {{{*/
3114-void Penta::GetInputValue(double* pvalue,Node* node,int enumtype){
3115+/*FUNCTION Penta::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype) {{{*/
3116+void Penta::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){
3117
3118 Input* input=inputs->GetInput(enumtype);
3119 if(!input) _error_("No input of type %s found in tria",EnumToStringx(enumtype));
3120@@ -887,12 +887,12 @@
3121 }
3122 /*}}}*/
3123 /*FUNCTION Penta::GetPhi {{{*/
3124-void Penta::GetPhi(double* phi, double* epsilon, double viscosity){
3125+void Penta::GetPhi(IssmDouble* phi, IssmDouble* epsilon, IssmDouble viscosity){
3126 /*Compute deformational heating from epsilon and viscosity */
3127
3128- double epsilon_matrix[3][3];
3129- double epsilon_eff;
3130- double epsilon_sqr[3][3];
3131+ IssmDouble epsilon_matrix[3][3];
3132+ IssmDouble epsilon_eff;
3133+ IssmDouble epsilon_sqr[3][3];
3134
3135 /* Build epsilon matrix */
3136 epsilon_matrix[0][0]=*(epsilon+0);
3137@@ -977,13 +977,13 @@
3138 }
3139 /*}}}*/
3140 /*FUNCTION Penta::GetStabilizationParameter {{{*/
3141-double Penta::GetStabilizationParameter(double u, double v, double w, double diameter, double kappa){
3142+IssmDouble Penta::GetStabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){
3143 /*Compute stabilization parameter*/
3144 /*kappa=thermalconductivity/(rho_ice*hearcapacity) for thermal model*/
3145 /*kappa=enthalpydiffusionparameter for enthalpy model*/
3146
3147- double normu;
3148- double tau_parameter;
3149+ IssmDouble normu;
3150+ IssmDouble tau_parameter;
3151
3152 normu=pow(pow(u,2)+pow(v,2)+pow(w,2),0.5);
3153 if(normu*diameter/(3*2*kappa)<1){
3154@@ -995,7 +995,7 @@
3155 }
3156 /*}}}*/
3157 /*FUNCTION Penta::GetStrainRate3dPattyn{{{*/
3158-void Penta::GetStrainRate3dPattyn(double* epsilon,double* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input){
3159+void Penta::GetStrainRate3dPattyn(IssmDouble* epsilon,IssmDouble* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input){
3160 /*Compute the 3d Blatter/PattynStrain Rate (5 components):
3161 *
3162 * epsilon=[exx eyy exy exz eyz]
3163@@ -1007,8 +1007,8 @@
3164 */
3165
3166 int i;
3167- double epsilonvx[5];
3168- double epsilonvy[5];
3169+ IssmDouble epsilonvx[5];
3170+ IssmDouble epsilonvy[5];
3171
3172 /*Check that both inputs have been found*/
3173 if (!vx_input || !vy_input){
3174@@ -1024,16 +1024,16 @@
3175 }
3176 /*}}}*/
3177 /*FUNCTION Penta::GetStrainRate3d{{{*/
3178-void Penta::GetStrainRate3d(double* epsilon,double* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input, Input* vz_input){
3179+void Penta::GetStrainRate3d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input, Input* vz_input){
3180 /*Compute the 3d Strain Rate (6 components):
3181 *
3182 * epsilon=[exx eyy ezz exy exz eyz]
3183 */
3184
3185 int i;
3186- double epsilonvx[6];
3187- double epsilonvy[6];
3188- double epsilonvz[6];
3189+ IssmDouble epsilonvx[6];
3190+ IssmDouble epsilonvy[6];
3191+ IssmDouble epsilonvz[6];
3192
3193 /*Check that both inputs have been found*/
3194 if (!vx_input || !vy_input || !vz_input){
3195@@ -1099,12 +1099,12 @@
3196 }
3197 /*}}}*/
3198 /*FUNCTION Penta::GetZcoord {{{*/
3199-double Penta::GetZcoord(GaussPenta* gauss){
3200+IssmDouble Penta::GetZcoord(GaussPenta* gauss){
3201
3202 int i;
3203- double z;
3204- double xyz_list[NUMVERTICES][3];
3205- double z_list[NUMVERTICES];
3206+ IssmDouble z;
3207+ IssmDouble xyz_list[NUMVERTICES][3];
3208+ IssmDouble z_list[NUMVERTICES];
3209
3210 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);
3211 for(i=0;i<NUMVERTICES;i++) z_list[i]=xyz_list[i][2];
3212@@ -1126,7 +1126,7 @@
3213 }
3214 /*}}}*/
3215 /*FUNCTION Penta::InputArtificialNoise{{{*/
3216-void Penta::InputArtificialNoise(int enum_type,double min,double max){
3217+void Penta::InputArtificialNoise(int enum_type,IssmDouble min,IssmDouble max){
3218
3219 Input* input=NULL;
3220
3221@@ -1139,7 +1139,7 @@
3222 }
3223 /*}}}*/
3224 /*FUNCTION Penta::InputConvergence{{{*/
3225-bool Penta::InputConvergence(double* eps, int* enums,int num_enums,int* criterionenums,double* criterionvalues,int num_criterionenums){
3226+bool Penta::InputConvergence(IssmDouble* eps, int* enums,int num_enums,int* criterionenums,IssmDouble* criterionvalues,int num_criterionenums){
3227
3228 int i;
3229 bool converged=true;
3230@@ -1170,8 +1170,8 @@
3231 return converged;
3232 }
3233 /*}}}*/
3234-/*FUNCTION Penta::InputCreate(double scalar,int enum,int code);{{{*/
3235-void Penta::InputCreate(double scalar,int name,int code){
3236+/*FUNCTION Penta::InputCreate(IssmDouble scalar,int enum,int code);{{{*/
3237+void Penta::InputCreate(IssmDouble scalar,int name,int code){
3238
3239 /*Check that name is an element input*/
3240 if (!IsInput(name)) return;
3241@@ -1182,27 +1182,27 @@
3242 else if ((code==6) || (code==2)){ //integer
3243 this->inputs->AddInput(new IntInput(name,(int)scalar));
3244 }
3245- else if ((code==7) || (code==3)){ //double
3246- this->inputs->AddInput(new DoubleInput(name,(double)scalar));
3247+ else if ((code==7) || (code==3)){ //IssmDouble
3248+ this->inputs->AddInput(new DoubleInput(name,(IssmDouble)scalar));
3249 }
3250 else _error_("%s%i"," could not recognize nature of vector from code ",code);
3251
3252 }
3253 /*}}}*/
3254-/*FUNCTION Penta::InputCreate(double* vector,int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){{{*/
3255-void Penta::InputCreate(double* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){//index into elements
3256+/*FUNCTION Penta::InputCreate(IssmDouble* vector,int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){{{*/
3257+void Penta::InputCreate(IssmDouble* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){//index into elements
3258
3259 /*Intermediaries*/
3260 int i,j,t;
3261 int penta_vertex_ids[6];
3262 int row;
3263- double nodeinputs[6];
3264- double time;
3265+ IssmDouble nodeinputs[6];
3266+ IssmDouble time;
3267 TransientInput* transientinput=NULL;
3268
3269 int numberofvertices;
3270 int numberofelements;
3271- double yts;
3272+ IssmDouble yts;
3273
3274 /*Fetch parameters: */
3275 iomodel->Constant(&numberofvertices,MeshNumberofverticesEnum);
3276@@ -1221,7 +1221,7 @@
3277 if(M==numberofvertices){
3278
3279 /*create input values: */
3280- for(i=0;i<6;i++)nodeinputs[i]=(double)vector[penta_vertex_ids[i]-1];
3281+ for(i=0;i<6;i++)nodeinputs[i]=(IssmDouble)vector[penta_vertex_ids[i]-1];
3282
3283 /*process units: */
3284 UnitConversion(&nodeinputs[0], 6 ,ExtToIuEnum, vector_enum);
3285@@ -1236,14 +1236,14 @@
3286 /*create input values: */
3287 for(i=0;i<6;i++){
3288 row=penta_vertex_ids[i]-1;
3289- nodeinputs[i]=(double)vector[N*row+t];
3290+ nodeinputs[i]=(IssmDouble)vector[N*row+t];
3291 }
3292
3293 /*process units: */
3294 UnitConversion(&nodeinputs[0], 6 ,ExtToIuEnum, vector_enum);
3295
3296 /*time? :*/
3297- time=(double)vector[(M-1)*N+t]*yts;
3298+ time=(IssmDouble)vector[(M-1)*N+t]*yts;
3299
3300 if(t==0)transientinput=new TransientInput(vector_enum);
3301 transientinput->AddTimeInput(new PentaP1Input(vector_enum,nodeinputs),time);
3302@@ -1264,8 +1264,8 @@
3303 else if (code==6){ //integer
3304 this->inputs->AddInput(new IntInput(vector_enum,(int)vector[index]));
3305 }
3306- else if (code==7){ //double
3307- this->inputs->AddInput(new DoubleInput(vector_enum,(double)vector[index]));
3308+ else if (code==7){ //IssmDouble
3309+ this->inputs->AddInput(new DoubleInput(vector_enum,(IssmDouble)vector[index]));
3310 }
3311 else _error_("%s%i"," could not recognize nature of vector from code ",code);
3312 }
3313@@ -1283,9 +1283,9 @@
3314 void Penta::InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum){
3315
3316 int step,i;
3317- double xyz_list[NUMVERTICES][3];
3318- double Helem_list[NUMVERTICES];
3319- double zeros_list[NUMVERTICES]={0.0};
3320+ IssmDouble xyz_list[NUMVERTICES][3];
3321+ IssmDouble Helem_list[NUMVERTICES];
3322+ IssmDouble zeros_list[NUMVERTICES]={0.0};
3323 Penta* penta=NULL;
3324 Input* original_input=NULL;
3325 Input* element_integrated_input=NULL;
3326@@ -1457,7 +1457,7 @@
3327 }
3328 /*}}}*/
3329 /*FUNCTION Penta::InputScale{{{*/
3330-void Penta::InputScale(int enum_type,double scale_factor){
3331+void Penta::InputScale(int enum_type,IssmDouble scale_factor){
3332
3333 Input* input=NULL;
3334
3335@@ -1470,7 +1470,7 @@
3336 }
3337 /*}}}*/
3338 /*FUNCTION Penta::InputToResult{{{*/
3339-void Penta::InputToResult(int enum_type,int step,double time){
3340+void Penta::InputToResult(int enum_type,int step,IssmDouble time){
3341
3342 int i;
3343 bool found = false;
3344@@ -1504,8 +1504,8 @@
3345 this->inputs->AddInput(new BoolInput(name,constant));
3346 }
3347 /*}}}*/
3348-/*FUNCTION Penta::InputUpdateFromConstant(double value, int name);{{{*/
3349-void Penta::InputUpdateFromConstant(double constant, int name){
3350+/*FUNCTION Penta::InputUpdateFromConstant(IssmDouble value, int name);{{{*/
3351+void Penta::InputUpdateFromConstant(IssmDouble constant, int name){
3352 /*Check that name is an element input*/
3353 if (!IsInput(name)) return;
3354
3355@@ -1528,11 +1528,11 @@
3356 /*Intermediaries*/
3357 IssmInt i,j;
3358 int penta_vertex_ids[6];
3359- double nodeinputs[6];
3360- double cmmininputs[6];
3361- double cmmaxinputs[6];
3362+ IssmDouble nodeinputs[6];
3363+ IssmDouble cmmininputs[6];
3364+ IssmDouble cmmaxinputs[6];
3365
3366- double yts;
3367+ IssmDouble yts;
3368 bool control_analysis;
3369 int num_control_type;
3370 int num_cm_responses;
3371@@ -1646,7 +1646,7 @@
3372 }
3373 /*}}}*/
3374 /*FUNCTION Penta::InputUpdateFromSolution {{{*/
3375-void Penta::InputUpdateFromSolution(double* solution){
3376+void Penta::InputUpdateFromSolution(IssmDouble* solution){
3377
3378 int analysis_type;
3379
3380@@ -1715,20 +1715,20 @@
3381 }
3382 /*}}}*/
3383 /*FUNCTION Penta::InputUpdateFromSolutionPrognostic{{{*/
3384-void Penta::InputUpdateFromSolutionPrognostic(double* solution){
3385+void Penta::InputUpdateFromSolutionPrognostic(IssmDouble* solution){
3386
3387 const int numdof = NDOF1*NUMVERTICES;
3388 const int numdof2d = NDOF1*NUMVERTICES2D;
3389
3390 int i,hydroadjustment;
3391 int* doflist = NULL;
3392- double rho_ice,rho_water,minthickness;
3393- double newthickness[numdof];
3394- double newbed[numdof];
3395- double newsurface[numdof];
3396- double oldbed[NUMVERTICES];
3397- double oldsurface[NUMVERTICES];
3398- double oldthickness[NUMVERTICES];
3399+ IssmDouble rho_ice,rho_water,minthickness;
3400+ IssmDouble newthickness[numdof];
3401+ IssmDouble newbed[numdof];
3402+ IssmDouble newsurface[numdof];
3403+ IssmDouble oldbed[NUMVERTICES];
3404+ IssmDouble oldsurface[NUMVERTICES];
3405+ IssmDouble oldthickness[NUMVERTICES];
3406 Penta *penta = NULL;
3407
3408 /*If not on bed, return*/
3409@@ -1798,11 +1798,11 @@
3410 }
3411 /*}}}*/
3412 /*FUNCTION Penta::InputUpdateFromSolutionOneDof{{{*/
3413-void Penta::InputUpdateFromSolutionOneDof(double* solution,int enum_type){
3414+void Penta::InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type){
3415
3416 const int numdof = NDOF1*NUMVERTICES;
3417
3418- double values[numdof];
3419+ IssmDouble values[numdof];
3420 int* doflist=NULL;
3421
3422 /*Get dof list: */
3423@@ -1822,12 +1822,12 @@
3424 }
3425 /*}}}*/
3426 /*FUNCTION Penta::InputUpdateFromSolutionOneDofCollpased{{{*/
3427-void Penta::InputUpdateFromSolutionOneDofCollapsed(double* solution,int enum_type){
3428+void Penta::InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int enum_type){
3429
3430 const int numdof = NDOF1*NUMVERTICES;
3431 const int numdof2d = NDOF1*NUMVERTICES2D;
3432
3433- double values[numdof];
3434+ IssmDouble values[numdof];
3435 int* doflist = NULL;
3436 Penta *penta = NULL;
3437
3438@@ -1861,8 +1861,8 @@
3439 xDelete<int>(doflist);
3440 }
3441 /*}}}*/
3442-/*FUNCTION Penta::InputUpdateFromVector(double* vector, int name, int type);{{{*/
3443-void Penta::InputUpdateFromVector(double* vector, int name, int type){
3444+/*FUNCTION Penta::InputUpdateFromVector(IssmDouble* vector, int name, int type);{{{*/
3445+void Penta::InputUpdateFromVector(IssmDouble* vector, int name, int type){
3446
3447 /*Check that name is an element input*/
3448 if (!IsInput(name)) return;
3449@@ -1874,7 +1874,7 @@
3450 case VertexEnum:
3451
3452 /*New PentaVertexInpu*/
3453- double values[6];
3454+ IssmDouble values[6];
3455
3456 /*Get values on the 6 vertices*/
3457 for (int i=0;i<6;i++){
3458@@ -1977,7 +1977,7 @@
3459 }
3460 /*}}}*/
3461 /*FUNCTION Penta::IsNodeOnShelfFromFlags {{{*/
3462-bool Penta::IsNodeOnShelfFromFlags(double* flags){
3463+bool Penta::IsNodeOnShelfFromFlags(IssmDouble* flags){
3464
3465 int i;
3466 bool shelf=false;
3467@@ -2008,14 +2008,14 @@
3468 }
3469 /*}}}*/
3470 /*FUNCTION Penta::ListResultsInfo{{{*/
3471-void Penta::ListResultsInfo(int** in_resultsenums,int** in_resultssizes,double** in_resultstimes,int** in_resultssteps,int* in_num_results){
3472+void Penta::ListResultsInfo(int** in_resultsenums,int** in_resultssizes,IssmDouble** in_resultstimes,int** in_resultssteps,int* in_num_results){
3473
3474 /*Intermediaries*/
3475 int i;
3476 int numberofresults = 0;
3477 int *resultsenums = NULL;
3478 int *resultssizes = NULL;
3479- double *resultstimes = NULL;
3480+ IssmDouble *resultstimes = NULL;
3481 int *resultssteps = NULL;
3482
3483 /*Checks*/
3484@@ -2032,7 +2032,7 @@
3485 /*Allocate output*/
3486 resultsenums=xNew<int>(numberofresults);
3487 resultssizes=xNew<int>(numberofresults);
3488- resultstimes=xNew<double>(numberofresults);
3489+ resultstimes=xNew<IssmDouble>(numberofresults);
3490 resultssteps=xNew<int>(numberofresults);
3491
3492 /*populate enums*/
3493@@ -2059,14 +2059,14 @@
3494
3495 }/*}}}*/
3496 /*FUNCTION Penta::MigrateGroundingLine{{{*/
3497-void Penta::MigrateGroundingLine(double* old_floating_ice,double* sheet_ungrounding){
3498+void Penta::MigrateGroundingLine(IssmDouble* old_floating_ice,IssmDouble* sheet_ungrounding){
3499
3500 int i,migration_style,unground;
3501 bool elementonshelf = false;
3502- double bed_hydro,yts,gl_melting_rate;
3503- double rho_water,rho_ice,density;
3504- double melting[NUMVERTICES];
3505- double h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES];
3506+ IssmDouble bed_hydro,yts,gl_melting_rate;
3507+ IssmDouble rho_water,rho_ice,density;
3508+ IssmDouble melting[NUMVERTICES];
3509+ IssmDouble h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES];
3510
3511 if(!IsOnBed()) return;
3512
3513@@ -2142,13 +2142,13 @@
3514 }
3515 /*}}}*/
3516 /*FUNCTION Penta::MinEdgeLength{{{*/
3517-double Penta::MinEdgeLength(double xyz_list[6][3]){
3518+IssmDouble Penta::MinEdgeLength(IssmDouble xyz_list[6][3]){
3519 /*Return the minimum lenght of the nine egdes of the penta*/
3520
3521 int i,node0,node1;
3522 int edges[9][2]={{0,1},{0,2},{1,2},{3,4},{3,5},{4,5},{0,3},{1,4},{2,5}}; //list of the nine edges
3523- double length;
3524- double minlength=-1;
3525+ IssmDouble length;
3526+ IssmDouble minlength=-1;
3527
3528 for(i=0;i<9;i++){
3529 /*Find the two nodes for this edge*/
3530@@ -2170,11 +2170,11 @@
3531 }
3532 /*}}}*/
3533 /*FUNCTION Penta::NodalValue {{{*/
3534-int Penta::NodalValue(double* pvalue, int index, int natureofdataenum,bool process_units){
3535+int Penta::NodalValue(IssmDouble* pvalue, int index, int natureofdataenum,bool process_units){
3536
3537 int i;
3538 int found=0;
3539- double value;
3540+ IssmDouble value;
3541 Input* data=NULL;
3542 GaussPenta* gauss=NULL;
3543
3544@@ -2252,60 +2252,60 @@
3545 }
3546 /*}}}*/
3547 /*FUNCTION Penta::PositiveDegreeDay{{{*/
3548-void Penta::PositiveDegreeDay(double* pdds,double* pds,double signorm){
3549+void Penta::PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){
3550
3551
3552 int i,iqj,imonth;
3553- double agd[NUMVERTICES]; // surface and basal
3554- double saccu[NUMVERTICES] = {0}; // yearly surface accumulation
3555- double smelt[NUMVERTICES] = {0}; // yearly melt
3556- double precrunoff[NUMVERTICES]; // yearly runoff
3557- double prect; // total precipitation during 1 year taking into account des. ef.
3558- double water; //water=rain + snowmelt
3559- double runoff; //meltwater only, does not include rain
3560- double sconv; //rhow_rain/rhoi / 12 months
3561+ IssmDouble agd[NUMVERTICES]; // surface and basal
3562+ IssmDouble saccu[NUMVERTICES] = {0}; // yearly surface accumulation
3563+ IssmDouble smelt[NUMVERTICES] = {0}; // yearly melt
3564+ IssmDouble precrunoff[NUMVERTICES]; // yearly runoff
3565+ IssmDouble prect; // total precipitation during 1 year taking into account des. ef.
3566+ IssmDouble water; //water=rain + snowmelt
3567+ IssmDouble runoff; //meltwater only, does not include rain
3568+ IssmDouble sconv; //rhow_rain/rhoi / 12 months
3569
3570- double rho_water,rho_ice,density;
3571- double lapser=6.5/1000, sealev=0; // lapse rate. degrees per meter.
3572- double desfac = 0.5; //desert elevation factor
3573- double s0p[NUMVERTICES]={0}; //should be set to elevation from precip source
3574- double s0t[NUMVERTICES]={0}; //should be set to elevation from temperature source
3575- double st; // elevation between altitude of the temp record and current altitude
3576- double sp; // elevation between altitude of the prec record and current altitude
3577+ IssmDouble rho_water,rho_ice,density;
3578+ IssmDouble lapser=6.5/1000, sealev=0; // lapse rate. degrees per meter.
3579+ IssmDouble desfac = 0.5; //desert elevation factor
3580+ IssmDouble s0p[NUMVERTICES]={0}; //should be set to elevation from precip source
3581+ IssmDouble s0t[NUMVERTICES]={0}; //should be set to elevation from temperature source
3582+ IssmDouble st; // elevation between altitude of the temp record and current altitude
3583+ IssmDouble sp; // elevation between altitude of the prec record and current altitude
3584
3585
3586 // PDD and PD constants and variables
3587- double siglim; // sigma limit for the integration which is equal to 2.5 sigmanorm
3588- double signormc = signorm - 0.5; // sigma of the temperature distribution for cloudy day
3589- double siglimc, siglim0, siglim0c;
3590- double PDup, pddsig, PDCUT = 2.0; // PDcut: rain/snow cutoff temperature (C)
3591- double DT = 0.02;
3592- double pddt, pd; // pd: snow/precip fraction, precipitation falling as snow
3593+ IssmDouble siglim; // sigma limit for the integration which is equal to 2.5 sigmanorm
3594+ IssmDouble signormc = signorm - 0.5; // sigma of the temperature distribution for cloudy day
3595+ IssmDouble siglimc, siglim0, siglim0c;
3596+ IssmDouble PDup, pddsig, PDCUT = 2.0; // PDcut: rain/snow cutoff temperature (C)
3597+ IssmDouble DT = 0.02;
3598+ IssmDouble pddt, pd; // pd: snow/precip fraction, precipitation falling as snow
3599
3600- double q, qmpt; // q is desert/elev. fact, hnpfac is huybrect fact, and pd is normal dist.
3601- double qm[NUMVERTICES] = {0}; // snow part of the precipitation
3602- double qmt[NUMVERTICES] = {0}; // precipitation without desertification effect adjustment
3603- double qmp[NUMVERTICES] = {0}; // desertification taken into account
3604- double pdd[NUMVERTICES] = {0};
3605- double frzndd[NUMVERTICES] = {0};
3606+ IssmDouble q, qmpt; // q is desert/elev. fact, hnpfac is huybrect fact, and pd is normal dist.
3607+ IssmDouble qm[NUMVERTICES] = {0}; // snow part of the precipitation
3608+ IssmDouble qmt[NUMVERTICES] = {0}; // precipitation without desertification effect adjustment
3609+ IssmDouble qmp[NUMVERTICES] = {0}; // desertification taken into account
3610+ IssmDouble pdd[NUMVERTICES] = {0};
3611+ IssmDouble frzndd[NUMVERTICES] = {0};
3612
3613- double tstar; // monthly mean surface temp
3614- double Tsum[NUMVERTICES]= {0}; // average summer (JJA) temperature
3615- double Tsurf[NUMVERTICES] = {0}; // average annual temperature
3616+ IssmDouble tstar; // monthly mean surface temp
3617+ IssmDouble Tsum[NUMVERTICES]= {0}; // average summer (JJA) temperature
3618+ IssmDouble Tsurf[NUMVERTICES] = {0}; // average annual temperature
3619
3620- double h[NUMVERTICES],s[NUMVERTICES],ttmp[NUMVERTICES],prectmp[NUMVERTICES]; // ,b[NUMVERTICES]
3621- double t[NUMVERTICES][12],prec[NUMVERTICES][12];
3622- double deltm=1/12;
3623+ IssmDouble h[NUMVERTICES],s[NUMVERTICES],ttmp[NUMVERTICES],prectmp[NUMVERTICES]; // ,b[NUMVERTICES]
3624+ IssmDouble t[NUMVERTICES][12],prec[NUMVERTICES][12];
3625+ IssmDouble deltm=1/12;
3626 int ismon[12]={12,1,2,3,4,5,6,7,8,9,10,11};
3627
3628- double snwm; // snow that could have been melted in a year.
3629- double snwmf; // ablation factor for snow per positive degree day.
3630- double smf; // ablation factor for ice per pdd (Braithwaite 1995 from tarasov 2002).
3631+ IssmDouble snwm; // snow that could have been melted in a year.
3632+ IssmDouble snwmf; // ablation factor for snow per positive degree day.
3633+ IssmDouble smf; // ablation factor for ice per pdd (Braithwaite 1995 from tarasov 2002).
3634
3635- double dfrz=1.5, CovrLm=2009./3.35e+5, dCovrLm=dfrz*CovrLm; //m*J kg^-1 C^-1 /(J kg^-1)=m/C yr
3636- double supice,supcap,diffndd;
3637- double fsupT=0.5, fsupndd=0.5; // Tsurf mode factors for supice
3638- double pddtj[NUMVERTICES], hmx2;
3639+ IssmDouble dfrz=1.5, CovrLm=2009./3.35e+5, dCovrLm=dfrz*CovrLm; //m*J kg^-1 C^-1 /(J kg^-1)=m/C yr
3640+ IssmDouble supice,supcap,diffndd;
3641+ IssmDouble fsupT=0.5, fsupndd=0.5; // Tsurf mode factors for supice
3642+ IssmDouble pddtj[NUMVERTICES], hmx2;
3643
3644 /*Recover info at the vertices: */
3645 GetInputListOnVertices(&h[0],ThicknessEnum);
3646@@ -2480,9 +2480,9 @@
3647 void Penta::PotentialSheetUngrounding(Vector* potential_sheet_ungrounding){
3648
3649 int i;
3650- double h[NUMVERTICES],ba[NUMVERTICES];
3651- double bed_hydro;
3652- double rho_water,rho_ice,density;
3653+ IssmDouble h[NUMVERTICES],ba[NUMVERTICES];
3654+ IssmDouble bed_hydro;
3655+ IssmDouble rho_water,rho_ice,density;
3656 bool elementonshelf = false;
3657
3658 /*material parameters: */
3659@@ -2517,15 +2517,15 @@
3660 }
3661 /*}}}*/
3662 /*FUNCTION Penta::ReduceMatrixStokes {{{*/
3663-void Penta::ReduceMatrixStokes(double* Ke_reduced, double* Ke_temp){
3664+void Penta::ReduceMatrixStokes(IssmDouble* Ke_reduced, IssmDouble* Ke_temp){
3665
3666 int i,j;
3667- double Kii[24][24];
3668- double Kib[24][3];
3669- double Kbb[3][3];
3670- double Kbi[3][24];
3671- double Kbbinv[3][3];
3672- double Kright[24][24];
3673+ IssmDouble Kii[24][24];
3674+ IssmDouble Kib[24][3];
3675+ IssmDouble Kbb[3][3];
3676+ IssmDouble Kbi[3][24];
3677+ IssmDouble Kbbinv[3][3];
3678+ IssmDouble Kright[24][24];
3679
3680 /*Create the four matrices used for reduction */
3681 for(i=0;i<24;i++){
3682@@ -2559,15 +2559,15 @@
3683 }
3684 /*}}}*/
3685 /*FUNCTION Penta::ReduceVectorStokes {{{*/
3686-void Penta::ReduceVectorStokes(double* Pe_reduced, double* Ke_temp, double* Pe_temp){
3687+void Penta::ReduceVectorStokes(IssmDouble* Pe_reduced, IssmDouble* Ke_temp, IssmDouble* Pe_temp){
3688
3689 int i,j;
3690- double Pi[24];
3691- double Pb[3];
3692- double Kbb[3][3];
3693- double Kib[24][3];
3694- double Kbbinv[3][3];
3695- double Pright[24];
3696+ IssmDouble Pi[24];
3697+ IssmDouble Pb[3];
3698+ IssmDouble Kbb[3][3];
3699+ IssmDouble Kib[24][3];
3700+ IssmDouble Kbbinv[3][3];
3701+ IssmDouble Pright[24];
3702
3703 /*Create the four matrices used for reduction */
3704 for(i=0;i<24;i++) Pi[i]=*(Pe_temp+i);
3705@@ -2594,7 +2594,7 @@
3706 }
3707 /*}}}*/
3708 /*FUNCTION Penta::RequestedOutput{{{*/
3709-void Penta::RequestedOutput(int output_enum,int step,double time){
3710+void Penta::RequestedOutput(int output_enum,int step,IssmDouble time){
3711
3712 if(IsInput(output_enum)){
3713 /*just transfer this input to results, and we are done: */
3714@@ -2648,9 +2648,9 @@
3715 void Penta::ResetCoordinateSystem(void){
3716
3717 int approximation;
3718- double slopex[NUMVERTICES];
3719- double slopey[NUMVERTICES];
3720- double xz_plane[6];
3721+ IssmDouble slopex[NUMVERTICES];
3722+ IssmDouble slopey[NUMVERTICES];
3723+ IssmDouble xz_plane[6];
3724
3725 /*For Stokes only: we want the CS to be tangential to the bedrock*/
3726 inputs->GetInputValue(&approximation,ApproximationEnum);
3727@@ -2738,10 +2738,10 @@
3728 }
3729 /*}}}*/
3730 /*FUNCTION Penta::SurfaceArea {{{*/
3731-double Penta::SurfaceArea(void){
3732+IssmDouble Penta::SurfaceArea(void){
3733
3734 int approximation;
3735- double S;
3736+ IssmDouble S;
3737 Tria* tria=NULL;
3738
3739 /*retrieve inputs :*/
3740@@ -2775,12 +2775,12 @@
3741 }
3742 /*}}}*/
3743 /*FUNCTION Penta::SurfaceNormal {{{*/
3744-void Penta::SurfaceNormal(double* surface_normal, double xyz_list[3][3]){
3745+void Penta::SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]){
3746
3747 int i;
3748- double v13[3],v23[3];
3749- double normal[3];
3750- double normal_norm;
3751+ IssmDouble v13[3],v23[3];
3752+ IssmDouble normal[3];
3753+ IssmDouble normal_norm;
3754
3755 for (i=0;i<3;i++){
3756 v13[i]=xyz_list[0][i]-xyz_list[2][i];
3757@@ -2799,13 +2799,13 @@
3758 }
3759 /*}}}*/
3760 /*FUNCTION Penta::TimeAdapt{{{*/
3761-double Penta::TimeAdapt(void){
3762+IssmDouble Penta::TimeAdapt(void){
3763
3764 int i;
3765- double C,dx,dy,dz,dt;
3766- double maxabsvx,maxabsvy,maxabsvz;
3767- double maxx,minx,maxy,miny,maxz,minz;
3768- double xyz_list[NUMVERTICES][3];
3769+ IssmDouble C,dx,dy,dz,dt;
3770+ IssmDouble maxabsvx,maxabsvy,maxabsvz;
3771+ IssmDouble maxx,minx,maxy,miny,maxz,minz;
3772+ IssmDouble xyz_list[NUMVERTICES][3];
3773
3774 /*get CFL coefficient:*/
3775 this->parameters->FindParam(&C,TimesteppingCflCoefficientEnum);
3776@@ -2850,12 +2850,12 @@
3777 int penta_type;
3778 int penta_node_ids[6];
3779 int penta_vertex_ids[6];
3780- double nodeinputs[6];
3781- double yts;
3782+ IssmDouble nodeinputs[6];
3783+ IssmDouble yts;
3784 int stabilization;
3785 bool dakota_analysis;
3786 bool isstokes;
3787- double beta,heatcapacity,referencetemperature,meltingpoint,latentheat;
3788+ IssmDouble beta,heatcapacity,referencetemperature,meltingpoint,latentheat;
3789
3790 /*Fetch parameters: */
3791 iomodel->Constant(&yts,ConstantsYtsEnum);
3792@@ -2997,7 +2997,7 @@
3793 }
3794 /*}}}*/
3795 /*FUNCTION Penta::UpdatePotentialSheetUngrounding{{{*/
3796-int Penta::UpdatePotentialSheetUngrounding(double* vertices_potentially_ungrounding,Vector* vec_nodes_on_iceshelf,double* nodes_on_iceshelf){
3797+int Penta::UpdatePotentialSheetUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf){
3798
3799 int i;
3800 int nflipped=0;
3801@@ -3024,12 +3024,12 @@
3802
3803 /*Intermediaries*/
3804 int iv;
3805- double phi;
3806- double viscosity;
3807- double xyz_list[NUMVERTICES][3];
3808- double epsilon[6];
3809- double viscousheating[NUMVERTICES]={0,0,0,0,0,0};
3810- double thickness;
3811+ IssmDouble phi;
3812+ IssmDouble viscosity;
3813+ IssmDouble xyz_list[NUMVERTICES][3];
3814+ IssmDouble epsilon[6];
3815+ IssmDouble viscousheating[NUMVERTICES]={0,0,0,0,0,0};
3816+ IssmDouble thickness;
3817 GaussPenta *gauss=NULL;
3818
3819 /*Initialize Element vector*/
3820@@ -3065,18 +3065,18 @@
3821 }
3822 /*}}}*/
3823 /*FUNCTION Penta::SmearFunction {{{*/
3824-void Penta::SmearFunction(Vector* smearedvector,double (*WeightFunction)(double distance,double radius),double radius){
3825+void Penta::SmearFunction(Vector* smearedvector,IssmDouble (*WeightFunction)(IssmDouble distance,IssmDouble radius),IssmDouble radius){
3826 _error_("not implemented yet");
3827 }
3828 /*}}}*/
3829
3830 #ifdef _HAVE_RESPONSES_
3831 /*FUNCTION Penta::IceVolume {{{*/
3832-double Penta::IceVolume(void){
3833+IssmDouble Penta::IceVolume(void){
3834
3835 /*The volume of a troncated prism is base * 1/3 sum(length of edges)*/
3836- double base,height;
3837- double xyz_list[NUMVERTICES][3];
3838+ IssmDouble base,height;
3839+ IssmDouble xyz_list[NUMVERTICES][3];
3840
3841 if(IsOnWater())return 0;
3842
3843@@ -3095,10 +3095,10 @@
3844 }
3845 /*}}}*/
3846 /*FUNCTION Penta::MinVel{{{*/
3847-void Penta::MinVel(double* pminvel, bool process_units){
3848+void Penta::MinVel(IssmDouble* pminvel, bool process_units){
3849
3850 /*Get minimum:*/
3851- double minvel=this->inputs->Min(VelEnum);
3852+ IssmDouble minvel=this->inputs->Min(VelEnum);
3853
3854 /*process units if requested: */
3855 if(process_units) minvel=UnitConversion(minvel,IuToExtEnum,VelEnum);
3856@@ -3108,10 +3108,10 @@
3857 }
3858 /*}}}*/
3859 /*FUNCTION Penta::MinVx{{{*/
3860-void Penta::MinVx(double* pminvx, bool process_units){
3861+void Penta::MinVx(IssmDouble* pminvx, bool process_units){
3862
3863 /*Get minimum:*/
3864- double minvx=this->inputs->Min(VxEnum);
3865+ IssmDouble minvx=this->inputs->Min(VxEnum);
3866
3867 /*process units if requested: */
3868 if(process_units) minvx=UnitConversion(minvx,IuToExtEnum,VxEnum);
3869@@ -3121,10 +3121,10 @@
3870 }
3871 /*}}}*/
3872 /*FUNCTION Penta::MinVy{{{*/
3873-void Penta::MinVy(double* pminvy, bool process_units){
3874+void Penta::MinVy(IssmDouble* pminvy, bool process_units){
3875
3876 /*Get minimum:*/
3877- double minvy=this->inputs->Min(VyEnum);
3878+ IssmDouble minvy=this->inputs->Min(VyEnum);
3879
3880 /*process units if requested: */
3881 if(process_units) minvy=UnitConversion(minvy,IuToExtEnum,VyEnum);
3882@@ -3134,10 +3134,10 @@
3883 }
3884 /*}}}*/
3885 /*FUNCTION Penta::MinVz{{{*/
3886-void Penta::MinVz(double* pminvz, bool process_units){
3887+void Penta::MinVz(IssmDouble* pminvz, bool process_units){
3888
3889 /*Get minimum:*/
3890- double minvz=this->inputs->Min(VzEnum);
3891+ IssmDouble minvz=this->inputs->Min(VzEnum);
3892
3893 /*process units if requested: */
3894 if(process_units) minvz=UnitConversion(minvz,IuToExtEnum,VzEnum);
3895@@ -3147,9 +3147,9 @@
3896 }
3897 /*}}}*/
3898 /*FUNCTION Penta::MassFlux {{{*/
3899-double Penta::MassFlux( double* segment,bool process_units){
3900+IssmDouble Penta::MassFlux( IssmDouble* segment,bool process_units){
3901
3902- double mass_flux=0;
3903+ IssmDouble mass_flux=0;
3904
3905 if(!IsOnBed()) return mass_flux;
3906
3907@@ -3171,10 +3171,10 @@
3908 }
3909 /*}}}*/
3910 /*FUNCTION Penta::MaxAbsVx{{{*/
3911-void Penta::MaxAbsVx(double* pmaxabsvx, bool process_units){
3912+void Penta::MaxAbsVx(IssmDouble* pmaxabsvx, bool process_units){
3913
3914 /*Get maximum:*/
3915- double maxabsvx=this->inputs->MaxAbs(VxEnum);
3916+ IssmDouble maxabsvx=this->inputs->MaxAbs(VxEnum);
3917
3918 /*process units if requested: */
3919 if(process_units) maxabsvx=UnitConversion(maxabsvx,IuToExtEnum,VxEnum);
3920@@ -3184,10 +3184,10 @@
3921 }
3922 /*}}}*/
3923 /*FUNCTION Penta::MaxAbsVy{{{*/
3924-void Penta::MaxAbsVy(double* pmaxabsvy, bool process_units){
3925+void Penta::MaxAbsVy(IssmDouble* pmaxabsvy, bool process_units){
3926
3927 /*Get maximum:*/
3928- double maxabsvy=this->inputs->MaxAbs(VyEnum);
3929+ IssmDouble maxabsvy=this->inputs->MaxAbs(VyEnum);
3930
3931 /*process units if requested: */
3932 if(process_units) maxabsvy=UnitConversion(maxabsvy,IuToExtEnum,VyEnum);
3933@@ -3197,10 +3197,10 @@
3934 }
3935 /*}}}*/
3936 /*FUNCTION Penta::MaxAbsVz{{{*/
3937-void Penta::MaxAbsVz(double* pmaxabsvz, bool process_units){
3938+void Penta::MaxAbsVz(IssmDouble* pmaxabsvz, bool process_units){
3939
3940 /*Get maximum:*/
3941- double maxabsvz=this->inputs->MaxAbs(VzEnum);
3942+ IssmDouble maxabsvz=this->inputs->MaxAbs(VzEnum);
3943
3944 /*process units if requested: */
3945 if(process_units) maxabsvz=UnitConversion(maxabsvz,IuToExtEnum,VyEnum);
3946@@ -3210,10 +3210,10 @@
3947 }
3948 /*}}}*/
3949 /*FUNCTION Penta::MaxVel{{{*/
3950-void Penta::MaxVel(double* pmaxvel, bool process_units){
3951+void Penta::MaxVel(IssmDouble* pmaxvel, bool process_units){
3952
3953 /*Get maximum:*/
3954- double maxvel=this->inputs->Max(VelEnum);
3955+ IssmDouble maxvel=this->inputs->Max(VelEnum);
3956
3957 /*process units if requested: */
3958 if(process_units) maxvel=UnitConversion(maxvel,IuToExtEnum,VelEnum);
3959@@ -3224,10 +3224,10 @@
3960 }
3961 /*}}}*/
3962 /*FUNCTION Penta::MaxVx{{{*/
3963-void Penta::MaxVx(double* pmaxvx, bool process_units){
3964+void Penta::MaxVx(IssmDouble* pmaxvx, bool process_units){
3965
3966 /*Get maximum:*/
3967- double maxvx=this->inputs->Max(VxEnum);
3968+ IssmDouble maxvx=this->inputs->Max(VxEnum);
3969
3970 /*process units if requested: */
3971 if(process_units) maxvx=UnitConversion(maxvx,IuToExtEnum,VxEnum);
3972@@ -3237,10 +3237,10 @@
3973 }
3974 /*}}}*/
3975 /*FUNCTION Penta::MaxVy{{{*/
3976-void Penta::MaxVy(double* pmaxvy, bool process_units){
3977+void Penta::MaxVy(IssmDouble* pmaxvy, bool process_units){
3978
3979 /*Get maximum:*/
3980- double maxvy=this->inputs->Max(VyEnum);
3981+ IssmDouble maxvy=this->inputs->Max(VyEnum);
3982
3983 /*process units if requested: */
3984 if(process_units) maxvy=UnitConversion(maxvy,IuToExtEnum,VyEnum);
3985@@ -3250,10 +3250,10 @@
3986 }
3987 /*}}}*/
3988 /*FUNCTION Penta::MaxVz{{{*/
3989-void Penta::MaxVz(double* pmaxvz, bool process_units){
3990+void Penta::MaxVz(IssmDouble* pmaxvz, bool process_units){
3991
3992 /*Get maximum:*/
3993- double maxvz=this->inputs->Max(VzEnum);
3994+ IssmDouble maxvz=this->inputs->Max(VzEnum);
3995
3996 /*process units if requested: */
3997 if(process_units) maxvz=UnitConversion(maxvz,IuToExtEnum,VzEnum);
3998@@ -3263,7 +3263,7 @@
3999 }
4000 /*}}}*/
4001 /*FUNCTION Penta::ElementResponse{{{*/
4002-void Penta::ElementResponse(double* presponse,int response_enum,bool process_units){
4003+void Penta::ElementResponse(IssmDouble* presponse,int response_enum,bool process_units){
4004
4005 switch(response_enum){
4006 case MaterialsRheologyBbarEnum:
4007@@ -3272,7 +3272,7 @@
4008 case VelEnum:
4009
4010 /*Get input:*/
4011- double vel;
4012+ IssmDouble vel;
4013 Input* vel_input;
4014
4015 vel_input=this->inputs->GetInput(VelEnum); _assert_(vel_input);
4016@@ -3315,24 +3315,24 @@
4017 /*Intermediaries */
4018 int stabilization;
4019 int i,j,ig,found=0;
4020- double Jdet,u,v,w,um,vm,wm;
4021- double h,hx,hy,hz,vx,vy,vz,vel;
4022- double gravity,rho_ice,rho_water;
4023- double epsvel=2.220446049250313e-16;
4024- double heatcapacity,thermalconductivity,dt;
4025- double pressure,enthalpy;
4026- double latentheat,kappa;
4027- double tau_parameter,diameter;
4028- double xyz_list[NUMVERTICES][3];
4029- double B_conduct[3][numdof];
4030- double B_advec[3][numdof];
4031- double Bprime_advec[3][numdof];
4032- double L[numdof];
4033- double dbasis[3][6];
4034- double D_scalar_conduct,D_scalar_advec;
4035- double D_scalar_trans,D_scalar_stab;
4036- double D[3][3];
4037- double K[3][3]={0.0};
4038+ IssmDouble Jdet,u,v,w,um,vm,wm;
4039+ IssmDouble h,hx,hy,hz,vx,vy,vz,vel;
4040+ IssmDouble gravity,rho_ice,rho_water;
4041+ IssmDouble epsvel=2.220446049250313e-16;
4042+ IssmDouble heatcapacity,thermalconductivity,dt;
4043+ IssmDouble pressure,enthalpy;
4044+ IssmDouble latentheat,kappa;
4045+ IssmDouble tau_parameter,diameter;
4046+ IssmDouble xyz_list[NUMVERTICES][3];
4047+ IssmDouble B_conduct[3][numdof];
4048+ IssmDouble B_advec[3][numdof];
4049+ IssmDouble Bprime_advec[3][numdof];
4050+ IssmDouble L[numdof];
4051+ IssmDouble dbasis[3][6];
4052+ IssmDouble D_scalar_conduct,D_scalar_advec;
4053+ IssmDouble D_scalar_trans,D_scalar_stab;
4054+ IssmDouble D[3][3];
4055+ IssmDouble K[3][3]={0.0};
4056 Tria* tria=NULL;
4057 GaussPenta *gauss=NULL;
4058
4059@@ -3471,13 +3471,13 @@
4060
4061 /*Intermediaries */
4062 int i,j,ig;
4063- double mixed_layer_capacity,thermal_exchange_velocity;
4064- double rho_ice,rho_water,heatcapacity;
4065- double Jdet2d,dt;
4066- double xyz_list[NUMVERTICES][3];
4067- double xyz_list_tria[NUMVERTICES2D][3];
4068- double basis[NUMVERTICES];
4069- double D_scalar;
4070+ IssmDouble mixed_layer_capacity,thermal_exchange_velocity;
4071+ IssmDouble rho_ice,rho_water,heatcapacity;
4072+ IssmDouble Jdet2d,dt;
4073+ IssmDouble xyz_list[NUMVERTICES][3];
4074+ IssmDouble xyz_list_tria[NUMVERTICES2D][3];
4075+ IssmDouble basis[NUMVERTICES];
4076+ IssmDouble D_scalar;
4077 GaussPenta *gauss=NULL;
4078
4079 /*Initialize Element matrix and return if necessary*/
4080@@ -3552,21 +3552,21 @@
4081 /*Intermediaries */
4082 int stabilization;
4083 int i,j,ig,found=0;
4084- double Jdet,u,v,w,um,vm,wm,vel;
4085- double h,hx,hy,hz,vx,vy,vz;
4086- double gravity,rho_ice,rho_water,kappa;
4087- double heatcapacity,thermalconductivity,dt;
4088- double tau_parameter,diameter;
4089- double xyz_list[NUMVERTICES][3];
4090- double B_conduct[3][numdof];
4091- double B_advec[3][numdof];
4092- double Bprime_advec[3][numdof];
4093- double L[numdof];
4094- double dbasis[3][6];
4095- double D_scalar_conduct,D_scalar_advec;
4096- double D_scalar_trans,D_scalar_stab;
4097- double D[3][3];
4098- double K[3][3]={0.0};
4099+ IssmDouble Jdet,u,v,w,um,vm,wm,vel;
4100+ IssmDouble h,hx,hy,hz,vx,vy,vz;
4101+ IssmDouble gravity,rho_ice,rho_water,kappa;
4102+ IssmDouble heatcapacity,thermalconductivity,dt;
4103+ IssmDouble tau_parameter,diameter;
4104+ IssmDouble xyz_list[NUMVERTICES][3];
4105+ IssmDouble B_conduct[3][numdof];
4106+ IssmDouble B_advec[3][numdof];
4107+ IssmDouble Bprime_advec[3][numdof];
4108+ IssmDouble L[numdof];
4109+ IssmDouble dbasis[3][6];
4110+ IssmDouble D_scalar_conduct,D_scalar_advec;
4111+ IssmDouble D_scalar_trans,D_scalar_stab;
4112+ IssmDouble D[3][3];
4113+ IssmDouble K[3][3]={0.0};
4114 Tria* tria=NULL;
4115 GaussPenta *gauss=NULL;
4116
4117@@ -3704,13 +3704,13 @@
4118
4119 /*Intermediaries */
4120 int i,j,ig;
4121- double mixed_layer_capacity,thermal_exchange_velocity;
4122- double rho_ice,rho_water,heatcapacity;
4123- double Jdet2d,dt;
4124- double xyz_list[NUMVERTICES][3];
4125- double xyz_list_tria[NUMVERTICES2D][3];
4126- double basis[NUMVERTICES];
4127- double D_scalar;
4128+ IssmDouble mixed_layer_capacity,thermal_exchange_velocity;
4129+ IssmDouble rho_ice,rho_water,heatcapacity;
4130+ IssmDouble Jdet2d,dt;
4131+ IssmDouble xyz_list[NUMVERTICES][3];
4132+ IssmDouble xyz_list_tria[NUMVERTICES2D][3];
4133+ IssmDouble basis[NUMVERTICES];
4134+ IssmDouble D_scalar;
4135 GaussPenta *gauss=NULL;
4136
4137 /*Initialize Element matrix and return if necessary*/
4138@@ -3775,19 +3775,19 @@
4139 /*Intermediaries*/
4140 int i,j,ig,found=0;
4141 int friction_type,stabilization;
4142- double Jdet,phi,dt;
4143- double rho_ice,heatcapacity;
4144- double thermalconductivity,kappa;
4145- double viscosity,pressure;
4146- double enthalpy,enthalpypicard;
4147- double tau_parameter,diameter;
4148- double u,v,w;
4149- double scalar_def,scalar_transient;
4150- double temperature_list[NUMVERTICES];
4151- double xyz_list[NUMVERTICES][3];
4152- double L[numdof];
4153- double dbasis[3][6];
4154- double epsilon[6];
4155+ IssmDouble Jdet,phi,dt;
4156+ IssmDouble rho_ice,heatcapacity;
4157+ IssmDouble thermalconductivity,kappa;
4158+ IssmDouble viscosity,pressure;
4159+ IssmDouble enthalpy,enthalpypicard;
4160+ IssmDouble tau_parameter,diameter;
4161+ IssmDouble u,v,w;
4162+ IssmDouble scalar_def,scalar_transient;
4163+ IssmDouble temperature_list[NUMVERTICES];
4164+ IssmDouble xyz_list[NUMVERTICES][3];
4165+ IssmDouble L[numdof];
4166+ IssmDouble dbasis[3][6];
4167+ IssmDouble epsilon[6];
4168 GaussPenta *gauss=NULL;
4169
4170 /*Initialize Element vector*/
4171@@ -3870,13 +3870,13 @@
4172
4173 /*Intermediaries */
4174 int i,j,ig;
4175- double Jdet2d;
4176- double heatcapacity,h_pmp;
4177- double mixed_layer_capacity,thermal_exchange_velocity;
4178- double rho_ice,rho_water,pressure,dt,scalar_ocean;
4179- double xyz_list[NUMVERTICES][3];
4180- double xyz_list_tria[NUMVERTICES2D][3];
4181- double basis[NUMVERTICES];
4182+ IssmDouble Jdet2d;
4183+ IssmDouble heatcapacity,h_pmp;
4184+ IssmDouble mixed_layer_capacity,thermal_exchange_velocity;
4185+ IssmDouble rho_ice,rho_water,pressure,dt,scalar_ocean;
4186+ IssmDouble xyz_list[NUMVERTICES][3];
4187+ IssmDouble xyz_list_tria[NUMVERTICES2D][3];
4188+ IssmDouble basis[NUMVERTICES];
4189 GaussPenta* gauss=NULL;
4190
4191 /* Ice/ocean heat exchange flux on ice shelf base */
4192@@ -3928,14 +3928,14 @@
4193 /*Intermediaries */
4194 int i,j,ig;
4195 int analysis_type;
4196- double xyz_list[NUMVERTICES][3];
4197- double xyz_list_tria[NUMVERTICES2D][3]={0.0};
4198- double Jdet2d,dt;
4199- double rho_ice,heatcapacity,geothermalflux_value;
4200- double basalfriction,alpha2,vx,vy;
4201- double scalar,enthalpy,enthalpyup;
4202- double pressure,pressureup;
4203- double basis[NUMVERTICES];
4204+ IssmDouble xyz_list[NUMVERTICES][3];
4205+ IssmDouble xyz_list_tria[NUMVERTICES2D][3]={0.0};
4206+ IssmDouble Jdet2d,dt;
4207+ IssmDouble rho_ice,heatcapacity,geothermalflux_value;
4208+ IssmDouble basalfriction,alpha2,vx,vy;
4209+ IssmDouble scalar,enthalpy,enthalpyup;
4210+ IssmDouble pressure,pressureup;
4211+ IssmDouble basis[NUMVERTICES];
4212 Friction* friction=NULL;
4213 GaussPenta* gauss=NULL;
4214 GaussPenta* gaussup=NULL;
4215@@ -4038,18 +4038,18 @@
4216 /*Intermediaries*/
4217 int i,j,ig,found=0;
4218 int friction_type,stabilization;
4219- double Jdet,phi,dt;
4220- double rho_ice,heatcapacity;
4221- double thermalconductivity,kappa;
4222- double viscosity,temperature;
4223- double tau_parameter,diameter;
4224- double u,v,w;
4225- double scalar_def,scalar_transient;
4226- double temperature_list[NUMVERTICES];
4227- double xyz_list[NUMVERTICES][3];
4228- double L[numdof];
4229- double dbasis[3][6];
4230- double epsilon[6];
4231+ IssmDouble Jdet,phi,dt;
4232+ IssmDouble rho_ice,heatcapacity;
4233+ IssmDouble thermalconductivity,kappa;
4234+ IssmDouble viscosity,temperature;
4235+ IssmDouble tau_parameter,diameter;
4236+ IssmDouble u,v,w;
4237+ IssmDouble scalar_def,scalar_transient;
4238+ IssmDouble temperature_list[NUMVERTICES];
4239+ IssmDouble xyz_list[NUMVERTICES][3];
4240+ IssmDouble L[numdof];
4241+ IssmDouble dbasis[3][6];
4242+ IssmDouble epsilon[6];
4243 GaussPenta *gauss=NULL;
4244
4245 /*Initialize Element vector*/
4246@@ -4124,13 +4124,13 @@
4247
4248 /*Intermediaries */
4249 int i,j,ig;
4250- double Jdet2d;
4251- double mixed_layer_capacity,thermal_exchange_velocity;
4252- double rho_ice,rho_water,pressure,dt,scalar_ocean;
4253- double heatcapacity,t_pmp;
4254- double xyz_list[NUMVERTICES][3];
4255- double xyz_list_tria[NUMVERTICES2D][3];
4256- double basis[NUMVERTICES];
4257+ IssmDouble Jdet2d;
4258+ IssmDouble mixed_layer_capacity,thermal_exchange_velocity;
4259+ IssmDouble rho_ice,rho_water,pressure,dt,scalar_ocean;
4260+ IssmDouble heatcapacity,t_pmp;
4261+ IssmDouble xyz_list[NUMVERTICES][3];
4262+ IssmDouble xyz_list_tria[NUMVERTICES2D][3];
4263+ IssmDouble basis[NUMVERTICES];
4264 GaussPenta* gauss=NULL;
4265
4266 /* Ice/ocean heat exchange flux on ice shelf base */
4267@@ -4182,13 +4182,13 @@
4268 /*Intermediaries */
4269 int i,j,ig;
4270 int analysis_type;
4271- double xyz_list[NUMVERTICES][3];
4272- double xyz_list_tria[NUMVERTICES2D][3]={0.0};
4273- double Jdet2d,dt;
4274- double rho_ice,heatcapacity,geothermalflux_value;
4275- double basalfriction,alpha2,vx,vy;
4276- double basis[NUMVERTICES];
4277- double scalar;
4278+ IssmDouble xyz_list[NUMVERTICES][3];
4279+ IssmDouble xyz_list_tria[NUMVERTICES2D][3]={0.0};
4280+ IssmDouble Jdet2d,dt;
4281+ IssmDouble rho_ice,heatcapacity,geothermalflux_value;
4282+ IssmDouble basalfriction,alpha2,vx,vy;
4283+ IssmDouble basis[NUMVERTICES];
4284+ IssmDouble scalar;
4285 Friction* friction=NULL;
4286 GaussPenta* gauss=NULL;
4287
4288@@ -4247,8 +4247,8 @@
4289
4290 int i;
4291 int* doflist=NULL;
4292- double values[numdof];
4293- double temp;
4294+ IssmDouble values[numdof];
4295+ IssmDouble temp;
4296 GaussPenta *gauss=NULL;
4297
4298 /*Get dof list: */
4299@@ -4278,8 +4278,8 @@
4300
4301 int i;
4302 int* doflist=NULL;
4303- double values[numdof];
4304- double enthalpy;
4305+ IssmDouble values[numdof];
4306+ IssmDouble enthalpy;
4307 GaussPenta *gauss=NULL;
4308
4309 /*Get dof list: */
4310@@ -4303,18 +4303,18 @@
4311 }
4312 /*}}}*/
4313 /*FUNCTION Penta::InputUpdateFromSolutionThermal {{{*/
4314-void Penta::InputUpdateFromSolutionThermal(double* solution){
4315+void Penta::InputUpdateFromSolutionThermal(IssmDouble* solution){
4316
4317 const int numdof=NDOF1*NUMVERTICES;
4318
4319 bool converged;
4320 int i,rheology_law;
4321- double xyz_list[NUMVERTICES][3];
4322- double values[numdof];
4323- double B[numdof];
4324- double B_average,s_average;
4325+ IssmDouble xyz_list[NUMVERTICES][3];
4326+ IssmDouble values[numdof];
4327+ IssmDouble B[numdof];
4328+ IssmDouble B_average,s_average;
4329 int* doflist=NULL;
4330- //double pressure[numdof];
4331+ //IssmDouble pressure[numdof];
4332
4333 /*Get dof list: */
4334 GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
4335@@ -4374,19 +4374,19 @@
4336 }
4337 /*}}}*/
4338 /*FUNCTION Penta::InputUpdateFromSolutionEnthalpy {{{*/
4339-void Penta::InputUpdateFromSolutionEnthalpy(double* solution){
4340+void Penta::InputUpdateFromSolutionEnthalpy(IssmDouble* solution){
4341
4342 const int numdof=NDOF1*NUMVERTICES;
4343
4344 bool converged=false;
4345 int i,rheology_law;
4346- double xyz_list[NUMVERTICES][3];
4347- double values[numdof];
4348- double pressure[NUMVERTICES];
4349- double temperatures[numdof];
4350- double waterfraction[numdof];
4351- double B[numdof];
4352- double B_average,s_average;
4353+ IssmDouble xyz_list[NUMVERTICES][3];
4354+ IssmDouble values[numdof];
4355+ IssmDouble pressure[NUMVERTICES];
4356+ IssmDouble temperatures[numdof];
4357+ IssmDouble waterfraction[numdof];
4358+ IssmDouble B[numdof];
4359+ IssmDouble B_average,s_average;
4360 int* doflist=NULL;
4361
4362 /*Get dof list: */
4363@@ -4475,7 +4475,7 @@
4364
4365 }/*}}}*/
4366 /*FUNCTION Penta::ControlInputScaleGradient{{{*/
4367-void Penta::ControlInputScaleGradient(int enum_type,double scale){
4368+void Penta::ControlInputScaleGradient(int enum_type,IssmDouble scale){
4369
4370 Input* input=NULL;
4371
4372@@ -4491,10 +4491,10 @@
4373 ((ControlInput*)input)->ScaleGradient(scale);
4374 }/*}}}*/
4375 /*FUNCTION Penta::ControlInputSetGradient{{{*/
4376-void Penta::ControlInputSetGradient(double* gradient,int enum_type,int control_index){
4377+void Penta::ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index){
4378
4379 int doflist1[NUMVERTICES];
4380- double grad_list[NUMVERTICES];
4381+ IssmDouble grad_list[NUMVERTICES];
4382 Input* grad_input=NULL;
4383 Input* input=NULL;
4384
4385@@ -4565,15 +4565,15 @@
4386 /*Intermediaries */
4387 int i,j,ig;
4388 bool incomplete_adjoint;
4389- double xyz_list[NUMVERTICES][3];
4390- double Jdet;
4391- double eps1dotdphii,eps1dotdphij;
4392- double eps2dotdphii,eps2dotdphij;
4393- double mu_prime;
4394- double epsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
4395- double eps1[3],eps2[3];
4396- double phi[NUMVERTICES];
4397- double dphi[3][NUMVERTICES];
4398+ IssmDouble xyz_list[NUMVERTICES][3];
4399+ IssmDouble Jdet;
4400+ IssmDouble eps1dotdphii,eps1dotdphij;
4401+ IssmDouble eps2dotdphii,eps2dotdphij;
4402+ IssmDouble mu_prime;
4403+ IssmDouble epsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
4404+ IssmDouble eps1[3],eps2[3];
4405+ IssmDouble phi[NUMVERTICES];
4406+ IssmDouble dphi[3][NUMVERTICES];
4407 GaussPenta *gauss=NULL;
4408
4409 /*Initialize Jacobian with regular Pattyn (first part of the Gateau derivative)*/
4410@@ -4633,16 +4633,16 @@
4411 /*Intermediaries */
4412 int i,j,ig;
4413 bool incomplete_adjoint;
4414- double xyz_list[NUMVERTICES][3];
4415- double Jdet;
4416- double eps1dotdphii,eps1dotdphij;
4417- double eps2dotdphii,eps2dotdphij;
4418- double eps3dotdphii,eps3dotdphij;
4419- double mu_prime;
4420- double epsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
4421- double eps1[3],eps2[3],eps3[3];
4422- double phi[NUMVERTICES];
4423- double dphi[3][NUMVERTICES];
4424+ IssmDouble xyz_list[NUMVERTICES][3];
4425+ IssmDouble Jdet;
4426+ IssmDouble eps1dotdphii,eps1dotdphij;
4427+ IssmDouble eps2dotdphii,eps2dotdphij;
4428+ IssmDouble eps3dotdphii,eps3dotdphij;
4429+ IssmDouble mu_prime;
4430+ IssmDouble epsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
4431+ IssmDouble eps1[3],eps2[3],eps3[3];
4432+ IssmDouble phi[NUMVERTICES];
4433+ IssmDouble dphi[3][NUMVERTICES];
4434 GaussPenta *gauss=NULL;
4435
4436 /*Initialize Jacobian with regular Stokes (first part of the Gateau derivative)*/
4437@@ -4888,14 +4888,14 @@
4438 int i,j,ig;
4439 int analysis_type;
4440 int doflist1[NUMVERTICES];
4441- double vx,vy,lambda,mu,alpha_complement,Jdet;
4442- double bed,thickness,Neff,drag;
4443- double xyz_list[NUMVERTICES][3];
4444- double xyz_list_tria[NUMVERTICES2D][3]={0.0};
4445- double dk[NDOF3];
4446- double grade_g[NUMVERTICES]={0.0};
4447- double grade_g_gaussian[NUMVERTICES];
4448- double basis[6];
4449+ IssmDouble vx,vy,lambda,mu,alpha_complement,Jdet;
4450+ IssmDouble bed,thickness,Neff,drag;
4451+ IssmDouble xyz_list[NUMVERTICES][3];
4452+ IssmDouble xyz_list_tria[NUMVERTICES2D][3]={0.0};
4453+ IssmDouble dk[NDOF3];
4454+ IssmDouble grade_g[NUMVERTICES]={0.0};
4455+ IssmDouble grade_g_gaussian[NUMVERTICES];
4456+ IssmDouble basis[6];
4457 Friction* friction=NULL;
4458 GaussPenta *gauss=NULL;
4459
4460@@ -4959,16 +4959,16 @@
4461 int i,j,ig;
4462 int analysis_type;
4463 int doflist1[NUMVERTICES];
4464- double bed,thickness,Neff;
4465- double lambda,mu,xi,Jdet,vx,vy,vz;
4466- double alpha_complement,drag;
4467- double surface_normal[3],bed_normal[3];
4468- double xyz_list[NUMVERTICES][3];
4469- double xyz_list_tria[NUMVERTICES2D][3]={0.0};
4470- double dk[NDOF3];
4471- double basis[6];
4472- double grade_g[NUMVERTICES]={0.0};
4473- double grade_g_gaussian[NUMVERTICES];
4474+ IssmDouble bed,thickness,Neff;
4475+ IssmDouble lambda,mu,xi,Jdet,vx,vy,vz;
4476+ IssmDouble alpha_complement,drag;
4477+ IssmDouble surface_normal[3],bed_normal[3];
4478+ IssmDouble xyz_list[NUMVERTICES][3];
4479+ IssmDouble xyz_list_tria[NUMVERTICES2D][3]={0.0};
4480+ IssmDouble dk[NDOF3];
4481+ IssmDouble basis[6];
4482+ IssmDouble grade_g[NUMVERTICES]={0.0};
4483+ IssmDouble grade_g_gaussian[NUMVERTICES];
4484 Friction* friction=NULL;
4485 GaussPenta* gauss=NULL;
4486
4487@@ -5098,7 +5098,7 @@
4488 this->matice->inputs->DeleteInput(MaterialsRheologyBbarEnum);
4489 } /*}}}*/
4490 /*FUNCTION Penta::InputControlUpdate{{{*/
4491-void Penta::InputControlUpdate(double scalar,bool save_parameter){
4492+void Penta::InputControlUpdate(IssmDouble scalar,bool save_parameter){
4493
4494 /*Intermediary*/
4495 int num_controls;
4496@@ -5136,16 +5136,16 @@
4497 }
4498 /*}}}*/
4499 /*FUNCTION Penta::InputUpdateFromSolutionAdjointStokes {{{*/
4500-void Penta::InputUpdateFromSolutionAdjointStokes(double* solution){
4501+void Penta::InputUpdateFromSolutionAdjointStokes(IssmDouble* solution){
4502
4503 const int numdof=NDOF4*NUMVERTICES;
4504
4505 int i;
4506- double values[numdof];
4507- double lambdax[NUMVERTICES];
4508- double lambday[NUMVERTICES];
4509- double lambdaz[NUMVERTICES];
4510- double lambdap[NUMVERTICES];
4511+ IssmDouble values[numdof];
4512+ IssmDouble lambdax[NUMVERTICES];
4513+ IssmDouble lambday[NUMVERTICES];
4514+ IssmDouble lambdaz[NUMVERTICES];
4515+ IssmDouble lambdap[NUMVERTICES];
4516 int* doflist=NULL;
4517
4518 /*Get dof list: */
4519@@ -5179,14 +5179,14 @@
4520 }
4521 /*}}}*/
4522 /*FUNCTION Penta::InputUpdateFromSolutionAdjointHoriz {{{*/
4523-void Penta::InputUpdateFromSolutionAdjointHoriz(double* solution){
4524+void Penta::InputUpdateFromSolutionAdjointHoriz(IssmDouble* solution){
4525
4526 const int numdof=NDOF2*NUMVERTICES;
4527
4528 int i;
4529- double values[numdof];
4530- double lambdax[NUMVERTICES];
4531- double lambday[NUMVERTICES];
4532+ IssmDouble values[numdof];
4533+ IssmDouble lambdax[NUMVERTICES];
4534+ IssmDouble lambday[NUMVERTICES];
4535 int* doflist=NULL;
4536
4537 /*Get dof list: */
4538@@ -5214,10 +5214,10 @@
4539 }
4540 /*}}}*/
4541 /*FUNCTION Penta::SurfaceAverageVelMisfit {{{*/
4542-double Penta::SurfaceAverageVelMisfit(bool process_units,int weight_index){
4543+IssmDouble Penta::SurfaceAverageVelMisfit(bool process_units,int weight_index){
4544
4545 int approximation;
4546- double J;
4547+ IssmDouble J;
4548 Tria* tria=NULL;
4549
4550 /*retrieve inputs :*/
4551@@ -5251,10 +5251,10 @@
4552 }
4553 /*}}}*/
4554 /*FUNCTION Penta::SurfaceAbsVelMisfit {{{*/
4555-double Penta::SurfaceAbsVelMisfit(bool process_units,int weight_index){
4556+IssmDouble Penta::SurfaceAbsVelMisfit(bool process_units,int weight_index){
4557
4558 int approximation;
4559- double J;
4560+ IssmDouble J;
4561 Tria* tria=NULL;
4562
4563 /*retrieve inputs :*/
4564@@ -5288,10 +5288,10 @@
4565 }
4566 /*}}}*/
4567 /*FUNCTION Penta::SurfaceLogVelMisfit {{{*/
4568-double Penta::SurfaceLogVelMisfit(bool process_units,int weight_index){
4569+IssmDouble Penta::SurfaceLogVelMisfit(bool process_units,int weight_index){
4570
4571 int approximation;
4572- double J;
4573+ IssmDouble J;
4574 Tria* tria=NULL;
4575
4576 /*retrieve inputs :*/
4577@@ -5325,9 +5325,9 @@
4578 }
4579 /*}}}*/
4580 /*FUNCTION Penta::SurfaceLogVxVyMisfit {{{*/
4581-double Penta::SurfaceLogVxVyMisfit(bool process_units,int weight_index){
4582+IssmDouble Penta::SurfaceLogVxVyMisfit(bool process_units,int weight_index){
4583
4584- double J;
4585+ IssmDouble J;
4586 Tria* tria=NULL;
4587
4588 /*inputs: */
4589@@ -5364,10 +5364,10 @@
4590 }
4591 /*}}}*/
4592 /*FUNCTION Penta::SurfaceRelVelMisfit {{{*/
4593-double Penta::SurfaceRelVelMisfit(bool process_units,int weight_index){
4594+IssmDouble Penta::SurfaceRelVelMisfit(bool process_units,int weight_index){
4595
4596 int approximation;
4597- double J;
4598+ IssmDouble J;
4599 Tria* tria=NULL;
4600
4601 /*retrieve inputs :*/
4602@@ -5401,16 +5401,16 @@
4603 }
4604 /*}}}*/
4605 /*FUNCTION Penta::ThicknessAbsGradient{{{*/
4606-double Penta::ThicknessAbsGradient(bool process_units,int weight_index){
4607+IssmDouble Penta::ThicknessAbsGradient(bool process_units,int weight_index){
4608
4609 _error_("Not implemented yet");
4610 }
4611 /*}}}*/
4612 /*FUNCTION Penta::ThicknessAbsMisfit {{{*/
4613-double Penta::ThicknessAbsMisfit(bool process_units,int weight_index){
4614+IssmDouble Penta::ThicknessAbsMisfit(bool process_units,int weight_index){
4615
4616 int approximation;
4617- double J;
4618+ IssmDouble J;
4619 Tria* tria=NULL;
4620
4621 /*retrieve inputs :*/
4622@@ -5427,9 +5427,9 @@
4623 }
4624 /*}}}*/
4625 /*FUNCTION Penta::DragCoefficientAbsGradient{{{*/
4626-double Penta::DragCoefficientAbsGradient(bool process_units,int weight_index){
4627+IssmDouble Penta::DragCoefficientAbsGradient(bool process_units,int weight_index){
4628
4629- double J;
4630+ IssmDouble J;
4631 Tria* tria=NULL;
4632
4633 /*If on water, on shelf or not on bed, skip: */
4634@@ -5442,9 +5442,9 @@
4635 }
4636 /*}}}*/
4637 /*FUNCTION Penta::RheologyBbarAbsGradient{{{*/
4638-double Penta::RheologyBbarAbsGradient(bool process_units,int weight_index){
4639+IssmDouble Penta::RheologyBbarAbsGradient(bool process_units,int weight_index){
4640
4641- double J;
4642+ IssmDouble J;
4643 Tria* tria=NULL;
4644
4645 /*If on water, on shelf or not on bed, skip: */
4646@@ -5480,9 +5480,9 @@
4647 }
4648 /*}}}*/
4649 /*FUNCTION Penta::SetControlInputsFromVector{{{*/
4650-void Penta::SetControlInputsFromVector(double* vector,int control_enum,int control_index){
4651+void Penta::SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index){
4652
4653- double values[NUMVERTICES];
4654+ IssmDouble values[NUMVERTICES];
4655 int doflist1[NUMVERTICES];
4656 Input *input = NULL;
4657 Input *new_input = NULL;
4658@@ -5517,8 +5517,8 @@
4659 #endif
4660
4661 #ifdef _HAVE_DAKOTA_
4662-/*FUNCTION Penta::InputUpdateFromVectorDakota(double* vector, int name, int type);{{{*/
4663-void Penta::InputUpdateFromVectorDakota(double* vector, int name, int type){
4664+/*FUNCTION Penta::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type);{{{*/
4665+void Penta::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){
4666
4667 int i,j;
4668
4669@@ -5530,7 +5530,7 @@
4670 case VertexEnum:
4671
4672 /*New PentaP1Input*/
4673- double values[6];
4674+ IssmDouble values[6];
4675
4676 /*Get values on the 6 vertices*/
4677 for (i=0;i<6;i++){
4678@@ -5541,11 +5541,11 @@
4679 switch(name){
4680 case ThicknessEnum:
4681 /*Update thickness + surface: assume bed is constant. On ice shelves, takes hydrostatic equilibrium {{{*/
4682- double thickness[6];
4683- double thickness_init[6];
4684- double hydrostatic_ratio[6];
4685- double surface[6];
4686- double bed[6];
4687+ IssmDouble thickness[6];
4688+ IssmDouble thickness_init[6];
4689+ IssmDouble hydrostatic_ratio[6];
4690+ IssmDouble surface[6];
4691+ IssmDouble bed[6];
4692
4693 /*retrieve inputs: */
4694 GetInputListOnVertices(&thickness_init[0],ThicknessEnum);
4695@@ -5559,7 +5559,7 @@
4696 /*build new bed and surface: */
4697 if (this->IsFloating()){
4698 /*hydrostatic equilibrium: */
4699- double rho_ice,rho_water,di;
4700+ IssmDouble rho_ice,rho_water,di;
4701 rho_ice=this->matpar->GetRhoIce();
4702 rho_water=this->matpar->GetRhoWater();
4703
4704@@ -5629,15 +5629,15 @@
4705 _error_(" not supported yet!");
4706 }
4707 /*}}}*/
4708-/*FUNCTION Penta::InputUpdateFromMatrixDakota(double* matrix, int nrows, int ncols, int name, int type);{{{*/
4709-void Penta::InputUpdateFromMatrixDakota(double* matrix, int nrows, int ncols, int name, int type){
4710+/*FUNCTION Penta::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type);{{{*/
4711+void Penta::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type){
4712
4713 int i,j,t;
4714 TransientInput* transientinput=NULL;
4715- double values[6];
4716- double time;
4717+ IssmDouble values[6];
4718+ IssmDouble time;
4719 int row;
4720- double yts;
4721+ IssmDouble yts;
4722
4723 /*Check that name is an element input*/
4724 if (!IsInput(name)) return;
4725@@ -5655,11 +5655,11 @@
4726 /*create input values: */
4727 for(i=0;i<6;i++){
4728 row=this->nodes[i]->GetSidList();
4729- values[i]=(double)matrix[ncols*row+t];
4730+ values[i]=(IssmDouble)matrix[ncols*row+t];
4731 }
4732
4733 /*time? :*/
4734- time=(double)matrix[(nrows-1)*ncols+t]*yts;
4735+ time=(IssmDouble)matrix[(nrows-1)*ncols+t]*yts;
4736
4737 if(t==0) transientinput=new TransientInput(name);
4738 transientinput->AddTimeInput(new PentaP1Input(name,values),time);
4739@@ -5741,16 +5741,16 @@
4740
4741 /*Intermediaries */
4742 int i,j,ig;
4743- double Jdet;
4744- double viscosity,oldviscosity,newviscosity,viscosity_overshoot; //viscosity
4745- double epsilon[5],oldepsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
4746- double xyz_list[NUMVERTICES][3];
4747- double B[3][numdofp];
4748- double Bprime[3][numdofm];
4749- double D[3][3]={0.0}; // material matrix, simple scalar matrix.
4750- double D_scalar;
4751- double Ke_gg[numdofp][numdofm]={0.0}; //local element stiffness matrix
4752- double Ke_gg_gaussian[numdofp][numdofm]; //stiffness matrix evaluated at the gaussian point.
4753+ IssmDouble Jdet;
4754+ IssmDouble viscosity,oldviscosity,newviscosity,viscosity_overshoot; //viscosity
4755+ IssmDouble epsilon[5],oldepsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
4756+ IssmDouble xyz_list[NUMVERTICES][3];
4757+ IssmDouble B[3][numdofp];
4758+ IssmDouble Bprime[3][numdofm];
4759+ IssmDouble D[3][3]={0.0}; // material matrix, simple scalar matrix.
4760+ IssmDouble D_scalar;
4761+ IssmDouble Ke_gg[numdofp][numdofm]={0.0}; //local element stiffness matrix
4762+ IssmDouble Ke_gg_gaussian[numdofp][numdofm]; //stiffness matrix evaluated at the gaussian point.
4763 GaussPenta *gauss=NULL;
4764 GaussTria *gauss_tria=NULL;
4765 Node *node_list[numnodes];
4766@@ -5833,17 +5833,17 @@
4767
4768 /*Intermediaries */
4769 int i,j,ig,analysis_type;
4770- double Jdet2d,slope_magnitude,alpha2;
4771- double xyz_list[NUMVERTICES][3];
4772- double xyz_list_tria[NUMVERTICES2D][3]={0.0};
4773- double slope[3]={0.0,0.0,0.0};
4774- double MAXSLOPE=.06; // 6 %
4775- double MOUNTAINKEXPONENT=10;
4776- double L[2][numdof];
4777- double DL[2][2] ={{ 0,0 },{0,0}}; //for basal drag
4778- double DL_scalar;
4779- double Ke_gg[numdof][numdof] ={0.0};
4780- double Ke_gg_gaussian[numdof][numdof]; //stiffness matrix contribution from drag
4781+ IssmDouble Jdet2d,slope_magnitude,alpha2;
4782+ IssmDouble xyz_list[NUMVERTICES][3];
4783+ IssmDouble xyz_list_tria[NUMVERTICES2D][3]={0.0};
4784+ IssmDouble slope[3]={0.0,0.0,0.0};
4785+ IssmDouble MAXSLOPE=.06; // 6 %
4786+ IssmDouble MOUNTAINKEXPONENT=10;
4787+ IssmDouble L[2][numdof];
4788+ IssmDouble DL[2][2] ={{ 0,0 },{0,0}}; //for basal drag
4789+ IssmDouble DL_scalar;
4790+ IssmDouble Ke_gg[numdof][numdof] ={0.0};
4791+ IssmDouble Ke_gg_gaussian[numdof][numdof]; //stiffness matrix contribution from drag
4792 Friction *friction = NULL;
4793 GaussPenta *gauss=NULL;
4794 Node *node_list[numnodes];
4795@@ -5891,7 +5891,7 @@
4796 slope_magnitude=sqrt(pow(slope[0],2)+pow(slope[1],2));
4797
4798 if (slope_magnitude>MAXSLOPE){
4799- alpha2=pow((double)10,MOUNTAINKEXPONENT);
4800+ alpha2=pow((IssmDouble)10,MOUNTAINKEXPONENT);
4801 }
4802
4803 GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0],gauss);
4804@@ -5946,21 +5946,21 @@
4805
4806 /*Intermediaries */
4807 int i,j,ig;
4808- double Jdet;
4809- double viscosity,stokesreconditioning; //viscosity
4810- double epsilon[6]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
4811- double xyz_list[NUMVERTICES][3];
4812- double B[4][numdofs+3];
4813- double Bprime[4][numdofm];
4814- double B2[3][numdofm];
4815- double Bprime2[3][numdofs+3];
4816- double D[4][4]={0.0}; // material matrix, simple scalar matrix.
4817- double D2[3][3]={0.0}; // material matrix, simple scalar matrix.
4818- double D_scalar;
4819- double Ke_gg[numdofs][numdofm]={0.0}; //local element stiffness matrix
4820- double Ke_gg2[numdofm][numdofs]={0.0}; //local element stiffness matrix
4821- double Ke_gg_gaussian[numdofs+3][numdofm]; //stiffness matrix evaluated at the gaussian point.
4822- double Ke_gg_gaussian2[numdofm][numdofs+3]; //stiffness matrix evaluated at the gaussian point.
4823+ IssmDouble Jdet;
4824+ IssmDouble viscosity,stokesreconditioning; //viscosity
4825+ IssmDouble epsilon[6]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
4826+ IssmDouble xyz_list[NUMVERTICES][3];
4827+ IssmDouble B[4][numdofs+3];
4828+ IssmDouble Bprime[4][numdofm];
4829+ IssmDouble B2[3][numdofm];
4830+ IssmDouble Bprime2[3][numdofs+3];
4831+ IssmDouble D[4][4]={0.0}; // material matrix, simple scalar matrix.
4832+ IssmDouble D2[3][3]={0.0}; // material matrix, simple scalar matrix.
4833+ IssmDouble D_scalar;
4834+ IssmDouble Ke_gg[numdofs][numdofm]={0.0}; //local element stiffness matrix
4835+ IssmDouble Ke_gg2[numdofm][numdofs]={0.0}; //local element stiffness matrix
4836+ IssmDouble Ke_gg_gaussian[numdofs+3][numdofm]; //stiffness matrix evaluated at the gaussian point.
4837+ IssmDouble Ke_gg_gaussian2[numdofm][numdofs+3]; //stiffness matrix evaluated at the gaussian point.
4838 GaussPenta *gauss=NULL;
4839 GaussTria *gauss_tria=NULL;
4840 Node *node_list[numnodes];
4841@@ -6053,20 +6053,20 @@
4842 /*Intermediaries */
4843 int i,j,ig;
4844 int analysis_type,approximation;
4845- double stokesreconditioning;
4846- double viscosity,alpha2_gauss,Jdet2d;
4847- double bed_normal[3];
4848- double epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
4849- double xyz_list[NUMVERTICES][3];
4850- double xyz_list_tria[NUMVERTICES2D][3];
4851- double LMacAyealStokes[8][numdof2dm];
4852- double LprimeMacAyealStokes[8][numdof2d];
4853- double DLMacAyealStokes[8][8]={0.0};
4854- double LStokesMacAyeal[4][numdof2d];
4855- double LprimeStokesMacAyeal[4][numdof2dm];
4856- double DLStokesMacAyeal[4][4]={0.0};
4857- double Ke_drag_gaussian[numdof2dm][numdof2d];
4858- double Ke_drag_gaussian2[numdof2d][numdof2dm];
4859+ IssmDouble stokesreconditioning;
4860+ IssmDouble viscosity,alpha2_gauss,Jdet2d;
4861+ IssmDouble bed_normal[3];
4862+ IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
4863+ IssmDouble xyz_list[NUMVERTICES][3];
4864+ IssmDouble xyz_list_tria[NUMVERTICES2D][3];
4865+ IssmDouble LMacAyealStokes[8][numdof2dm];
4866+ IssmDouble LprimeMacAyealStokes[8][numdof2d];
4867+ IssmDouble DLMacAyealStokes[8][8]={0.0};
4868+ IssmDouble LStokesMacAyeal[4][numdof2d];
4869+ IssmDouble LprimeStokesMacAyeal[4][numdof2dm];
4870+ IssmDouble DLStokesMacAyeal[4][4]={0.0};
4871+ IssmDouble Ke_drag_gaussian[numdof2dm][numdof2d];
4872+ IssmDouble Ke_drag_gaussian2[numdof2d][numdof2dm];
4873 Friction* friction=NULL;
4874 GaussPenta *gauss=NULL;
4875 Node *node_list[numnodes];
4876@@ -6241,7 +6241,7 @@
4877 /*Intermediaries*/
4878 int connectivity[2];
4879 int i,i0,i1,j0,j1;
4880- double one0,one1;
4881+ IssmDouble one0,one1;
4882
4883 /*Initialize Element matrix*/
4884 ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
4885@@ -6258,8 +6258,8 @@
4886 /*Find connectivity for the two nodes*/
4887 connectivity[0]=nodes[i]->GetConnectivity();
4888 connectivity[1]=nodes[i+3]->GetConnectivity();
4889- one0=1/(double)connectivity[0];
4890- one1=1/(double)connectivity[1];
4891+ one0=1/(IssmDouble)connectivity[0];
4892+ one1=1/(IssmDouble)connectivity[1];
4893
4894 /*Create matrix for these two nodes*/
4895 if (IsOnBed() && IsOnSurface()){
4896@@ -6340,16 +6340,16 @@
4897
4898 /*Intermediaries */
4899 int i,j,ig,approximation;
4900- double Jdet;
4901- double viscosity, oldviscosity, newviscosity, viscosity_overshoot;
4902- double epsilon[5],oldepsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
4903- double epsilons[6]; //6 for stokes
4904- double xyz_list[NUMVERTICES][3];
4905- double B[3][numdof2d];
4906- double Bprime[3][numdof2d];
4907- double D[3][3]={0.0}; // material matrix, simple scalar matrix.
4908- double D_scalar;
4909- double Ke_gg_gaussian[numdof2d][numdof2d]; //stiffness matrix evaluated at the gaussian point.
4910+ IssmDouble Jdet;
4911+ IssmDouble viscosity, oldviscosity, newviscosity, viscosity_overshoot;
4912+ IssmDouble epsilon[5],oldepsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
4913+ IssmDouble epsilons[6]; //6 for stokes
4914+ IssmDouble xyz_list[NUMVERTICES][3];
4915+ IssmDouble B[3][numdof2d];
4916+ IssmDouble Bprime[3][numdof2d];
4917+ IssmDouble D[3][3]={0.0}; // material matrix, simple scalar matrix.
4918+ IssmDouble D_scalar;
4919+ IssmDouble Ke_gg_gaussian[numdof2d][numdof2d]; //stiffness matrix evaluated at the gaussian point.
4920 Tria* tria=NULL;
4921 Penta* pentabase=NULL;
4922 GaussPenta *gauss=NULL;
4923@@ -6493,14 +6493,14 @@
4924 /*Intermediaries */
4925 int i,j,ig;
4926 int approximation;
4927- double xyz_list[NUMVERTICES][3];
4928- double Jdet;
4929- double viscosity,oldviscosity,newviscosity,viscosity_overshoot; //viscosity
4930- double epsilon[5],oldepsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
4931- double D_scalar;
4932- double D[5][5]={0.0}; // material matrix, simple scalar matrix.
4933- double B[5][numdof];
4934- double Bprime[5][numdof];
4935+ IssmDouble xyz_list[NUMVERTICES][3];
4936+ IssmDouble Jdet;
4937+ IssmDouble viscosity,oldviscosity,newviscosity,viscosity_overshoot; //viscosity
4938+ IssmDouble epsilon[5],oldepsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
4939+ IssmDouble D_scalar;
4940+ IssmDouble D[5][5]={0.0}; // material matrix, simple scalar matrix.
4941+ IssmDouble B[5][numdof];
4942+ IssmDouble Bprime[5][numdof];
4943 Tria* tria=NULL;
4944 GaussPenta *gauss=NULL;
4945
4946@@ -6558,15 +6558,15 @@
4947 /*Intermediaries */
4948 int i,j,ig;
4949 int analysis_type;
4950- double xyz_list[NUMVERTICES][3];
4951- double xyz_list_tria[NUMVERTICES2D][3]={0.0};
4952- double slope_magnitude,alpha2,Jdet;
4953- double slope[3]={0.0,0.0,0.0};
4954- double MAXSLOPE=.06; // 6 %
4955- double MOUNTAINKEXPONENT=10;
4956- double L[2][numdof];
4957- double DL[2][2]={{ 0,0 },{0,0}}; //for basal drag
4958- double DL_scalar;
4959+ IssmDouble xyz_list[NUMVERTICES][3];
4960+ IssmDouble xyz_list_tria[NUMVERTICES2D][3]={0.0};
4961+ IssmDouble slope_magnitude,alpha2,Jdet;
4962+ IssmDouble slope[3]={0.0,0.0,0.0};
4963+ IssmDouble MAXSLOPE=.06; // 6 %
4964+ IssmDouble MOUNTAINKEXPONENT=10;
4965+ IssmDouble L[2][numdof];
4966+ IssmDouble DL[2][2]={{ 0,0 },{0,0}}; //for basal drag
4967+ IssmDouble DL_scalar;
4968 Friction *friction = NULL;
4969 GaussPenta *gauss=NULL;
4970
4971@@ -6603,7 +6603,7 @@
4972 // If we have a slope > 6% for this element, it means we are on a mountain. In this particular case,
4973 //velocity should be = 0. To achieve this result, we set alpha2_list to a very high value: */
4974 if (slope_magnitude>MAXSLOPE){
4975- alpha2=pow((double)10,MOUNTAINKEXPONENT);
4976+ alpha2=pow((IssmDouble)10,MOUNTAINKEXPONENT);
4977 }
4978
4979 DL_scalar=alpha2*gauss->weight*Jdet;
4980@@ -6659,14 +6659,14 @@
4981
4982 /*Intermediaries */
4983 int i,j,ig,approximation;
4984- double Jdet,viscosity,stokesreconditioning;
4985- double xyz_list[NUMVERTICES][3];
4986- double epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
4987- double B[8][27];
4988- double B_prime[8][27];
4989- double D_scalar;
4990- double D[8][8]={0.0};
4991- double Ke_temp[27][27]={0.0}; //for the six nodes and the bubble
4992+ IssmDouble Jdet,viscosity,stokesreconditioning;
4993+ IssmDouble xyz_list[NUMVERTICES][3];
4994+ IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
4995+ IssmDouble B[8][27];
4996+ IssmDouble B_prime[8][27];
4997+ IssmDouble D_scalar;
4998+ IssmDouble D[8][8]={0.0};
4999+ IssmDouble Ke_temp[27][27]={0.0}; //for the six nodes and the bubble
5000 GaussPenta *gauss=NULL;
5001
5002 /*If on water or not Stokes, skip stiffness: */
5003@@ -6725,14 +6725,14 @@
5004 /*Intermediaries */
5005 int i,j,ig;
5006 int analysis_type,approximation;
5007- double alpha2,Jdet2d;
5008- double stokesreconditioning,viscosity;
5009- double epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
5010- double xyz_list[NUMVERTICES][3];
5011- double xyz_list_tria[NUMVERTICES2D][3];
5012- double LStokes[2][numdof2d];
5013- double DLStokes[2][2]={0.0};
5014- double Ke_drag_gaussian[numdof2d][numdof2d];
5015+ IssmDouble alpha2,Jdet2d;
5016+ IssmDouble stokesreconditioning,viscosity;
5017+ IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
5018+ IssmDouble xyz_list[NUMVERTICES][3];
5019+ IssmDouble xyz_list_tria[NUMVERTICES2D][3];
5020+ IssmDouble LStokes[2][numdof2d];
5021+ IssmDouble DLStokes[2][2]={0.0};
5022+ IssmDouble Ke_drag_gaussian[numdof2d][numdof2d];
5023 Friction* friction=NULL;
5024 GaussPenta *gauss=NULL;
5025
5026@@ -6810,11 +6810,11 @@
5027
5028 /*Intermediaries */
5029 int i,j,ig;
5030- double Jdet;
5031- double xyz_list[NUMVERTICES][3];
5032- double B[NDOF1][NUMVERTICES];
5033- double Bprime[NDOF1][NUMVERTICES];
5034- double DL_scalar;
5035+ IssmDouble Jdet;
5036+ IssmDouble xyz_list[NUMVERTICES][3];
5037+ IssmDouble B[NDOF1][NUMVERTICES];
5038+ IssmDouble Bprime[NDOF1][NUMVERTICES];
5039+ IssmDouble DL_scalar;
5040 GaussPenta *gauss=NULL;
5041
5042 /*Initialize Element matrix*/
5043@@ -6856,11 +6856,11 @@
5044
5045 /*Intermediaries */
5046 int i,j,ig;
5047- double xyz_list[NUMVERTICES][3];
5048- double xyz_list_tria[NUMVERTICES2D][3];
5049- double surface_normal[3];
5050- double Jdet2d,DL_scalar;
5051- double basis[NUMVERTICES];
5052+ IssmDouble xyz_list[NUMVERTICES][3];
5053+ IssmDouble xyz_list_tria[NUMVERTICES2D][3];
5054+ IssmDouble surface_normal[3];
5055+ IssmDouble Jdet2d,DL_scalar;
5056+ IssmDouble basis[NUMVERTICES];
5057 GaussPenta *gauss=NULL;
5058
5059 /*Initialize Element matrix*/
5060@@ -6916,13 +6916,13 @@
5061 /*Intermediaries */
5062 int i,j,ig;
5063 int approximation;
5064- double viscosity,Jdet;
5065- double stokesreconditioning;
5066- double epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
5067- double dw[3];
5068- double xyz_list[NUMVERTICES][3];
5069- double basis[6]; //for the six nodes of the penta
5070- double dbasis[3][6]; //for the six nodes of the penta
5071+ IssmDouble viscosity,Jdet;
5072+ IssmDouble stokesreconditioning;
5073+ IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
5074+ IssmDouble dw[3];
5075+ IssmDouble xyz_list[NUMVERTICES][3];
5076+ IssmDouble basis[6]; //for the six nodes of the penta
5077+ IssmDouble dbasis[3][6]; //for the six nodes of the penta
5078 GaussPenta *gauss=NULL;
5079
5080 /*Initialize Element vector and return if necessary*/
5081@@ -6978,15 +6978,15 @@
5082 /*Intermediaries*/
5083 int i,j,ig;
5084 int approximation,analysis_type;
5085- double Jdet,Jdet2d;
5086- double stokesreconditioning;
5087- double bed_normal[3];
5088- double epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
5089- double viscosity, w, alpha2_gauss;
5090- double dw[3];
5091- double xyz_list_tria[NUMVERTICES2D][3];
5092- double xyz_list[NUMVERTICES][3];
5093- double basis[6]; //for the six nodes of the penta
5094+ IssmDouble Jdet,Jdet2d;
5095+ IssmDouble stokesreconditioning;
5096+ IssmDouble bed_normal[3];
5097+ IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
5098+ IssmDouble viscosity, w, alpha2_gauss;
5099+ IssmDouble dw[3];
5100+ IssmDouble xyz_list_tria[NUMVERTICES2D][3];
5101+ IssmDouble xyz_list[NUMVERTICES][3];
5102+ IssmDouble basis[6]; //for the six nodes of the penta
5103 Tria* tria=NULL;
5104 Friction* friction=NULL;
5105 GaussPenta *gauss=NULL;
5106@@ -7067,13 +7067,13 @@
5107 /*Intermediaries */
5108 int i,j,ig;
5109 int approximation;
5110- double viscosity,Jdet;
5111- double stokesreconditioning;
5112- double epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
5113- double dw[3];
5114- double xyz_list[NUMVERTICES][3];
5115- double basis[6]; //for the six nodes of the penta
5116- double dbasis[3][6]; //for the six nodes of the penta
5117+ IssmDouble viscosity,Jdet;
5118+ IssmDouble stokesreconditioning;
5119+ IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
5120+ IssmDouble dw[3];
5121+ IssmDouble xyz_list[NUMVERTICES][3];
5122+ IssmDouble basis[6]; //for the six nodes of the penta
5123+ IssmDouble dbasis[3][6]; //for the six nodes of the penta
5124 GaussPenta *gauss=NULL;
5125
5126 /*Initialize Element vector and return if necessary*/
5127@@ -7129,15 +7129,15 @@
5128 /*Intermediaries*/
5129 int i,j,ig;
5130 int approximation,analysis_type;
5131- double Jdet,Jdet2d;
5132- double stokesreconditioning;
5133- double bed_normal[3];
5134- double epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
5135- double viscosity, w, alpha2_gauss;
5136- double dw[3];
5137- double xyz_list_tria[NUMVERTICES2D][3];
5138- double xyz_list[NUMVERTICES][3];
5139- double basis[6]; //for the six nodes of the penta
5140+ IssmDouble Jdet,Jdet2d;
5141+ IssmDouble stokesreconditioning;
5142+ IssmDouble bed_normal[3];
5143+ IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
5144+ IssmDouble viscosity, w, alpha2_gauss;
5145+ IssmDouble dw[3];
5146+ IssmDouble xyz_list_tria[NUMVERTICES2D][3];
5147+ IssmDouble xyz_list[NUMVERTICES][3];
5148+ IssmDouble basis[6]; //for the six nodes of the penta
5149 Tria* tria=NULL;
5150 Friction* friction=NULL;
5151 GaussPenta *gauss=NULL;
5152@@ -7279,14 +7279,14 @@
5153 int i,j,k,ig;
5154 int node0,node1;
5155 int connectivity[2];
5156- double Jdet;
5157- double xyz_list[NUMVERTICES][3];
5158- double xyz_list_segment[2][3];
5159- double z_list[NUMVERTICES];
5160- double z_segment[2],slope[2];
5161- double slope2,constant_part;
5162- double rho_ice,gravity,n,B;
5163- double ub,vb,z_g,surface,thickness;
5164+ IssmDouble Jdet;
5165+ IssmDouble xyz_list[NUMVERTICES][3];
5166+ IssmDouble xyz_list_segment[2][3];
5167+ IssmDouble z_list[NUMVERTICES];
5168+ IssmDouble z_segment[2],slope[2];
5169+ IssmDouble slope2,constant_part;
5170+ IssmDouble rho_ice,gravity,n,B;
5171+ IssmDouble ub,vb,z_g,surface,thickness;
5172 GaussPenta* gauss=NULL;
5173
5174 /*Initialize Element vector*/
5175@@ -7334,22 +7334,22 @@
5176 GetSegmentJacobianDeterminant(&Jdet,&xyz_list_segment[0][0],gauss);
5177
5178 if (IsOnSurface()){
5179- for(j=0;j<NDOF2;j++) pe->values[2*node1+j]+=constant_part*pow((surface-z_g)/B,n)*slope[j]*Jdet*gauss->weight/(double)connectivity[1];
5180+ for(j=0;j<NDOF2;j++) pe->values[2*node1+j]+=constant_part*pow((surface-z_g)/B,n)*slope[j]*Jdet*gauss->weight/(IssmDouble)connectivity[1];
5181 }
5182 else{//connectivity is too large, should take only half on it
5183- for(j=0;j<NDOF2;j++) pe->values[2*node1+j]+=constant_part*pow((surface-z_g)/B,n)*slope[j]*Jdet*gauss->weight*2/(double)connectivity[1];
5184+ for(j=0;j<NDOF2;j++) pe->values[2*node1+j]+=constant_part*pow((surface-z_g)/B,n)*slope[j]*Jdet*gauss->weight*2/(IssmDouble)connectivity[1];
5185 }
5186 }
5187 delete gauss;
5188
5189 //Deal with lower surface
5190 if (IsOnBed()){
5191- constant_part=-1.58*pow((double)10.0,-(double)10.0)*rho_ice*gravity*thickness;
5192+ constant_part=-1.58*pow((IssmDouble)10.0,-(IssmDouble)10.0)*rho_ice*gravity*thickness;
5193 ub=constant_part*slope[0];
5194 vb=constant_part*slope[1];
5195
5196- pe->values[2*node0]+=ub/(double)connectivity[0];
5197- pe->values[2*node0+1]+=vb/(double)connectivity[0];
5198+ pe->values[2*node0]+=ub/(IssmDouble)connectivity[0];
5199+ pe->values[2*node0+1]+=vb/(IssmDouble)connectivity[0];
5200 }
5201 }
5202
5203@@ -7379,11 +7379,11 @@
5204
5205 /*Intermediaries*/
5206 int i,j,ig;
5207- double Jdet;
5208- double slope[3]; //do not put 2! this goes into GetInputDerivativeValue, which addresses slope[3] also!
5209- double driving_stress_baseline,thickness;
5210- double xyz_list[NUMVERTICES][3];
5211- double basis[6];
5212+ IssmDouble Jdet;
5213+ IssmDouble slope[3]; //do not put 2! this goes into GetInputDerivativeValue, which addresses slope[3] also!
5214+ IssmDouble driving_stress_baseline,thickness;
5215+ IssmDouble xyz_list[NUMVERTICES][3];
5216+ IssmDouble basis[6];
5217 GaussPenta *gauss=NULL;
5218
5219 /*Initialize Element vector*/
5220@@ -7442,19 +7442,19 @@
5221 /*Intermediaries*/
5222 int i,j,ig;
5223 int approximation;
5224- double Jdet,viscosity;
5225- double gravity,rho_ice,stokesreconditioning;
5226- double xyz_list[NUMVERTICES][3];
5227- double epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
5228- double l1l7[7]; //for the six nodes and the bubble
5229- double B[8][numdofbubble];
5230- double B_prime[8][numdofbubble];
5231- double B_prime_bubble[8][3];
5232- double D[8][8]={0.0};
5233- double D_scalar;
5234- double Pe_gaussian[numdofbubble]={0.0}; //for the six nodes and the bubble
5235- double Ke_temp[numdofbubble][3]={0.0}; //for the six nodes and the bubble
5236- double Ke_gaussian[numdofbubble][3];
5237+ IssmDouble Jdet,viscosity;
5238+ IssmDouble gravity,rho_ice,stokesreconditioning;
5239+ IssmDouble xyz_list[NUMVERTICES][3];
5240+ IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
5241+ IssmDouble l1l7[7]; //for the six nodes and the bubble
5242+ IssmDouble B[8][numdofbubble];
5243+ IssmDouble B_prime[8][numdofbubble];
5244+ IssmDouble B_prime_bubble[8][3];
5245+ IssmDouble D[8][8]={0.0};
5246+ IssmDouble D_scalar;
5247+ IssmDouble Pe_gaussian[numdofbubble]={0.0}; //for the six nodes and the bubble
5248+ IssmDouble Ke_temp[numdofbubble][3]={0.0}; //for the six nodes and the bubble
5249+ IssmDouble Ke_gaussian[numdofbubble][3];
5250 GaussPenta *gauss=NULL;
5251
5252 /*Initialize Element vector and return if necessary*/
5253@@ -7519,14 +7519,14 @@
5254 /*Intermediaries*/
5255 int i,j,ig;
5256 int approximation,shelf_dampening;
5257- double gravity,rho_water,bed,water_pressure;
5258- double damper,normal_vel,vx,vy,vz,dt;
5259- double xyz_list_tria[NUMVERTICES2D][3];
5260- double xyz_list[NUMVERTICES][3];
5261- double bed_normal[3];
5262- double dz[3];
5263- double basis[6]; //for the six nodes of the penta
5264- double Jdet2d;
5265+ IssmDouble gravity,rho_water,bed,water_pressure;
5266+ IssmDouble damper,normal_vel,vx,vy,vz,dt;
5267+ IssmDouble xyz_list_tria[NUMVERTICES2D][3];
5268+ IssmDouble xyz_list[NUMVERTICES][3];
5269+ IssmDouble bed_normal[3];
5270+ IssmDouble dz[3];
5271+ IssmDouble basis[6]; //for the six nodes of the penta
5272+ IssmDouble Jdet2d;
5273 GaussPenta *gauss=NULL;
5274
5275 /*Initialize Element vector and return if necessary*/
5276@@ -7604,11 +7604,11 @@
5277 /*Intermediaries*/
5278 int i,ig;
5279 int approximation;
5280- double Jdet;
5281- double xyz_list[NUMVERTICES][3];
5282- double dudx,dvdy,dwdz;
5283- double du[3],dv[3],dw[3];
5284- double basis[6];
5285+ IssmDouble Jdet;
5286+ IssmDouble xyz_list[NUMVERTICES][3];
5287+ IssmDouble dudx,dvdy,dwdz;
5288+ IssmDouble du[3],dv[3],dw[3];
5289+ IssmDouble basis[6];
5290 GaussPenta *gauss=NULL;
5291
5292 /*Initialize Element vector*/
5293@@ -7661,12 +7661,12 @@
5294 /*Intermediaries */
5295 int i,j,ig;
5296 int approximation;
5297- double xyz_list[NUMVERTICES][3];
5298- double xyz_list_tria[NUMVERTICES2D][3];
5299- double Jdet2d;
5300- double vx,vy,vz,dbdx,dbdy,basalmeltingvalue;
5301- double slope[3];
5302- double basis[NUMVERTICES];
5303+ IssmDouble xyz_list[NUMVERTICES][3];
5304+ IssmDouble xyz_list_tria[NUMVERTICES2D][3];
5305+ IssmDouble Jdet2d;
5306+ IssmDouble vx,vy,vz,dbdx,dbdy,basalmeltingvalue;
5307+ IssmDouble slope[3];
5308+ IssmDouble basis[NUMVERTICES];
5309 GaussPenta* gauss=NULL;
5310
5311 if (!IsOnBed()) return NULL;
5312@@ -7767,15 +7767,15 @@
5313
5314 /*Intermediaries */
5315 int i,j,ig;
5316- double xyz_list[NUMVERTICES][3];
5317- double Jdet;
5318- double eps1dotdphii,eps1dotdphij;
5319- double eps2dotdphii,eps2dotdphij;
5320- double mu_prime;
5321- double epsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
5322- double eps1[3],eps2[3];
5323- double phi[NUMVERTICES];
5324- double dphi[3][NUMVERTICES];
5325+ IssmDouble xyz_list[NUMVERTICES][3];
5326+ IssmDouble Jdet;
5327+ IssmDouble eps1dotdphii,eps1dotdphij;
5328+ IssmDouble eps2dotdphii,eps2dotdphij;
5329+ IssmDouble mu_prime;
5330+ IssmDouble epsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
5331+ IssmDouble eps1[3],eps2[3];
5332+ IssmDouble phi[NUMVERTICES];
5333+ IssmDouble dphi[3][NUMVERTICES];
5334 GaussPenta *gauss=NULL;
5335
5336 /*Initialize Jacobian with regular Pattyn (first part of the Gateau derivative)*/
5337@@ -7832,16 +7832,16 @@
5338
5339 /*Intermediaries */
5340 int i,j,ig;
5341- double xyz_list[NUMVERTICES][3];
5342- double Jdet;
5343- double eps1dotdphii,eps1dotdphij;
5344- double eps2dotdphii,eps2dotdphij;
5345- double eps3dotdphii,eps3dotdphij;
5346- double mu_prime;
5347- double epsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
5348- double eps1[3],eps2[3],eps3[3];
5349- double phi[NUMVERTICES];
5350- double dphi[3][NUMVERTICES];
5351+ IssmDouble xyz_list[NUMVERTICES][3];
5352+ IssmDouble Jdet;
5353+ IssmDouble eps1dotdphii,eps1dotdphij;
5354+ IssmDouble eps2dotdphii,eps2dotdphij;
5355+ IssmDouble eps3dotdphii,eps3dotdphij;
5356+ IssmDouble mu_prime;
5357+ IssmDouble epsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
5358+ IssmDouble eps1[3],eps2[3],eps3[3];
5359+ IssmDouble phi[NUMVERTICES];
5360+ IssmDouble dphi[3][NUMVERTICES];
5361 GaussPenta *gauss=NULL;
5362
5363 /*Initialize Jacobian with regular Stokes (first part of the Gateau derivative)*/
5364@@ -7908,8 +7908,8 @@
5365 int i;
5366 int approximation;
5367 int* doflist=NULL;
5368- double vx,vy;
5369- double values[numdof];
5370+ IssmDouble vx,vy;
5371+ IssmDouble values[numdof];
5372 GaussPenta* gauss;
5373
5374 /*Get approximation enum and dof list: */
5375@@ -7949,8 +7949,8 @@
5376
5377 int i;
5378 int* doflist=NULL;
5379- double vx,vy;
5380- double values[numdof];
5381+ IssmDouble vx,vy;
5382+ IssmDouble values[numdof];
5383 GaussPenta* gauss=NULL;
5384
5385 /*Get dof list: */
5386@@ -7985,8 +7985,8 @@
5387
5388 int i;
5389 int* doflist=NULL;
5390- double vz;
5391- double values[numdof];
5392+ IssmDouble vz;
5393+ IssmDouble values[numdof];
5394 GaussPenta* gauss=NULL;
5395
5396 /*Get dof list: */
5397@@ -8018,9 +8018,9 @@
5398
5399 int i;
5400 int* doflist=NULL;
5401- double vx,vy,vz,p;
5402- double stokesreconditioning;
5403- double values[numdof];
5404+ IssmDouble vx,vy,vz,p;
5405+ IssmDouble stokesreconditioning;
5406+ IssmDouble values[numdof];
5407 GaussPenta *gauss;
5408
5409 /*Get dof list: */
5410@@ -8057,7 +8057,7 @@
5411 }
5412 /*}}}*/
5413 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticHoriz {{{*/
5414-void Penta::InputUpdateFromSolutionDiagnosticHoriz(double* solution){
5415+void Penta::InputUpdateFromSolutionDiagnosticHoriz(IssmDouble* solution){
5416
5417 int approximation;
5418
5419@@ -8093,20 +8093,20 @@
5420 }
5421 /*}}}*/
5422 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticMacAyeal {{{*/
5423-void Penta::InputUpdateFromSolutionDiagnosticMacAyeal(double* solution){
5424+void Penta::InputUpdateFromSolutionDiagnosticMacAyeal(IssmDouble* solution){
5425
5426 const int numdof=NDOF2*NUMVERTICES;
5427
5428 int i;
5429- double rho_ice,g;
5430- double values[numdof];
5431- double vx[NUMVERTICES];
5432- double vy[NUMVERTICES];
5433- double vz[NUMVERTICES];
5434- double vel[NUMVERTICES];
5435- double pressure[NUMVERTICES];
5436- double surface[NUMVERTICES];
5437- double xyz_list[NUMVERTICES][3];
5438+ IssmDouble rho_ice,g;
5439+ IssmDouble values[numdof];
5440+ IssmDouble vx[NUMVERTICES];
5441+ IssmDouble vy[NUMVERTICES];
5442+ IssmDouble vz[NUMVERTICES];
5443+ IssmDouble vel[NUMVERTICES];
5444+ IssmDouble pressure[NUMVERTICES];
5445+ IssmDouble surface[NUMVERTICES];
5446+ IssmDouble xyz_list[NUMVERTICES][3];
5447 int *doflist = NULL;
5448 Penta *penta = NULL;
5449
5450@@ -8174,22 +8174,22 @@
5451 }
5452 /*}}}*/
5453 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticMacAyealPattyn {{{*/
5454-void Penta::InputUpdateFromSolutionDiagnosticMacAyealPattyn(double* solution){
5455+void Penta::InputUpdateFromSolutionDiagnosticMacAyealPattyn(IssmDouble* solution){
5456
5457 const int numdof=NDOF2*NUMVERTICES;
5458 const int numdof2d=NDOF2*NUMVERTICES2D;
5459
5460 int i;
5461- double rho_ice,g;
5462- double macayeal_values[numdof];
5463- double pattyn_values[numdof];
5464- double vx[NUMVERTICES];
5465- double vy[NUMVERTICES];
5466- double vz[NUMVERTICES];
5467- double vel[NUMVERTICES];
5468- double pressure[NUMVERTICES];
5469- double surface[NUMVERTICES];
5470- double xyz_list[NUMVERTICES][3];
5471+ IssmDouble rho_ice,g;
5472+ IssmDouble macayeal_values[numdof];
5473+ IssmDouble pattyn_values[numdof];
5474+ IssmDouble vx[NUMVERTICES];
5475+ IssmDouble vy[NUMVERTICES];
5476+ IssmDouble vz[NUMVERTICES];
5477+ IssmDouble vel[NUMVERTICES];
5478+ IssmDouble pressure[NUMVERTICES];
5479+ IssmDouble surface[NUMVERTICES];
5480+ IssmDouble xyz_list[NUMVERTICES][3];
5481 int* doflistp = NULL;
5482 int* doflistm = NULL;
5483 Penta *penta = NULL;
5484@@ -8258,24 +8258,24 @@
5485 }
5486 /*}}}*/
5487 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticMacAyealStokes {{{*/
5488-void Penta::InputUpdateFromSolutionDiagnosticMacAyealStokes(double* solution){
5489+void Penta::InputUpdateFromSolutionDiagnosticMacAyealStokes(IssmDouble* solution){
5490
5491 const int numdofm=NDOF2*NUMVERTICES;
5492 const int numdofs=NDOF4*NUMVERTICES;
5493 const int numdof2d=NDOF2*NUMVERTICES2D;
5494
5495 int i;
5496- double stokesreconditioning;
5497- double macayeal_values[numdofm];
5498- double stokes_values[numdofs];
5499- double vx[NUMVERTICES];
5500- double vy[NUMVERTICES];
5501- double vz[NUMVERTICES];
5502- double vzmacayeal[NUMVERTICES];
5503- double vzstokes[NUMVERTICES];
5504- double vel[NUMVERTICES];
5505- double pressure[NUMVERTICES];
5506- double xyz_list[NUMVERTICES][3];
5507+ IssmDouble stokesreconditioning;
5508+ IssmDouble macayeal_values[numdofm];
5509+ IssmDouble stokes_values[numdofs];
5510+ IssmDouble vx[NUMVERTICES];
5511+ IssmDouble vy[NUMVERTICES];
5512+ IssmDouble vz[NUMVERTICES];
5513+ IssmDouble vzmacayeal[NUMVERTICES];
5514+ IssmDouble vzstokes[NUMVERTICES];
5515+ IssmDouble vel[NUMVERTICES];
5516+ IssmDouble pressure[NUMVERTICES];
5517+ IssmDouble xyz_list[NUMVERTICES][3];
5518 int* doflistm = NULL;
5519 int* doflists = NULL;
5520 Penta *penta = NULL;
5521@@ -8358,20 +8358,20 @@
5522 }
5523 /*}}}*/
5524 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticPattyn {{{*/
5525-void Penta::InputUpdateFromSolutionDiagnosticPattyn(double* solution){
5526+void Penta::InputUpdateFromSolutionDiagnosticPattyn(IssmDouble* solution){
5527
5528 const int numdof=NDOF2*NUMVERTICES;
5529
5530 int i;
5531- double rho_ice,g;
5532- double values[numdof];
5533- double vx[NUMVERTICES];
5534- double vy[NUMVERTICES];
5535- double vz[NUMVERTICES];
5536- double vel[NUMVERTICES];
5537- double pressure[NUMVERTICES];
5538- double surface[NUMVERTICES];
5539- double xyz_list[NUMVERTICES][3];
5540+ IssmDouble rho_ice,g;
5541+ IssmDouble values[numdof];
5542+ IssmDouble vx[NUMVERTICES];
5543+ IssmDouble vy[NUMVERTICES];
5544+ IssmDouble vz[NUMVERTICES];
5545+ IssmDouble vel[NUMVERTICES];
5546+ IssmDouble pressure[NUMVERTICES];
5547+ IssmDouble surface[NUMVERTICES];
5548+ IssmDouble xyz_list[NUMVERTICES][3];
5549 int* doflist = NULL;
5550
5551 /*Get dof list: */
5552@@ -8432,23 +8432,23 @@
5553 }
5554 /*}}}*/
5555 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticPattynStokes {{{*/
5556-void Penta::InputUpdateFromSolutionDiagnosticPattynStokes(double* solution){
5557+void Penta::InputUpdateFromSolutionDiagnosticPattynStokes(IssmDouble* solution){
5558
5559 const int numdofp=NDOF2*NUMVERTICES;
5560 const int numdofs=NDOF4*NUMVERTICES;
5561
5562 int i;
5563- double pattyn_values[numdofp];
5564- double stokes_values[numdofs];
5565- double vx[NUMVERTICES];
5566- double vy[NUMVERTICES];
5567- double vz[NUMVERTICES];
5568- double vzpattyn[NUMVERTICES];
5569- double vzstokes[NUMVERTICES];
5570- double vel[NUMVERTICES];
5571- double pressure[NUMVERTICES];
5572- double xyz_list[NUMVERTICES][3];
5573- double stokesreconditioning;
5574+ IssmDouble pattyn_values[numdofp];
5575+ IssmDouble stokes_values[numdofs];
5576+ IssmDouble vx[NUMVERTICES];
5577+ IssmDouble vy[NUMVERTICES];
5578+ IssmDouble vz[NUMVERTICES];
5579+ IssmDouble vzpattyn[NUMVERTICES];
5580+ IssmDouble vzstokes[NUMVERTICES];
5581+ IssmDouble vel[NUMVERTICES];
5582+ IssmDouble pressure[NUMVERTICES];
5583+ IssmDouble xyz_list[NUMVERTICES][3];
5584+ IssmDouble stokesreconditioning;
5585 int* doflistp = NULL;
5586 int* doflists = NULL;
5587 Penta *penta = NULL;
5588@@ -8526,20 +8526,20 @@
5589 }
5590 /*}}}*/
5591 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticHutter {{{*/
5592-void Penta::InputUpdateFromSolutionDiagnosticHutter(double* solution){
5593+void Penta::InputUpdateFromSolutionDiagnosticHutter(IssmDouble* solution){
5594
5595 const int numdof=NDOF2*NUMVERTICES;
5596
5597 int i;
5598- double rho_ice,g;
5599- double values[numdof];
5600- double vx[NUMVERTICES];
5601- double vy[NUMVERTICES];
5602- double vz[NUMVERTICES];
5603- double vel[NUMVERTICES];
5604- double pressure[NUMVERTICES];
5605- double surface[NUMVERTICES];
5606- double xyz_list[NUMVERTICES][3];
5607+ IssmDouble rho_ice,g;
5608+ IssmDouble values[numdof];
5609+ IssmDouble vx[NUMVERTICES];
5610+ IssmDouble vy[NUMVERTICES];
5611+ IssmDouble vz[NUMVERTICES];
5612+ IssmDouble vel[NUMVERTICES];
5613+ IssmDouble pressure[NUMVERTICES];
5614+ IssmDouble surface[NUMVERTICES];
5615+ IssmDouble xyz_list[NUMVERTICES][3];
5616 int* doflist = NULL;
5617
5618 /*Get dof list: */
5619@@ -8589,24 +8589,24 @@
5620 }
5621 /*}}}*/
5622 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticVert {{{*/
5623-void Penta::InputUpdateFromSolutionDiagnosticVert(double* solution){
5624+void Penta::InputUpdateFromSolutionDiagnosticVert(IssmDouble* solution){
5625
5626 const int numdof=NDOF1*NUMVERTICES;
5627
5628 int i;
5629 int approximation;
5630- double rho_ice,g;
5631- double values[numdof];
5632- double vx[NUMVERTICES];
5633- double vy[NUMVERTICES];
5634- double vz[NUMVERTICES];
5635- double vzmacayeal[NUMVERTICES];
5636- double vzpattyn[NUMVERTICES];
5637- double vzstokes[NUMVERTICES];
5638- double vel[NUMVERTICES];
5639- double pressure[NUMVERTICES];
5640- double surface[NUMVERTICES];
5641- double xyz_list[NUMVERTICES][3];
5642+ IssmDouble rho_ice,g;
5643+ IssmDouble values[numdof];
5644+ IssmDouble vx[NUMVERTICES];
5645+ IssmDouble vy[NUMVERTICES];
5646+ IssmDouble vz[NUMVERTICES];
5647+ IssmDouble vzmacayeal[NUMVERTICES];
5648+ IssmDouble vzpattyn[NUMVERTICES];
5649+ IssmDouble vzstokes[NUMVERTICES];
5650+ IssmDouble vel[NUMVERTICES];
5651+ IssmDouble pressure[NUMVERTICES];
5652+ IssmDouble surface[NUMVERTICES];
5653+ IssmDouble xyz_list[NUMVERTICES][3];
5654 int* doflist = NULL;
5655
5656
5657@@ -8693,18 +8693,18 @@
5658 }
5659 /*}}}*/
5660 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticStokes {{{*/
5661-void Penta::InputUpdateFromSolutionDiagnosticStokes(double* solution){
5662+void Penta::InputUpdateFromSolutionDiagnosticStokes(IssmDouble* solution){
5663
5664 const int numdof=NDOF4*NUMVERTICES;
5665
5666 int i;
5667- double values[numdof];
5668- double vx[NUMVERTICES];
5669- double vy[NUMVERTICES];
5670- double vz[NUMVERTICES];
5671- double vel[NUMVERTICES];
5672- double pressure[NUMVERTICES];
5673- double stokesreconditioning;
5674+ IssmDouble values[numdof];
5675+ IssmDouble vx[NUMVERTICES];
5676+ IssmDouble vy[NUMVERTICES];
5677+ IssmDouble vz[NUMVERTICES];
5678+ IssmDouble vel[NUMVERTICES];
5679+ IssmDouble pressure[NUMVERTICES];
5680+ IssmDouble stokesreconditioning;
5681 int* doflist=NULL;
5682
5683 /*Get dof list: */
5684Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/PentaRef.h
5685===================================================================
5686--- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/PentaRef.h (revision 12470)
5687+++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/PentaRef.h (revision 12471)
5688@@ -22,42 +22,42 @@
5689 void SetElementType(int type,int type_counter);
5690
5691 /*Numerics*/
5692- void GetNodalFunctionsP1(double* l1l6, GaussPenta* gauss);
5693- void GetNodalFunctionsMINI(double* l1l7, GaussPenta* gauss);
5694- void GetNodalFunctionsP1Derivatives(double* dh1dh6,double* xyz_list, GaussPenta* gauss);
5695- void GetNodalFunctionsMINIDerivatives(double* dh1dh7,double* xyz_list, GaussPenta* gauss);
5696- void GetNodalFunctionsP1DerivativesReference(double* dl1dl6,GaussPenta* gauss);
5697- void GetNodalFunctionsMINIDerivativesReference(double* dl1dl7,GaussPenta* gauss);
5698- void GetQuadNodalFunctions(double* l1l4,GaussPenta* gauss,int index1,int index2,int index3,int index4);
5699- void GetQuadJacobianDeterminant(double* Jdet, double xyz_list[4][3],GaussPenta* gauss);
5700- void GetJacobian(double* J, double* xyz_list,GaussPenta* gauss);
5701- void GetJacobianDeterminant(double* Jdet, double* xyz_list,GaussPenta* gauss);
5702- void GetTriaJacobianDeterminant(double* Jdet, double* xyz_list,GaussPenta* gauss);
5703- void GetSegmentJacobianDeterminant(double* Jdet, double* xyz_list,GaussPenta* gauss);
5704- void GetJacobianInvert(double* Jinv, double* xyz_list,GaussPenta* gauss);
5705- void GetBMacAyealPattyn(double* B, double* xyz_list, GaussPenta* gauss);
5706- void GetBMacAyealStokes(double* B, double* xyz_list, GaussPenta* gauss);
5707- void GetBPattyn(double* B, double* xyz_list, GaussPenta* gauss);
5708- void GetBStokes(double* B, double* xyz_list, GaussPenta* gauss);
5709- void GetBprimeMacAyealStokes(double* Bprime, double* xyz_list, GaussPenta* gauss);
5710- void GetBprimePattyn(double* B, double* xyz_list, GaussPenta* gauss);
5711- void GetBprimeStokes(double* B_prime, double* xyz_list, GaussPenta* gauss);
5712- void GetBprimeVert(double* B, double* xyz_list, GaussPenta* gauss);
5713- void GetBAdvec(double* B_advec, double* xyz_list, GaussPenta* gauss);
5714- void GetBConduct(double* B_conduct, double* xyz_list, GaussPenta* gauss);
5715- void GetBVert(double* B, double* xyz_list, GaussPenta* gauss);
5716- void GetBprimeAdvec(double* Bprime_advec, double* xyz_list, GaussPenta* gauss);
5717- void GetL(double* L, GaussPenta* gauss,int numdof);
5718- void GetLStokes(double* LStokes, GaussPenta* gauss);
5719- void GetLprimeStokes(double* LprimeStokes, double* xyz_list, GaussPenta* gauss);
5720- void GetLMacAyealStokes(double* LMacAyealStokes, GaussPenta* gauss);
5721- void GetLprimeMacAyealStokes(double* LprimeMacAyealStokes, double* xyz_list, GaussPenta* gauss);
5722- void GetLStokesMacAyeal(double* LStokesMacAyeal, GaussPenta* gauss);
5723- void GetLprimeStokesMacAyeal(double* LprimeStokesMacAyeal, double* xyz_list, GaussPenta* gauss);
5724- void GetInputValue(double* pvalue,double* plist, GaussPenta* gauss);
5725- void GetInputValue(double* pvalue,double* plist,GaussTria* gauss){_error_("only PentaGauss are supported");};
5726- void GetInputDerivativeValue(double* pvalues, double* plist,double* xyz_list, GaussPenta* gauss);
5727- void GetInputDerivativeValue(double* pvalues, double* plist,double* xyz_list, GaussTria* gauss){_error_("only PentaGauss are supported");};
5728+ void GetNodalFunctionsP1(IssmDouble* l1l6, GaussPenta* gauss);
5729+ void GetNodalFunctionsMINI(IssmDouble* l1l7, GaussPenta* gauss);
5730+ void GetNodalFunctionsP1Derivatives(IssmDouble* dh1dh6,IssmDouble* xyz_list, GaussPenta* gauss);
5731+ void GetNodalFunctionsMINIDerivatives(IssmDouble* dh1dh7,IssmDouble* xyz_list, GaussPenta* gauss);
5732+ void GetNodalFunctionsP1DerivativesReference(IssmDouble* dl1dl6,GaussPenta* gauss);
5733+ void GetNodalFunctionsMINIDerivativesReference(IssmDouble* dl1dl7,GaussPenta* gauss);
5734+ void GetQuadNodalFunctions(IssmDouble* l1l4,GaussPenta* gauss,int index1,int index2,int index3,int index4);
5735+ void GetQuadJacobianDeterminant(IssmDouble* Jdet, IssmDouble xyz_list[4][3],GaussPenta* gauss);
5736+ void GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussPenta* gauss);
5737+ void GetJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,GaussPenta* gauss);
5738+ void GetTriaJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,GaussPenta* gauss);
5739+ void GetSegmentJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,GaussPenta* gauss);
5740+ void GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussPenta* gauss);
5741+ void GetBMacAyealPattyn(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss);
5742+ void GetBMacAyealStokes(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss);
5743+ void GetBPattyn(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss);
5744+ void GetBStokes(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss);
5745+ void GetBprimeMacAyealStokes(IssmDouble* Bprime, IssmDouble* xyz_list, GaussPenta* gauss);
5746+ void GetBprimePattyn(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss);
5747+ void GetBprimeStokes(IssmDouble* B_prime, IssmDouble* xyz_list, GaussPenta* gauss);
5748+ void GetBprimeVert(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss);
5749+ void GetBAdvec(IssmDouble* B_advec, IssmDouble* xyz_list, GaussPenta* gauss);
5750+ void GetBConduct(IssmDouble* B_conduct, IssmDouble* xyz_list, GaussPenta* gauss);
5751+ void GetBVert(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss);
5752+ void GetBprimeAdvec(IssmDouble* Bprime_advec, IssmDouble* xyz_list, GaussPenta* gauss);
5753+ void GetL(IssmDouble* L, GaussPenta* gauss,int numdof);
5754+ void GetLStokes(IssmDouble* LStokes, GaussPenta* gauss);
5755+ void GetLprimeStokes(IssmDouble* LprimeStokes, IssmDouble* xyz_list, GaussPenta* gauss);
5756+ void GetLMacAyealStokes(IssmDouble* LMacAyealStokes, GaussPenta* gauss);
5757+ void GetLprimeMacAyealStokes(IssmDouble* LprimeMacAyealStokes, IssmDouble* xyz_list, GaussPenta* gauss);
5758+ void GetLStokesMacAyeal(IssmDouble* LStokesMacAyeal, GaussPenta* gauss);
5759+ void GetLprimeStokesMacAyeal(IssmDouble* LprimeStokesMacAyeal, IssmDouble* xyz_list, GaussPenta* gauss);
5760+ void GetInputValue(IssmDouble* pvalue,IssmDouble* plist, GaussPenta* gauss);
5761+ void GetInputValue(IssmDouble* pvalue,IssmDouble* plist,GaussTria* gauss){_error_("only PentaGauss are supported");};
5762+ void GetInputDerivativeValue(IssmDouble* pvalues, IssmDouble* plist,IssmDouble* xyz_list, GaussPenta* gauss);
5763+ void GetInputDerivativeValue(IssmDouble* pvalues, IssmDouble* plist,IssmDouble* xyz_list, GaussTria* gauss){_error_("only PentaGauss are supported");};
5764
5765 };
5766 #endif
5767Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/Penta.h
5768===================================================================
5769--- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/Penta.h (revision 12470)
5770+++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/Penta.h (revision 12471)
5771@@ -58,22 +58,22 @@
5772 /*}}}*/
5773 /*Update virtual functions definitions: {{{*/
5774 void InputUpdateFromConstant(bool constant, int name);
5775- void InputUpdateFromConstant(double constant, int name);
5776+ void InputUpdateFromConstant(IssmDouble constant, int name);
5777 void InputUpdateFromConstant(int constant, int name);
5778- void InputUpdateFromSolution(double* solutiong);
5779+ void InputUpdateFromSolution(IssmDouble* solutiong);
5780 void InputUpdateFromVector(bool* vector, int name, int type);
5781- void InputUpdateFromVector(double* vector, int name, int type);
5782+ void InputUpdateFromVector(IssmDouble* vector, int name, int type);
5783 void InputUpdateFromVector(int* vector, int name, int type);
5784 #ifdef _HAVE_DAKOTA_
5785 void InputUpdateFromVectorDakota(bool* vector, int name, int type);
5786- void InputUpdateFromVectorDakota(double* vector, int name, int type);
5787+ void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type);
5788 void InputUpdateFromVectorDakota(int* vector, int name, int type);
5789- void InputUpdateFromMatrixDakota(double* matrix, int nows, int ncols, int name, int type);
5790+ void InputUpdateFromMatrixDakota(IssmDouble* matrix, int nows, int ncols, int name, int type);
5791 #endif
5792 void InputUpdateFromIoModel(int index, IoModel* iomodel);
5793 /*}}}*/
5794 /*Element virtual functions definitions: {{{*/
5795- void AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas,double* vertex_response,double* qmu_part);
5796+ void AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part);
5797 void BasalFrictionCreateInput(void);
5798 void ComputeBasalStress(Vector* sigma_b);
5799 void ComputeStrainRate(Vector* eps);
5800@@ -86,57 +86,57 @@
5801 void DeleteResults(void);
5802 int GetNodeIndex(Node* node);
5803 void GetSolutionFromInputs(Vector* solution);
5804- double GetZcoord(GaussPenta* gauss);
5805+ IssmDouble GetZcoord(GaussPenta* gauss);
5806 void GetVectorFromInputs(Vector* vector,int name_enum);
5807 void GetVectorFromResults(Vector* vector,int offset,int interp);
5808
5809 int Sid();
5810- void InputArtificialNoise(int enum_type,double min, double max);
5811- bool InputConvergence(double* eps, int* enums,int num_enums,int* criterionenums,double* criterionvalues,int num_criterionenums);
5812- void InputCreate(double scalar,int name,int code);
5813- void InputCreate(double* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
5814+ void InputArtificialNoise(int enum_type,IssmDouble min, IssmDouble max);
5815+ bool InputConvergence(IssmDouble* eps, int* enums,int num_enums,int* criterionenums,IssmDouble* criterionvalues,int num_criterionenums);
5816+ void InputCreate(IssmDouble scalar,int name,int code);
5817+ void InputCreate(IssmDouble* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
5818 void InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum=MeshElementsEnum);
5819 void InputDuplicate(int original_enum,int new_enum);
5820- void InputScale(int enum_type,double scale_factor);
5821+ void InputScale(int enum_type,IssmDouble scale_factor);
5822
5823- void InputToResult(int enum_type,int step,double time);
5824- void MigrateGroundingLine(double* old_floating_ice,double* sheet_ungrounding);
5825+ void InputToResult(int enum_type,int step,IssmDouble time);
5826+ void MigrateGroundingLine(IssmDouble* old_floating_ice,IssmDouble* sheet_ungrounding);
5827 void PotentialSheetUngrounding(Vector* potential_sheet_ungrounding);
5828- void RequestedOutput(int output_enum,int step,double time);
5829- void ListResultsInfo(int** results_enums,int** results_size,double** results_times,int** results_steps,int* num_results);
5830+ void RequestedOutput(int output_enum,int step,IssmDouble time);
5831+ void ListResultsInfo(int** results_enums,int** results_size,IssmDouble** results_times,int** results_steps,int* num_results);
5832 void PatchFill(int* pcount, Patch* patch);
5833 void PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes);
5834- void PositiveDegreeDay(double* pdds,double* pds,double signorm);
5835+ void PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm);
5836 void ProcessResultsUnits(void);
5837 void ResetCoordinateSystem(void);
5838- double SurfaceArea(void);
5839+ IssmDouble SurfaceArea(void);
5840 void Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type);
5841- int UpdatePotentialSheetUngrounding(double* potential_sheet_ungrounding,Vector* vec_nodes_on_iceshelf,double* nodes_on_iceshelf);
5842- int NodalValue(double* pvalue, int index, int natureofdataenum,bool process_units);
5843- double TimeAdapt();
5844+ int UpdatePotentialSheetUngrounding(IssmDouble* potential_sheet_ungrounding,Vector* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf);
5845+ int NodalValue(IssmDouble* pvalue, int index, int natureofdataenum,bool process_units);
5846+ IssmDouble TimeAdapt();
5847 int* GetHorizontalNeighboorSids(void);
5848 void ViscousHeatingCreateInput(void);
5849- void SmearFunction(Vector* smearedvector,double (*WeightFunction)(double distance,double radius),double radius);
5850+ void SmearFunction(Vector* smearedvector,IssmDouble (*WeightFunction)(IssmDouble distance,IssmDouble radius),IssmDouble radius);
5851
5852 #ifdef _HAVE_RESPONSES_
5853- double IceVolume(void);
5854- void MinVel(double* pminvel, bool process_units);
5855- void MinVx(double* pminvx, bool process_units);
5856- void MinVy(double* pminvy, bool process_units);
5857- void MinVz(double* pminvz, bool process_units);
5858- double MassFlux(double* segment,bool process_units);
5859- void MaxAbsVx(double* pmaxabsvx, bool process_units);
5860- void MaxAbsVy(double* pmaxabsvy, bool process_units);
5861- void MaxAbsVz(double* pmaxabsvz, bool process_units);
5862- void MaxVel(double* pmaxvel, bool process_units);
5863- void ElementResponse(double* presponse,int response_enum,bool process_units);
5864- void MaxVx(double* pmaxvx, bool process_units);
5865- void MaxVy(double* pmaxvy, bool process_units);
5866- void MaxVz(double* pmaxvz, bool process_units);
5867+ IssmDouble IceVolume(void);
5868+ void MinVel(IssmDouble* pminvel, bool process_units);
5869+ void MinVx(IssmDouble* pminvx, bool process_units);
5870+ void MinVy(IssmDouble* pminvy, bool process_units);
5871+ void MinVz(IssmDouble* pminvz, bool process_units);
5872+ IssmDouble MassFlux(IssmDouble* segment,bool process_units);
5873+ void MaxAbsVx(IssmDouble* pmaxabsvx, bool process_units);
5874+ void MaxAbsVy(IssmDouble* pmaxabsvy, bool process_units);
5875+ void MaxAbsVz(IssmDouble* pmaxabsvz, bool process_units);
5876+ void MaxVel(IssmDouble* pmaxvel, bool process_units);
5877+ void ElementResponse(IssmDouble* presponse,int response_enum,bool process_units);
5878+ void MaxVx(IssmDouble* pmaxvx, bool process_units);
5879+ void MaxVy(IssmDouble* pmaxvy, bool process_units);
5880+ void MaxVz(IssmDouble* pmaxvz, bool process_units);
5881 #endif
5882
5883 #ifdef _HAVE_CONTROL_
5884- double DragCoefficientAbsGradient(bool process_units,int weight_index);
5885+ IssmDouble DragCoefficientAbsGradient(bool process_units,int weight_index);
5886 void GradientIndexing(int* indexing,int control_index);
5887 void Gradj(Vector* gradient,int control_type,int control_index);
5888 void GradjDragMacAyeal(Vector* gradient,int control_index);
5889@@ -146,23 +146,23 @@
5890 void GradjBbarPattyn(Vector* gradient,int control_index);
5891 void GradjBbarStokes(Vector* gradient,int control_index);
5892 void GetVectorFromControlInputs(Vector* gradient,int control_enum,int control_index,const char* data);
5893- void SetControlInputsFromVector(double* vector,int control_enum,int control_index);
5894+ void SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index);
5895 void ControlInputGetGradient(Vector* gradient,int enum_type,int control_index);
5896- void ControlInputScaleGradient(int enum_type,double scale);
5897- void ControlInputSetGradient(double* gradient,int enum_type,int control_index);
5898- double RheologyBbarAbsGradient(bool process_units,int weight_index);
5899- double ThicknessAbsMisfit( bool process_units,int weight_index);
5900- double SurfaceAbsVelMisfit( bool process_units,int weight_index);
5901- double SurfaceRelVelMisfit( bool process_units,int weight_index);
5902- double SurfaceLogVelMisfit( bool process_units,int weight_index);
5903- double SurfaceLogVxVyMisfit( bool process_units,int weight_index);
5904- double SurfaceAverageVelMisfit(bool process_units,int weight_index);
5905- double ThicknessAbsGradient(bool process_units,int weight_index);
5906- void InputControlUpdate(double scalar,bool save_parameter);
5907+ void ControlInputScaleGradient(int enum_type,IssmDouble scale);
5908+ void ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index);
5909+ IssmDouble RheologyBbarAbsGradient(bool process_units,int weight_index);
5910+ IssmDouble ThicknessAbsMisfit( bool process_units,int weight_index);
5911+ IssmDouble SurfaceAbsVelMisfit( bool process_units,int weight_index);
5912+ IssmDouble SurfaceRelVelMisfit( bool process_units,int weight_index);
5913+ IssmDouble SurfaceLogVelMisfit( bool process_units,int weight_index);
5914+ IssmDouble SurfaceLogVxVyMisfit( bool process_units,int weight_index);
5915+ IssmDouble SurfaceAverageVelMisfit(bool process_units,int weight_index);
5916+ IssmDouble ThicknessAbsGradient(bool process_units,int weight_index);
5917+ void InputControlUpdate(IssmDouble scalar,bool save_parameter);
5918 #endif
5919 /*}}}*/
5920 /*Penta specific routines:{{{*/
5921- void BedNormal(double* bed_normal, double xyz_list[3][3]);
5922+ void BedNormal(IssmDouble* bed_normal, IssmDouble xyz_list[3][3]);
5923 ElementMatrix* CreateKMatrixPrognostic(void);
5924 ElementMatrix* CreateKMatrixSlope(void);
5925 ElementVector* CreatePVectorPrognostic(void);
5926@@ -172,35 +172,35 @@
5927 void GetSidList(int* sidlist);
5928 void GetConnectivityList(int* connectivity);
5929 int GetElementType(void);
5930- void GetElementSizes(double* hx,double* hy,double* hz);
5931- void GetInputListOnVertices(double* pvalue,int enumtype);
5932- void GetInputListOnVertices(double* pvalue,int enumtype,double defaultvalue);
5933- void GetInputValue(double* pvalue,Node* node,int enumtype);
5934- void GetPhi(double* phi, double* epsilon, double viscosity);
5935+ void GetElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
5936+ void GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
5937+ void GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
5938+ void GetInputValue(IssmDouble* pvalue,Node* node,int enumtype);
5939+ void GetPhi(IssmDouble* phi, IssmDouble* epsilon, IssmDouble viscosity);
5940 void GetSolutionFromInputsEnthalpy(Vector* solutiong);
5941- double GetStabilizationParameter(double u, double v, double w, double diameter, double kappa);
5942- void GetStrainRate3dPattyn(double* epsilon,double* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input);
5943- void GetStrainRate3d(double* epsilon,double* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input, Input* vz_input);
5944+ IssmDouble GetStabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa);
5945+ void GetStrainRate3dPattyn(IssmDouble* epsilon,IssmDouble* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input);
5946+ void GetStrainRate3d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input, Input* vz_input);
5947 Penta* GetUpperElement(void);
5948 Penta* GetLowerElement(void);
5949 Penta* GetBasalElement(void);
5950 void InputExtrude(int enum_type,int object_type);
5951- void InputUpdateFromSolutionPrognostic(double* solutiong);
5952- void InputUpdateFromSolutionOneDof(double* solutiong,int enum_type);
5953- void InputUpdateFromSolutionOneDofCollapsed(double* solutiong,int enum_type);
5954+ void InputUpdateFromSolutionPrognostic(IssmDouble* solutiong);
5955+ void InputUpdateFromSolutionOneDof(IssmDouble* solutiong,int enum_type);
5956+ void InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solutiong,int enum_type);
5957 bool IsInput(int name);
5958 bool IsOnSurface(void);
5959 bool IsOnBed(void);
5960 bool IsFloating(void);
5961 bool IsNodeOnShelf();
5962- bool IsNodeOnShelfFromFlags(double* flags);
5963+ bool IsNodeOnShelfFromFlags(IssmDouble* flags);
5964 bool IsOnWater(void);
5965- double MinEdgeLength(double xyz_list[6][3]);
5966- void ReduceMatrixStokes(double* Ke_reduced, double* Ke_temp);
5967- void ReduceVectorStokes(double* Pe_reduced, double* Ke_temp, double* Pe_temp);
5968+ IssmDouble MinEdgeLength(IssmDouble xyz_list[6][3]);
5969+ void ReduceMatrixStokes(IssmDouble* Ke_reduced, IssmDouble* Ke_temp);
5970+ void ReduceVectorStokes(IssmDouble* Pe_reduced, IssmDouble* Ke_temp, IssmDouble* Pe_temp);
5971 void SetClone(int* minranks);
5972 Tria* SpawnTria(int g0, int g1, int g2);
5973- void SurfaceNormal(double* surface_normal, double xyz_list[3][3]);
5974+ void SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]);
5975
5976 #ifdef _HAVE_DIAGNOSTIC_
5977 ElementMatrix* CreateKMatrixCouplingMacAyealPattyn(void);
5978@@ -235,15 +235,15 @@
5979 ElementMatrix* CreateJacobianDiagnosticMacayeal2d(void);
5980 ElementMatrix* CreateJacobianDiagnosticPattyn(void);
5981 ElementMatrix* CreateJacobianDiagnosticStokes(void);
5982- void InputUpdateFromSolutionDiagnosticHoriz( double* solutiong);
5983- void InputUpdateFromSolutionDiagnosticMacAyeal( double* solutiong);
5984- void InputUpdateFromSolutionDiagnosticMacAyealPattyn( double* solutiong);
5985- void InputUpdateFromSolutionDiagnosticMacAyealStokes( double* solutiong);
5986- void InputUpdateFromSolutionDiagnosticPattyn( double* solutiong);
5987- void InputUpdateFromSolutionDiagnosticPattynStokes( double* solutiong);
5988- void InputUpdateFromSolutionDiagnosticHutter( double* solutiong);
5989- void InputUpdateFromSolutionDiagnosticVert( double* solutiong);
5990- void InputUpdateFromSolutionDiagnosticStokes( double* solutiong);
5991+ void InputUpdateFromSolutionDiagnosticHoriz( IssmDouble* solutiong);
5992+ void InputUpdateFromSolutionDiagnosticMacAyeal( IssmDouble* solutiong);
5993+ void InputUpdateFromSolutionDiagnosticMacAyealPattyn( IssmDouble* solutiong);
5994+ void InputUpdateFromSolutionDiagnosticMacAyealStokes( IssmDouble* solutiong);
5995+ void InputUpdateFromSolutionDiagnosticPattyn( IssmDouble* solutiong);
5996+ void InputUpdateFromSolutionDiagnosticPattynStokes( IssmDouble* solutiong);
5997+ void InputUpdateFromSolutionDiagnosticHutter( IssmDouble* solutiong);
5998+ void InputUpdateFromSolutionDiagnosticVert( IssmDouble* solutiong);
5999+ void InputUpdateFromSolutionDiagnosticStokes( IssmDouble* solutiong);
6000 void GetSolutionFromInputsDiagnosticHoriz(Vector* solutiong);
6001 void GetSolutionFromInputsDiagnosticHutter(Vector* solutiong);
6002 void GetSolutionFromInputsDiagnosticStokes(Vector* solutiong);
6003@@ -277,8 +277,8 @@
6004 ElementVector* CreatePVectorAdjointMacAyeal(void);
6005 ElementVector* CreatePVectorAdjointPattyn(void);
6006 ElementVector* CreatePVectorAdjointStokes(void);
6007- void InputUpdateFromSolutionAdjointHoriz( double* solutiong);
6008- void InputUpdateFromSolutionAdjointStokes( double* solutiong);
6009+ void InputUpdateFromSolutionAdjointHoriz( IssmDouble* solutiong);
6010+ void InputUpdateFromSolutionAdjointStokes( IssmDouble* solutiong);
6011 #endif
6012
6013 #ifdef _HAVE_HYDROLOGY_
6014@@ -302,8 +302,8 @@
6015 ElementVector* CreatePVectorThermalShelf(void);
6016 ElementVector* CreatePVectorThermalSheet(void);
6017 void GetSolutionFromInputsThermal(Vector* solutiong);
6018- void InputUpdateFromSolutionThermal( double* solutiong);
6019- void InputUpdateFromSolutionEnthalpy( double* solutiong);
6020+ void InputUpdateFromSolutionThermal( IssmDouble* solutiong);
6021+ void InputUpdateFromSolutionEnthalpy( IssmDouble* solutiong);
6022 #endif
6023 #ifdef _HAVE_BALANCED_
6024 ElementMatrix* CreateKMatrixBalancethickness(void);
6025Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/TriaRef.cpp
6026===================================================================
6027--- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/TriaRef.cpp (revision 12470)
6028+++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Elements/TriaRef.cpp (revision 12471)
6029@@ -56,7 +56,7 @@
6030
6031 /*Reference Element numerics*/
6032 /*FUNCTION TriaRef::GetBMacAyeal {{{*/
6033-void TriaRef::GetBMacAyeal(double* B, double* xyz_list, GaussTria* gauss){
6034+void TriaRef::GetBMacAyeal(IssmDouble* B, IssmDouble* xyz_list, GaussTria* gauss){
6035 /*Compute B matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2.
6036 * For node i, Bi can be expressed in the actual coordinate system
6037 * by:
6038@@ -69,7 +69,7 @@
6039 */
6040
6041 int i;
6042- double dbasis[NDOF2][NUMNODES];
6043+ IssmDouble dbasis[NDOF2][NUMNODES];
6044
6045 /*Get dh1dh2dh3 in actual coordinate system: */
6046 GetNodalFunctionsDerivatives(&dbasis[0][0],xyz_list,gauss);
6047@@ -86,7 +86,7 @@
6048 }
6049 /*}}}*/
6050 /*FUNCTION TriaRef::GetBMacAyealStokes {{{*/
6051-void TriaRef::GetBMacAyealStokes(double* B, double* xyz_list, GaussTria* gauss){
6052+void TriaRef::GetBMacAyealStokes(IssmDouble* B, IssmDouble* xyz_list, GaussTria* gauss){
6053
6054 /*Compute B matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2.
6055 * For node i, Bi can be expressed in the actual coordinate system
6056@@ -100,7 +100,7 @@
6057 */
6058
6059 /*Same thing in the actual coordinate system: */
6060- double dbasis[NDOF2][NUMNODES];
6061+ IssmDouble dbasis[NDOF2][NUMNODES];
6062
6063 /*Get dh1dh2dh3 in actual coordinates system : */
6064 GetNodalFunctionsDerivatives(&dbasis[0][0],xyz_list,gauss);
6065@@ -117,7 +117,7 @@
6066 }
6067 /*}}}*/
6068 /*FUNCTION TriaRef::GetSegmentBFlux{{{*/
6069-void TriaRef::GetSegmentBFlux(double* B,GaussTria* gauss, int index1,int index2){
6070+void TriaRef::GetSegmentBFlux(IssmDouble* B,GaussTria* gauss, int index1,int index2){
6071 /*Compute B matrix. B=[phi1 phi2 -phi3 -phi4]
6072 *
6073 * and phi1=phi3 phi2=phi4
6074@@ -125,7 +125,7 @@
6075 * We assume B has been allocated already, of size: 1x4
6076 */
6077
6078- double l1l3[NUMNODES];
6079+ IssmDouble l1l3[NUMNODES];
6080
6081 GetNodalFunctions(&l1l3[0],gauss);
6082
6083@@ -136,7 +136,7 @@
6084 }
6085 /*}}}*/
6086 /*FUNCTION TriaRef::GetSegmentBprimeFlux{{{*/
6087-void TriaRef::GetSegmentBprimeFlux(double* Bprime,GaussTria* gauss, int index1,int index2){
6088+void TriaRef::GetSegmentBprimeFlux(IssmDouble* Bprime,GaussTria* gauss, int index1,int index2){
6089 /*Compute Bprime matrix. Bprime=[phi1 phi2 phi3 phi4]
6090 *
6091 * and phi1=phi3 phi2=phi4
6092@@ -144,7 +144,7 @@
6093 * We assume Bprime has been allocated already, of size: 1x4
6094 */
6095
6096- double l1l3[NUMNODES];
6097+ IssmDouble l1l3[NUMNODES];
6098
6099 GetNodalFunctions(&l1l3[0],gauss);
6100
6101@@ -155,7 +155,7 @@
6102 }
6103 /*}}}*/
6104 /*FUNCTION TriaRef::GetBPrognostic{{{*/
6105-void TriaRef::GetBPrognostic(double* B_prog, double* xyz_list, GaussTria* gauss){
6106+void TriaRef::GetBPrognostic(IssmDouble* B_prog, IssmDouble* xyz_list, GaussTria* gauss){
6107 /*Compute B matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2.
6108 * For node i, Bi can be expressed in the actual coordinate system
6109 * by:
6110@@ -166,7 +166,7 @@
6111 * We assume B_prog has been allocated already, of size: 2x(NDOF1*NUMNODES)
6112 */
6113
6114- double basis[NUMNODES];
6115+ IssmDouble basis[NUMNODES];
6116
6117 /*Get dh1dh2dh3 in actual coordinate system: */
6118 GetNodalFunctions(&basis[0],gauss);
6119@@ -179,7 +179,7 @@
6120 }
6121 /*}}}*/
6122 /*FUNCTION TriaRef::GetBprimeMacAyeal {{{*/
6123-void TriaRef::GetBprimeMacAyeal(double* Bprime, double* xyz_list, GaussTria* gauss){
6124+void TriaRef::GetBprimeMacAyeal(IssmDouble* Bprime, IssmDouble* xyz_list, GaussTria* gauss){
6125
6126 /*Compute B' matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2.
6127 * For node i, Bi' can be expressed in the actual coordinate system
6128@@ -193,7 +193,7 @@
6129 */
6130
6131 /*Same thing in the actual coordinate system: */
6132- double dbasis[NDOF2][NUMNODES];
6133+ IssmDouble dbasis[NDOF2][NUMNODES];
6134
6135 /*Get dh1dh2dh3 in actual coordinates system : */
6136 GetNodalFunctionsDerivatives(&dbasis[0][0],xyz_list,gauss);
6137@@ -210,7 +210,7 @@
6138 }
6139 /*}}}*/
6140 /*FUNCTION TriaRef::GetBprimeMacAyealStokes {{{*/
6141-void TriaRef::GetBprimeMacAyealStokes(double* Bprime, double* xyz_list, GaussTria* gauss){
6142+void TriaRef::GetBprimeMacAyealStokes(IssmDouble* Bprime, IssmDouble* xyz_list, GaussTria* gauss){
6143
6144 /*Compute Bprime matrix. Bprime=[Bprime1 Bprime2 Bprime3] where Bprimei is of size 3*NDOF2.
6145 * For node i, Bprimei can be expressed in the actual coordinate system
6146@@ -225,7 +225,7 @@
6147 */
6148
6149 /*Same thing in the actual coordinate system: */
6150- double dbasis[NDOF2][NUMNODES];
6151+ IssmDouble dbasis[NDOF2][NUMNODES];
6152
6153 /*Get dh1dh2dh3 in actual coordinates system : */
6154 GetNodalFunctionsDerivatives(&dbasis[0][0],xyz_list,gauss);
6155@@ -244,7 +244,7 @@
6156 }
6157 /*}}}*/
6158 /*FUNCTION TriaRef::GetBprimePrognostic{{{*/
6159-void TriaRef::GetBprimePrognostic(double* Bprime_prog, double* xyz_list, GaussTria* gauss){
6160+void TriaRef::GetBprimePrognostic(IssmDouble* Bprime_prog, IssmDouble* xyz_list, GaussTria* gauss){
6161 /*Compute B' matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2.
6162 * For node i, Bi' can be expressed in the actual coordinate system
6163 * by:
6164@@ -256,7 +256,7 @@
6165 */
6166
6167 /*Same thing in the actual coordinate system: */
6168- double dbasis[NDOF2][NUMNODES];
6169+ IssmDouble dbasis[NDOF2][NUMNODES];
6170
6171 /*Get dh1dh2dh3 in actual coordinates system : */
6172 GetNodalFunctionsDerivatives(&dbasis[0][0],xyz_list,gauss);
6173@@ -269,7 +269,7 @@
6174 }
6175 /*}}}*/
6176 /*FUNCTION TriaRef::GetL{{{*/
6177-void TriaRef::GetL(double* L, double* xyz_list,GaussTria* gauss,int numdof){
6178+void TriaRef::GetL(IssmDouble* L, IssmDouble* xyz_list,GaussTria* gauss,int numdof){
6179 /*Compute L matrix. L=[L1 L2 L3] where Li is square and of size numdof.
6180 * For node i, Li can be expressed in the actual coordinate system
6181 * by:
6182@@ -284,7 +284,7 @@
6183 */
6184
6185 int i;
6186- double basis[3];
6187+ IssmDouble basis[3];
6188
6189 /*Get basis in actual coordinate system: */
6190 GetNodalFunctions(basis,gauss);
6191@@ -306,10 +306,10 @@
6192 }
6193 /*}}}*/
6194 /*FUNCTION TriaRef::GetJacobian{{{*/
6195-void TriaRef::GetJacobian(double* J, double* xyz_list,GaussTria* gauss){
6196+void TriaRef::GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussTria* gauss){
6197 /*The Jacobian is constant over the element, discard the gaussian points.
6198 * J is assumed to have been allocated of size NDOF2xNDOF2.*/
6199- double x1,y1,x2,y2,x3,y3;
6200+ IssmDouble x1,y1,x2,y2,x3,y3;
6201
6202 x1=*(xyz_list+NUMNODES*0+0);
6203 y1=*(xyz_list+NUMNODES*0+1);
6204@@ -326,10 +326,10 @@
6205 }
6206 /*}}}*/
6207 /*FUNCTION TriaRef::GetSegmentJacobianDeterminant{{{*/
6208-void TriaRef::GetSegmentJacobianDeterminant(double* Jdet, double* xyz_list,GaussTria* gauss){
6209+void TriaRef::GetSegmentJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,GaussTria* gauss){
6210 /*The Jacobian determinant is constant over the element, discard the gaussian points.
6211 * J is assumed to have been allocated*/
6212- double x1,y1,x2,y2;
6213+ IssmDouble x1,y1,x2,y2;
6214
6215 x1=*(xyz_list+3*0+0);
6216 y1=*(xyz_list+3*0+1);
6217@@ -342,10 +342,10 @@
6218 }
6219 /*}}}*/
6220 /*FUNCTION TriaRef::GetJacobianDeterminant2d{{{*/
6221-void TriaRef::GetJacobianDeterminant2d(double* Jdet, double* xyz_list,GaussTria* gauss){
6222+void TriaRef::GetJacobianDeterminant2d(IssmDouble* Jdet, IssmDouble* xyz_list,GaussTria* gauss){
6223 /*The Jacobian determinant is constant over the element, discard the gaussian points.
6224 * J is assumed to have been allocated of size NDOF2xNDOF2.*/
6225- double J[2][2];
6226+ IssmDouble J[2][2];
6227
6228 /*Get Jacobian*/
6229 GetJacobian(&J[0][0],xyz_list,gauss);
6230@@ -357,11 +357,11 @@
6231 }
6232 /*}}}*/
6233 /*FUNCTION TriaRef::GetJacobianDeterminant3d {{{*/
6234-void TriaRef::GetJacobianDeterminant3d(double* Jdet, double* xyz_list,GaussTria* gauss){
6235+void TriaRef::GetJacobianDeterminant3d(IssmDouble* Jdet, IssmDouble* xyz_list,GaussTria* gauss){
6236 /*The Jacobian determinant is constant over the element, discard the gaussian points.
6237 * J is assumed to have been allocated of size NDOF2xNDOF2.*/
6238
6239- double x1,x2,x3,y1,y2,y3,z1,z2,z3;
6240+ IssmDouble x1,x2,x3,y1,y2,y3,z1,z2,z3;
6241
6242 x1=*(xyz_list+3*0+0);
6243 y1=*(xyz_list+3*0+1);
6244@@ -379,10 +379,10 @@
6245 }
6246 /*}}}*/
6247 /*FUNCTION TriaRef::GetJacobianInvert{{{*/
6248-void TriaRef::GetJacobianInvert(double* Jinv, double* xyz_list,GaussTria* gauss){
6249+void TriaRef::GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussTria* gauss){
6250
6251 /*Jacobian*/
6252- double J[2][2];
6253+ IssmDouble J[2][2];
6254
6255 /*Call Jacobian routine to get the jacobian:*/
6256 GetJacobian(&J[0][0], xyz_list, gauss);
6257@@ -393,7 +393,7 @@
6258 }
6259 /*}}}*/
6260 /*FUNCTION TriaRef::GetNodalFunctions{{{*/
6261-void TriaRef::GetNodalFunctions(double* basis,GaussTria* gauss){
6262+void TriaRef::GetNodalFunctions(IssmDouble* basis,GaussTria* gauss){
6263 /*This routine returns the values of the nodal functions at the gaussian point.*/
6264
6265 basis[0]=gauss->coord1;
6266@@ -403,10 +403,10 @@
6267 }
6268 /*}}}*/
6269 /*FUNCTION TriaRef::GetSegmentNodalFunctions{{{*/
6270-void TriaRef::GetSegmentNodalFunctions(double* basis,GaussTria* gauss,int index1,int index2){
6271+void TriaRef::GetSegmentNodalFunctions(IssmDouble* basis,GaussTria* gauss,int index1,int index2){
6272 /*This routine returns the values of the nodal functions at the gaussian point.*/
6273
6274- double BasisFunctions[3];
6275+ IssmDouble BasisFunctions[3];
6276
6277 GetNodalFunctions(&BasisFunctions[0],gauss);
6278
6279@@ -417,13 +417,13 @@
6280 }
6281 /*}}}*/
6282 /*FUNCTION TriaRef::GetNodalFunctionsDerivatives{{{*/
6283-void TriaRef::GetNodalFunctionsDerivatives(double* dbasis,double* xyz_list, GaussTria* gauss){
6284+void TriaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTria* gauss){
6285
6286 /*This routine returns the values of the nodal functions derivatives (with respect to the
6287 * actual coordinate system): */
6288 int i;
6289- double dbasis_ref[NDOF2][NUMNODES];
6290- double Jinv[NDOF2][NDOF2];
6291+ IssmDouble dbasis_ref[NDOF2][NUMNODES];
6292+ IssmDouble Jinv[NDOF2][NDOF2];
6293
6294 /*Get derivative values with respect to parametric coordinate system: */
6295 GetNodalFunctionsDerivativesReference(&dbasis_ref[0][0], gauss);
6296@@ -444,7 +444,7 @@
6297 }
6298 /*}}}*/
6299 /*FUNCTION TriaRef::GetNodalFunctionsDerivativesReference{{{*/
6300-void TriaRef::GetNodalFunctionsDerivativesReference(double* dl1dl3,GaussTria* gauss){
6301+void TriaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dl1dl3,GaussTria* gauss){
6302 /*This routine returns the values of the nodal functions derivatives (with respect to the
6303 * natural coordinate system) at the gaussian point. */
6304
6305@@ -463,7 +463,7 @@
6306 }
6307 /*}}}*/
6308 /*FUNCTION TriaRef::GetInputDerivativeValue{{{*/
6309-void TriaRef::GetInputDerivativeValue(double* p, double* plist,double* xyz_list, GaussTria* gauss){
6310+void TriaRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussTria* gauss){
6311
6312 /*From node values of parameter p (plist[0],plist[1],plist[2]), return parameter derivative value at gaussian
6313 * point specified by gauss_basis:
6314@@ -474,7 +474,7 @@
6315 */
6316
6317 /*Nodal Derivatives*/
6318- double dbasis[2][3]; //nodal derivative functions in actual coordinate system.
6319+ IssmDouble dbasis[2][3]; //nodal derivative functions in actual coordinate system.
6320
6321 /*Get dh1dh2dh3 in actual coordinate system: */
6322 GetNodalFunctionsDerivatives(&dbasis[0][0],xyz_list, gauss);
6323@@ -486,13 +486,13 @@
6324 }
6325 /*}}}*/
6326 /*FUNCTION TriaRef::GetInputValue{{{*/
6327-void TriaRef::GetInputValue(double* p, double* plist, GaussTria* gauss){
6328+void TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTria* gauss){
6329
6330 /*From node values of parameter p (plist[0],plist[1],plist[2]), return parameter value at gaussian
6331 * point specifie by gauss: */
6332
6333 /*nodal functions annd output: */
6334- double basis[3];
6335+ IssmDouble basis[3];
6336
6337 /*Get nodal functions*/
6338 GetNodalFunctions(basis, gauss);
Note: See TracBrowser for help on using the repository browser.