Changeset 16166
- Timestamp:
- 09/18/13 10:13:56 (12 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/bamg/Geometry.cpp
r16158 r16166 499 499 double eps = 1e-20; 500 500 BamgQuadtree quadtree; // build quadtree to find duplicates 501 BamgVertex *v0 = vertices;502 501 503 502 k=0; -
issm/trunk-jpl/src/c/bamg/Mesh.cpp
r16158 r16166 522 522 head=(int)bamgmesh->SubDomains[i*3+1]-1;//C indexing 523 523 direction=(int)bamgmesh->SubDomains[i*3+2]; 524 if (i3!= 23) _error_("Bad Subdomain definition: first number should be 3");524 if (i3!=3) _error_("Bad Subdomain definition: first number should be 3"); 525 525 if (head<0 || head>=nbt) _error_("Bad Subdomain definition: head should in [1 " << nbt << "] (triangle number)"); 526 526 subdomains[i].head = triangles+head; 527 subdomains[i].direction = direction; 528 subdomains[i].ReferenceNumber = i3; 527 529 } 528 530 } … … 1051 1053 1052 1054 /*Get options*/ 1053 int verbose =bamgopts->verbose;1054 double anisomax = bamgopts->anisomax;1055 double errg = bamgopts->errg;1055 int verbose = bamgopts->verbose; 1056 double anisomax = bamgopts->anisomax; 1057 double errg = bamgopts->errg; 1056 1058 1057 1059 double ss[2]={0.00001,0.99999}; … … 1061 1063 1062 1064 //check that hmax is positive 1063 if (hmax<=0){ 1064 _error_("hmax<=0"); 1065 } 1065 _assert_(hmax>0); 1066 1066 1067 1067 //errC cannot be higher than 1 1068 if 1068 if(errC>1) errC=1; 1069 1069 1070 1070 //Set all vertices to "on" … … 1072 1072 1073 1073 //loop over all the vertices on edges 1074 for 1074 for(int i=0;i<nbe;i++){ 1075 1075 for (int j=0;j<2;j++){ 1076 1076 … … 2621 2621 2622 2622 } 2623 else 2624 { // find the head for all sub domaine 2623 else{ // find the head for all subdomains 2625 2624 if (Gh.nbsubdomains != nbsubdomains && subdomains) 2626 2625 delete [] subdomains, subdomains=0; … … 2628 2627 subdomains = new SubDomain[ Gh.nbsubdomains]; 2629 2628 nbsubdomains =Gh.nbsubdomains; 2630 long err=0;2631 2629 CreateSingleVertexToTriangleConnectivity(); 2632 2630 long * mark = new long[nbt]; … … 2639 2637 GeomEdge &eg = *Gh.subdomains[i].edge; 2640 2638 subdomains[i].ReferenceNumber = Gh.subdomains[i].ReferenceNumber; 2641 int ssdlab = subdomains[i].ReferenceNumber;2642 2639 // by carefull is not easy to find a edge create from a GeomEdge 2643 2640 // see routine MakeGeomEdgeToEdge … … 3109 3106 void Mesh::MakeBamgQuadtree() { 3110 3107 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/MakeBamgQuadtree)*/ 3111 3112 long int verbose=0; 3113 if ( !quadtree ) quadtree = new BamgQuadtree(this); 3114 3108 if(!quadtree) quadtree = new BamgQuadtree(this); 3115 3109 } 3116 3110 /*}}}*/ … … 3314 3308 } 3315 3309 3316 } while (nbv!=nbvold); 3317 3318 delete [] first_np_or_next_t; 3319 3320 long NbSwapf =0,NbSwp; 3321 3322 NbSwp = NbSwapf; 3323 for (i=0;i<nbv;i++) 3324 NbSwapf += vertices[i].Optim(0); 3325 NbTSwap += NbSwapf ; 3326 } 3327 /*}}}*/ 3310 }while(nbv!=nbvold); 3311 delete [] first_np_or_next_t; 3312 3313 long NbSwapf =0; 3314 3315 for(i=0;i<nbv;i++) NbSwapf += vertices[i].Optim(0); 3316 }/*}}}*/ 3328 3317 /*FUNCTION Mesh::ProjectOnCurve{{{*/ 3329 3318 GeomEdge* Mesh::ProjectOnCurve( Edge & BhAB, BamgVertex & vA, BamgVertex & vB, … … 3766 3755 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/ReNumberingTheTriangleBySubDomain)*/ 3767 3756 3768 long int verbose=0;3769 3757 long *renu= new long[nbt]; 3770 3758 register Triangle *t0,*t,*te=triangles+nbt; … … 4889 4877 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/ConsRefTriangle)*/ 4890 4878 4891 long int verbose=0;4892 4879 register Triangle *t0,*t; 4893 4880 register long k=0, num; … … 5416 5403 5417 5404 /*Initialize variables*/ 5418 double Lstep=0 ,Lcurve=0;// step between two points (phase==1)5405 double Lstep=0; // step between two points (phase==1) 5419 5406 long NbCreatePointOnCurve=0;// Nb of new points on curve (phase==1) 5420 5407 … … 5549 5536 long NbSegOnCurve = Max((long)(L+0.5),(long) 1);// nb of seg 5550 5537 Lstep = L/NbSegOnCurve; 5551 Lcurve = L;5552 5538 NbCreatePointOnCurve = NbSegOnCurve-1; 5553 5539 NbOfNewEdge += NbSegOnCurve; … … 5680 5666 _error_("!v1 || !v2"); 5681 5667 } 5682 Icoor2 detss = 0,l=0 ,ks;5683 while (( ks=SwapForForcingEdge( va, vb, tc, detss, det1,det2,NbSwap)))5668 Icoor2 detss = 0,l=0; 5669 while ((SwapForForcingEdge( va, vb, tc, detss, det1,det2,NbSwap))) 5684 5670 if(l++ > 10000000) { 5685 5671 _error_("Loop in forcing Egde, nb de swap=" << NbSwap << ", nb of try swap (" << l << ") too big"); -
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r16164 r16166 157 157 void Penta::BasalFrictionCreateInput(void){ 158 158 159 /*Constants*/160 const int numdof=NUMVERTICES*NDOF1;161 162 159 /*Intermediaries */ 163 int count;164 IssmDouble basalfriction[NUMVERTICES]={0,0,0,0,0,0};165 IssmDouble alpha2,vx,vy;166 Friction * friction=NULL;167 GaussPenta * gauss=NULL;160 int count; 161 IssmDouble basalfriction[NUMVERTICES]; 162 IssmDouble alpha2 ,vx,vy; 163 Friction *friction = NULL; 164 GaussPenta *gauss = NULL; 168 165 169 166 /* Basal friction can only be found at the base of an ice sheet: */ … … 567 564 568 565 /*retrieve parameters: */ 569 ElementMatrix* Ke=NULL;570 566 ElementVector* De=NULL; 571 567 int analysis_type; 572 568 parameters->FindParam(&analysis_type,AnalysisTypeEnum); 573 569 574 /*Checks in debugging {{{*/570 /*Checks in debugging*/ 575 571 _assert_(this->nodes && this->material && this->matpar && this->verticalneighbors && this->parameters && this->inputs); 576 /*}}}*/577 572 578 573 switch(analysis_type){ … … 2144 2139 void Penta::InputToResult(int enum_type,int step,IssmDouble time){ 2145 2140 2146 bool found = false;2147 2141 Input *input = NULL; 2148 2142 2149 2143 /*Go through all the input objects, and find the one corresponding to enum_type, if it exists: */ 2150 if (enum_type==MaterialsRheologyBbarEnum) input=this->material->inputs->GetInput(MaterialsRheologyBEnum); 2151 else if (enum_type==MaterialsRheologyZbarEnum) input=this->material->inputs->GetInput(MaterialsRheologyZEnum); 2152 else input=this->inputs->GetInput(enum_type); 2144 if (enum_type==MaterialsRheologyBbarEnum) 2145 input=this->material->inputs->GetInput(MaterialsRheologyBEnum); 2146 else if (enum_type==MaterialsRheologyZbarEnum) 2147 input=this->material->inputs->GetInput(MaterialsRheologyZEnum); 2148 else 2149 input=this->inputs->GetInput(enum_type); 2153 2150 //if (!input) _error_("Input " << EnumToStringx(enum_type) << " not found in penta->inputs"); why error out? if the requested input does not exist, we should still 2154 2151 //try and output whatever we can instead of just failing. … … 2852 2849 2853 2850 /*Intermediaries*/ 2854 int i; 2855 int numberofresults = 0; 2856 int *resultsenums = NULL; 2857 int *resultssizes = NULL; 2858 IssmDouble *resultstimes = NULL; 2859 int *resultssteps = NULL; 2851 int *resultsenums = NULL; 2852 int *resultssizes = NULL; 2853 IssmDouble *resultstimes = NULL; 2854 int *resultssteps = NULL; 2860 2855 2861 2856 /*Checks*/ … … 2863 2858 2864 2859 /*Count number of results*/ 2865 for(i=0;i<this->results->Size();i++){ 2866 ElementResult* elementresult=(ElementResult*)this->results->GetObjectByOffset(i); 2867 numberofresults++; 2868 } 2860 int numberofresults = this->results->Size(); 2869 2861 2870 2862 if(numberofresults){ 2871 2872 2863 /*Allocate output*/ 2873 2864 resultsenums=xNew<int>(numberofresults); … … 2877 2868 2878 2869 /*populate enums*/ 2879 for(i =0;i<this->results->Size();i++){2870 for(int i=0;i<this->results->Size();i++){ 2880 2871 ElementResult* elementresult=(ElementResult*)this->results->GetObjectByOffset(i); 2881 2872 resultsenums[i]=elementresult->InstanceEnum(); … … 3781 3772 void Penta::ViscousHeatingCreateInput(void){ 3782 3773 3783 /*Constants*/3784 const int numdof=NUMVERTICES*NDOF1;3785 3786 3774 /*Intermediaries*/ 3787 3775 IssmDouble phi; … … 3789 3777 IssmDouble xyz_list[NUMVERTICES][3]; 3790 3778 IssmDouble epsilon[6]; 3791 IssmDouble viscousheating[NUMVERTICES] ={0,0,0,0,0,0};3779 IssmDouble viscousheating[NUMVERTICES]; 3792 3780 IssmDouble thickness; 3793 GaussPenta *gauss=NULL;3794 3795 /*Initialize Element vector*/3796 ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters);3797 3781 3798 3782 /*Retrieve all inputs and parameters*/ … … 3804 3788 3805 3789 /*loop over vertices: */ 3806 gauss=new GaussPenta();3790 GaussPenta* gauss=new GaussPenta(); 3807 3791 for (int iv=0;iv<NUMVERTICES;iv++){ 3808 3792 gauss->GaussVertex(iv); … … 4101 4085 IssmDouble D[3][3]; 4102 4086 IssmDouble K[3][3]={0.0}; 4103 Tria* tria=NULL;4104 4087 GaussPenta *gauss=NULL; 4105 4088 … … 4334 4317 IssmDouble D[3][3]; 4335 4318 IssmDouble K[3][3]={0.0}; 4336 Tria* tria=NULL;4337 4319 GaussPenta *gauss=NULL; 4338 4320 -
issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp
r16164 r16166 441 441 442 442 // The penalty is stable if it doesn't change during to successive iterations. 443 const int numnodes=1;444 443 IssmDouble pressure; 445 444 IssmDouble temperature; … … 623 622 624 623 // The penalty is stable if it doesn't change during two consecutive iterations. 625 const int numnodes = 1;626 624 int unstable = 0; 627 625 int new_active; -
issm/trunk-jpl/src/c/classes/kriging/Quadtree.cpp
r16164 r16166 205 205 QuadtreeBox *box = NULL; 206 206 int xi,yi; 207 int level ,levelbin;207 int levelbin; 208 208 int index; 209 209 double length,length2; … … 212 212 this->IntergerCoordinates(&xi,&yi,x,y); 213 213 214 /*Initialize levels*/ 215 level = 0; 214 /*Initialize level*/ 216 215 levelbin = (1L<<this->MaxDepth);// = 2^30 217 216 … … 221 220 /*Find the smallest box where this point is located*/ 222 221 while((box=*pbox) && (box->nbitems<0)){ 223 224 levelbin>>=1; level+=1; 225 222 levelbin>>=1; 226 223 pbox = &box->box[IJ(xi,yi,levelbin)]; 227 224 } -
issm/trunk-jpl/src/c/modules/ContourToMeshx/ContourToMeshx.cpp
r15335 r16166 13 13 14 14 /*Contour:*/ 15 double value; 16 17 /*threading: */ 18 ContourToMeshxThreadStruct gate; 19 int num=1; 20 #ifdef _MULTITHREADING_ 21 num=_NUMTHREADS_; 22 #endif 15 double value; 23 16 24 17 /*output: */ … … 29 22 30 23 /*initialize thread parameters: */ 31 gate.contours=contours; 32 gate.nods=nods; 33 gate.edgevalue=edgevalue; 34 gate.in_nod=in_nod; 35 gate.x=x; 36 gate.y=y; 24 ContourToMeshxThreadStruct gate; 25 gate.contours = contours; 26 gate.nods = nods; 27 gate.edgevalue = edgevalue; 28 gate.in_nod = in_nod; 29 gate.x = x; 30 gate.y = y; 37 31 38 32 /*launch the thread manager with ContourToMeshxt as a core: */ 39 LaunchThread(ContourToMeshxt,(void*)&gate, num);33 LaunchThread(ContourToMeshxt,(void*)&gate,_NUMTHREADS_); 40 34 41 35 /*Take care of the case where an element interpolation has been requested: */ … … 43 37 for(int n=0;n<nel;n++){ 44 38 if ( (in_nod[ (int)*(index+3*n+0) -1] == 1) && (in_nod[ (int)*(index+3*n+1) -1] == 1) && (in_nod[ (int)*(index+3*n+2) -1] == 1) ){ 45 value=1 ; in_elem[n]=value;39 value=1.; in_elem[n]=value; 46 40 } 47 41 } -
issm/trunk-jpl/src/c/modules/InterpFromGridToMeshx/InterpFromGridToMeshx.cpp
r16164 r16166 26 26 int i; 27 27 28 /*threading: */29 InterpFromGridToMeshxThreadStruct gate;30 int num=1;31 #ifdef _MULTITHREADING_32 num=_NUMTHREADS_;33 #endif34 35 28 /*Some checks on arguments: */ 36 29 if ((M<2) || (N<2) || (nods<=0)){ … … 53 46 x=xNew<double>(N); 54 47 y=xNew<double>(M); 55 for (i=0;i<N;i++) x[i]=(x_in[i]+x_in[i+1])/2;56 for (i=0;i<M;i++) y[i]=(y_in[i]+y_in[i+1])/2;48 for(i=0;i<N;i++) x[i]=(x_in[i]+x_in[i+1])/2.; 49 for(i=0;i<M;i++) y[i]=(y_in[i]+y_in[i+1])/2.; 57 50 x_rows=x_rows-1; 58 51 y_rows=y_rows-1; … … 63 56 x=xNew<double>(N); 64 57 y=xNew<double>(M); 65 for 66 for 58 for(i=0;i<N;i++) x[i]=x_in[i]; 59 for(i=0;i<M;i++) y[i]=y_in[i]; 67 60 } 68 61 else{ … … 71 64 72 65 /*initialize thread parameters: */ 73 gate.x_mesh=x_mesh; 74 gate.y_mesh=y_mesh; 75 gate.x_rows=x_rows; 76 gate.y_rows=y_rows; 77 gate.x=x; 78 gate.y=y; 79 gate.nods=nods; 80 gate.data_mesh=data_mesh; 81 gate.data=data; 82 gate.default_value=default_value; 83 gate.interp=interpenum; 84 gate.M=M; 85 gate.N=N; 66 InterpFromGridToMeshxThreadStruct gate; 67 gate.x_mesh = x_mesh; 68 gate.y_mesh = y_mesh; 69 gate.x_rows = x_rows; 70 gate.y_rows = y_rows; 71 gate.x = x; 72 gate.y = y; 73 gate.nods = nods; 74 gate.data_mesh = data_mesh; 75 gate.data = data; 76 gate.default_value = default_value; 77 gate.interp = interpenum; 78 gate.M = M; 79 gate.N = N; 86 80 87 81 /*launch the thread manager with InterpFromGridToMeshxt as a core: */ 88 LaunchThread(InterpFromGridToMeshxt,(void*)&gate, num);82 LaunchThread(InterpFromGridToMeshxt,(void*)&gate,_NUMTHREADS_); 89 83 _printf_("\r interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"% \n"); 90 84 -
issm/trunk-jpl/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dx.cpp
r15217 r16166 25 25 26 26 /*contours: */ 27 double *incontour = NULL; 28 29 /*threading: */ 30 InterpFromMesh2dxThreadStruct gate; 31 int num=1; 32 33 #ifdef _MULTITHREADING_ 34 num=_NUMTHREADS_; 35 #endif 27 double *incontour = NULL; 36 28 37 29 /*some checks*/ … … 84 76 85 77 /*initialize thread parameters: */ 86 gate.interpolation_type=interpolation_type; 87 gate.debug=debug; 88 gate.nels_data=nels_data; 89 gate.index_data=index_data; 90 gate.x_data=x_data; 91 gate.y_data=y_data; 92 gate.data=data; 93 gate.xmin=xmin; 94 gate.xmax=xmax; 95 gate.ymin=ymin; 96 gate.ymax=ymax; 97 gate.nods_prime=nods_prime; 98 gate.data_prime=data_prime; 99 gate.x_prime=x_prime; 100 gate.y_prime=y_prime; 101 gate.default_values=default_values; 102 gate.num_default_values=num_default_values; 103 gate.incontour=incontour; 78 InterpFromMesh2dxThreadStruct gate; 79 gate.interpolation_type = interpolation_type; 80 gate.debug = debug; 81 gate.nels_data = nels_data; 82 gate.index_data = index_data; 83 gate.x_data = x_data; 84 gate.y_data = y_data; 85 gate.data = data; 86 gate.xmin = xmin; 87 gate.xmax = xmax; 88 gate.ymin = ymin; 89 gate.ymax = ymax; 90 gate.nods_prime = nods_prime; 91 gate.data_prime = data_prime; 92 gate.x_prime = x_prime; 93 gate.y_prime = y_prime; 94 gate.default_values = default_values; 95 gate.num_default_values = num_default_values; 96 gate.incontour = incontour; 104 97 105 98 /*launch the thread manager with InterpFromGridToMeshxt as a core: */ 106 LaunchThread(InterpFromMesh2dxt,(void*)&gate, num);99 LaunchThread(InterpFromMesh2dxt,(void*)&gate,_NUMTHREADS_); 107 100 108 101 /*Assign output pointers:*/ -
issm/trunk-jpl/src/c/modules/Krigingx/Krigingx.cpp
r15557 r16166 28 28 /*threading: */ 29 29 KrigingxThreadStruct gate; 30 int num=1; 31 #ifdef _MULTITHREADING_ 32 num=_NUMTHREADS_; 33 #endif 30 int num = _NUMTHREADS_; 34 31 35 32 /*Get Variogram from Options*/ -
issm/trunk-jpl/src/c/modules/ModelProcessorx/Stressbalance/CreateConstraintsStressbalance.cpp
r16164 r16166 40 40 /*Output*/ 41 41 Constraints *constraints = NULL; 42 SpcStatic *spcstatic = NULL;43 42 44 43 /*Fetch parameters: */ -
issm/trunk-jpl/src/c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsx.cpp
r16164 r16166 11 11 12 12 /*threading: */ 13 PointCloudFindNeighborsThreadStruct gate;14 15 #ifdef _MULTITHREADING_16 13 int num=_NUMTHREADS_; 17 #else18 int num=1;19 #endif20 21 14 if(!multithread)num=1; 22 15 23 16 /*initialize thread parameters: */ 24 gate.x=x; 25 gate.y=y; 26 gate.nods=nods; 27 gate.mindistance=mindistance; 28 gate.flags=flags; 17 PointCloudFindNeighborsThreadStruct gate; 18 gate.x = x; 19 gate.y = y; 20 gate.nods = nods; 21 gate.mindistance = mindistance; 22 gate.flags = flags; 29 23 30 24 /*launch the thread manager with InterpFromGridToMeshxt as a core: */
Note:
See TracChangeset
for help on using the changeset viewer.