Changeset 2899


Ignore:
Timestamp:
01/22/10 17:14:29 (15 years ago)
Author:
Mathieu Morlighem
Message:

some improvements in Bamg

Location:
issm/trunk/src
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/Bamgx/Bamgx.cpp

    r2877 r2899  
    5252        double omega=1.8;
    5353        int NbSmooth=3;
     54        int ChoiseHessien = 0;
     55        double power=1;
     56        int Rescaling=1;
     57
    5458        Triangles* Thr=NULL;
    5559        Triangles* Thb=NULL;
     
    7983                if (verbosity>1) printf("   Processing geometry...\n");
    8084                Geometry Gh(bamggeom,bamgopts);
     85                if (verbosity>10){
     86                        Gh.Echo();
     87                }
     88
     89                //get hmin and hmax from geometry to generate the metric
    8190                hmin = Max(hmin,Gh.MinimalHmin());
    8291                hmax = Min(hmax,Gh.MaximalHmax());
     
    118127                hmax = Min(hmax,BTh.MaximalHmax());
    119128
    120                 //?????TEST
     129                //Make Quadtree from background mesh
    121130                BTh.MakeQuadTree();
    122131
    123132                //build metric if not given in input
    124                 if (verbosity>1) printf("   Processing Metric...\n");
    125133                if (bamgopts->metric){
     134                        if (verbosity>1) printf("   Processing Metric...\n");
    126135                        BTh.ReadMetric(bamgopts,hmin,hmax,coef);
     136                }
     137                else if (bamgopts->field){
     138                        if (verbosity>1) printf("   Generating Metric from solution field...\n");
     139                        BTh.IntersectConsMetric(bamgopts->field,1,0,hmin,hmax,sqrt(err)*coef,1e30,AbsError?0.0:cutoff,nbjacoby,Rescaling,power,ChoiseHessien);
    127140                }
    128141                else { // init with hmax
    129142                        Metric Mhmax(hmax);
    130                         for (Int4 iv=0;iv<BTh.nbv;iv++)
    131                          BTh[iv].m = Mhmax;
     143                        for (Int4 iv=0;iv<BTh.nbv;iv++) BTh[iv].m = Mhmax;
    132144                }
    133145
     
    138150
    139151                //Build new mesh Thr
     152                if (verbosity>1) printf("   Generating Mesh...\n");
    140153                Thr=&BTh,Thb=0;
    141154                Triangles & Th( *(0 ?  new Triangles(*Thr,&Thr->Gh,Thb,maxnbv) :  new Triangles(maxnbv,BTh,KeepBackVertices)));
     
    163176                if (verbosity>1) printf("   Write Geometry...\n");
    164177                Th.Gh.WriteGeometry(bamggeom,bamgopts);
     178                if (verbosity>1) printf("   Write Metric...\n");
     179                BTh.WriteMetric(bamgopts);
    165180
    166181                /*clean up*/
  • issm/trunk/src/c/Bamgx/Mesh2.h

    r2877 r2899  
    845845                        Real8 MaximalAngleOfCorner;
    846846
    847                         //  end of data
    848 
     847                        void Echo();
    849848
    850849                        I2 toI2(const R2 & P) const {
  • issm/trunk/src/c/Bamgx/Metric.h

    r2862 r2899  
    7373                inline void  Box(Real4 &hx,Real4 &hy) const ; 
    7474                MetricAnIso(const MatVVP2x2);
     75                void  Echo();
    7576        };
    7677
     
    8283                D2 v;
    8384
     85                void  Echo();
    8486                MatVVP2x2(double r1,double r2,const D2 vp1): lambda1(r1),lambda2(r2),v(vp1){}
    8587
     
    103105                void BoundAniso(const Real8 c){ BoundAniso2(1/(c*c));}
    104106                void operator *=(double coef){ lambda1*=coef;lambda2*=coef;}
    105           };
     107        };
    106108
    107109        inline void  MatVVP2x2::BoundAniso2(const Real8 coef){
  • issm/trunk/src/c/Bamgx/objects/Geometry.cpp

    r2885 r2899  
    580580                        }
    581581                }
    582 
    583                 // bulle sort on the angle of edge 
     582                // in our case, for 4 points and 4 edges (in parenthesis from now on):
     583                // hv =  7 2 4 6
     584                // ev =  -1 -1 1 -1 3 -1 5 0
     585
     586                //compute angle of edges
    584587                for (i=0;i<nbv;i++) {
     588
    585589                        int exch=1, ord=0;     
    586590                        while (exch){
    587                                 exch  =0;
    588                                 Int4* p=hv+i;
    589                                 Int4* po=p;
    590                                 Int4  n=*p;
     591                                Int4 *p=hv+i;                   // pointer to hv[vertex i]  (p=hv)
     592                                Int4 *po=p;                     // copy of pointer p        (po=p)
     593                                Int4  n=*p;                     // value hv[vertex i]       (n=7)
    591594                                register float angleold=-1000 ; // angle = - infinity
    592                                 ord = 0;
    593                                 while (n >=0){
     595                                ord=0; exch=0;
     596                                while (n >=0){// loop as long as ...
    594597                                        ord++;
    595                                         register Int4 i1=n/2;
    596                                         register Int4 j1=n%2;
    597                                         register Int4 *pn=ev+n;
     598                                        register Int4  i1=n/2;       // i1 = floor (n/2)          (i1 = 7/2 = 3)
     599                                        register Int4  j1=n%2;       // j1 = 1 if n is odd        (j1 = 1)
     600                                        register Int4* pn=ev+n;      // pointer to ev[n]          (pn = &ev[7])
     601                                        //compute angle from eangle:
     602                                        // if n odd: angle = eangle - Pi [2*Pi]
     603                                        // else    : angle = eangle
    598604                                        float angle = j1 ? OppositeAngle(eangle[i1]):  eangle[i1];
    599                                         n = *pn;
    600                                         if (angleold > angle) // exch to have : po -> pn -> p
    601                                          exch=1,*pn = *po,*po=*p,*p=n,po = pn;
    602                                         else //  to have : po -> p -> pn
    603                                          angleold =  angle, po = p,p  = pn;
    604                                 }
    605                         }
    606 
    607                         // angulare test to find a corner
     605                                        n=*pn;                       //  n = ev[n]                (n = ev[7] = 0)
     606                                        if (angleold > angle){       // exch to have : po -> pn -> p
     607                                                exch=1, *pn=*po, *po=*p, *p=n, po=pn;
     608                                        }
     609                                        else{                        //  to have : po -> p -> pn
     610                                                angleold=angle, po=p, p=pn;
     611                                        }
     612                                }
     613                        }
     614                        //first iteration: i=0
     615                        //hv 0 2 4 6
     616                        //ev 7 -1 1 -1 3 -1 5 -1
     617
     618                        // angular test on current vertex to guess whether it is a corner
    608619                        if(ord == 2) {
    609                                 Int4 n1 = hv[i];
    610                                 Int4 n2 = ev[n1];
    611                                 Int4 i1 = n1 /2, i2 = n2/2; // edge number
    612                                 Int4  j1 = n1 %2, j2 = n2%2; // vertex in the edge
     620                                Int4  n1 = hv[i];
     621                                Int4  n2 = ev[n1];
     622                                Int4  i1 = n1/2, i2 = n2/2; // edge number
     623                                Int4  j1 = n1%2, j2 = n2%2; // vertex in the edge
     624                                /*//first iteration i=0
     625                                //n1=hv[i]=0
     626                                //n2=ev[i]=7
     627                                //i1 = 0  i2 = 3
     628                                //j1 = 0  j2 = 1
     629                                printf("i=%i\n",i);
     630                                printf("n1=hv[i]=%i\n",n1);
     631                                printf("n2=ev[i]=%i\n",n2);
     632                                printf("i1 = %i  i2 = %i\n",i1,i2);
     633                                printf("j1 = %i  j2 = %i\n",j1,j2);*/
    613634                                float angle1=  j1 ? OppositeAngle(eangle[i1]) : eangle[i1];
    614635                                float angle2= !j2 ? OppositeAngle(eangle[i2]) : eangle[i2];
     
    638659                k =0;
    639660                for (i=0;i<nbe;i++){
    640                         for (jj=0;jj<2;jj++){
     661                        for (j=0;j<2;j++){
    641662                                Int4 n1 = ev[k++];
    642663                                Int4 i1 = n1/2 ,j1=n1%2;
    643                                 if( edges[i1].v[j1] != edges[i].v[jj]) {
     664                                if( edges[i1].v[j1] != edges[i].v[j]) {
    644665                                        throw ErrorException(__FUNCT__,exprintf("Bug Adj edge"));
    645666                                }
    646667                                edges[i1].Adj[j1] = edges + i;
    647                                 edges[i1].DirAdj[j1] = jj;
     668                                edges[i1].DirAdj[j1] = j;
    648669                        }
    649670                }
     
    776797        }
    777798        /*}}}1*/
     799        /*FUNCTION  Geometry::Echo {{{1*/
     800
     801        void Geometry::Echo(void){
     802
     803                printf("Geometry:\n");
     804                printf("   name: %s\n",name);
     805                printf("   nbvx (maximum number of vertices) : %i\n",nbvx);
     806                printf("   nbtx (maximum number of triangles): %i\n",nbtx);
     807                printf("   nbv  (number of vertices) : %i\n",nbv);
     808                printf("   nbt  (number of triangles): %i\n",nbt);
     809                printf("   nbe  (number of edges)    : %i\n",nbe);
     810                printf("   nbv  (number of initial vertices) : %i\n",nbiv);
     811                printf("   NbSubDomains: %i\n",NbSubDomains);
     812                printf("   NbEquiEdges: %i\n",NbEquiEdges);
     813                printf("   NbCrackedEdges: %i\n",NbCrackedEdges);
     814                printf("   NbOfCurves: %i\n",NbOfCurves);
     815                printf("   vertices: %p\n",vertices);
     816                printf("   triangles: %p\n",triangles);
     817                printf("   edges: %p\n",edges);
     818                printf("   quadtree: %p\n",quadtree);
     819                printf("   subdomains: %p\n",subdomains);
     820                printf("   curves: %p\n",curves);
     821                printf("   pmin (x,y): (%g %g)\n",pmin.x,pmin.y);
     822                printf("   pmax (x,y): (%g %g)\n",pmax.x,pmax.y);
     823                printf("   coefIcoor: %g\n",coefIcoor);
     824                printf("   MaximalAngleOfCorner: %g\n",MaximalAngleOfCorner);
     825
     826                return;
     827        }
     828        /*}}}*/
    778829        /*FUNCTION  Geometry::EmptyGeometry(){{{1*/
    779830        void Geometry::EmptyGeometry() {
  • issm/trunk/src/c/Bamgx/objects/MatVVP2x2.cpp

    r2865 r2899  
    4747        /*}}}1*/
    4848
     49        /*Methods*/
     50        /*FUNCTION MatVVP2x2::Echo {{{1*/
     51
     52        void MatVVP2x2::Echo(void){
     53
     54                printf("MatVVP2x2:\n");
     55                printf("   lambda1: %g\n",lambda1);
     56                printf("   lambda2: %g\n",lambda2);
     57                printf("   v.x: %g\n",v.x);
     58                printf("   v.y: %g\n",v.y);
     59
     60                return;
     61        }
     62        /*}}}*/
     63
    4964}
  • issm/trunk/src/c/Bamgx/objects/MetricAnIso.cpp

    r2865 r2899  
    5959
    6060        /*Methods*/
     61        /*FUNCTION MetricAnIso::Echo {{{1*/
     62
     63        void MetricAnIso::Echo(void){
     64
     65                printf("MetricAnIso:\n");
     66                printf("   [a11 a21 a22]: [%g %g %g]\n",a11,a21,a22);
     67
     68                return;
     69        }
     70        /*}}}*/
    6171        /*FUNCTION MetricAnIso::IntersectWith{{{1*/
    6272        int MetricAnIso::IntersectWith(const MetricAnIso M2) {
  • issm/trunk/src/c/Bamgx/objects/Triangles.cpp

    r2877 r2899  
    325325                        hvertices=1;
    326326                        for (i=0;i< nbv;i++){
    327                                 vertices[i].m=Metric((Real4)bamgmesh->hVertices[i]);
     327                                if (!isnan(bamgmesh->hVertices[i])){
     328                                        vertices[i].m=Metric((Real4)bamgmesh->hVertices[i]);
     329                                }
    328330                        }
    329331                }
     
    689691                        }
    690692                        else if (j==3){
    691                                 Real8 a,b,c;         
    692                                 a=bamgopts->metric[i*3+0];
    693                                 b=bamgopts->metric[i*3+1];
    694                                 c=bamgopts->metric[i*3+2];
    695                                 MetricAnIso M(a,b,c);
    696                                 MatVVP2x2 Vp(M/coef);
    697 
    698                                 Vp.Maxh(hmin);
    699                                 Vp.Minh(hmax);
    700                                 vertices[i].m = Vp;
     693                                //do not erase metric computed by hVertices
     694                                if (vertices[i].m.a11==1 && vertices[i].m.a21==0 && vertices[i].m.a22==1){
     695                                        Real8 a,b,c;         
     696                                        a=bamgopts->metric[i*3+0];
     697                                        b=bamgopts->metric[i*3+1];
     698                                        c=bamgopts->metric[i*3+2];
     699                                        MetricAnIso M(a,b,c);
     700                                        MatVVP2x2 Vp(M/coef);
     701
     702                                        Vp.Maxh(hmin);
     703                                        Vp.Minh(hmax);
     704                                        vertices[i].m = Vp;
     705                                }
    701706                        }
    702707                }
     
    27232728        /*}}}1*/
    27242729/*FUNCTION Triangles::IntersectConsMetric{{{1*/
    2725 void Triangles::IntersectConsMetric(const double * s,const Int4 nbsol,const int * typsols,
     2730void Triangles::IntersectConsMetric(const double* s,const Int4 nbsol,const int * typsols,
    27262731                        const  Real8 hmin1,const Real8 hmax1,const Real8 coef,
    27272732                        const Real8 anisomax ,const Real8 CutOff,const int NbJacobi,
    2728                         const int DoNormalisation,const double power,const int choice)
    2729 { //  the array of solution s is store   
     2733                        const int DoNormalisation,const double power,const int choice){
     2734        //  the array of solution s is store   
    27302735        // sol0,sol1,...,soln    on vertex 0
    27312736        //  sol0,sol1,...,soln   on vertex 1
    27322737        //  etc.
    2733         //  choise = 0 =>  H is computed with green formule
    2734         //   otherwise  => H is computed from P2 on 4T
     2738        //  choise = 0 =>  H is computed with green formula
     2739        //  otherwise  =>  H is computed from P2 on 4T
     2740
    27352741        const int dim = 2;
    2736 
    27372742        long int verbosity=0;
    27382743
     
    27412746        // computation of the nb of field
    27422747        Int4 ntmp = 0;
    2743         if (typsols)
    2744           {
    2745                 for (Int4 i=0;i<nbsol;i++)
    2746                  ntmp += sizeoftype[typsols[i]];
     2748        if (typsols){
     2749                for (Int4 i=0;i<nbsol;i++) ntmp += sizeoftype[typsols[i]];
    27472750          }
    2748         else
    2749          ntmp = nbsol;
     2751        else ntmp = nbsol;
    27502752
    27512753        // n is the total number of fields
     
    27682770                else printf("      Absolute error\n");
    27692771        }
    2770         double *ss=(double*)s;
     2772        double* ss=(double*)s;
    27712773
    27722774        double sA,sB,sC;
     
    27812783        Real8 *workV= new Real8[nbv];
    27822784        int *OnBoundary = new int[nbv];
    2783         for (iv=0;iv<nbv;iv++)
    2784           {
     2785        for (iv=0;iv<nbv;iv++){
    27852786                Mmass[iv]=0;
    27862787                OnBoundary[iv]=0;
    27872788                Mmassxx[iv]=0;
    2788           }
     2789        }
    27892790
    27902791        for (i=0;i<nbt;i++)
    2791          if(triangles[i].link) // the real triangles
    2792                 {
     2792         if(triangles[i].link){ // the real triangles
    27932793                 const Triangle &t=triangles[i];
    27942794                 // coor of 3 vertices
     
    28232823                 Mmass[iC] += dett;
    28242824
    2825                  if((nbb==0)|| !choice)
    2826                         {
     2825                 if((nbb==0)|| !choice){
    28272826                         Mmassxx[iA] += dett;
    28282827                         Mmassxx[iB] += dett;
     
    28302829                        }
    28312830                }
    2832          else
    2833           workT[i]=-1;
    2834 
    2835         for (Int4 nusol=0;nusol<nbsol;nusol++)
    2836           { //for all Solution 
     2831         else workT[i]=-1;
     2832
     2833        for (Int4 nusol=0;nusol<nbsol;nusol++) {
     2834                //for all Solution 
    28372835
    28382836                Real8 smin=ss[0],smax=ss[0];
     
    28432841                int nbfield = typsols? sizeoftype[typsols[nusol]] : 1;
    28442842                if (nbfield == 1)
    2845                  for ( iv=0,k=0; iv<nbv; iv++,k+=n )
    2846                         {
     2843                 for ( iv=0,k=0; iv<nbv; iv++,k+=n ){
    28472844                         dxdx[iv]=dxdy[iv]=dydy[iv]=0;
    28482845                         smin=Min(smin,ss[k]);
    28492846                         smax=Max(smax,ss[k]);
    2850                         }
    2851                 else
    2852                   {
     2847                 }
     2848                else{
    28532849                        //  cas vectoriel
    2854                         for ( iv=0,k=0; iv<nbv; iv++,k+=n )
    2855                           {     
     2850                        for ( iv=0,k=0; iv<nbv; iv++,k+=n ){   
    28562851                                double v=0;                 
    28572852                                for (int i=0;i<nbfield;i++)
     
    28602855                                smin=Min(smin,v);
    28612856                                smax=Max(smax,v);
    2862                           }
    2863                   }
     2857                        }
     2858                }
    28642859                Real8 sdelta = smax-smin;
    28652860                Real8 absmax=Max(Abs(smin),Abs(smax));
     
    28742869
    28752870                double *sf  = ss;
    2876                 for (Int4 nufield=0;nufield<nbfield;nufield++,ss++)
    2877                   {
     2871                for (Int4 nufield=0;nufield<nbfield;nufield++,ss++){
    28782872                        for ( iv=0,k=0; iv<nbv; iv++,k+=n )
    28792873                         dxdx[iv]=dxdy[iv]=dydy[iv]=0;
     
    30353029                         else kk++;
    30363030
    3037 
    3038                         // correction of second derivate
     3031                        // correction of second derivative
    30393032                        // by a laplacien
    3040 
    30413033                        Real8 *d2[3] = { dxdx, dxdy, dydy};
    30423034                        Real8 *dd;
    3043                         for (int xy = 0;xy<3;xy++)
    3044                           {
     3035                        for (int xy = 0;xy<3;xy++) {
    30453036                                dd = d2[xy];
    30463037                                // do leat 2 iteration for boundary problem
    3047                                 for (int ijacobi=0;ijacobi<Max(NbJacobi,2);ijacobi++)
    3048                                   {
     3038                                for (int ijacobi=0;ijacobi<Max(NbJacobi,2);ijacobi++){
    30493039                                        for (i=0;i<nbt;i++)
    30503040                                         if(triangles[i].link) // the real triangles
     
    30783068                                         if( ijacobi<NbJacobi || OnBoundary[iv])
    30793069                                          dd[iv] = workV[iv]/(Mmass[iv]*6);
    3080 
    3081 
    3082                                   }
    3083 
    3084 
    3085                           }
     3070                                }
     3071                        }
    30863072
    30873073                        // constuction  of the metrix from the Hessian dxdx. dxdy,dydy
    3088 
    30893074                        Real8 rCutOff=CutOff*absmax;// relative cut off
    30903075
     
    31073092
    31083093                                Vp.Abs();
    3109                                 if(power!=1.0)
    3110                                  Vp.pow(power);
    3111 
    3112 
     3094                                if(power!=1.0) Vp.pow(power);
    31133095
    31143096                                h1=Min(h1,Vp.lmin());
     
    31283110                                Metric MVp(Vp);
    31293111                                vertices[iv].m.IntersectWith(MVp);
     3112                                //vertices[iv].m=Vp; TEST: work like that
    31303113                          }// for all vertices
    3131                         if (verbosity>2) {
     3114                        //vertices[nbv-1].m.Echo();
     3115                        if (verbosity>-1) {
    31323116                                printf("      Field %i of solution %i\n",nufield,nusol);
    31333117                                printf("         before bounding : Hmin = %g, Hmax = %g, factor of anisotropy max = %g\n",pow(h2,-0.5), pow(h1,-0.5), pow(rx,0.5));
     
    31353119                        }
    31363120                  } //  end of for all field
    3137           }// end for all solution
     3121        }// end for all solution
    31383122
    31393123        delete [] detT;
  • issm/trunk/src/c/objects/BamgOpts.h

    r2790 r2899  
    1818        int     verbose;
    1919        double* metric;
     20        double* field;
    2021
    2122};
  • issm/trunk/src/m/classes/public/bamg.m

    r2794 r2899  
    3535                        bamg_geometry.Vertices=[bamg_geometry.Vertices; [domain(i).x(1:nods) domain(i).y(1:nods) ones(nods,1)]];
    3636                        bamg_geometry.Edges=[bamg_geometry.Edges; [transp(count+1:count+nods) transp([count+2:count+nods count+1])  ones(nods,1)]];
    37                         bamg_geometry.hVertices=[];%[bamg_geometry.hVertices; resolution*ones(nods,1)];
    3837                        if i>1,
    3938                                clockwise=-1;
     
    4140                        end
    4241                        count=count+nods;
     42                end
     43                if exist(options,'hVertices'),
     44                        bamg_geometry.hVertices=getfieldvalueerr(options,'hVertices');
     45                        if length(bamg_geometry.hVertices)~=nods,
     46                                error(['hVertices option should be of size [' num2str(nods) ',1]']);
     47                        end
    4348                end
    4449                bamg_geometry.NumVertices=size(bamg_geometry.Vertices,1);
     
    5560bamg_mesh.Triangles=[];
    5661bamg_mesh.index=zeros(0,3);
     62bamg_mesh.hVertices=[];
    5763if (~exist(options,'domain') & md.numberofgrids~=0 & strcmpi(md.type,'2d')),
    5864        bamg_mesh.NumVertices=md.numberofgrids;
     
    6066        bamg_mesh.NumTriangles=md.numberofelements;
    6167        bamg_mesh.Triangles=[md.elements ones(md.numberofelements,1)];
     68        if exist(options,'hVertices'),
     69                bamg_mesh.hVertices=getfieldvalueerr(options,'hVertices');
     70                if length(bamg_mesh.hVertices)~=md.numberofgrids,
     71                        error(['hVertices option should be of size [' num2str(md.numberofgrids) ',1]']);
     72                end
     73        end
    6274end
    6375%}}}
     
    7486bamg_options.splitcorners=getfieldvalue(options,'splitcorners',1);
    7587bamg_options.metric=getfieldvalue(options,'metric',zeros(0,3));
     88bamg_options.field=getfieldvalue(options,'field',zeros(0,1));
    7689%}}}
    7790
    7891%call Bamg
    79 [triangles vertices]=Bamg(bamg_mesh,bamg_geometry,bamg_options);
     92[triangles vertices metric]=Bamg(bamg_mesh,bamg_geometry,bamg_options);
    8093
    8194% plug results onto model
     
    8396md.y=vertices(:,2);
    8497md.elements=triangles(:,1:3);
     98md.dummy=metric;
    8599
    86100%Fill in rest of fields:
  • issm/trunk/src/mex/Bamg/Bamg.cpp

    r2798 r2899  
    99        int   noerr=1;
    1010        int   i;
     11        int   nods=0; //to be removed
    1112        BamgOpts bamgopts;
    1213        BamgMesh bamgmesh;
     
    1819        int     NumTrianglesMesh;
    1920        double* TrianglesMesh=NULL;
     21        double* hVerticesMesh=NULL;
    2022
    2123        /*Geom inputs: */
     
    3436        double gradation;
    3537        double cutoff;
    36         double* metric;
     38        double* metric=NULL;
     39        double* field=NULL;
    3740
    3841        /*Boot module: */
     
    7982        FetchData(&TrianglesMesh,NULL,NULL,mxGetField(BAMGMESH,0,"Triangles"));
    8083        bamgmesh.Triangles=TrianglesMesh;
    81         bamgmesh.hVertices=NULL;
     84        FetchData(&hVerticesMesh,NULL,NULL,mxGetField(BAMGMESH,0,"hVertices"));
     85        bamgmesh.hVertices=hVerticesMesh;
    8286        bamgmesh.NumQuadrilaterals=0;
    8387        bamgmesh.Quadrilaterals=NULL;
     
    118122        FetchData(&metric,NULL,NULL,mxGetField(BAMGOPTIONS,0,"metric"));
    119123        bamgopts.metric=metric;
     124        FetchData(&field,NULL,NULL,mxGetField(BAMGOPTIONS,0,"field"));
     125        bamgopts.field=field;
    120126
    121127        /*!Generate internal degree of freedom numbers: */
     128        nods=bamgmesh.NumVertices;
    122129        Bamgx(&bamgmesh,&bamggeom,&bamgopts);
    123130
     
    125132        WriteData(TRIANGLESOUT,bamgmesh.Triangles,bamgmesh.NumTriangles,4);
    126133        WriteData(VERTICESOUT,bamgmesh.Vertices,bamgmesh.NumVertices,3);
     134        WriteData(METRICOUT,bamgopts.metric,nods,3);
    127135
    128136        /*Free ressources: */
  • issm/trunk/src/mex/Bamg/Bamg.h

    r2785 r2899  
    2525#define TRIANGLESOUT (mxArray**)&plhs[0]
    2626#define VERTICESOUT  (mxArray**)&plhs[1]
     27#define METRICOUT    (mxArray**)&plhs[2]
    2728
    2829/* serial arg counts: */
    2930#undef NLHS
    30 #define NLHS  2
     31#define NLHS  3
    3132#undef NRHS
    3233#define NRHS  3
Note: See TracChangeset for help on using the changeset viewer.