Changeset 5662
- Timestamp:
- 09/03/10 09:38:58 (15 years ago)
- Location:
- issm/trunk/src/c/objects/Elements
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Penta.cpp
r5660 r5662 18 18 #include "../../Container/Container.h" 19 19 /*}}}*/ 20 21 /*Element macros*/ 22 #define NUMVERTICES 6 20 23 21 24 /*Penta constructors and destructor*/ … … 482 485 483 486 int i,j; 484 const int numgrids=6; 485 int doflist[numgrids]; 486 double xyz_list[numgrids][3]; 487 int doflist[NUMVERTICES]; 488 double xyz_list[NUMVERTICES][3]; 487 489 double xyz_list_tria[3][3]; 488 490 … … 555 557 556 558 /* Get node coordinates and dof list: */ 557 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);559 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 558 560 for(i=0;i<3;i++){ 559 561 for(j=0;j<3;j++){ … … 968 970 969 971 int i; 970 const int numvertices=6; 971 int doflist1[numvertices]; 972 int doflist1[NUMVERTICES]; 972 973 973 974 /*Find NameEnum input in the inputs dataset, and get it to fill in the vector: */ … … 1107 1108 1108 1109 /*Intermediaries*/ 1109 const int numvertices=6;1110 1110 bool onbed; 1111 1111 int step,i; … … 1119 1119 Input* depth_averaged_input=NULL; 1120 1120 1121 double xyz_list[ numvertices][3];1122 double Helem_list[ numvertices];1123 double zeros_list[ numvertices]={0.0};1121 double xyz_list[NUMVERTICES][3]; 1122 double Helem_list[NUMVERTICES]; 1123 double zeros_list[NUMVERTICES]={0.0}; 1124 1124 1125 1125 /*recover parameters: */ … … 1157 1157 1158 1158 /*Step2: Create element thickness input*/ 1159 GetVerticesCoordinates(&xyz_list[0][0],penta->nodes, numvertices);1159 GetVerticesCoordinates(&xyz_list[0][0],penta->nodes,NUMVERTICES); 1160 1160 for(i=0;i<3;i++){ 1161 1161 Helem_list[i]=xyz_list[i+3][2]-xyz_list[i][2]; … … 1705 1705 /*output: */ 1706 1706 int numrows = 0; 1707 int numvertices = 0;1708 1707 int numnodes = 0; 1709 1708 … … 1714 1713 numrows++; 1715 1714 /*now, how many vertices and how many nodal values for this result? :*/ 1716 numvertices=6; //this is a penta element, with 6 vertices1717 1715 numnodes=elementresult->NumberOfNodalValues(); //ask result object. 1718 1716 } … … 1720 1718 /*Assign output pointers:*/ 1721 1719 *pnumrows=numrows; 1722 *pnumvertices= numvertices;1720 *pnumvertices=NUMVERTICES; 1723 1721 *pnumnodes=numnodes; 1724 1722 … … 2153 2151 2154 2152 /* node data: */ 2155 const int numgridsm=3; //MacAyealnumgrids2156 const int numdofm=2* numgridsm;2157 const int numgridsp=6; //Pattyn numgrids2158 const int numdofp=2* numgridsp;2159 double xyz_list[ numgridsp][3];2153 const int NUMVERTICESm=3; //MacAyealNUMVERTICES 2154 const int numdofm=2*NUMVERTICESm; 2155 const int NUMVERTICESp=6; //Pattyn NUMVERTICES 2156 const int numdofp=2*NUMVERTICESp; 2157 double xyz_list[NUMVERTICESp][3]; 2160 2158 int* doflistm=NULL; 2161 2159 int* doflistp=NULL; … … 2226 2224 2227 2225 /* Get node coordinates and dof list: */ 2228 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgridsp);2226 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICESp); 2229 2227 tria->GetDofList(&doflistm,MacAyealApproximationEnum); //Pattyn dof list 2230 2228 GetDofList(&doflistp,PattynApproximationEnum); //MacAyeal dof list … … 2304 2302 /*Collapsed formulation: */ 2305 2303 int i; 2306 const int numgrids=6;2307 2304 const int NDOF2=2; 2308 const int numdofs=NDOF2* numgrids;2305 const int numdofs=NDOF2*NUMVERTICES; 2309 2306 int* doflist=NULL; 2310 2307 double Ke_gg[numdofs][numdofs]={0.0}; … … 2389 2386 2390 2387 /* node data: */ 2391 const int numgrids3d=6;2392 const int numgrids2d=3;2393 const int numdof2d=2* numgrids2d;2394 double xyz_list[ numgrids3d][3];2388 const int NUMVERTICES3d=6; 2389 const int NUMVERTICES2d=3; 2390 const int numdof2d=2*NUMVERTICES2d; 2391 double xyz_list[NUMVERTICES3d][3]; 2395 2392 int* doflist=NULL; 2396 2393 … … 2500 2497 2501 2498 /* Get node coordinates and dof list: */ 2502 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids3d);2499 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES3d); 2503 2500 tria->GetDofList(&doflist,MacAyealApproximationEnum); //Pattyn dof list 2504 2501 … … 2576 2573 2577 2574 /* node data: */ 2578 const int numgrids=6; 2579 const int numdof=2*numgrids; 2580 double xyz_list[numgrids][3]; 2575 const int numdof=2*NUMVERTICES; 2576 double xyz_list[NUMVERTICES][3]; 2581 2577 int* doflist=NULL; 2582 2578 … … 2648 2644 2649 2645 /* Get node coordinates and dof list: */ 2650 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);2646 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 2651 2647 GetDofList(&doflist,PattynApproximationEnum); 2652 2648 … … 2719 2715 2720 2716 int i,j; 2721 const int numgrids=6;2722 2717 const int DOFPERGRID=4; 2723 const int numdof= numgrids*DOFPERGRID;2718 const int numdof=NUMVERTICES*DOFPERGRID; 2724 2719 int* doflist=NULL; 2725 2720 2726 const int numgrids2d=3;2727 const int numdof2d= numgrids2d*DOFPERGRID;2721 const int NUMVERTICES2d=3; 2722 const int numdof2d=NUMVERTICES2d*DOFPERGRID; 2728 2723 2729 2724 /*Collapsed formulation: */ … … 2731 2726 2732 2727 /*Grid data: */ 2733 double xyz_list[ numgrids][3];2734 double xyz_list_tria[ numgrids2d][3];2728 double xyz_list[NUMVERTICES][3]; 2729 double xyz_list_tria[NUMVERTICES2d][3]; 2735 2730 double bed_normal[3]; 2736 2731 … … 2759 2754 double* area_gauss_weights = NULL; 2760 2755 double* vert_gauss_weights = NULL; 2761 double gaussgrids[ numgrids][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}};2756 double gaussgrids[NUMVERTICES][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}}; 2762 2757 2763 2758 /* specific gaussian point: */ … … 2802 2797 2803 2798 /* Get node coordinates and dof list: */ 2804 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);2799 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 2805 2800 GetDofList(&doflist,StokesApproximationEnum); 2806 2801 … … 2877 2872 friction=new Friction("3d",inputs,matpar,analysis_type); 2878 2873 2879 for(i=0;i< numgrids2d;i++){2874 for(i=0;i<NUMVERTICES2d;i++){ 2880 2875 for(j=0;j<3;j++){ 2881 2876 xyz_list_tria[i][j]=xyz_list[i][j]; … … 2975 2970 2976 2971 /* node data: */ 2977 const int numgrids=6;2978 2972 const int NDOF1=1; 2979 const int numdof=NDOF1* numgrids;2980 double xyz_list[ numgrids][3];2973 const int numdof=NDOF1*NUMVERTICES; 2974 double xyz_list[NUMVERTICES][3]; 2981 2975 int* doflist=NULL; 2982 2976 … … 2989 2983 double Ke_gg_gaussian[numdof][numdof]; 2990 2984 double Jdet; 2991 double B[NDOF1][ numgrids];2992 double Bprime[NDOF1][ numgrids];2985 double B[NDOF1][NUMVERTICES]; 2986 double Bprime[NDOF1][NUMVERTICES]; 2993 2987 double DL_scalar; 2994 2988 … … 3018 3012 3019 3013 /* Get node coordinates and dof list: */ 3020 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);3014 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 3021 3015 GetDofList(&doflist); 3022 3016 … … 3036 3030 3037 3031 /* Do the triple product tB*D*Bprime: */ 3038 TripleMultiply( &B[0][0],1, numgrids,1,3032 TripleMultiply( &B[0][0],1,NUMVERTICES,1, 3039 3033 &DL_scalar,1,1,0, 3040 &Bprime[0][0],1, numgrids,0,3034 &Bprime[0][0],1,NUMVERTICES,0, 3041 3035 &Ke_gg_gaussian[0][0],0); 3042 3036 … … 3154 3148 3155 3149 /* node data: */ 3156 const int numgrids=6;3157 3150 const int NDOF1=1; 3158 const int numdof=NDOF1* numgrids;3159 double xyz_list[ numgrids][3];3151 const int numdof=NDOF1*NUMVERTICES; 3152 double xyz_list[NUMVERTICES][3]; 3160 3153 int* doflist=NULL; 3161 3154 … … 3222 3215 3223 3216 /* Get node coordinates and dof list: */ 3224 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);3217 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 3225 3218 GetDofList(&doflist); 3226 3219 … … 3487 3480 int i,j,k; 3488 3481 3489 const int numgrids=6;3490 3482 const int NDOF2=2; 3491 const int numdofs=NDOF2* numgrids;3483 const int numdofs=NDOF2*NUMVERTICES; 3492 3484 int* doflist=NULL; 3493 3485 double pe_g[numdofs]={0.0}; 3494 double xyz_list[ numgrids][3];3495 double z_list[ numgrids];3486 double xyz_list[NUMVERTICES][3]; 3487 double z_list[NUMVERTICES]; 3496 3488 double z_segment[2]; 3497 3489 double slope2,constant_part; … … 3555 3547 slopey_input=inputs->GetInput(SurfaceSlopeYEnum); 3556 3548 3557 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);3558 for(i=0;i< numgrids;i++)z_list[i]=xyz_list[i][2];3549 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 3550 for(i=0;i<NUMVERTICES;i++)z_list[i]=xyz_list[i][2]; 3559 3551 3560 3552 //Get gaussian points and weights. order 2 since we have a product of 2 nodal functions … … 3675 3667 3676 3668 /* node data: */ 3677 const int numgrids=6;3678 3669 const int NDOF2=2; 3679 const int numdof=NDOF2* numgrids;3680 double xyz_list[ numgrids][3];3670 const int numdof=NDOF2*NUMVERTICES; 3671 double xyz_list[NUMVERTICES][3]; 3681 3672 int* doflist=NULL; 3682 3673 … … 3714 3705 3715 3706 /* Get node coordinates and dof list: */ 3716 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);3707 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 3717 3708 GetDofList(&doflist,PattynApproximationEnum); 3718 3709 … … 3743 3734 3744 3735 /*Build pe_g_gaussian vector: */ 3745 for (i=0;i< numgrids;i++){3736 for (i=0;i<NUMVERTICES;i++){ 3746 3737 for (j=0;j<NDOF2;j++){ 3747 3738 pe_g_gaussian[i*NDOF2+j]=-driving_stress_baseline*slope[j]*Jdet*gauss->weight*l1l6[i]; … … 3766 3757 int i,j; 3767 3758 3768 const int numgrids=6;3769 3759 const int DOFPERGRID=4; 3770 const int numdof= numgrids*DOFPERGRID;3771 const int numgrids2d=3;3772 int numdof2d= numgrids2d*DOFPERGRID;3760 const int numdof=NUMVERTICES*DOFPERGRID; 3761 const int NUMVERTICES2d=3; 3762 int numdof2d=NUMVERTICES2d*DOFPERGRID; 3773 3763 int* doflist=NULL; 3774 3764 … … 3777 3767 3778 3768 /*parameters: */ 3779 double xyz_list_tria[ numgrids2d][3];3780 double xyz_list[ numgrids][3];3769 double xyz_list_tria[NUMVERTICES2d][3]; 3770 double xyz_list[NUMVERTICES][3]; 3781 3771 double bed_normal[3]; 3782 3772 double bed; … … 3857 3847 3858 3848 /* Get node coordinates and dof list: */ 3859 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);3849 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 3860 3850 GetDofList(&doflist,StokesApproximationEnum); 3861 3851 … … 3898 3888 3899 3889 /* Build gaussian vector */ 3900 for(i=0;i< numgrids+1;i++){3890 for(i=0;i<NUMVERTICES+1;i++){ 3901 3891 Pe_gaussian[i*DOFPERGRID+2]=-rho_ice*gravity*Jdet*gauss_weight*l1l7[i]; 3902 3892 } … … 3944 3934 if ( (onbed==1) && (shelf==1)){ 3945 3935 3946 for(i=0;i< numgrids2d;i++){3936 for(i=0;i<NUMVERTICES2d;i++){ 3947 3937 for(j=0;j<3;j++){ 3948 3938 xyz_list_tria[i][j]=xyz_list[i][j]; … … 3980 3970 BedNormal(&bed_normal[0],xyz_list_tria); 3981 3971 3982 for(i=0;i< numgrids2d;i++){3972 for(i=0;i<NUMVERTICES2d;i++){ 3983 3973 for(j=0;j<3;j++){ 3984 3974 Pe_temp[i*DOFPERGRID+j]+=water_pressure*gauss_weight*Jdet2d*L[i]*bed_normal[j]; … … 4035 4025 4036 4026 /* node data: */ 4037 const int numgrids=6;4038 4027 const int NDOF1=1; 4039 const int numdof=NDOF1* numgrids;4040 double xyz_list[ numgrids][3];4028 const int numdof=NDOF1*NUMVERTICES; 4029 double xyz_list[NUMVERTICES][3]; 4041 4030 int* doflist=NULL; 4042 4031 … … 4084 4073 /*Now, handle the standard penta element: */ 4085 4074 /* Get node coordinates and dof list: */ 4086 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);4075 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 4087 4076 GetDofList(&doflist); 4088 4077 … … 4110 4099 4111 4100 /*Build pe_g_gaussian vector: */ 4112 for (i=0;i< numgrids;i++){4101 for (i=0;i<NUMVERTICES;i++){ 4113 4102 pe_g_gaussian[i]=(dudx+dvdy)*Jdet*gauss->weight*l1l6[i]; 4114 4103 } … … 4200 4189 int found=0; 4201 4190 4202 const int numgrids=6;4203 4191 const int NDOF1=1; 4204 const int numdof= numgrids*NDOF1;4192 const int numdof=NUMVERTICES*NDOF1; 4205 4193 int* doflist=NULL; 4206 4194 4207 4195 /*Grid data: */ 4208 double xyz_list[ numgrids][3];4196 double xyz_list[NUMVERTICES][3]; 4209 4197 4210 4198 /* gaussian points: */ … … 4212 4200 GaussPenta *gauss=NULL; 4213 4201 4214 double temperature_list[ numgrids];4202 double temperature_list[NUMVERTICES]; 4215 4203 double temperature; 4216 4204 … … 4269 4257 4270 4258 /* Get node coordinates and dof list: */ 4271 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);4259 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 4272 4260 GetDofList(&doflist); 4273 4261 … … 4309 4297 if(dt) scalar_def=scalar_def*dt; 4310 4298 4311 for(i=0;i< numgrids;i++) P_terms[i]+=scalar_def*L[i];4299 for(i=0;i<NUMVERTICES;i++) P_terms[i]+=scalar_def*L[i]; 4312 4300 4313 4301 /* Build transient now */ … … 4315 4303 temperature_input->GetParameterValue(&temperature, gauss); 4316 4304 scalar_transient=temperature*Jdet*gauss->weight; 4317 for(i=0;i< numgrids;i++) P_terms[i]+=scalar_transient*L[i];4305 for(i=0;i<NUMVERTICES;i++) P_terms[i]+=scalar_transient*L[i]; 4318 4306 } 4319 4307 } … … 4435 4423 4436 4424 /*Intermediaries*/ 4437 const int numvertices = 6; 4438 double value[numvertices]; 4425 double value[NUMVERTICES]; 4439 4426 GaussPenta *gauss = NULL; 4440 4427 … … 4448 4435 /* Start looping on the number of vertices: */ 4449 4436 gauss=new GaussPenta(); 4450 for (int iv=0;iv< numvertices;iv++){4437 for (int iv=0;iv<NUMVERTICES;iv++){ 4451 4438 gauss->GaussVertex(iv); 4452 4439 input->GetParameterValue(&pvalue[iv],gauss); … … 4461 4448 4462 4449 /*Intermediaries*/ 4463 const int numvertices = 6; 4464 double value[numvertices]; 4450 double value[NUMVERTICES]; 4465 4451 GaussPenta *gauss = NULL; 4466 4452 … … 4474 4460 if (input){ 4475 4461 gauss=new GaussPenta(); 4476 for (int iv=0;iv< numvertices;iv++){4462 for (int iv=0;iv<NUMVERTICES;iv++){ 4477 4463 gauss->GaussVertex(iv); 4478 4464 input->GetParameterValue(&pvalue[iv],gauss); … … 4480 4466 } 4481 4467 else{ 4482 for (int iv=0;iv< numvertices;iv++) pvalue[iv]=defaultvalue;4468 for (int iv=0;iv<NUMVERTICES;iv++) pvalue[iv]=defaultvalue; 4483 4469 } 4484 4470 … … 4656 4642 int i; 4657 4643 4658 const int numvertices=6;4659 4644 const int numdofpervertex=2; 4660 const int numdof=numdofpervertex* numvertices;4661 double gauss[ numvertices][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}};4645 const int numdof=numdofpervertex*NUMVERTICES; 4646 double gauss[NUMVERTICES][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}}; 4662 4647 int* doflist=NULL; 4663 4648 double values[numdof]; … … 4680 4665 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 4681 4666 /*P1 element only for now*/ 4682 for(i=0;i< numvertices;i++){4667 for(i=0;i<NUMVERTICES;i++){ 4683 4668 4684 4669 /*Recover vx and vy*/ … … 4701 4686 int i; 4702 4687 4703 const int numvertices=6;4704 4688 const int numdofpervertex=2; 4705 const int numdof=numdofpervertex* numvertices;4706 double gauss[ numvertices][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}};4689 const int numdof=numdofpervertex*NUMVERTICES; 4690 double gauss[NUMVERTICES][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}}; 4707 4691 int* doflist=NULL; 4708 4692 double values[numdof]; … … 4715 4699 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 4716 4700 /*P1 element only for now*/ 4717 for(i=0;i< numvertices;i++){4701 for(i=0;i<NUMVERTICES;i++){ 4718 4702 4719 4703 /*Recover vx and vy*/ … … 4736 4720 int i; 4737 4721 4738 const int numvertices=6;4739 4722 const int numdofpervertex=1; 4740 const int numdof=numdofpervertex* numvertices;4741 double gauss[ numvertices][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}};4723 const int numdof=numdofpervertex*NUMVERTICES; 4724 double gauss[NUMVERTICES][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}}; 4742 4725 int* doflist=NULL; 4743 4726 double values[numdof]; … … 4749 4732 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 4750 4733 /*P1 element only for now*/ 4751 for(i=0;i< numvertices;i++){4734 for(i=0;i<NUMVERTICES;i++){ 4752 4735 4753 4736 /*Recover vz */ … … 4768 4751 int i; 4769 4752 4770 const int numvertices=6;4771 4753 const int numdofpervertex=4; 4772 const int numdof=numdofpervertex* numvertices;4773 double gauss[ numvertices][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}};4754 const int numdof=numdofpervertex*NUMVERTICES; 4755 double gauss[NUMVERTICES][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}}; 4774 4756 int* doflist=NULL; 4775 4757 double values[numdof]; … … 4785 4767 /*Ok, we have vx vy vz and P in values, fill in vx vy vz P arrays: */ 4786 4768 /*P1 element only for now*/ 4787 for(i=0;i< numvertices;i++){4769 for(i=0;i<NUMVERTICES;i++){ 4788 4770 4789 4771 /*Recover vx and vy*/ … … 4810 4792 int i; 4811 4793 4812 const int numvertices=6;4813 4794 const int numdofpervertex=1; 4814 const int numdof=numdofpervertex* numvertices;4815 double gauss[ numvertices][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}};4795 const int numdof=numdofpervertex*NUMVERTICES; 4796 double gauss[NUMVERTICES][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}}; 4816 4797 int* doflist=NULL; 4817 4798 double values[numdof]; … … 4824 4805 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 4825 4806 /*P1 element only for now*/ 4826 for(i=0;i< numvertices;i++){4807 for(i=0;i<NUMVERTICES;i++){ 4827 4808 4828 4809 /*Recover vz */ … … 5196 5177 int i; 5197 5178 5198 const int numvertices=6;5199 5179 const int numdofpervertex=2; 5200 const int numdof=numdofpervertex* numvertices;5180 const int numdof=numdofpervertex*NUMVERTICES; 5201 5181 int* doflist=NULL; 5202 5182 double values[numdof]; 5203 double vx[ numvertices];5204 double vy[ numvertices];5205 double vz[ numvertices];5206 double vel[ numvertices];5183 double vx[NUMVERTICES]; 5184 double vy[NUMVERTICES]; 5185 double vz[NUMVERTICES]; 5186 double vel[NUMVERTICES]; 5207 5187 int dummy; 5208 double pressure[ numvertices];5209 double surface[ numvertices];5188 double pressure[NUMVERTICES]; 5189 double surface[NUMVERTICES]; 5210 5190 double rho_ice,g; 5211 double xyz_list[ numvertices][3];5212 double gauss[ numvertices][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}};5191 double xyz_list[NUMVERTICES][3]; 5192 double gauss[NUMVERTICES][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}}; 5213 5193 5214 5194 Input *vz_input = NULL; … … 5243 5223 5244 5224 /*Get node data: */ 5245 GetVerticesCoordinates(&xyz_list[0][0],penta->nodes, numvertices);5225 GetVerticesCoordinates(&xyz_list[0][0],penta->nodes,NUMVERTICES); 5246 5226 5247 5227 /*Now Compute vel*/ … … 5250 5230 if (vz_input->Enum()!=PentaVertexInputEnum) ISSMERROR("Cannot compute Vel as Vz is of type %s",EnumToString(vz_input->Enum())); 5251 5231 vz_input->GetValuesPtr(&vz_ptr,&dummy); 5252 for(i=0;i< numvertices;i++) vz[i]=vz_ptr[i];5253 } 5254 else{for(i=0;i< numvertices;i++) vz[i]=0.0;}5255 for(i=0;i< numvertices;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5);5232 for(i=0;i<NUMVERTICES;i++) vz[i]=vz_ptr[i]; 5233 } 5234 else{for(i=0;i<NUMVERTICES;i++) vz[i]=0.0;} 5235 for(i=0;i<NUMVERTICES;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5); 5256 5236 5257 5237 /*Now compute pressure*/ 5258 5238 GetParameterListOnVertices(&surface[0],SurfaceEnum); 5259 for(i=0;i< numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i][2]);5239 for(i=0;i<NUMVERTICES;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i][2]); 5260 5240 5261 5241 /*Now, we have to move the previous Vx and Vy inputs to old … … 5287 5267 int i; 5288 5268 5289 const int numvertices=6; 5290 const int numvertices2d=3; 5269 const int NUMVERTICES2d=3; 5291 5270 const int numdofpervertex=2; 5292 const int numdof=numdofpervertex* numvertices;5293 const int numdof2d=numdofpervertex* numvertices2d;5271 const int numdof=numdofpervertex*NUMVERTICES; 5272 const int numdof2d=numdofpervertex*NUMVERTICES2d; 5294 5273 int* doflistp=NULL; 5295 5274 int* doflistm=NULL; 5296 5275 double macayeal_values[numdof]; 5297 5276 double pattyn_values[numdof]; 5298 double vx[ numvertices];5299 double vy[ numvertices];5300 double vz[ numvertices];5301 double vel[ numvertices];5277 double vx[NUMVERTICES]; 5278 double vy[NUMVERTICES]; 5279 double vz[NUMVERTICES]; 5280 double vel[NUMVERTICES]; 5302 5281 int dummy; 5303 double pressure[ numvertices];5304 double surface[ numvertices];5282 double pressure[NUMVERTICES]; 5283 double surface[NUMVERTICES]; 5305 5284 double rho_ice,g; 5306 double xyz_list[ numvertices][3];5307 double gauss[ numvertices][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}};5285 double xyz_list[NUMVERTICES][3]; 5286 double gauss[NUMVERTICES][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}}; 5308 5287 5309 5288 Input *vz_input = NULL; … … 5320 5299 5321 5300 /*Get node data: */ 5322 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);5301 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 5323 5302 5324 5303 /*Use the dof list to index into the solution vector: */ … … 5333 5312 5334 5313 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 5335 for(i=0;i< numvertices;i++){5314 for(i=0;i<NUMVERTICES;i++){ 5336 5315 vx[i]=macayeal_values[i*numdofpervertex+0]+pattyn_values[i*numdofpervertex+0]; 5337 5316 vy[i]=macayeal_values[i*numdofpervertex+1]+pattyn_values[i*numdofpervertex+1]; … … 5345 5324 } 5346 5325 vz_input->GetValuesPtr(&vz_ptr,&dummy); 5347 for(i=0;i< numvertices;i++) vz[i]=vz_ptr[i];5326 for(i=0;i<NUMVERTICES;i++) vz[i]=vz_ptr[i]; 5348 5327 } 5349 5328 else{ 5350 for(i=0;i< numvertices;i++) vz[i]=0.0;5329 for(i=0;i<NUMVERTICES;i++) vz[i]=0.0; 5351 5330 } 5352 5331 5353 5332 /*Now Compute vel*/ 5354 for(i=0;i< numvertices;i++) {5333 for(i=0;i<NUMVERTICES;i++) { 5355 5334 vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5); 5356 5335 } … … 5361 5340 g=matpar->GetG(); 5362 5341 GetParameterListOnVertices(&surface[0],SurfaceEnum); 5363 for(i=0;i< numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i][2]);5342 for(i=0;i<NUMVERTICES;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i][2]); 5364 5343 5365 5344 /*Now, we have to move the previous Vx and Vy inputs to old … … 5385 5364 int i; 5386 5365 5387 const int numvertices=6;5388 5366 const int numdofpervertex=2; 5389 const int numdof=numdofpervertex* numvertices;5367 const int numdof=numdofpervertex*NUMVERTICES; 5390 5368 int* doflist=NULL; 5391 5369 double values[numdof]; 5392 double vx[ numvertices];5393 double vy[ numvertices];5394 double vz[ numvertices];5395 double vel[ numvertices];5370 double vx[NUMVERTICES]; 5371 double vy[NUMVERTICES]; 5372 double vz[NUMVERTICES]; 5373 double vel[NUMVERTICES]; 5396 5374 int dummy; 5397 double pressure[ numvertices];5398 double surface[ numvertices];5375 double pressure[NUMVERTICES]; 5376 double surface[NUMVERTICES]; 5399 5377 double rho_ice,g; 5400 double xyz_list[ numvertices][3];5401 double gauss[ numvertices][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}};5378 double xyz_list[NUMVERTICES][3]; 5379 double gauss[NUMVERTICES][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}}; 5402 5380 5403 5381 Input *vz_input = NULL; … … 5408 5386 5409 5387 /*Get node data: */ 5410 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);5388 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 5411 5389 5412 5390 /*Use the dof list to index into the solution vector: */ … … 5416 5394 5417 5395 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 5418 for(i=0;i< numvertices;i++){5396 for(i=0;i<NUMVERTICES;i++){ 5419 5397 vx[i]=values[i*numdofpervertex+0]; 5420 5398 vy[i]=values[i*numdofpervertex+1]; … … 5428 5406 } 5429 5407 vz_input->GetValuesPtr(&vz_ptr,&dummy); 5430 for(i=0;i< numvertices;i++) vz[i]=vz_ptr[i];5408 for(i=0;i<NUMVERTICES;i++) vz[i]=vz_ptr[i]; 5431 5409 } 5432 5410 else{ 5433 for(i=0;i< numvertices;i++) vz[i]=0.0;5411 for(i=0;i<NUMVERTICES;i++) vz[i]=0.0; 5434 5412 } 5435 5413 5436 5414 /*Now Compute vel*/ 5437 for(i=0;i< numvertices;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5);5415 for(i=0;i<NUMVERTICES;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5); 5438 5416 5439 5417 /*For pressure: we have not computed pressure in this analysis, for this element. We are in 3D, … … 5442 5420 g=matpar->GetG(); 5443 5421 GetParameterListOnVertices(&surface[0],SurfaceEnum); 5444 for(i=0;i< numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i][2]);5422 for(i=0;i<NUMVERTICES;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i][2]); 5445 5423 5446 5424 /*Now, we have to move the previous Vx and Vy inputs to old … … 5466 5444 int i; 5467 5445 5468 const int numvertices=6;5469 5446 const int numdofpervertex=2; 5470 const int numdof=numdofpervertex* numvertices;5447 const int numdof=numdofpervertex*NUMVERTICES; 5471 5448 int* doflist=NULL; 5472 5449 double values[numdof]; 5473 double vx[ numvertices];5474 double vy[ numvertices];5475 double vz[ numvertices];5476 double vel[ numvertices];5450 double vx[NUMVERTICES]; 5451 double vy[NUMVERTICES]; 5452 double vz[NUMVERTICES]; 5453 double vel[NUMVERTICES]; 5477 5454 int dummy; 5478 double pressure[ numvertices];5479 double surface[ numvertices];5455 double pressure[NUMVERTICES]; 5456 double surface[NUMVERTICES]; 5480 5457 double rho_ice,g; 5481 double xyz_list[ numvertices][3];5482 double gauss[ numvertices][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}};5458 double xyz_list[NUMVERTICES][3]; 5459 double gauss[NUMVERTICES][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}}; 5483 5460 5484 5461 Input* vz_input=NULL; … … 5489 5466 5490 5467 /*Get node data: */ 5491 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);5468 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 5492 5469 5493 5470 /*Use the dof list to index into the solution vector: */ … … 5497 5474 5498 5475 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 5499 for(i=0;i< numvertices;i++){5476 for(i=0;i<NUMVERTICES;i++){ 5500 5477 vx[i]=values[i*numdofpervertex+0]; 5501 5478 vy[i]=values[i*numdofpervertex+1]; … … 5509 5486 } 5510 5487 vz_input->GetValuesPtr(&vz_ptr,&dummy); 5511 for(i=0;i< numvertices;i++) vz[i]=vz_ptr[i];5488 for(i=0;i<NUMVERTICES;i++) vz[i]=vz_ptr[i]; 5512 5489 } 5513 5490 else{ 5514 for(i=0;i< numvertices;i++) vz[i]=0.0;5491 for(i=0;i<NUMVERTICES;i++) vz[i]=0.0; 5515 5492 } 5516 5493 5517 5494 /*Now Compute vel*/ 5518 for(i=0;i< numvertices;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5);5495 for(i=0;i<NUMVERTICES;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5); 5519 5496 5520 5497 /*For pressure: we have not computed pressure in this analysis, for this element. We are in 3D, … … 5523 5500 g=matpar->GetG(); 5524 5501 GetParameterListOnVertices(&surface[0],SurfaceEnum); 5525 for(i=0;i< numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i][2]);5502 for(i=0;i<NUMVERTICES;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i][2]); 5526 5503 5527 5504 /*Now, we have to move the previous Vx and Vy inputs to old … … 5547 5524 int i; 5548 5525 5549 const int numvertices=6;5550 5526 const int numdofpervertex=1; 5551 const int numdof=numdofpervertex* numvertices;5527 const int numdof=numdofpervertex*NUMVERTICES; 5552 5528 int* doflist=NULL; 5553 5529 double values[numdof]; 5554 double vx[ numvertices];5555 double vy[ numvertices];5556 double vz[ numvertices];5557 double vel[ numvertices];5530 double vx[NUMVERTICES]; 5531 double vy[NUMVERTICES]; 5532 double vz[NUMVERTICES]; 5533 double vel[NUMVERTICES]; 5558 5534 int dummy; 5559 double pressure[ numvertices];5560 double surface[ numvertices];5535 double pressure[NUMVERTICES]; 5536 double surface[NUMVERTICES]; 5561 5537 double rho_ice,g; 5562 double xyz_list[ numvertices][3];5563 double gauss[ numvertices][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}};5538 double xyz_list[NUMVERTICES][3]; 5539 double gauss[NUMVERTICES][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}}; 5564 5540 5565 5541 Input* vx_input=NULL; … … 5572 5548 5573 5549 /*Get node data: */ 5574 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);5550 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 5575 5551 5576 5552 /*Use the dof list to index into the solution vector: */ … … 5580 5556 5581 5557 /*Ok, we have vz in values, fill in vz array: */ 5582 for(i=0;i< numvertices;i++){5558 for(i=0;i<NUMVERTICES;i++){ 5583 5559 vz[i]=values[i*numdofpervertex+0]; 5584 5560 } … … 5589 5565 if (vx_input->Enum()!=PentaVertexInputEnum) ISSMERROR("Cannot compute Vel as Vx is of type %s",EnumToString(vx_input->Enum())); 5590 5566 vx_input->GetValuesPtr(&vx_ptr,&dummy); 5591 for(i=0;i< numvertices;i++) vx[i]=vx_ptr[i];5592 } 5593 else for(i=0;i< numvertices;i++) vx[i]=0.0;5567 for(i=0;i<NUMVERTICES;i++) vx[i]=vx_ptr[i]; 5568 } 5569 else for(i=0;i<NUMVERTICES;i++) vx[i]=0.0; 5594 5570 5595 5571 vy_input=inputs->GetInput(VyEnum); … … 5597 5573 if (vy_input->Enum()!=PentaVertexInputEnum) ISSMERROR("Cannot compute Vel as Vy is of type %s",EnumToString(vy_input->Enum())); 5598 5574 vy_input->GetValuesPtr(&vy_ptr,&dummy); 5599 for(i=0;i< numvertices;i++) vy[i]=vy_ptr[i];5600 } 5601 else for(i=0;i< numvertices;i++) vy[i]=0.0;5575 for(i=0;i<NUMVERTICES;i++) vy[i]=vy_ptr[i]; 5576 } 5577 else for(i=0;i<NUMVERTICES;i++) vy[i]=0.0; 5602 5578 5603 5579 /*Now Compute vel*/ 5604 for(i=0;i< numvertices;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5);5580 for(i=0;i<NUMVERTICES;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5); 5605 5581 5606 5582 /*For pressure: we have not computed pressure in this analysis, for this element. We are in 3D, … … 5609 5585 g=matpar->GetG(); 5610 5586 GetParameterListOnVertices(&surface[0],SurfaceEnum); 5611 for(i=0;i< numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i][2]);5587 for(i=0;i<NUMVERTICES;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i][2]); 5612 5588 5613 5589 /*Now, we have to move the previous Vz inputs to old … … 5630 5606 int i; 5631 5607 5632 const int numvertices=6;5633 5608 const int numdofpervertex=4; 5634 const int numdof=numdofpervertex* numvertices;5609 const int numdof=numdofpervertex*NUMVERTICES; 5635 5610 int* doflist=NULL; 5636 5611 double values[numdof]; 5637 double vx[ numvertices];5638 double vy[ numvertices];5639 double vz[ numvertices];5640 double vel[ numvertices];5641 double pressure[ numvertices];5612 double vx[NUMVERTICES]; 5613 double vy[NUMVERTICES]; 5614 double vz[NUMVERTICES]; 5615 double vel[NUMVERTICES]; 5616 double pressure[NUMVERTICES]; 5642 5617 double stokesreconditioning; 5643 5618 … … 5651 5626 5652 5627 /*Ok, we have vx and vy in values, fill in all arrays: */ 5653 for(i=0;i< numvertices;i++){5628 for(i=0;i<NUMVERTICES;i++){ 5654 5629 vx[i]=values[i*numdofpervertex+0]; 5655 5630 vy[i]=values[i*numdofpervertex+1]; … … 5660 5635 /*Recondition pressure: */ 5661 5636 this->parameters->FindParam(&stokesreconditioning,StokesReconditioningEnum); 5662 for(i=0;i< numvertices;i++){5637 for(i=0;i<NUMVERTICES;i++){ 5663 5638 pressure[i]=pressure[i]*stokesreconditioning; 5664 5639 } 5665 5640 5666 5641 /*Now Compute vel*/ 5667 for(i=0;i< numvertices;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5);5642 for(i=0;i<NUMVERTICES;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5); 5668 5643 5669 5644 /*Now, we have to move the previous inputs to old … … 5691 5666 int i; 5692 5667 5693 const int numvertices=6;5694 5668 const int numdofpervertex=4; 5695 const int numdof=numdofpervertex* numvertices;5669 const int numdof=numdofpervertex*NUMVERTICES; 5696 5670 int* doflist=NULL; 5697 5671 double values[numdof]; 5698 double lambdax[ numvertices];5699 double lambday[ numvertices];5700 double lambdaz[ numvertices];5701 double lambdap[ numvertices];5672 double lambdax[NUMVERTICES]; 5673 double lambday[NUMVERTICES]; 5674 double lambdaz[NUMVERTICES]; 5675 double lambdap[NUMVERTICES]; 5702 5676 5703 5677 /*Get dof list: */ … … 5710 5684 5711 5685 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 5712 for(i=0;i< numvertices;i++){5686 for(i=0;i<NUMVERTICES;i++){ 5713 5687 lambdax[i]=values[i*numdofpervertex+0]; 5714 5688 lambday[i]=values[i*numdofpervertex+1]; … … 5732 5706 int i; 5733 5707 5734 const int numvertices=6;5735 5708 const int numdofpervertex=2; 5736 const int numdof=numdofpervertex* numvertices;5709 const int numdof=numdofpervertex*NUMVERTICES; 5737 5710 int* doflist=NULL; 5738 5711 double values[numdof]; 5739 double lambdax[ numvertices];5740 double lambday[ numvertices];5712 double lambdax[NUMVERTICES]; 5713 double lambday[NUMVERTICES]; 5741 5714 5742 5715 /*Get dof list: */ … … 5749 5722 5750 5723 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 5751 for(i=0;i< numvertices;i++){5724 for(i=0;i<NUMVERTICES;i++){ 5752 5725 lambdax[i]=values[i*numdofpervertex+0]; 5753 5726 lambday[i]=values[i*numdofpervertex+1]; … … 5767 5740 int i; 5768 5741 5769 const int numvertices=6;5770 5742 const int numdofpervertex=1; 5771 const int numdof=numdofpervertex* numvertices;5743 const int numdof=numdofpervertex*NUMVERTICES; 5772 5744 int* doflist=NULL; 5773 5745 double values[numdof]; … … 5801 5773 void Penta::InputUpdateFromSolutionOneDof(double* solution,int enum_type){ 5802 5774 5803 const int numvertices = 6;5804 5775 const int numdofpervertex = 1; 5805 const int numdof = numdofpervertex * numvertices;5776 const int numdof = numdofpervertex *NUMVERTICES; 5806 5777 int* doflist=NULL; 5807 5778 double values[numdof]; … … 5825 5796 void Penta::InputUpdateFromSolutionOneDofCollapsed(double* solution,int enum_type){ 5826 5797 5827 const int numvertices = 6;5828 5798 const int numdofpervertex = 1; 5829 const int numdof = numdofpervertex * numvertices;5799 const int numdof = numdofpervertex *NUMVERTICES; 5830 5800 const int numdof2d = numdof/2; 5831 5801 int* doflist=NULL; -
issm/trunk/src/c/objects/Elements/Tria.cpp
r5660 r5662 18 18 #include "../../include/include.h" 19 19 /*}}}*/ 20 21 /*Element macros*/ 22 #define NUMVERTICES 3 20 23 21 24 /*Tria constructors and destructor*/ … … 449 452 void Tria::InputUpdateFromVectorDakota(double* vector, int name, int type){ 450 453 451 const int numvertices=3;452 454 int i,j; 453 455 … … 535 537 536 538 int i,j; 537 const int numvertices=3;538 539 double area; 539 540 double mean; 540 int partition[ numvertices];541 int offset[ numvertices];541 int partition[NUMVERTICES]; 542 int offset[NUMVERTICES]; 542 543 double values[3]; 543 544 bool already=false; … … 549 550 this->GetDofList1(&offset[0]); 550 551 mean=0; 551 for(i=0;i< numvertices;i++){552 for(i=0;i<NUMVERTICES;i++){ 552 553 partition[i]=(int)qmu_part[offset[i]]; 553 mean=mean+1.0/ numvertices*vertex_response[offset[i]];554 mean=mean+1.0/NUMVERTICES*vertex_response[offset[i]]; 554 555 } 555 556 556 557 /*Add contribution: */ 557 for(i=0;i< numvertices;i++){558 for(i=0;i<NUMVERTICES;i++){ 558 559 already=false; 559 560 for(j=0;j<i;j++){ … … 627 628 628 629 /*constants: */ 629 const int numvertices=3;630 630 const int NDOF2=2; 631 const int numdof=NDOF2* numvertices;631 const int numdof=NDOF2*NUMVERTICES; 632 632 633 633 /* Intermediaries */ … … 638 638 double cm_noisedmp; 639 639 double Jdet; 640 double xyz_list[ numvertices][3];640 double xyz_list[NUMVERTICES][3]; 641 641 double dk[NDOF2],dB[NDOF2]; 642 642 GaussTria *gauss = NULL; … … 654 654 if(onwater) return 0; 655 655 656 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);656 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 657 657 658 658 /* Start looping on the number of gaussian points: */ … … 857 857 void Tria::GetVectorFromInputs(Vec vector,int NameEnum){ 858 858 859 const int numvertices=3; 860 int doflist1[numvertices]; 859 int doflist1[NUMVERTICES]; 861 860 862 861 /*Find NameEnum input in the inputs dataset, and get it to fill in the vector: */ … … 901 900 902 901 /* constants*/ 903 const int numvertices=3;904 902 const int NDOF2=2; 905 903 … … 910 908 double vx,vy,lambda,mu,thickness; 911 909 double cm_noisedmp; 912 int doflist[ numvertices];910 int doflist[NUMVERTICES]; 913 911 double dvx[NDOF2],dvy[NDOF2],dadjx[NDOF2],dadjy[NDOF2],dB[NDOF2]; 914 double xyz_list[ numvertices][3];912 double xyz_list[NUMVERTICES][3]; 915 913 double basis[3]; 916 double dbasis[NDOF2][ numvertices];917 double grad[ numvertices]={0.0};918 double grad_g[ numvertices];914 double dbasis[NDOF2][NUMVERTICES]; 915 double grad[NUMVERTICES]={0.0}; 916 double grad_g[NUMVERTICES]; 919 917 double epsilon[3]; /* epsilon=[exx,eyy,exy];*/ 920 918 GaussTria *gauss = NULL; … … 924 922 925 923 /* Get node coordinates and dof list: */ 926 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);924 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 927 925 GetDofList1(&doflist[0]); 928 926 … … 956 954 957 955 /*standard gradient dJ/dki*/ 958 for (i=0;i< numvertices;i++){956 for (i=0;i<NUMVERTICES;i++){ 959 957 grad_g[i]=-viscosity_complement*thickness*( (2*dvx[0]+dvy[1])*2*dadjx[0]+(dvx[1]+dvy[0])*(dadjx[1]+dadjy[0])+(2*dvy[1]+dvx[0])*2*dadjy[1])*Jdet*gauss->weight*basis[i]; 960 958 } 961 959 /*Add regularization term*/ 962 for (i=0;i< numvertices;i++){960 for (i=0;i<NUMVERTICES;i++){ 963 961 grad_g[i]-=cm_noisedmp*Jdet*gauss->weight*(dbasis[0][i]*dB[0]+dbasis[1][i]*dB[1]); 964 962 } 965 963 966 for(i=0;i< numvertices;i++) grad[i]+=grad_g[i];964 for(i=0;i<NUMVERTICES;i++) grad[i]+=grad_g[i]; 967 965 } 968 966 969 967 /*Add grade_g to global vector gradient: */ 970 VecSetValues(gradient, numvertices,doflist,(const double*)grad,ADD_VALUES);968 VecSetValues(gradient,NUMVERTICES,doflist,(const double*)grad,ADD_VALUES); 971 969 972 970 /*clean-up*/ … … 980 978 981 979 /* node data: */ 982 const int numvertices=3;983 980 const int NDOF2=2; 984 double xyz_list[ numvertices][3];985 int doflist1[ numvertices];986 double dh1dh3[NDOF2][ numvertices];981 double xyz_list[NUMVERTICES][3]; 982 int doflist1[NUMVERTICES]; 983 double dh1dh3[NDOF2][NUMVERTICES]; 987 984 988 985 /* gaussian points: */ … … 1001 998 1002 999 /*element vector at the gaussian points: */ 1003 double grade_g[ numvertices]={0.0};1004 double grade_g_gaussian[ numvertices];1000 double grade_g[NUMVERTICES]={0.0}; 1001 double grade_g_gaussian[NUMVERTICES]; 1005 1002 1006 1003 /* Jacobian: */ … … 1039 1036 1040 1037 /* Get node coordinates and dof list: */ 1041 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);1038 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 1042 1039 GetDofList1(&doflist1[0]); 1043 1040 … … 1087 1084 1088 1085 /*Build gradje_g_gaussian vector (actually -dJ/ddrag): */ 1089 for (i=0;i< numvertices;i++){1086 for (i=0;i<NUMVERTICES;i++){ 1090 1087 1091 1088 //standard term dJ/dki … … 1097 1094 1098 1095 /*Add gradje_g_gaussian vector to gradje_g: */ 1099 for( i=0; i< numvertices; i++)grade_g[i]+=grade_g_gaussian[i];1096 for( i=0; i<NUMVERTICES; i++)grade_g[i]+=grade_g_gaussian[i]; 1100 1097 } 1101 1098 1102 1099 /*Add grade_g to global vector gradient: */ 1103 VecSetValues(gradient, numvertices,doflist1,(const double*)grade_g,ADD_VALUES);1100 VecSetValues(gradient,NUMVERTICES,doflist1,(const double*)grade_g,ADD_VALUES); 1104 1101 1105 1102 /*Clean up and return*/ … … 1115 1112 1116 1113 /* node data: */ 1117 const int numvertices=3; 1118 int doflist1[numvertices]; 1114 int doflist1[NUMVERTICES]; 1119 1115 1120 1116 /*Gauss*/ 1121 double gauss[ numvertices][numvertices]={{1,0,0},{0,1,0},{0,0,1}};1117 double gauss[NUMVERTICES][NUMVERTICES]={{1,0,0},{0,1,0},{0,0,1}}; 1122 1118 1123 1119 /* grid data: */ … … 1125 1121 1126 1122 /*element vector at the gaussian points: */ 1127 double gradient_g[ numvertices];1123 double gradient_g[NUMVERTICES]; 1128 1124 1129 1125 /*Inputs*/ … … 1137 1133 1138 1134 /* Start looping on the vertices: */ 1139 for(i=0; i< numvertices;i++){1135 for(i=0; i<NUMVERTICES;i++){ 1140 1136 adjoint_input->GetParameterValue(&lambda,&gauss[i][0]); 1141 1137 gradient_g[i]=-lambda; … … 1143 1139 1144 1140 /*Add grade_g to global vector gradient: */ 1145 VecSetValues(gradient, numvertices,doflist1,(const double*)gradient_g,INSERT_VALUES);1141 VecSetValues(gradient,NUMVERTICES,doflist1,(const double*)gradient_g,INSERT_VALUES); 1146 1142 } 1147 1143 /*}}}*/ … … 1340 1336 int i; 1341 1337 1342 const int numvertices=3;1343 1338 const int numdofs=2; 1344 1339 double mass_flux=0; 1345 double xyz_list[ numvertices][3];1340 double xyz_list[NUMVERTICES][3]; 1346 1341 double gauss_1[3]; 1347 1342 double gauss_2[3]; … … 1363 1358 1364 1359 /*Get xyz list: */ 1365 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);1360 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 1366 1361 1367 1362 /*get area coordinates of 0 and 1 locations: */ … … 1552 1547 1553 1548 /* Constants */ 1554 const int numvertices=3; 1555 const int numdof=1*numvertices; 1549 const int numdof=1*NUMVERTICES; 1556 1550 1557 1551 /*Intermediaries*/ … … 1561 1555 double Jdet; 1562 1556 double Jelem = 0; 1563 double xyz_list[ numvertices][3];1557 double xyz_list[NUMVERTICES][3]; 1564 1558 GaussTria *gauss = NULL; 1565 1559 … … 1568 1562 1569 1563 /* Get node coordinates and dof list: */ 1570 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);1564 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 1571 1565 1572 1566 /*Retrieve all inputs we will be needing: */ … … 1608 1602 1609 1603 /* node data: */ 1610 const int numvertices=3; 1611 const int numdof=2*numvertices; 1604 const int numdof=2*NUMVERTICES; 1612 1605 const int NDOF2=2; 1613 double xyz_list[ numvertices][3];1606 double xyz_list[NUMVERTICES][3]; 1614 1607 1615 1608 /* grid data: */ 1616 double vx_list[ numvertices];1617 double vy_list[ numvertices];1618 double obs_vx_list[ numvertices];1619 double obs_vy_list[ numvertices];1620 double misfit_square_list[ numvertices];1621 double misfit_list[ numvertices];1622 double weights_list[ numvertices];1609 double vx_list[NUMVERTICES]; 1610 double vy_list[NUMVERTICES]; 1611 double obs_vx_list[NUMVERTICES]; 1612 double obs_vy_list[NUMVERTICES]; 1613 double misfit_square_list[NUMVERTICES]; 1614 double misfit_list[NUMVERTICES]; 1615 double weights_list[NUMVERTICES]; 1623 1616 1624 1617 /* gaussian points: */ … … 1645 1638 1646 1639 /* Get node coordinates and dof list: */ 1647 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);1640 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 1648 1641 1649 1642 /* Recover input data: */ … … 1675 1668 * 1676 1669 */ 1677 for (i=0;i< numvertices;i++){1670 for (i=0;i<NUMVERTICES;i++){ 1678 1671 misfit_list[i]=0.5*(pow((vx_list[i]-obs_vx_list[i]),(double)2)+pow((vy_list[i]-obs_vy_list[i]),(double)2)); 1679 1672 } 1680 1673 /*Process units: */ 1681 if(process_units)UnitConversion(&misfit_list[0], numvertices,IuToExtEnum,SurfaceAbsVelMisfitEnum,this->parameters);1674 if(process_units)UnitConversion(&misfit_list[0],NUMVERTICES,IuToExtEnum,SurfaceAbsVelMisfitEnum,this->parameters); 1682 1675 1683 1676 /*Apply weights to misfits*/ 1684 for (i=0;i< numvertices;i++){1677 for (i=0;i<NUMVERTICES;i++){ 1685 1678 misfit_list[i]=weights_list[i]*misfit_list[i]; 1686 1679 } … … 1711 1704 1712 1705 /* node data: */ 1713 const int numvertices=3; 1714 const int numdof=2*numvertices; 1706 const int numdof=2*NUMVERTICES; 1715 1707 const int NDOF2=2; 1716 double xyz_list[ numvertices][3];1708 double xyz_list[NUMVERTICES][3]; 1717 1709 1718 1710 /* grid data: */ 1719 double vx_list[ numvertices];1720 double vy_list[ numvertices];1721 double obs_vx_list[ numvertices];1722 double obs_vy_list[ numvertices];1723 double misfit_square_list[ numvertices];1724 double misfit_list[ numvertices];1725 double weights_list[ numvertices];1711 double vx_list[NUMVERTICES]; 1712 double vy_list[NUMVERTICES]; 1713 double obs_vx_list[NUMVERTICES]; 1714 double obs_vy_list[NUMVERTICES]; 1715 double misfit_square_list[NUMVERTICES]; 1716 double misfit_list[NUMVERTICES]; 1717 double weights_list[NUMVERTICES]; 1726 1718 1727 1719 /* gaussian points: */ … … 1752 1744 1753 1745 /* Get node coordinates and dof list: */ 1754 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);1746 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 1755 1747 1756 1748 /* Recover input data: */ … … 1782 1774 * obs obs 1783 1775 */ 1784 for (i=0;i< numvertices;i++){1776 for (i=0;i<NUMVERTICES;i++){ 1785 1777 scalex=pow(meanvel/(obs_vx_list[i]+epsvel),(double)2); 1786 1778 scaley=pow(meanvel/(obs_vy_list[i]+epsvel),(double)2); … … 1791 1783 1792 1784 /*Process units: */ 1793 if(process_units)UnitConversion(&misfit_list[0], numvertices,IuToExtEnum,SurfaceRelVelMisfitEnum,this->parameters);1785 if(process_units)UnitConversion(&misfit_list[0],NUMVERTICES,IuToExtEnum,SurfaceRelVelMisfitEnum,this->parameters); 1794 1786 1795 1787 /*Apply weights to misfits*/ 1796 for (i=0;i< numvertices;i++){1788 for (i=0;i<NUMVERTICES;i++){ 1797 1789 misfit_list[i]=weights_list[i]*misfit_list[i]; 1798 1790 } … … 1823 1815 1824 1816 /* node data: */ 1825 const int numvertices=3; 1826 const int numdof=2*numvertices; 1817 const int numdof=2*NUMVERTICES; 1827 1818 const int NDOF2=2; 1828 double xyz_list[ numvertices][3];1819 double xyz_list[NUMVERTICES][3]; 1829 1820 1830 1821 /* grid data: */ 1831 double vx_list[ numvertices];1832 double vy_list[ numvertices];1833 double obs_vx_list[ numvertices];1834 double obs_vy_list[ numvertices];1835 double misfit_square_list[ numvertices];1836 double misfit_list[ numvertices];1837 double weights_list[ numvertices];1822 double vx_list[NUMVERTICES]; 1823 double vy_list[NUMVERTICES]; 1824 double obs_vx_list[NUMVERTICES]; 1825 double obs_vy_list[NUMVERTICES]; 1826 double misfit_square_list[NUMVERTICES]; 1827 double misfit_list[NUMVERTICES]; 1828 double weights_list[NUMVERTICES]; 1838 1829 1839 1830 /* gaussian points: */ … … 1863 1854 1864 1855 /* Get node coordinates and dof list: */ 1865 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);1856 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 1866 1857 1867 1858 /* Recover input data: */ … … 1893 1884 * obs 1894 1885 */ 1895 for (i=0;i< numvertices;i++){1886 for (i=0;i<NUMVERTICES;i++){ 1896 1887 velocity_mag=sqrt(pow(vx_list[i],(double)2)+pow(vy_list[i],(double)2))+epsvel; //epsvel to avoid velocity being nil. 1897 1888 obs_velocity_mag=sqrt(pow(obs_vx_list[i],(double)2)+pow(obs_vy_list[i],(double)2))+epsvel; //epsvel to avoid observed velocity being nil. … … 1900 1891 1901 1892 /*Process units: */ 1902 if(process_units)UnitConversion(&misfit_list[0], numvertices,IuToExtEnum,SurfaceLogVelMisfitEnum,this->parameters);1893 if(process_units)UnitConversion(&misfit_list[0],NUMVERTICES,IuToExtEnum,SurfaceLogVelMisfitEnum,this->parameters); 1903 1894 1904 1895 /*Apply weights to misfits*/ 1905 for (i=0;i< numvertices;i++){1896 for (i=0;i<NUMVERTICES;i++){ 1906 1897 misfit_list[i]=weights_list[i]*misfit_list[i]; 1907 1898 } … … 1932 1923 1933 1924 /* node data: */ 1934 const int numvertices=3; 1935 const int numdof=2*numvertices; 1925 const int numdof=2*NUMVERTICES; 1936 1926 const int NDOF2=2; 1937 double xyz_list[ numvertices][3];1927 double xyz_list[NUMVERTICES][3]; 1938 1928 1939 1929 /* grid data: */ 1940 double vx_list[ numvertices];1941 double vy_list[ numvertices];1942 double obs_vx_list[ numvertices];1943 double obs_vy_list[ numvertices];1944 double misfit_square_list[ numvertices];1945 double misfit_list[ numvertices];1946 double weights_list[ numvertices];1930 double vx_list[NUMVERTICES]; 1931 double vy_list[NUMVERTICES]; 1932 double obs_vx_list[NUMVERTICES]; 1933 double obs_vy_list[NUMVERTICES]; 1934 double misfit_square_list[NUMVERTICES]; 1935 double misfit_list[NUMVERTICES]; 1936 double weights_list[NUMVERTICES]; 1947 1937 1948 1938 /* gaussian points: */ … … 1975 1965 1976 1966 /* Get node coordinates and dof list: */ 1977 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);1967 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 1978 1968 1979 1969 /* Recover input data: */ … … 2005 1995 * obs obs 2006 1996 */ 2007 for (i=0;i< numvertices;i++){1997 for (i=0;i<NUMVERTICES;i++){ 2008 1998 misfit_list[i]=0.5*pow(meanvel,(double)2)*( 2009 1999 pow(log((fabs(vx_list[i])+epsvel)/(fabs(obs_vx_list[i])+epsvel)),(double)2) + … … 2012 2002 2013 2003 /*Process units: */ 2014 if(process_units)UnitConversion(&misfit_list[0], numvertices,IuToExtEnum,SurfaceLogVxVyMisfitEnum,this->parameters);2004 if(process_units)UnitConversion(&misfit_list[0],NUMVERTICES,IuToExtEnum,SurfaceLogVxVyMisfitEnum,this->parameters); 2015 2005 2016 2006 /*Apply weights to misfits*/ 2017 for (i=0;i< numvertices;i++){2007 for (i=0;i<NUMVERTICES;i++){ 2018 2008 misfit_list[i]=weights_list[i]*misfit_list[i]; 2019 2009 } … … 2044 2034 2045 2035 /* node data: */ 2046 const int numvertices=3; 2047 const int numdof=2*numvertices; 2036 const int numdof=2*NUMVERTICES; 2048 2037 const int NDOF2=2; 2049 double xyz_list[ numvertices][3];2038 double xyz_list[NUMVERTICES][3]; 2050 2039 2051 2040 /* grid data: */ 2052 double vx_list[ numvertices];2053 double vy_list[ numvertices];2054 double obs_vx_list[ numvertices];2055 double obs_vy_list[ numvertices];2056 double misfit_square_list[ numvertices];2057 double misfit_list[ numvertices];2058 double weights_list[ numvertices];2041 double vx_list[NUMVERTICES]; 2042 double vy_list[NUMVERTICES]; 2043 double obs_vx_list[NUMVERTICES]; 2044 double obs_vy_list[NUMVERTICES]; 2045 double misfit_square_list[NUMVERTICES]; 2046 double misfit_list[NUMVERTICES]; 2047 double weights_list[NUMVERTICES]; 2059 2048 2060 2049 /* gaussian points: */ … … 2087 2076 2088 2077 /* Get node coordinates and dof list: */ 2089 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);2078 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 2090 2079 2091 2080 /* Recover input data: */ … … 2117 2106 * S obs obs 2118 2107 */ 2119 for (i=0;i< numvertices;i++) misfit_square_list[i]=pow(vx_list[i]-obs_vx_list[i],2)+pow(vy_list[i]-obs_vx_list[i],2);2108 for (i=0;i<NUMVERTICES;i++) misfit_square_list[i]=pow(vx_list[i]-obs_vx_list[i],2)+pow(vy_list[i]-obs_vx_list[i],2); 2120 2109 2121 2110 /*Process units: */ 2122 if(process_units)UnitConversion(&misfit_square_list[0], numvertices,IuToExtEnum,SurfaceAverageVelMisfitEnum,this->parameters);2111 if(process_units)UnitConversion(&misfit_square_list[0],NUMVERTICES,IuToExtEnum,SurfaceAverageVelMisfitEnum,this->parameters); 2123 2112 2124 2113 /*Take the square root, and scale by surface: */ 2125 for (i=0;i< numvertices;i++)misfit_list[i]=pow(misfit_square_list[i],2)/S;2114 for (i=0;i<NUMVERTICES;i++)misfit_list[i]=pow(misfit_square_list[i],2)/S; 2126 2115 2127 2116 /*Apply weights to misfits*/ 2128 for (i=0;i< numvertices;i++){2117 for (i=0;i<NUMVERTICES;i++){ 2129 2118 misfit_list[i]=weights_list[i]*misfit_list[i]; 2130 2119 } … … 2182 2171 /*output: */ 2183 2172 int numrows = 0; 2184 int numvertices = 0;2185 2173 int numnodes = 0; 2186 2174 … … 2191 2179 numrows++; 2192 2180 /*now, how many vertices and how many nodal values for this result? :*/ 2193 numvertices=3; //this is a tria element, with 3 vertices2194 2181 numnodes=elementresult->NumberOfNodalValues(); //ask result object. 2195 2182 } … … 2197 2184 /*Assign output pointers:*/ 2198 2185 *pnumrows=numrows; 2199 *pnumvertices= numvertices;2186 *pnumvertices=NUMVERTICES; 2200 2187 *pnumnodes=numnodes; 2201 2188 … … 2223 2210 2224 2211 /* node data: */ 2225 int numvertices=3; 2226 double xyz_list[numvertices][3]; 2212 double xyz_list[NUMVERTICES][3]; 2227 2213 double v13[3]; 2228 2214 double v23[3]; … … 2239 2225 2240 2226 /* Get node coordinates and dof list: */ 2241 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);2227 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 2242 2228 2243 2229 for (i=0;i<3;i++){ … … 2489 2475 2490 2476 /* node data: */ 2491 const int numvertices=3;2492 2477 const int NDOF1=1; 2493 const int numdof=NDOF1* numvertices;2494 double xyz_list[ numvertices][3];2478 const int numdof=NDOF1*NUMVERTICES; 2479 double xyz_list[NUMVERTICES][3]; 2495 2480 int* doflist=NULL; 2496 2481 … … 2500 2485 2501 2486 /* matrices: */ 2502 double L[ numvertices];2503 double B[2][ numvertices];2504 double Bprime[2][ numvertices];2487 double L[NUMVERTICES]; 2488 double B[2][NUMVERTICES]; 2489 double Bprime[2][NUMVERTICES]; 2505 2490 double DL[2][2]={0.0}; 2506 2491 double DLprime[2][2]={0.0}; … … 2531 2516 2532 2517 /* Get node coordinates and dof list: */ 2533 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);2518 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 2534 2519 GetDofList(&doflist); 2535 2520 … … 2645 2630 2646 2631 /* node data: */ 2647 const int numvertices=3;2648 2632 const int NDOF1=1; 2649 const int numdof=NDOF1* numvertices;2650 double xyz_list[ numvertices][3];2633 const int numdof=NDOF1*NUMVERTICES; 2634 double xyz_list[NUMVERTICES][3]; 2651 2635 int* doflist=NULL; 2652 2636 … … 2656 2640 2657 2641 /* matrices: */ 2658 double B[2][ numvertices];2659 double Bprime[2][ numvertices];2642 double B[2][NUMVERTICES]; 2643 double Bprime[2][NUMVERTICES]; 2660 2644 double DL[2][2]={0.0}; 2661 2645 double DLprime[2][2]={0.0}; … … 2675 2659 2676 2660 /* Get node coordinates and dof list: */ 2677 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);2661 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 2678 2662 GetDofList(&doflist); 2679 2663 this->parameters->FindParam(&dim,DimEnum); … … 2734 2718 2735 2719 /* node data: */ 2736 const int numvertices=3;2737 2720 const int NDOF1=1; 2738 const int numdof=NDOF1* numvertices;2739 double xyz_list[ numvertices][3];2721 const int numdof=NDOF1*NUMVERTICES; 2722 double xyz_list[NUMVERTICES][3]; 2740 2723 int* doflist=NULL; 2741 2724 … … 2745 2728 2746 2729 /* matrices: */ 2747 double L[ numvertices];2748 double B[2][ numvertices];2749 double Bprime[2][ numvertices];2730 double L[NUMVERTICES]; 2731 double B[2][NUMVERTICES]; 2732 double Bprime[2][NUMVERTICES]; 2750 2733 double DL[2][2]={0.0}; 2751 2734 double DLprime[2][2]={0.0}; … … 2782 2765 2783 2766 /* Get node coordinates and dof list: */ 2784 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);2767 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 2785 2768 GetDofList(&doflist); 2786 2769 … … 2798 2781 /*Modify z so that it reflects the surface*/ 2799 2782 GetParameterListOnVertices(&surface_list[0],SurfaceEnum); 2800 for(i=0;i< numvertices;i++) xyz_list[i][2]=surface_list[i];2783 for(i=0;i<NUMVERTICES;i++) xyz_list[i][2]=surface_list[i]; 2801 2784 2802 2785 /*Get normal vector to the surface*/ … … 2903 2886 2904 2887 /* node data: */ 2905 const int numvertices=3; 2906 const int numdof=2*numvertices; 2907 double xyz_list[numvertices][3]; 2888 const int numdof=2*NUMVERTICES; 2889 double xyz_list[NUMVERTICES][3]; 2908 2890 int* doflist=NULL; 2909 2891 … … 2958 2940 2959 2941 /* Get node coordinates and dof list: */ 2960 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);2942 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 2961 2943 GetDofList(&doflist,MacAyealApproximationEnum); 2962 2944 … … 3034 3016 3035 3017 /* node data: */ 3036 const int numvertices = 3; 3037 const int numdof = 2 *numvertices; 3038 double xyz_list[numvertices][3]; 3018 const int numdof = 2 *NUMVERTICES; 3019 double xyz_list[NUMVERTICES][3]; 3039 3020 int* doflistm=NULL; 3040 3021 int* doflistp=NULL; … … 3087 3068 3088 3069 /* Get node coordinates and dof list: */ 3089 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);3070 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 3090 3071 GetDofList(&doflistm,MacAyealApproximationEnum); 3091 3072 GetDofList(&doflistp,PattynApproximationEnum); … … 3159 3140 3160 3141 /* node data: */ 3161 const int numvertices = 3; 3162 const int numdof = 2 *numvertices; 3163 double xyz_list[numvertices][3]; 3142 const int numdof = 2 *NUMVERTICES; 3143 double xyz_list[NUMVERTICES][3]; 3164 3144 int* doflist=NULL; 3165 3145 int numberofdofspernode=2; … … 3211 3191 3212 3192 /* Get node coordinates and dof list: */ 3213 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);3193 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 3214 3194 GetDofList(&doflist,MacAyealApproximationEnum); 3215 3195 … … 3280 3260 3281 3261 /* node data: */ 3282 const int numvertices = 3; 3283 const int numdof = 2 *numvertices; 3284 double xyz_list[numvertices][3]; 3262 const int numdof = 2 *NUMVERTICES; 3263 double xyz_list[NUMVERTICES][3]; 3285 3264 int* doflist=NULL; 3286 3265 int numberofdofspernode=2; … … 3332 3311 3333 3312 /* Get node coordinates and dof list: */ 3334 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);3313 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 3335 3314 GetDofList(&doflist,PattynApproximationEnum); 3336 3315 … … 3399 3378 int i; 3400 3379 int connectivity; 3401 const int numvertices=3;3402 3380 const int NDOF2=2; 3403 const int numdofs= numvertices*NDOF2;3381 const int numdofs=NUMVERTICES*NDOF2; 3404 3382 int* doflist=NULL; 3405 3383 … … 3436 3414 3437 3415 /* node data: */ 3438 const int numvertices=3;3439 3416 const int NDOF1=1; 3440 const int numdof=NDOF1* numvertices;3441 double xyz_list[ numvertices][3];3417 const int numdof=NDOF1*NUMVERTICES; 3418 double xyz_list[NUMVERTICES][3]; 3442 3419 int* doflist=NULL; 3443 3420 … … 3466 3443 3467 3444 /* Get node coordinates and dof list: */ 3468 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);3445 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 3469 3446 GetDofList(&doflist); 3470 3447 … … 3539 3516 int i,j; 3540 3517 3541 const int numvertices=3;3542 3518 const int NDOF1=1; 3543 const int numdof= numvertices*NDOF1;3519 const int numdof=NUMVERTICES*NDOF1; 3544 3520 int* doflist=NULL; 3545 3521 3546 3522 /*Grid data: */ 3547 double xyz_list[ numvertices][3];3523 double xyz_list[NUMVERTICES][3]; 3548 3524 3549 3525 /*Material constants */ … … 3567 3543 3568 3544 /* Get node coordinates and dof list: */ 3569 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);3545 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 3570 3546 GetDofList(&doflist); 3571 3547 … … 3589 3565 MatrixMultiply(&tLD[0],numdof,1,0,&L[0],1,numdof,0,&Ke_gaussian[0][0],0); 3590 3566 3591 for(i=0;i< numvertices;i++){3592 for(j=0;j< numvertices;j++){3567 for(i=0;i<NUMVERTICES;i++){ 3568 for(j=0;j<NUMVERTICES;j++){ 3593 3569 K_terms[i][j]+=Ke_gaussian[i][j]; 3594 3570 } … … 3611 3587 3612 3588 /* node data: */ 3613 const int numvertices=3;3614 3589 const int NDOF1=1; 3615 const int numdof=NDOF1* numvertices;3616 double xyz_list[ numvertices][3];3590 const int numdof=NDOF1*NUMVERTICES; 3591 double xyz_list[NUMVERTICES][3]; 3617 3592 int* doflist=NULL; 3618 3593 int numberofdofspernode=1; … … 3623 3598 3624 3599 /* matrices: */ 3625 double L[ numvertices];3626 double B[2][ numvertices];3627 double Bprime[2][ numvertices];3600 double L[NUMVERTICES]; 3601 double B[2][NUMVERTICES]; 3602 double Bprime[2][NUMVERTICES]; 3628 3603 double DL[2][2]={0.0}; 3629 3604 double DLprime[2][2]={0.0}; … … 3658 3633 3659 3634 /* Get node coordinates and dof list: */ 3660 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);3635 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 3661 3636 GetDofList(&doflist); 3662 3637 … … 3781 3756 3782 3757 /* node data: */ 3783 const int numvertices=3;3784 3758 const int NDOF1=1; 3785 const int numdof=NDOF1* numvertices;3786 double xyz_list[ numvertices][3];3759 const int numdof=NDOF1*NUMVERTICES; 3760 double xyz_list[NUMVERTICES][3]; 3787 3761 int* doflist=NULL; 3788 3762 int numberofdofspernode=1; … … 3793 3767 3794 3768 /* matrices: */ 3795 double L[ numvertices];3796 double B[2][ numvertices];3797 double Bprime[2][ numvertices];3769 double L[NUMVERTICES]; 3770 double B[2][NUMVERTICES]; 3771 double Bprime[2][NUMVERTICES]; 3798 3772 double DL[2][2]={0.0}; 3799 3773 double DLprime[2][2]={0.0}; … … 3819 3793 3820 3794 /* Get node coordinates and dof list: */ 3821 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);3795 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 3822 3796 GetDofList(&doflist); 3823 3797 … … 3941 3915 3942 3916 /* node data: */ 3943 const int numvertices=3;3944 3917 const int NDOF1=1; 3945 const int numdof=NDOF1* numvertices;3946 double xyz_list[ numvertices][3];3918 const int numdof=NDOF1*NUMVERTICES; 3919 double xyz_list[NUMVERTICES][3]; 3947 3920 int* doflist=NULL; 3948 3921 … … 3960 3933 double K_terms[numdof][numdof]={0.0}; 3961 3934 double Ke_gaussian[numdof][numdof]={0.0}; 3962 double l1l2l3[ numvertices];3935 double l1l2l3[NUMVERTICES]; 3963 3936 double tl1l2l3D[3]; 3964 3937 double D_scalar; … … 3971 3944 3972 3945 /* Get node coordinates and dof list: */ 3973 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);3946 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 3974 3947 GetDofList(&doflist); 3975 3948 … … 4026 3999 4027 4000 /* node data: */ 4028 const int numvertices=3;4029 4001 const int NDOF1=1; 4030 const int numdof=NDOF1* numvertices;4031 double xyz_list[ numvertices][3];4002 const int numdof=NDOF1*NUMVERTICES; 4003 double xyz_list[NUMVERTICES][3]; 4032 4004 int* doflist=NULL; 4033 4005 int numberofdofspernode=1; … … 4038 4010 4039 4011 /* matrix */ 4040 double pe_g[ numvertices]={0.0};4041 double L[ numvertices];4012 double pe_g[NUMVERTICES]={0.0}; 4013 double L[NUMVERTICES]; 4042 4014 double Jdettria; 4043 4015 … … 4053 4025 4054 4026 /* Get node coordinates and dof list: */ 4055 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);4027 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 4056 4028 GetDofList(&doflist); 4057 4029 … … 4098 4070 4099 4071 /* node data: */ 4100 const int numvertices=3;4101 4072 const int NDOF1=1; 4102 const int numdof=NDOF1* numvertices;4103 double xyz_list[ numvertices][3];4073 const int numdof=NDOF1*NUMVERTICES; 4074 double xyz_list[NUMVERTICES][3]; 4104 4075 int* doflist=NULL; 4105 4076 int numberofdofspernode=1; … … 4110 4081 4111 4082 /* matrix */ 4112 double pe_g[ numvertices]={0.0};4113 double L[ numvertices];4083 double pe_g[NUMVERTICES]={0.0}; 4084 double L[NUMVERTICES]; 4114 4085 double Jdettria; 4115 4086 … … 4125 4096 4126 4097 /* Get node coordinates and dof list: */ 4127 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);4098 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 4128 4099 GetDofList(&doflist); 4129 4100 … … 4170 4141 4171 4142 /* node data: */ 4172 const int numvertices=3;4173 4143 const int NDOF1=1; 4174 const int numdof=NDOF1* numvertices;4175 double xyz_list[ numvertices][3];4144 const int numdof=NDOF1*NUMVERTICES; 4145 double xyz_list[NUMVERTICES][3]; 4176 4146 int* doflist=NULL; 4177 4147 int numberofdofspernode=1; … … 4182 4152 4183 4153 /* matrix */ 4184 double pe_g[ numvertices]={0.0};4185 double L[ numvertices];4154 double pe_g[NUMVERTICES]={0.0}; 4155 double L[NUMVERTICES]; 4186 4156 double Jdettria; 4187 4157 … … 4195 4165 4196 4166 /* Get node coordinates and dof list: */ 4197 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);4167 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 4198 4168 GetDofList(&doflist); 4199 4169 … … 4237 4207 4238 4208 /* node data: */ 4239 const int numvertices=3;4240 4209 const int NDOF1=1; 4241 const int numdof=NDOF1* numvertices;4242 double xyz_list[ numvertices][3];4210 const int numdof=NDOF1*NUMVERTICES; 4211 double xyz_list[NUMVERTICES][3]; 4243 4212 int* doflist=NULL; 4244 4213 … … 4258 4227 4259 4228 /* matrices: */ 4260 double L[ numvertices];4229 double L[NUMVERTICES]; 4261 4230 4262 4231 /*input parameters for structural analysis (diagnostic): */ … … 4273 4242 4274 4243 /* Get node coordinates and dof list: */ 4275 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);4244 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 4276 4245 GetDofList(&doflist); 4277 4246 … … 4308 4277 4309 4278 /*Build gaussian vector: */ 4310 for(i=0;i< numvertices;i++){4279 for(i=0;i<NUMVERTICES;i++){ 4311 4280 pe_g_gaussian[i]=-Jdet*gauss->weight*(vx*dbdx+vy*dbdy-meltingvalue)*L[i]; 4312 4281 } … … 4331 4300 4332 4301 /* node data: */ 4333 const int numvertices=3; 4334 const int numdof=2*numvertices; 4302 const int numdof=2*NUMVERTICES; 4335 4303 const int NDOF2=2; 4336 double xyz_list[ numvertices][3];4304 double xyz_list[NUMVERTICES][3]; 4337 4305 int* doflist=NULL; 4338 4306 … … 4382 4350 4383 4351 /* Get node coordinates and dof list: */ 4384 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);4352 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 4385 4353 GetDofList(&doflist,MacAyealApproximationEnum); 4386 4354 … … 4418 4386 /*Build pe_g_gaussian vector: */ 4419 4387 if(drag_type==1){ 4420 for (i=0;i< numvertices;i++){4388 for (i=0;i<NUMVERTICES;i++){ 4421 4389 for (j=0;j<NDOF2;j++){ 4422 4390 pe_g_gaussian[i*NDOF2+j]=(-driving_stress_baseline*slope[j]-plastic_stress)*Jdet*gauss_weight*l1l2l3[i]; … … 4425 4393 } 4426 4394 else { 4427 for (i=0;i< numvertices;i++){4395 for (i=0;i<NUMVERTICES;i++){ 4428 4396 for (j=0;j<NDOF2;j++){ 4429 4397 pe_g_gaussian[i*NDOF2+j]=-driving_stress_baseline*slope[j]*Jdet*gauss_weight*l1l2l3[i]; … … 4454 4422 4455 4423 /* node data: */ 4456 const int numvertices=3; 4457 const int numdof=1*numvertices; 4458 double xyz_list[numvertices][3]; 4424 const int numdof=1*NUMVERTICES; 4425 double xyz_list[NUMVERTICES][3]; 4459 4426 int* doflist=NULL; 4460 4427 … … 4482 4449 4483 4450 /* Get node coordinates and dof list: */ 4484 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);4451 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 4485 4452 GetDofList(&doflist); 4486 4453 … … 4507 4474 weights_input->GetParameterValue(&weight, gauss); 4508 4475 4509 for (i=0;i< numvertices;i++){4476 for (i=0;i<NUMVERTICES;i++){ 4510 4477 pe_g_gaussian[i]=(thicknessobs-thickness)*weight*Jdet*gauss->weight*l1l2l3[i]; 4511 4478 } … … 4531 4498 4532 4499 /* node data: */ 4533 const int numvertices=3; 4534 const int numdof=2*numvertices; 4500 const int numdof=2*NUMVERTICES; 4535 4501 const int NDOF2=2; 4536 double xyz_list[ numvertices][3];4502 double xyz_list[NUMVERTICES][3]; 4537 4503 int* doflist=NULL; 4538 4504 4539 4505 /* grid data: */ 4540 double vx_list[ numvertices];4541 double vy_list[ numvertices];4542 double obs_vx_list[ numvertices];4543 double obs_vy_list[ numvertices];4544 double dux_list[ numvertices];4545 double duy_list[ numvertices];4546 double weights_list[ numvertices];4506 double vx_list[NUMVERTICES]; 4507 double vy_list[NUMVERTICES]; 4508 double obs_vx_list[NUMVERTICES]; 4509 double obs_vy_list[NUMVERTICES]; 4510 double dux_list[NUMVERTICES]; 4511 double duy_list[NUMVERTICES]; 4512 double weights_list[NUMVERTICES]; 4547 4513 4548 4514 /* gaussian points: */ … … 4577 4543 4578 4544 /* Get node coordinates and dof list: */ 4579 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);4545 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 4580 4546 GetDofList(&doflist); 4581 4547 … … 4616 4582 * du obs 4617 4583 */ 4618 for (i=0;i< numvertices;i++){4584 for (i=0;i<NUMVERTICES;i++){ 4619 4585 dux_list[i]=obs_vx_list[i]-vx_list[i]; 4620 4586 duy_list[i]=obs_vy_list[i]-vy_list[i]; … … 4634 4600 * obs 4635 4601 */ 4636 for (i=0;i< numvertices;i++){4602 for (i=0;i<NUMVERTICES;i++){ 4637 4603 scalex=pow(meanvel/(obs_vx_list[i]+epsvel),2); 4638 4604 scaley=pow(meanvel/(obs_vy_list[i]+epsvel),2); … … 4656 4622 * 4657 4623 */ 4658 for (i=0;i< numvertices;i++){4624 for (i=0;i<NUMVERTICES;i++){ 4659 4625 velocity_mag=sqrt(pow(vx_list[i],2)+pow(vy_list[i],2))+epsvel; //epsvel to avoid velocity being nil. 4660 4626 obs_velocity_mag=sqrt(pow(obs_vx_list[i],2)+pow(obs_vy_list[i],2))+epsvel; //epsvel to avoid observed velocity being nil. … … 4675 4641 * du S 2 sqrt(...) obs 4676 4642 */ 4677 for (i=0;i< numvertices;i++){4643 for (i=0;i<NUMVERTICES;i++){ 4678 4644 scale=1.0/(S*sqrt(pow(vx_list[i]-obs_vx_list[i],2)+pow(vy_list[i]-obs_vx_list[i],2))+epsvel); 4679 4645 dux_list[i]=scale*(obs_vx_list[i]-vx_list[i]); … … 4692 4658 * du |u| + eps |u| u + eps 4693 4659 */ 4694 for (i=0;i< numvertices;i++){4660 for (i=0;i<NUMVERTICES;i++){ 4695 4661 dux_list[i] = - pow(meanvel,(double)2)*( 4696 4662 log((fabs(vx_list[i])+epsvel)/(fabs(obs_vx_list[i])+epsvel)) * 1/(vx_list[i]+epsvel)); … … 4705 4671 4706 4672 /*Apply weights to DU*/ 4707 for (i=0;i< numvertices;i++){4673 for (i=0;i<NUMVERTICES;i++){ 4708 4674 dux_list[i]=weights_list[i]*dux_list[i]; 4709 4675 duy_list[i]=weights_list[i]*duy_list[i]; … … 4729 4695 4730 4696 /*compute Du*/ 4731 for (i=0;i< numvertices;i++){4697 for (i=0;i<NUMVERTICES;i++){ 4732 4698 pe_g_gaussian[i*NDOF2+0]=dux*Jdet*gauss->weight*l1l2l3[i]; 4733 4699 pe_g_gaussian[i*NDOF2+1]=duy*Jdet*gauss->weight*l1l2l3[i]; … … 4754 4720 4755 4721 /* node data: */ 4756 const int numvertices=3;4757 4722 const int NDOF4=4; 4758 const int numdof=NDOF4* numvertices;4759 double xyz_list[ numvertices][3];4723 const int numdof=NDOF4*NUMVERTICES; 4724 double xyz_list[NUMVERTICES][3]; 4760 4725 int* doflist=NULL; 4761 4726 4762 4727 /* grid data: */ 4763 double vx_list[ numvertices];4764 double vy_list[ numvertices];4765 double obs_vx_list[ numvertices];4766 double obs_vy_list[ numvertices];4767 double dux_list[ numvertices];4768 double duy_list[ numvertices];4769 double weights_list[ numvertices];4728 double vx_list[NUMVERTICES]; 4729 double vy_list[NUMVERTICES]; 4730 double obs_vx_list[NUMVERTICES]; 4731 double obs_vy_list[NUMVERTICES]; 4732 double dux_list[NUMVERTICES]; 4733 double duy_list[NUMVERTICES]; 4734 double weights_list[NUMVERTICES]; 4770 4735 4771 4736 /* gaussian points: */ … … 4800 4765 4801 4766 /* Get node coordinates and dof list: */ 4802 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);4767 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 4803 4768 GetDofList(&doflist); 4804 4769 … … 4839 4804 * du obs 4840 4805 */ 4841 for (i=0;i< numvertices;i++){4806 for (i=0;i<NUMVERTICES;i++){ 4842 4807 dux_list[i]=obs_vx_list[i]-vx_list[i]; 4843 4808 duy_list[i]=obs_vy_list[i]-vy_list[i]; … … 4857 4822 * obs 4858 4823 */ 4859 for (i=0;i< numvertices;i++){4824 for (i=0;i<NUMVERTICES;i++){ 4860 4825 scalex=pow(meanvel/(obs_vx_list[i]+epsvel),2); 4861 4826 scaley=pow(meanvel/(obs_vy_list[i]+epsvel),2); … … 4879 4844 * 4880 4845 */ 4881 for (i=0;i< numvertices;i++){4846 for (i=0;i<NUMVERTICES;i++){ 4882 4847 velocity_mag=sqrt(pow(vx_list[i],2)+pow(vy_list[i],2))+epsvel; //epsvel to avoid velocity being nil. 4883 4848 obs_velocity_mag=sqrt(pow(obs_vx_list[i],2)+pow(obs_vy_list[i],2))+epsvel; //epsvel to avoid observed velocity being nil. … … 4898 4863 * du S 2 sqrt(...) obs 4899 4864 */ 4900 for (i=0;i< numvertices;i++){4865 for (i=0;i<NUMVERTICES;i++){ 4901 4866 scale=1.0/(S*sqrt(pow(vx_list[i]-obs_vx_list[i],2)+pow(vy_list[i]-obs_vx_list[i],2))+epsvel); 4902 4867 dux_list[i]=scale*(obs_vx_list[i]-vx_list[i]); … … 4915 4880 * du |u| + eps |u| u + eps 4916 4881 */ 4917 for (i=0;i< numvertices;i++){4882 for (i=0;i<NUMVERTICES;i++){ 4918 4883 dux_list[i] = - pow(meanvel,(double)2)*( 4919 4884 log((fabs(vx_list[i])+epsvel)/(fabs(obs_vx_list[i])+epsvel)) * 1/(vx_list[i]+epsvel)); … … 4928 4893 4929 4894 /*Apply weights to DU*/ 4930 for (i=0;i< numvertices;i++){4895 for (i=0;i<NUMVERTICES;i++){ 4931 4896 dux_list[i]=weights_list[i]*dux_list[i]; 4932 4897 duy_list[i]=weights_list[i]*duy_list[i]; … … 4952 4917 4953 4918 /*compute Du*/ 4954 for (i=0;i< numvertices;i++){4919 for (i=0;i<NUMVERTICES;i++){ 4955 4920 pe_g[i*NDOF4+0]+=dux*Jdet*gauss->weight*l1l2l3[i]; 4956 4921 pe_g[i*NDOF4+1]+=duy*Jdet*gauss->weight*l1l2l3[i]; … … 4971 4936 /*Collapsed formulation: */ 4972 4937 int i; 4973 const int numvertices=3;4974 4938 const int NDOF2=2; 4975 const int numdofs=NDOF2* numvertices;4939 const int numdofs=NDOF2*NUMVERTICES; 4976 4940 int* doflist=NULL; 4977 4941 double constant_part,ub,vb; … … 5011 4975 /*Spawn 3 sing elements: */ 5012 4976 gauss=new GaussTria(); 5013 for(i=0;i< numvertices;i++){4977 for(i=0;i<NUMVERTICES;i++){ 5014 4978 5015 4979 gauss->GaussVertex(i); … … 5048 5012 5049 5013 /* node data: */ 5050 const int numvertices=3;5051 5014 const int NDOF1=1; 5052 const int numdof=NDOF1* numvertices;5053 double xyz_list[ numvertices][3];5015 const int numdof=NDOF1*NUMVERTICES; 5016 double xyz_list[NUMVERTICES][3]; 5054 5017 int* doflist=NULL; 5055 5018 int numberofdofspernode=1; … … 5060 5023 5061 5024 /* matrix */ 5062 double pe_g[ numvertices]={0.0};5063 double L[ numvertices];5025 double pe_g[NUMVERTICES]={0.0}; 5026 double L[NUMVERTICES]; 5064 5027 double Jdettria; 5065 5028 … … 5079 5042 5080 5043 /* Get node coordinates and dof list: */ 5081 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);5044 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 5082 5045 GetDofList(&doflist); 5083 5046 … … 5125 5088 5126 5089 /* node data: */ 5127 const int numvertices=3;5128 5090 const int NDOF1=1; 5129 const int numdof=NDOF1* numvertices;5130 double xyz_list[ numvertices][3];5091 const int numdof=NDOF1*NUMVERTICES; 5092 double xyz_list[NUMVERTICES][3]; 5131 5093 int* doflist=NULL; 5132 5094 int numberofdofspernode=1; … … 5137 5099 5138 5100 /* matrix */ 5139 double pe_g[ numvertices]={0.0};5140 double L[ numvertices];5101 double pe_g[NUMVERTICES]={0.0}; 5102 double L[NUMVERTICES]; 5141 5103 double Jdettria; 5142 5104 … … 5154 5116 5155 5117 /* Get node coordinates and dof list: */ 5156 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);5118 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 5157 5119 GetDofList(&doflist); 5158 5120 … … 5198 5160 5199 5161 /* node data: */ 5200 const int numvertices=3;5201 5162 const int NDOF1=1; 5202 const int numdof=NDOF1* numvertices;5203 double xyz_list[ numvertices][3];5163 const int numdof=NDOF1*NUMVERTICES; 5164 double xyz_list[NUMVERTICES][3]; 5204 5165 int* doflist=NULL; 5205 5166 … … 5227 5188 5228 5189 /* Get node coordinates and dof list: */ 5229 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);5190 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 5230 5191 GetDofList(&doflist); 5231 5192 … … 5278 5239 int i,found; 5279 5240 5280 const int numvertices=3;5281 5241 const int NDOF1=1; 5282 const int numdof= numvertices*NDOF1;5242 const int numdof=NUMVERTICES*NDOF1; 5283 5243 int* doflist=NULL; 5284 double xyz_list[ numvertices][3];5244 double xyz_list[NUMVERTICES][3]; 5285 5245 5286 5246 double mixed_layer_capacity; … … 5303 5263 double Jdet; 5304 5264 double P_terms[numdof]={0.0}; 5305 double l1l2l3[ numvertices];5265 double l1l2l3[NUMVERTICES]; 5306 5266 5307 5267 double t_pmp; … … 5312 5272 5313 5273 /* Get node coordinates and dof list: */ 5314 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);5274 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 5315 5275 GetDofList(&doflist); 5316 5276 … … 5372 5332 int i,found; 5373 5333 5374 const int numvertices=3;5375 5334 const int NDOF1=1; 5376 const int numdof= numvertices*NDOF1;5335 const int numdof=NUMVERTICES*NDOF1; 5377 5336 int* doflist=NULL; 5378 double xyz_list[ numvertices][3];5337 double xyz_list[NUMVERTICES][3]; 5379 5338 5380 5339 double rho_ice; … … 5398 5357 double Jdet; 5399 5358 double P_terms[numdof]={0.0}; 5400 double l1l2l3[ numvertices];5359 double l1l2l3[NUMVERTICES]; 5401 5360 double scalar; 5402 5361 … … 5413 5372 5414 5373 /* Get node coordinates and dof list: */ 5415 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);5374 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 5416 5375 GetDofList(&doflist); 5417 5376 … … 5479 5438 5480 5439 double area=0; 5481 const int numvertices=3; 5482 double xyz_list[numvertices][3]; 5440 double xyz_list[NUMVERTICES][3]; 5483 5441 double x1,y1,x2,y2,x3,y3; 5484 5442 5485 5443 /*Get xyz list: */ 5486 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);5444 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 5487 5445 x1=xyz_list[0][0]; y1=xyz_list[0][1]; 5488 5446 x2=xyz_list[1][0]; y2=xyz_list[1][1]; … … 5497 5455 /*Intermediaries*/ 5498 5456 double area = 0; 5499 const int numvertices = 3; 5500 double xyz_list[numvertices][3]; 5457 double xyz_list[NUMVERTICES][3]; 5501 5458 double x1,y1,x2,y2,x3,y3; 5502 5459 … … 5505 5462 5506 5463 /*Get xyz list: */ 5507 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);5464 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 5508 5465 x1=xyz_list[0][0]; y1=xyz_list[0][1]; 5509 5466 x2=xyz_list[1][0]; y2=xyz_list[1][1]; … … 5577 5534 5578 5535 /*Intermediaries*/ 5579 const int numvertices = 3; 5580 double value[numvertices]; 5536 double value[NUMVERTICES]; 5581 5537 GaussTria *gauss = NULL; 5582 5538 … … 5590 5546 /* Start looping on the number of vertices: */ 5591 5547 gauss=new GaussTria(); 5592 for (int iv=0;iv< numvertices;iv++){5548 for (int iv=0;iv<NUMVERTICES;iv++){ 5593 5549 gauss->GaussVertex(iv); 5594 5550 input->GetParameterValue(&pvalue[iv],gauss); … … 5603 5559 5604 5560 /*Intermediaries*/ 5605 const int numvertices = 3; 5606 double value[numvertices]; 5561 double value[NUMVERTICES]; 5607 5562 GaussTria *gauss = NULL; 5608 5563 … … 5616 5571 if (input){ 5617 5572 gauss=new GaussTria(); 5618 for (int iv=0;iv< numvertices;iv++){5573 for (int iv=0;iv<NUMVERTICES;iv++){ 5619 5574 gauss->GaussVertex(iv); 5620 5575 input->GetParameterValue(&pvalue[iv],gauss); … … 5622 5577 } 5623 5578 else{ 5624 for (int iv=0;iv< numvertices;iv++) pvalue[iv]=defaultvalue;5579 for (int iv=0;iv<NUMVERTICES;iv++) pvalue[iv]=defaultvalue; 5625 5580 } 5626 5581 … … 5786 5741 5787 5742 int i; 5788 const int numvertices=3;5789 5743 const int numdofpervertex=2; 5790 const int numdof=numdofpervertex* numvertices;5744 const int numdof=numdofpervertex*NUMVERTICES; 5791 5745 int* doflist=NULL; 5792 5746 double values[numdof]; … … 5805 5759 /*P1 element only for now*/ 5806 5760 gauss=new GaussTria(); 5807 for(i=0;i< numvertices;i++){5761 for(i=0;i<NUMVERTICES;i++){ 5808 5762 5809 5763 gauss->GaussVertex(i); … … 5829 5783 5830 5784 int i; 5831 const int numvertices=3;5832 5785 const int numdofpervertex=2; 5833 const int numdof=numdofpervertex* numvertices;5786 const int numdof=numdofpervertex*NUMVERTICES; 5834 5787 int* doflist=NULL; 5835 5788 double values[numdof]; … … 5849 5802 /*P1 element only for now*/ 5850 5803 gauss=new GaussTria(); 5851 for(i=0;i< numvertices;i++){5804 for(i=0;i<NUMVERTICES;i++){ 5852 5805 5853 5806 gauss->GaussVertex(i); … … 5927 5880 5928 5881 /* node data: */ 5929 const int numvertices=3;5930 5882 const int NDOF2=2; 5931 double xyz_list[ numvertices][3];5932 int doflist1[ numvertices];5933 double dh1dh3[NDOF2][ numvertices];5883 double xyz_list[NUMVERTICES][3]; 5884 int doflist1[NUMVERTICES]; 5885 double dh1dh3[NDOF2][NUMVERTICES]; 5934 5886 5935 5887 /* grid data: */ … … 5956 5908 5957 5909 /*element vector at the gaussian points: */ 5958 double grade_g[ numvertices]={0.0};5959 double grade_g_gaussian[ numvertices];5910 double grade_g[NUMVERTICES]={0.0}; 5911 double grade_g_gaussian[NUMVERTICES]; 5960 5912 5961 5913 /* Jacobian: */ … … 5991 5943 5992 5944 /* Get node coordinates and dof list: */ 5993 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);5945 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 5994 5946 GetDofList1(&doflist1[0]); 5995 5947 … … 6044 5996 6045 5997 /*Build gradje_g_gaussian vector (actually -dJ/ddrag): */ 6046 for (i=0;i< numvertices;i++){5998 for (i=0;i<NUMVERTICES;i++){ 6047 5999 //standard gradient dJ/dki 6048 6000 grade_g_gaussian[i]=( … … 6057 6009 6058 6010 /*Add gradje_g_gaussian vector to gradje_g: */ 6059 for( i=0; i< numvertices; i++)grade_g[i]+=grade_g_gaussian[i];6011 for( i=0; i<NUMVERTICES; i++)grade_g[i]+=grade_g_gaussian[i]; 6060 6012 } 6061 6013 6062 6014 /*Add grade_g to global vector gradient: */ 6063 VecSetValues(gradient, numvertices,doflist1,(const double*)grade_g,ADD_VALUES);6015 VecSetValues(gradient,NUMVERTICES,doflist1,(const double*)grade_g,ADD_VALUES); 6064 6016 6065 6017 /*Add grade_g to the inputs of this element: */ … … 6079 6031 int i; 6080 6032 6081 const int numvertices=3;6082 6033 const int numdofpervertex=1; 6083 const int numdof=numdofpervertex* numvertices;6034 const int numdof=numdofpervertex*NUMVERTICES; 6084 6035 int* doflist=NULL; 6085 6036 double values[numdof]; 6086 double lambda[ numvertices];6037 double lambda[NUMVERTICES]; 6087 6038 6088 6039 /*Get dof list: */ … … 6112 6063 int i; 6113 6064 6114 const int numvertices=3;6115 6065 const int numdofpervertex=2; 6116 const int numdof=numdofpervertex* numvertices;6066 const int numdof=numdofpervertex*NUMVERTICES; 6117 6067 int* doflist=NULL; 6118 6068 double values[numdof]; 6119 double lambdax[ numvertices];6120 double lambday[ numvertices];6069 double lambdax[NUMVERTICES]; 6070 double lambday[NUMVERTICES]; 6121 6071 6122 6072 /*Get dof list: */ … … 6129 6079 6130 6080 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 6131 for(i=0;i< numvertices;i++){6081 for(i=0;i<NUMVERTICES;i++){ 6132 6082 lambdax[i]=values[i*numdofpervertex+0]; 6133 6083 lambday[i]=values[i*numdofpervertex+1]; … … 6148 6098 int i; 6149 6099 6150 const int numvertices=3;6151 6100 const int numdofpervertex=2; 6152 const int numdof=numdofpervertex* numvertices;6101 const int numdof=numdofpervertex*NUMVERTICES; 6153 6102 int* doflist=NULL; 6154 6103 double values[numdof]; 6155 double vx[ numvertices];6156 double vy[ numvertices];6157 double vz[ numvertices];6158 double vel[ numvertices];6159 double pressure[ numvertices];6160 double thickness[ numvertices];6104 double vx[NUMVERTICES]; 6105 double vy[NUMVERTICES]; 6106 double vz[NUMVERTICES]; 6107 double vel[NUMVERTICES]; 6108 double pressure[NUMVERTICES]; 6109 double thickness[NUMVERTICES]; 6161 6110 double rho_ice,g; 6162 6111 int dummy; … … 6171 6120 6172 6121 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 6173 for(i=0;i< numvertices;i++){6122 for(i=0;i<NUMVERTICES;i++){ 6174 6123 vx[i]=values[i*numdofpervertex+0]; 6175 6124 vy[i]=values[i*numdofpervertex+1]; … … 6180 6129 6181 6130 /*Now Compute vel*/ 6182 for(i=0;i< numvertices;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5);6131 for(i=0;i<NUMVERTICES;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5); 6183 6132 6184 6133 /*For pressure: we have not computed pressure in this analysis, for this element. We are in 2D, … … 6187 6136 g=matpar->GetG(); 6188 6137 GetParameterListOnVertices(&thickness[0],ThicknessEnum); 6189 for(i=0;i< numvertices;i++) pressure[i]=rho_ice*g*thickness[i];6138 for(i=0;i<NUMVERTICES;i++) pressure[i]=rho_ice*g*thickness[i]; 6190 6139 6191 6140 /*Now, we have to move the previous Vx and Vy inputs to old … … 6211 6160 int i; 6212 6161 6213 const int numvertices=3;6214 6162 const int numdofpervertex=2; 6215 const int numdof=numdofpervertex* numvertices;6163 const int numdof=numdofpervertex*NUMVERTICES; 6216 6164 int* doflist=NULL; 6217 6165 double values[numdof]; 6218 double vx[ numvertices];6219 double vy[ numvertices];6220 double vz[ numvertices];6221 double vel[ numvertices];6222 double pressure[ numvertices];6223 double thickness[ numvertices];6166 double vx[NUMVERTICES]; 6167 double vy[NUMVERTICES]; 6168 double vz[NUMVERTICES]; 6169 double vel[NUMVERTICES]; 6170 double pressure[NUMVERTICES]; 6171 double thickness[NUMVERTICES]; 6224 6172 double rho_ice,g; 6225 6173 Input* vz_input=NULL; … … 6236 6184 6237 6185 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 6238 for(i=0;i< numvertices;i++){6186 for(i=0;i<NUMVERTICES;i++){ 6239 6187 vx[i]=values[i*numdofpervertex+0]; 6240 6188 vy[i]=values[i*numdofpervertex+1]; … … 6248 6196 } 6249 6197 vz_input->GetValuesPtr(&vz_ptr,&dummy); 6250 for(i=0;i< numvertices;i++) vz[i]=vz_ptr[i];6198 for(i=0;i<NUMVERTICES;i++) vz[i]=vz_ptr[i]; 6251 6199 } 6252 6200 else{ 6253 for(i=0;i< numvertices;i++) vz[i]=0.0;6201 for(i=0;i<NUMVERTICES;i++) vz[i]=0.0; 6254 6202 } 6255 6203 6256 6204 /*Now Compute vel*/ 6257 for(i=0;i< numvertices;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5);6205 for(i=0;i<NUMVERTICES;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5); 6258 6206 6259 6207 /*For pressure: we have not computed pressure in this analysis, for this element. We are in 2D, … … 6263 6211 GetParameterListOnVertices(&thickness[0],ThicknessEnum); 6264 6212 6265 for(i=0;i< numvertices;i++){6213 for(i=0;i<NUMVERTICES;i++){ 6266 6214 pressure[i]=rho_ice*g*thickness[i]; 6267 6215 } … … 6287 6235 void Tria::InputUpdateFromSolutionOneDof(double* solution,int enum_type){ 6288 6236 6289 const int numvertices = 3;6290 6237 const int numdofpervertex = 1; 6291 const int numdof = numdofpervertex * numvertices;6238 const int numdof = numdofpervertex *NUMVERTICES; 6292 6239 int* doflist=NULL; 6293 6240 double values[numdof]; -
issm/trunk/src/c/objects/Elements/Tria.h
r5661 r5662 22 22 #include "../../EnumDefinitions/EnumDefinitions.h" 23 23 /*}}}*/ 24 25 /*Element macros*/26 #define NUMVERTICES 327 24 28 25 class Tria: public Element,public TriaHook,public TriaRef{
Note:
See TracChangeset
for help on using the changeset viewer.