Changeset 5357


Ignore:
Timestamp:
08/18/10 10:13:38 (15 years ago)
Author:
Eric.Larour
Message:

Extended TriaSearch to deal with several grids

Location:
issm/trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/modules/TriaSearchx/TriaSearchx.cpp

    r5354 r5357  
    1313using namespace std;
    1414
    15 void TriaSearchx(double* ptria,double* index,int nel, double* x, double* y, int nods,double x0, double y0){
     15void TriaSearchx(double** ptria,double* index,int nel, double* x, double* y, int nods,double* x0, double* y0,int numberofgrids){
    1616
    1717        /*Output*/
    18         double tria;
     18        double* tria=NULL;
     19
     20        /*allocate: */
     21        tria=(double*)xmalloc(numberofgrids*sizeof(double));
    1922
    2023        /*Intermediary*/
     
    3437        Th.CreateSingleVertexToTriangleConnectivity();
    3538
    36         //Get current point coordinates
    37         r.x=x0; r.y=y0;
    38         I=Th.R2ToI2(r);
     39        for(i=0;i<numberofgrids;i++){
    3940
    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);
    4245
    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;
    5564        }
    56         //external point
    57         else tria=NAN;
    58        
     65
    5966        /*Assign output pointers:*/
    6067        *ptria=tria;
  • issm/trunk/src/c/modules/TriaSearchx/TriaSearchx.h

    r5354 r5357  
    99
    1010/* local prototypes: */
    11 void TriaSearchx(double* ptria,double* index,int nel, double* x, double* y, int nods,double x0, double y0);
     11void TriaSearchx(double** ptria,double* index,int nel, double* x, double* y, int nods,double* x0, double* y0,int numberofgrids);
    1212
    1313#endif
  • issm/trunk/src/m/classes/public/ismodelselfconsistent.m

    r5324 r5357  
    351351
    352352        %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'};
    354355        checksize(md,fields,[md.nsteps 1]);
    355356
  • issm/trunk/src/m/classes/public/solveparallel.m

    r5189 r5357  
    4242        end
    4343end
     44
     45%post processes qmu results if necessary
     46if md.qmu_analysis,
     47        system(['rm -rf qmu' num2str(GetPId)]);
     48end
     49
     50
  • issm/trunk/src/m/utils/Exp/flowlines.m

    r5338 r5357  
    3838
    3939%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));
     40tria=TriaSearch(index,x,y,x0,y0);
     41if isnan(tria),
     42        error('flowlines error message: seed point is not inside mesh!');
    4843end
    4944
  • issm/trunk/src/mex/TriaSearch/TriaSearch.cpp

    r5354 r5357  
    1414
    1515        double* x=NULL;
     16        double* y=NULL;
    1617        int     nods;
    1718
    18         double* y=NULL;
     19        double* x0=NULL;
     20        double* y0=NULL;
     21        int     numberofgrids;
    1922
    20         double  x0,y0;
    21        
    2223        /* output: */
    23         double  tria;
     24        double*  tria=NULL;
    2425
    2526        /*Boot module: */
     
    3334        FetchData(&x,&nods,XHANDLE);
    3435        FetchData(&y,&nods,YHANDLE);
    35         FetchData(&x0,X0HANDLE);
    36         FetchData(&y0,Y0HANDLE);
     36        FetchData(&x0,&numberofgrids,X0HANDLE);
     37        FetchData(&y0,&numberofgrids,Y0HANDLE);
    3738
    3839        /* Echo: {{{1*/
     
    4142
    4243        /* Run core computations: */
    43         TriaSearchx(&tria,index,nel,x,y,nods,x0,y0);
     44        TriaSearchx(&tria,index,nel,x,y,nods,x0,y0,numberofgrids);
    4445
    4546        /* c to matlab: */
    46         tria++;
     47        for(i=0;i<numberofgrids;i++)tria[i]++;
    4748
    4849        /*Write data: */
    49         WriteData(TRIA,tria);
     50        WriteData(TRIA,tria,numberofgrids);
    5051
    5152        /*end module: */
     
    6162        _printf_("      index,x,y: mesh triangulatrion\n");
    6263        _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");
    6365        _printf_("\n");
    6466}
Note: See TracChangeset for help on using the changeset viewer.