Changeset 5357
- Timestamp:
- 08/18/10 10:13:38 (15 years ago)
- Location:
- issm/trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/modules/TriaSearchx/TriaSearchx.cpp
r5354 r5357 13 13 using namespace std; 14 14 15 void TriaSearchx(double* ptria,double* index,int nel, double* x, double* y, int nods,double x0, double y0){15 void TriaSearchx(double** ptria,double* index,int nel, double* x, double* y, int nods,double* x0, double* y0,int numberofgrids){ 16 16 17 17 /*Output*/ 18 double tria; 18 double* tria=NULL; 19 20 /*allocate: */ 21 tria=(double*)xmalloc(numberofgrids*sizeof(double)); 19 22 20 23 /*Intermediary*/ … … 34 37 Th.CreateSingleVertexToTriangleConnectivity(); 35 38 36 //Get current point coordinates 37 r.x=x0; r.y=y0; 38 I=Th.R2ToI2(r); 39 for(i=0;i<numberofgrids;i++){ 39 40 40 //Find triangle holding r/I 41 Triangle &tb=*Th.TriangleFindFromCoord(I,dete); 41 //Get current point coordinates 42 r.x=x0[i]; r.y=y0[i]; 43 44 I=Th.R2ToI2(r); 42 45 43 // internal point 44 if (tb.det>0){ 45 //Area coordinate 46 areacoord[0]= (double) dete[0]/ tb.det; 47 areacoord[1]= (double) dete[1] / tb.det; 48 areacoord[2]= (double) dete[2] / tb.det; 49 //3 vertices of the triangle 50 i0=Th.GetId(tb[0]); 51 i1=Th.GetId(tb[1]); 52 i2=Th.GetId(tb[2]); 53 //triangle number 54 tria=(double)Th.GetId(tb); 46 //Find triangle holding r/I 47 Triangle &tb=*Th.TriangleFindFromCoord(I,dete); 48 49 // internal point 50 if (tb.det>0){ 51 //Area coordinate 52 areacoord[0]= (double) dete[0]/ tb.det; 53 areacoord[1]= (double) dete[1] / tb.det; 54 areacoord[2]= (double) dete[2] / tb.det; 55 //3 vertices of the triangle 56 i0=Th.GetId(tb[0]); 57 i1=Th.GetId(tb[1]); 58 i2=Th.GetId(tb[2]); 59 //triangle number 60 tria[i]=(double)Th.GetId(tb); 61 } 62 //external point 63 else tria[i]=NAN; 55 64 } 56 //external point 57 else tria=NAN; 58 65 59 66 /*Assign output pointers:*/ 60 67 *ptria=tria; -
issm/trunk/src/c/modules/TriaSearchx/TriaSearchx.h
r5354 r5357 9 9 10 10 /* local prototypes: */ 11 void TriaSearchx(double* ptria,double* index,int nel, double* x, double* y, int nods,double x0, double y0);11 void TriaSearchx(double** ptria,double* index,int nel, double* x, double* y, int nods,double* x0, double* y0,int numberofgrids); 12 12 13 13 #endif -
issm/trunk/src/m/classes/public/ismodelselfconsistent.m
r5324 r5357 351 351 352 352 %LENGTH CONTROL FIELDS 353 fields={'maxiter','optscal','cm_responses','cm_jump'}; 353 %fields={'maxiter','optscal','cm_responses','cm_jump'}; 354 fields={'maxiter','optscal','cm_jump'}; 354 355 checksize(md,fields,[md.nsteps 1]); 355 356 -
issm/trunk/src/m/classes/public/solveparallel.m
r5189 r5357 42 42 end 43 43 end 44 45 %post processes qmu results if necessary 46 if md.qmu_analysis, 47 system(['rm -rf qmu' num2str(GetPId)]); 48 end 49 50 -
issm/trunk/src/m/utils/Exp/flowlines.m
r5338 r5357 38 38 39 39 %check seed points 40 tria=tsearch(x,y,index,x0,y0); 41 pos=find(isnan(tria)); 42 %seems to be a bug here: must do the test several times... 43 while ~isempty(pos) 44 x0(pos)=[]; 45 y0(pos)=[]; 46 tria=tsearch(x,y,index,x0,y0); 47 pos=find(isnan(tria)); 40 tria=TriaSearch(index,x,y,x0,y0); 41 if isnan(tria), 42 error('flowlines error message: seed point is not inside mesh!'); 48 43 end 49 44 -
issm/trunk/src/mex/TriaSearch/TriaSearch.cpp
r5354 r5357 14 14 15 15 double* x=NULL; 16 double* y=NULL; 16 17 int nods; 17 18 18 double* y=NULL; 19 double* x0=NULL; 20 double* y0=NULL; 21 int numberofgrids; 19 22 20 double x0,y0;21 22 23 /* output: */ 23 double tria;24 double* tria=NULL; 24 25 25 26 /*Boot module: */ … … 33 34 FetchData(&x,&nods,XHANDLE); 34 35 FetchData(&y,&nods,YHANDLE); 35 FetchData(&x0, X0HANDLE);36 FetchData(&y0, Y0HANDLE);36 FetchData(&x0,&numberofgrids,X0HANDLE); 37 FetchData(&y0,&numberofgrids,Y0HANDLE); 37 38 38 39 /* Echo: {{{1*/ … … 41 42 42 43 /* Run core computations: */ 43 TriaSearchx(&tria,index,nel,x,y,nods,x0,y0 );44 TriaSearchx(&tria,index,nel,x,y,nods,x0,y0,numberofgrids); 44 45 45 46 /* c to matlab: */ 46 tria++;47 for(i=0;i<numberofgrids;i++)tria[i]++; 47 48 48 49 /*Write data: */ 49 WriteData(TRIA,tria );50 WriteData(TRIA,tria,numberofgrids); 50 51 51 52 /*end module: */ … … 61 62 _printf_(" index,x,y: mesh triangulatrion\n"); 62 63 _printf_(" x0,y0: coordinates of the point for which we are trying to find a triangle\n"); 64 _printf_(" x0,y0 can be an array of points\n"); 63 65 _printf_("\n"); 64 66 }
Note:
See TracChangeset
for help on using the changeset viewer.