Ignore:
Timestamp:
08/19/10 09:28:10 (15 years ago)
Author:
Mathieu Morlighem
Message:

As usual renaming of Bamg routines and fields

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/objects/Bamg/Geometry.cpp

    r5397 r5400  
    400400
    401401        /*Methods*/
     402        /*FUNCTION Geometry::Echo {{{1*/
     403        void Geometry::Echo(void){
     404
     405                printf("Geometry:\n");
     406                printf("   nbv  (number of vertices) : %i\n",nbv);
     407                printf("   nbe  (number of edges)    : %i\n",nbe);
     408                printf("   nbsubdomains: %i\n",nbsubdomains);
     409                printf("   nbcurves: %i\n",nbcurves);
     410                printf("   vertices: %p\n",vertices);
     411                printf("   edges: %p\n",edges);
     412                printf("   quadtree: %p\n",quadtree);
     413                printf("   subdomains: %p\n",subdomains);
     414                printf("   curves: %p\n",curves);
     415                printf("   pmin (x,y): (%g %g)\n",pmin.x,pmin.y);
     416                printf("   pmax (x,y): (%g %g)\n",pmax.x,pmax.y);
     417                printf("   coefIcoor: %g\n",coefIcoor);
     418                printf("   MaxCornerAngle: %g\n",MaxCornerAngle);
     419
     420                return;
     421        }
     422        /*}}}*/
     423        /*FUNCTION Geometry::Init{{{1*/
     424        void Geometry::Init(void){
     425                /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, MeshGeom.cpp/EmptyGeometry)*/
     426
     427                NbRef=0;
     428                nbv=0;
     429                nbe=0;
     430                quadtree=NULL;
     431                curves=NULL;
     432                edges=NULL;
     433                vertices=NULL;
     434                nbsubdomains=0;
     435                nbcurves=0;
     436                subdomains=NULL;
     437                MaxCornerAngle = 10*Pi/180; //default is 10 degres
     438        }
     439        /*}}}1*/
     440        /*FUNCTION Geometry::MinimalHmin{{{1*/
     441        double Geometry::MinimalHmin() {
     442                /* coeffIcoor = (2^30-1)/D
     443                 * We cannot go beyond hmin = D/2^30 because of the quadtree
     444                 * hmin is therefore approximately 2/coeffIcoor */
     445                return 2.0/coefIcoor;
     446        }/*}}}*/
     447        /*FUNCTION Geometry::MaximalHmax{{{1*/
     448        double Geometry::MaximalHmax() {
     449                return Max(pmax.x-pmin.x,pmax.y-pmin.y);
     450        }/*}}}*/
     451        /*FUNCTION Geometry::GetId(const GeometricalVertex &t){{{1*/
     452        long Geometry::GetId(const GeometricalVertex & t) const  {
     453                return &t - vertices;
     454        }/*}}}*/
     455        /*FUNCTION Geometry::GetId(const GeometricalVertex * t){{{1*/
     456        long Geometry::GetId(const GeometricalVertex * t) const  {
     457                return t - vertices;
     458        }/*}}}*/
     459        /*FUNCTION Geometry::GetId(const GeometricalEdge & t){{{1*/
     460        long Geometry::GetId(const GeometricalEdge & t) const  {
     461                return &t - edges;
     462        }/*}}}*/
     463        /*FUNCTION Geometry::GetId(const GeometricalEdge * t){{{1*/
     464        long Geometry::GetId(const GeometricalEdge * t) const  {
     465                return t - edges;
     466        }/*}}}*/
     467        /*FUNCTION Geometry::GetId(const Curve * c){{{1*/
     468        long Geometry::GetId(const Curve * c) const  {
     469                return c - curves;
     470        }/*}}}*/
     471        /*FUNCTION Geometry::Containing{{{1*/
     472        GeometricalEdge* Geometry::Containing(const R2 P,  GeometricalEdge * start) const {
     473                /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, MeshGeom.cpp/Contening)*/
     474
     475                GeometricalEdge* on =start,* pon=0;
     476                // walk with the cos on geometry
     477                int counter=0;
     478                while(pon != on){ 
     479                        counter++;
     480                        ISSMASSERT(counter<100);
     481                        pon = on;
     482                        R2 A= (*on)[0];
     483                        R2 B= (*on)[1];
     484                        R2 AB = B-A;
     485                        R2 AP = P-A;
     486                        R2 BP = P-B;
     487                        if ( (AB,AP) < 0)
     488                         on = on->Adj[0];
     489                        else if ( (AB,BP)  > 0)
     490                         on = on->Adj[1];
     491                        else
     492                         return on;
     493                }
     494                return on;
     495        }
     496        /*}}}1*/
    402497        /*FUNCTION Geometry::PostRead{{{1*/
    403498        void Geometry::PostRead(){
     
    420515
    421516                        /*build integer coordinates (non unique)
    422                         these coordinates are used by the quadtree to group
    423                         the vertices by groups of 5:
    424                         All the coordinates are transformed to ]0,1[^2
    425                         then, the integer coordinates are computed using
    426                         the transformation ]0,1[^2 -> [0 2^30-1[^2 for a quadtree of depth 30*/
     517                          these coordinates are used by the quadtree to group
     518                          the vertices by groups of 5:
     519                          All the coordinates are transformed to ]0,1[^2
     520                          then, the integer coordinates are computed using
     521                          the transformation ]0,1[^2 -> [0 2^30-1[^2 for a quadtree of depth 30*/
    427522                        vertices[i].i=R2ToI2(vertices[i].r);
    428523
     
    669764                                                        GeometricalVertex *a=(*e)(k0); // begin
    670765                                                        if(curves){
    671                                                                 curves[nbcurves].be=e;
    672                                                                 curves[nbcurves].kb=k0;
     766                                                                curves[nbcurves].FirstEdge=e;
     767                                                                curves[nbcurves].FirstVertexIndex=k0;
    673768                                                        }
    674769                                                        int nee=0;
     
    679774                                                                nb_marked_edges++;
    680775                                                                e->CurveNumber=nbcurves;
    681                                                                 if(curves){
    682                                                                         curves[nbcurves].ee=e;
    683                                                                         curves[nbcurves].ke=k1;
    684                                                                 }
    685 
    686776                                                                GeometricalVertex *b=(*e)(k1);
    687777
    688778                                                                //break if we have reached the other end of the curve
    689779                                                                if (a==b || b->Required()){
     780                                                                        if(curves){
     781                                                                                curves[nbcurves].LastEdge=e;
     782                                                                                curves[nbcurves].LastVertexIndex=k1;
     783                                                                        }
    690784                                                                        break;
    691785                                                                }
     
    706800                        if(step==0) curves=new Curve[nbcurves];
    707801                }
    708                 for(int i=0;i<nbcurves ;i++){
    709                         GeometricalEdge * be=curves[i].be, *eqbe=be;
    710                         //GeometricalEdge * ee=curves[i].ee, *eqee=be;
    711                 }
    712802
    713803                /*clean up*/
     
    716806                delete [] eangle;
    717807
    718         }
    719         /*}}}1*/
    720         /*FUNCTION Geometry::Echo {{{1*/
    721         void Geometry::Echo(void){
    722 
    723                 printf("Geometry:\n");
    724                 printf("   nbv  (number of vertices) : %i\n",nbv);
    725                 printf("   nbe  (number of edges)    : %i\n",nbe);
    726                 printf("   nbsubdomains: %i\n",nbsubdomains);
    727                 printf("   nbcurves: %i\n",nbcurves);
    728                 printf("   vertices: %p\n",vertices);
    729                 printf("   edges: %p\n",edges);
    730                 printf("   quadtree: %p\n",quadtree);
    731                 printf("   subdomains: %p\n",subdomains);
    732                 printf("   curves: %p\n",curves);
    733                 printf("   pmin (x,y): (%g %g)\n",pmin.x,pmin.y);
    734                 printf("   pmax (x,y): (%g %g)\n",pmax.x,pmax.y);
    735                 printf("   coefIcoor: %g\n",coefIcoor);
    736                 printf("   MaxCornerAngle: %g\n",MaxCornerAngle);
    737 
    738                 return;
    739         }
    740         /*}}}*/
    741         /*FUNCTION Geometry::Init{{{1*/
    742         void Geometry::Init(void){
    743                 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, MeshGeom.cpp/EmptyGeometry)*/
    744 
    745                 NbRef=0;
    746                 nbv=0;
    747                 nbe=0;
    748                 quadtree=NULL;
    749                 curves=NULL;
    750                 edges=NULL;
    751                 vertices=NULL;
    752                 nbsubdomains=0;
    753                 nbcurves=0;
    754                 subdomains=NULL;
    755                 MaxCornerAngle = 10*Pi/180; //default is 10 degres
    756         }
    757         /*}}}1*/
    758         /*FUNCTION Geometry::MinimalHmin{{{1*/
    759         double Geometry::MinimalHmin() {
    760                 /* coeffIcoor = (2^30-1)/D
    761                  * We cannot go beyond hmin = D/2^30 because of the quadtree
    762                  * hmin is therefore approximately 2/coeffIcoor */
    763                 return 2.0/coefIcoor;
    764         }/*}}}*/
    765         /*FUNCTION Geometry::MaximalHmax{{{1*/
    766         double Geometry::MaximalHmax() {
    767                 return Max(pmax.x-pmin.x,pmax.y-pmin.y);
    768         }/*}}}*/
    769         /*FUNCTION Geometry::GetId(const GeometricalVertex &t){{{1*/
    770         long Geometry::GetId(const GeometricalVertex & t) const  {
    771                 return &t - vertices;
    772         }/*}}}*/
    773         /*FUNCTION Geometry::GetId(const GeometricalVertex * t){{{1*/
    774         long Geometry::GetId(const GeometricalVertex * t) const  {
    775                 return t - vertices;
    776         }/*}}}*/
    777         /*FUNCTION Geometry::GetId(const GeometricalEdge & t){{{1*/
    778         long Geometry::GetId(const GeometricalEdge & t) const  {
    779                 return &t - edges;
    780         }/*}}}*/
    781         /*FUNCTION Geometry::GetId(const GeometricalEdge * t){{{1*/
    782         long Geometry::GetId(const GeometricalEdge * t) const  {
    783                 return t - edges;
    784         }/*}}}*/
    785         /*FUNCTION Geometry::GetId(const Curve * c){{{1*/
    786         long Geometry::GetId(const Curve * c) const  {
    787                 return c - curves;
    788         }/*}}}*/
    789         /*FUNCTION Geometry::Containing{{{1*/
    790         GeometricalEdge* Geometry::Containing(const R2 P,  GeometricalEdge * start) const {
    791                 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, MeshGeom.cpp/Contening)*/
    792 
    793                 GeometricalEdge* on =start,* pon=0;
    794                 // walk with the cos on geometry
    795                 int counter=0;
    796                 while(pon != on){ 
    797                         counter++;
    798                         ISSMASSERT(counter<100);
    799                         pon = on;
    800                         R2 A= (*on)[0];
    801                         R2 B= (*on)[1];
    802                         R2 AB = B-A;
    803                         R2 AP = P-A;
    804                         R2 BP = P-B;
    805                         if ( (AB,AP) < 0)
    806                          on = on->Adj[0];
    807                         else if ( (AB,BP)  > 0)
    808                          on = on->Adj[1];
    809                         else
    810                          return on;
    811                 }
    812                 return on;
    813808        }
    814809        /*}}}1*/
Note: See TracChangeset for help on using the changeset viewer.