Changeset 2787


Ignore:
Timestamp:
01/08/10 12:09:50 (15 years ago)
Author:
Mathieu Morlighem
Message:

fixed first crash (bad initialization of triangles)

Location:
issm/trunk/src/c/Bamgx
Files:
3 edited

Legend:

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

    r2785 r2787  
    173173                Triangles BTh(bamgmesh,bamgargs); // read the background mesh
    174174
     175                throw ErrorException(__FUNCT__,exprintf("TESTTESTTESTTEST"));
     176                printf("ok1\n");
    175177                hmin = Max(hmin,BTh.MinimalHmin());
     178                printf("ok2\n");
    176179                hmax = Min(hmax,BTh.MaximalHmax());
    177 
    178                 throw ErrorException(__FUNCT__," done");
    179180
    180181                BTh.MakeQuadTree();
  • issm/trunk/src/c/Bamgx/Mesh2.cpp

    r2783 r2787  
    2626   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    2727   */
    28 #ifdef __MWERKS__
    29 #ifdef __INTEL__
    30 //#pragma global_optimizer off
    31 //#pragma inline_depth(0)
    32 //#pragma optimization_level 2
    33 #endif
    34 //#pragma inline_depth 0
    35 #endif
    3628extern bool withrgraphique;
     29
     30#include "../shared/shared.h"
    3731#include <stdio.h>
    3832#include <string.h>
     
    4034#include <time.h>
    4135#include <iostream>
     36
    4237using namespace std;
    4338
     
    41294124
    41304125                void Triangles::FillHoleInMesh() {
    4131                         Triangles * OldCurrentTh =CurrentTh;
     4126
     4127                        Triangles* OldCurrentTh =CurrentTh;
    41324128                        CurrentTh=this;
    4133                         int verbosity=1;
    4134                         //  Int4 NbTold = nbt;
    4135                         // generation of the integer coor
     4129
     4130                        int verbosity=10;
     4131
     4132                        // generation of the integer coordinate
    41364133                          {
    41374134
    4138                                 //  double coef = coefIcoor;
    4139                                 // recherche des extrema des vertices pmin,pmax
     4135                                // find extrema coordinates of vertices pmin,pmax
    41404136                                Int4 i;
    4141                                 if(verbosity>2)
    4142                                  cout << "  -- FillHoleInMesh: Nb of vertices =" << nbv
    4143                                         << " Pmin = "<< pmin << " Pmax = "<< pmax << endl;
    4144 
     4137                                if(verbosity>2) printf("      Filling holes in mesh of %i vertices\n",nbv);
     4138
     4139                                //initialize ordre
    41454140                                assert(ordre);
    4146                                 for (i=0;i<nbv;i++)
    4147                                  ordre[i]= 0 ;
    4148 
     4141                                for (i=0;i<nbv;i++) ordre[i]=0;
    41494142
    41504143                                NbSubDomains =0;
    41514144
    4152                                 // generation of the adjacence of the triangles
    4153                                 SetOfEdges4 * edge4= new SetOfEdges4(nbt*3,nbv);
    4154                                 Int4 * st = new Int4[nbt*3];
    4155                                 for (i=0;i<nbt*3;i++)
    4156                                  st[i]=-1;
     4145                                /* generation of the adjacence of the triangles*/
     4146
     4147                                SetOfEdges4* edge4= new SetOfEdges4(nbt*3,nbv);
     4148
     4149                                //initialize st
     4150                                Int4* st = new Int4[nbt*3];
     4151                                for (i=0;i<nbt*3;i++) st[i]=-1;
     4152
     4153                                //check number of edges
    41574154                                Int4 kk =0;
    4158                                 for (i=0;i<nbe;i++)
    4159                                  kk += (i == edge4->addtrie(Number(edges[i][0]),Number(edges[i][1])));
    4160                                 if (kk != nbe)
    4161                                   {
    4162                                         cerr << " Some Double edge in the mesh, the number is " << kk-nbe << endl;
    4163                                         MeshError(1002,this);
    4164                                   }
    4165                                 for (i=0;i<nbt;i++)
    4166                                  for (int j=0;j<3;j++)
    4167                                         {
    4168                                          // Int4 i0,i1;
    4169                                          Int4 k =edge4->addtrie(Number(triangles[i][VerticesOfTriangularEdge[j][0]]),
    4170                                                                  Number(triangles[i][VerticesOfTriangularEdge[j][1]]));
    4171                                          Int4 invisible = triangles[i].Hidden(j);
    4172                                          if(st[k]==-1)
    4173                                           st[k]=3*i+j;
    4174                                          else if(st[k]>=0) {
    4175                                                  assert( ! triangles[i].TriangleAdj(j) && !triangles[st[k] / 3].TriangleAdj((int) (st[k]%3)));
    4176 
    4177                                                  triangles[i].SetAdj2(j,triangles + st[k] / 3,(int) (st[k]%3));
    4178                                                  if (invisible)  triangles[i].SetHidden(j);
    4179                                                  if (k<nbe) {
    4180                                                          triangles[i].SetLocked(j);
     4155                                for (i=0;i<nbe;i++){
     4156                                        kk=kk+(i == edge4->addtrie(Number(edges[i][0]),Number(edges[i][1])));
     4157                                }
     4158                                if (kk != nbe) {
     4159                                        throw ErrorException(__FUNCT__,exprintf("Some Double edge in the mesh, the number is %i",kk-nbe));
     4160                                }
     4161
     4162                                //
     4163                                for (i=0;i<nbt;i++){
     4164                                        for (int j=0;j<3;j++) {
     4165                                                Int4 k =edge4->addtrie(Number(triangles[i][VerticesOfTriangularEdge[j][0]]),
     4166                                                                        Number(triangles[i][VerticesOfTriangularEdge[j][1]]));
     4167                                                Int4 invisible = triangles[i].Hidden(j);
     4168                                                if(st[k]==-1){
     4169                                                        st[k]=3*i+j;
     4170                                                }
     4171                                                else if(st[k]>=0) {
     4172                                                        assert( ! triangles[i].TriangleAdj(j) && !triangles[st[k] / 3].TriangleAdj((int) (st[k]%3)));
     4173
     4174                                                        triangles[i].SetAdj2(j,triangles + st[k] / 3,(int) (st[k]%3));
     4175                                                        if (invisible)  triangles[i].SetHidden(j);
     4176                                                        if (k<nbe) {
     4177                                                                triangles[i].SetLocked(j);
     4178                                                        }
     4179                                                        st[k]=-2-st[k];
     4180                                                }
     4181                                                else {
     4182                                                        throw ErrorException(__FUNCT__,exprintf("The edge (%i , %i) belongs to more than 2 triangles",
     4183                                                                                        Number(triangles[i][VerticesOfTriangularEdge[j][0]]),Number(triangles[i][VerticesOfTriangularEdge[j][1]])));
     4184                                                }
     4185                                        }
     4186                                }
     4187                                if(verbosity>5) {
     4188                                        printf("         info on Mesh %s:\n",name);
     4189                                        printf("            - number of vertices    = %i \n",nbv);
     4190                                        printf("            - number of triangles   = %i \n",nbt);
     4191                                        printf("            - number of given edges = %i \n",nbe);
     4192                                        printf("            - number of all edges   = %i \n"  ,edge4->nb());
     4193                                        printf("            - Euler number 1 - nb of holes = %i \n"  ,nbt-edge4->nb()+nbv);
     4194                                }
     4195
     4196                                // check the consistant of edge[].adj and the geometrical required  vertex
     4197                                Int4 k=0;
     4198                                for (i=0;i<edge4->nb();i++){
     4199                                        if (st[i] >=0){ // edge alone
     4200                                                if (i < nbe) {
     4201                                                        Int4 i0=edge4->i(i);
     4202                                                        ordre[i0] = vertices+i0;
     4203                                                        Int4 i1=edge4->j(i);
     4204                                                        ordre[i1] = vertices+i1;
     4205                                                }
     4206                                                else {
     4207                                                        k=k+1;
     4208                                                        if (k <20) {
     4209                                                                throw ErrorException(__FUNCT__,exprintf("Lost boundary edges %i : %i %i",i,edge4->i(i),edge4->j(i)));
     4210                                                        }
     4211                                                }
     4212                                        }
     4213                                }
     4214                                if(k != 0) {
     4215                                        throw ErrorException(__FUNCT__,exprintf("%i boundary edges  are not defined as edges",k));
     4216                                }
     4217
     4218                                /* mesh generation with boundary points*/
     4219                                Int4 nbvb = 0;
     4220                                for (i=0;i<nbv;i++){
     4221                                        vertices[i].t=0;
     4222                                        vertices[i].vint=0;
     4223                                        if (ordre[i]){
     4224                                                ordre[nbvb++] = ordre[i];
     4225                                        }
     4226                                }
     4227
     4228                                Triangle* savetriangles= triangles;
     4229                                Int4 savenbt=nbt;
     4230                                Int4 savenbtx=nbtx;
     4231                                SubDomain * savesubdomains = subdomains;
     4232                                subdomains = 0;
     4233
     4234                                Int4  Nbtriafillhole = 2*nbvb;
     4235                                Triangle* triafillhole =new Triangle[Nbtriafillhole];
     4236                                triangles =  triafillhole;
     4237
     4238                                nbt=2;
     4239                                nbtx= Nbtriafillhole;
     4240
     4241                                for (i=2 ; det( ordre[0]->i, ordre[1]->i, ordre[i]->i ) == 0;)
     4242                                 if  ( ++i >= nbvb) {
     4243                                         cerr << "FillHoleInMesh: All the vertices are aline " << nbvb << endl;
     4244                                         MeshError(998,this); }
     4245                                         Exchange( ordre[2], ordre[i]);
     4246
     4247                                         Vertex *  v0=ordre[0], *v1=ordre[1];
     4248
     4249
     4250                                         triangles[0](0) = 0; // sommet pour infini
     4251                                         triangles[0](1) = v0;
     4252                                         triangles[0](2) = v1;
     4253
     4254                                         triangles[1](0) = 0;// sommet pour infini
     4255                                         triangles[1](2) = v0;
     4256                                         triangles[1](1) = v1;
     4257                                         const int e0 = OppositeEdge[0];
     4258                                         const int e1 = NextEdge[e0];
     4259                                         const int e2 = PreviousEdge[e0];
     4260                                         triangles[0].SetAdj2(e0, &triangles[1] ,e0);
     4261                                         triangles[0].SetAdj2(e1, &triangles[1] ,e2);
     4262                                         triangles[0].SetAdj2(e2, &triangles[1] ,e1);
     4263
     4264                                         triangles[0].det = -1;  // faux triangles
     4265                                         triangles[1].det = -1;  // faux triangles
     4266
     4267                                         triangles[0].SetTriangleContainingTheVertex();
     4268                                         triangles[1].SetTriangleContainingTheVertex();
     4269
     4270                                         triangles[0].link=&triangles[1];
     4271                                         triangles[1].link=&triangles[0];
     4272
     4273                                         if (!quadtree )
     4274                                          delete  quadtree; // ->ReInitialise();
     4275
     4276                                         quadtree = new QuadTree(this,0);
     4277                                         quadtree->Add(*v0);
     4278                                         quadtree->Add(*v1);
     4279
     4280                                         // We add the vertices one by one
     4281                                         Int4 NbSwap=0;
     4282                                         for (Int4 icount=2; icount<nbvb; icount++) {
     4283                                                 Vertex *vi  = ordre[icount];
     4284                                                 //       cout << " Add vertex " <<  Number(vi) << endl;
     4285                                                 Icoor2 dete[3];
     4286                                                 Triangle *tcvi = FindTriangleContening(vi->i,dete);
     4287                                                 quadtree->Add(*vi);
     4288                                                 Add(*vi,tcvi,dete);
     4289                                                 NbSwap += vi->Optim(1,1);
     4290                                         }
     4291
     4292                                         // inforce the boundary
     4293                                         TriangleAdjacent ta(0,0);
     4294                                         Int4 nbloss = 0,knbe=0;
     4295                                         for ( i = 0; i < nbe; i++){
     4296                                                 if (st[i] >=0){  // edge alone => on border ...  FH oct 2009
     4297                                                         Vertex & a=edges[i][0], & b =    edges[i][1];
     4298                                                         if (a.t && b.t) // le bug est la si maillage avec des bod non raffine 1.
     4299                                                                {
     4300                                                                 knbe++;
     4301                                                                 if (ForceEdge(a,b,ta)<0)
     4302                                                                  nbloss++;
     4303                                                                }
    41814304                                                 }
    4182                                                  st[k]=-2-st[k]; }
    4183                                          else {
    4184                                                  cerr << " The edge ("
    4185                                                         << Number(triangles[i][VerticesOfTriangularEdge[j][0]])
    4186                                                         << " , "
    4187                                                         << Number(triangles[i][VerticesOfTriangularEdge[j][1]])
    4188                                                         << " ) is in more than 2 triangles " <<k <<endl;
    4189                                                  cerr << " Edge " << j << " Of Triangle " << i << endl;
    4190                                                  cerr << " Edge " << (-st[k]+2)%3 << " Of Triangle " << (-st[k]+2)/3  << endl;
    4191                                                  cerr << " Edge " << triangles[(-st[k]+2)/3].NuEdgeTriangleAdj((int)((-st[k]+2)%3))
    4192                                                         << " Of Triangle " <<  Number(triangles[(-st[k]+2)/3].TriangleAdj((int)((-st[k]+2)%3))) << endl;
    4193                                                  MeshError(9999,this);}
    4194 
    4195 
    4196                                         }
    4197                                 if(verbosity>5) {
    4198                                         cout << "    On Mesh " << name << endl;
    4199                                         cout << "    - The number of Vertices  = " << nbv << endl;
    4200                                         cout << "    - The number of Triangles = " << nbt << endl;
    4201                                         cout << "    - The number of given edge = " << nbe << endl;
    4202                                         cout << "    - The number of all edges = " << edge4->nb() << endl;
    4203                                         cout << "    - The Euler number = 1-Nb Of Hole = " << nbt-edge4->nb()+nbv << endl; }
    4204 
    4205 
    4206                                         // check the consistant of edge[].adj and the geometrical required  vertex
    4207                                         Int4 k=0;
    4208                                         for (i=0;i<edge4->nb();i++)
    4209                                          if (st[i] >=0) // edge alone
    4210                                           if (i < nbe)
    4211                                                  {
    4212                                                   Int4 i0=edge4->i(i);ordre[i0] = vertices+i0;
    4213                                                   Int4 i1=edge4->j(i);ordre[i1] = vertices+i1;
     4305                                         }
     4306                                         if(nbloss) {
     4307                                                 cerr << " we loss some  " << nbloss << " "  << " edges other " << knbe << endl;
     4308                                                 MeshError(1100,this);
     4309                                         }
     4310
     4311                                         FindSubDomain(1);
     4312                                         // remove all the hole
     4313                                         // remove all the good sub domain
     4314                                         Int4 krm =0;
     4315                                         for (i=0;i<nbt;i++){
     4316                                                 if (triangles[i].link){ // remove triangles
     4317                                                         krm++;
     4318                                                         for (int j=0;j<3;j++)
     4319                                                                {
     4320                                                                 TriangleAdjacent ta =  triangles[i].Adj(j);
     4321                                                                 Triangle & tta = * (Triangle *) ta;
     4322                                                                 if(! tta.link) // edge between remove and not remove
     4323                                                                        { // change the link of ta;
     4324                                                                         int ja = ta;
     4325                                                                         Vertex *v0= ta.EdgeVertex(0);
     4326                                                                         Vertex *v1= ta.EdgeVertex(1);
     4327                                                                         Int4 k =edge4->addtrie(v0?Number(v0):nbv,v1? Number(v1):nbv);
     4328                                                                         assert(st[k] >=0);
     4329                                                                         tta.SetAdj2(ja,savetriangles + st[k] / 3,(int) (st[k]%3));
     4330                                                                         ta.SetLock();
     4331                                                                         st[k]=-2-st[k];
     4332                                                                        }
     4333                                                                }
    42144334                                                 }
    4215                                           else {
    4216                                                   k++;
    4217                                                   if (verbosity>20 && k <20)
    4218                                                          {
    4219                                                           Int4 i0=edge4->i(i);
    4220                                                           Int4 i1=edge4->j(i);
    4221                                                           cerr << " Lose boundary edges " << i << " : " << i0 << " " << i1 << endl;
     4335                                         }
     4336                                                 Int4 NbTfillHoll =0;
     4337                                                 for (i=0;i<nbt;i++){
     4338                                                         if (triangles[i].link) {
     4339                                                                 triangles[i]=Triangle((Vertex *) NULL,(Vertex *) NULL,(Vertex *) NULL);
     4340                                                                 triangles[i].color=-1;
    42224341                                                         }
    4223                                           }
    4224 
    4225                                         if(k != 0) {
    4226                                                 if (verbosity>20)
    4227                                                   {
    4228                                                         cout << " The given edge are " << endl;
    4229                                                         for (int i=0;i< nbe;i++)
    4230                                                          cout <<  " Edge " << i << " : " <<  Number(edges[i][0]) << " " <<  Number(edges[i][1])
    4231                                                                 << " " << edges[i].ref << endl;
    4232                                                   }
    4233                                                 cerr << k << " boundary edges  are not defined as edges " << endl;
    4234                                                 MeshError(9998,this);
    4235                                         }
    4236                                         // generation of the mesh with boundary points   
    4237                                         Int4 nbvb = 0;
    4238                                         for (i=0;i<nbv;i++)
    4239                                           {
    4240                                                 vertices[i].t=0;
    4241                                                 vertices[i].vint=0;
    4242                                                 if (ordre[i])
    4243                                                  ordre[nbvb++] = ordre[i];
    4244                                           }
    4245 
    4246                                         Triangle *savetriangles= triangles;
    4247                                         Int4 savenbt=nbt;
    4248                                         Int4 savenbtx=nbtx;
    4249                                         SubDomain * savesubdomains = subdomains;
    4250                                         subdomains = 0;
    4251 
    4252                                         Int4  Nbtriafillhole = 2*nbvb;
    4253                                         Triangle * triafillhole =new Triangle[Nbtriafillhole];
    4254                                         if (verbosity>9)
    4255                                          cout << " Nbtriafillhole triafillhole*" << triafillhole << endl;
    4256                                         triangles =  triafillhole;
    4257 
    4258                                         nbt=2;
    4259                                         nbtx= Nbtriafillhole;
    4260 
    4261                                         for (i=2 ; det( ordre[0]->i, ordre[1]->i, ordre[i]->i ) == 0;)
    4262                                          if  ( ++i >= nbvb) {
    4263                                                  cerr << "FillHoleInMesh: All the vertices are aline " << nbvb << endl;
    4264                                                  MeshError(998,this); }
    4265                                                  Exchange( ordre[2], ordre[i]);
    4266 
    4267                                                  Vertex *  v0=ordre[0], *v1=ordre[1];
    4268 
    4269 
    4270                                                  triangles[0](0) = 0; // sommet pour infini
    4271                                                  triangles[0](1) = v0;
    4272                                                  triangles[0](2) = v1;
    4273 
    4274                                                  triangles[1](0) = 0;// sommet pour infini
    4275                                                  triangles[1](2) = v0;
    4276                                                  triangles[1](1) = v1;
    4277                                                  const int e0 = OppositeEdge[0];
    4278                                                  const int e1 = NextEdge[e0];
    4279                                                  const int e2 = PreviousEdge[e0];
    4280                                                  triangles[0].SetAdj2(e0, &triangles[1] ,e0);
    4281                                                  triangles[0].SetAdj2(e1, &triangles[1] ,e2);
    4282                                                  triangles[0].SetAdj2(e2, &triangles[1] ,e1);
    4283 
    4284                                                  triangles[0].det = -1;  // faux triangles
    4285                                                  triangles[1].det = -1;  // faux triangles
    4286 
    4287                                                  triangles[0].SetTriangleContainingTheVertex();
    4288                                                  triangles[1].SetTriangleContainingTheVertex();
    4289 
    4290                                                  triangles[0].link=&triangles[1];
    4291                                                  triangles[1].link=&triangles[0];
    4292 
    4293 #ifdef DEBUG
    4294                                                  triangles[0].check();
    4295                                                  triangles[1].check();
    4296 #endif 
    4297                                                  //  nbtf = 2;
    4298                                                  if (  !quadtree )
    4299                                                   delete  quadtree; // ->ReInitialise();
    4300 
    4301                                                  quadtree = new QuadTree(this,0);
    4302                                                  quadtree->Add(*v0);
    4303                                                  quadtree->Add(*v1);
    4304 
    4305                                                  // on ajoute les sommets un a un
    4306                                                  Int4 NbSwap=0;
    4307                                                  for (Int4 icount=2; icount<nbvb; icount++) {
    4308 
    4309                                                          Vertex *vi  = ordre[icount];
    4310                                                          //       cout << " Add vertex " <<  Number(vi) << endl;
    4311                                                          Icoor2 dete[3];
    4312                                                          Triangle *tcvi = FindTriangleContening(vi->i,dete);
    4313                                                          quadtree->Add(*vi);
    4314                                                          Add(*vi,tcvi,dete);
    4315                                                          NbSwap += vi->Optim(1,1);
    4316 
    4317 #ifdef DRAWING2
    4318                                                          cout << Number(vi) << " " <<  NbSwap <<  endl;
    4319                                                          reffecran();
    4320                                                          Draw();
    4321                                                          vi->Draw();
    4322                                                          inquire();
    4323 #endif
    4324                                                  }// end loop on  icount       
    4325 #ifdef DRAWING1
    4326                                                  inquire();
    4327 #endif
    4328 
    4329                                                  //Int4 nbtfillhole = nbt;
    4330                                                  // inforce the boundary
    4331                                                  TriangleAdjacent ta(0,0);
    4332                                                  Int4 nbloss = 0,knbe=0;
    4333                                                  for ( i = 0; i < nbe; i++)
    4334                                                   if (st[i] >=0)  // edge alone => on border ...  FH oct 2009
    4335                                                          {
    4336                                                           Vertex & a=edges[i][0], & b =    edges[i][1];
    4337                                                           if (a.t && b.t) // le bug est la si maillage avec des bod non raffine 1.
    4338                                                                  {
    4339                                                                   knbe++;
    4340                                                                   if (ForceEdge(a,b,ta)<0)
    4341                                                                         nbloss++;
    4342                                                                  }
    4343                                                          }
    4344                                                  if(nbloss)
    4345                                                         {
    4346                                                          cerr << " we loss some  " << nbloss << " "  << " edges other " << knbe << endl;
    4347                                                          MeshError(1100,this);
    4348                                                         }
    4349                                                  FindSubDomain(1);
    4350                                                  // remove all the hole
    4351                                                  // remove all the good sub domain
    4352                                                  Int4 krm =0;
    4353                                                  for (i=0;i<nbt;i++)
    4354                                                   if (triangles[i].link) // remove triangles
    4355                                                          {
    4356                                                           krm++;
    4357                                                           for (int j=0;j<3;j++)
    4358                                                                  {
    4359                                                                   TriangleAdjacent ta =  triangles[i].Adj(j);
    4360                                                                   Triangle & tta = * (Triangle *) ta;
    4361                                                                   if(! tta.link) // edge between remove and not remove
    4362                                                                          { // change the link of ta;
    4363                                                                           int ja = ta;
    4364                                                                           Vertex *v0= ta.EdgeVertex(0);
    4365                                                                           Vertex *v1= ta.EdgeVertex(1);
    4366                                                                           Int4 k =edge4->addtrie(v0?Number(v0):nbv,v1? Number(v1):nbv);
    4367                                                                           assert(st[k] >=0);
    4368                                                                           tta.SetAdj2(ja,savetriangles + st[k] / 3,(int) (st[k]%3));
    4369                                                                           ta.SetLock();
    4370                                                                           st[k]=-2-st[k];
    4371                                                                          }
    4372                                                                  }
    4373                                                          }
    4374                                                  Int4 NbTfillHoll =0;
    4375                                                  for (i=0;i<nbt;i++)
    4376                                                   if (triangles[i].link) {
    4377                                                           triangles[i]=Triangle((Vertex *) NULL,(Vertex *) NULL,(Vertex *) NULL);
    4378                                                           triangles[i].color=-1;
    4379                                                   }
    4380                                                   else
    4381                                                          {
    4382                                                           triangles[i].color= savenbt+ NbTfillHoll++;
    4383 #ifdef DEBUG
    4384                                                           triangles[i].check();
    4385 #endif
    4386                                                          }
     4342                                                         else
     4343                                                                {
     4344                                                                 triangles[i].color= savenbt+ NbTfillHoll++;
     4345                                                                }
     4346                                                 }
    43874347                                                 // cout <<      savenbt+NbTfillHoll << " " <<  savenbtx  << endl;
    43884348                                                 assert(savenbt+NbTfillHoll <= savenbtx );
    43894349                                                 // copy of the outside triangles in saveTriangles
    4390                                                  for (i=0;i<nbt;i++)
    4391                                                   if(triangles[i].color>=0)
    4392                                                          {
    4393                                                           savetriangles[savenbt]=triangles[i];
    4394                                                           savetriangles[savenbt].link=0;
    4395                                                           savenbt++;
     4350                                                 for (i=0;i<nbt;i++){
     4351                                                         if(triangles[i].color>=0) {
     4352                                                                 savetriangles[savenbt]=triangles[i];
     4353                                                                 savetriangles[savenbt].link=0;
     4354                                                                 savenbt++;
    43964355                                                         }
     4356                                                 }
    43974357                                                 // gestion of the adj
    43984358                                                 k =0;
     
    44394399                                                 // cout << " NbTOld = " << NbTold << " ==  " << nbt - NbOutT << " " << nbt << endl;
    44404400
    4441                                                  //
    4442 
    4443                                                  //delete edge4; //TESTESTESTSTSTSTSTST
    4444                                                  //delete [] st; //TESTESTESTSTSTSTSTST
    4445                                                  printf("ok1\n");
     4401                                                 delete edge4;
     4402                                                 delete [] st;
    44464403                                                 for (i=0;i<nbv;i++)
    44474404                                                  quadtree->Add(vertices[i]);
     
    44654422                                                          }
    44664423                          }
    4467                         printf("ok2\n");
    44684424                        CurrentTh=OldCurrentTh;
    44694425                }
  • issm/trunk/src/c/Bamgx/MeshRead.cpp

    r2785 r2787  
    7070                        vertices[i].DirOfSearch =NoDirOfSearch;
    7171                        vertices[i].m=M1;
    72                         vertices[i].color=bamgmesh->Vertices[i*3+2];
     72                        vertices[i].color=(Int4)bamgmesh->Vertices[i*3+2];
    7373                }
    7474                nbtx=2*nbvx-2; // for filling The Holes and quadrilaterals
     
    8181        if(bamgmesh->Triangles){
    8282                if(verbose>3) printf("      processing Triangles\n");
    83                 triangles =new Triangle[nbt];
     83                triangles =new Triangle[nbtx]; //we cannot allocate only nbt triangles since
     84                                                                                                 //other triangles will be added for each edge
    8485                for (i=0;i<nbt;i++){
    8586                        Triangle & t = triangles[i];
     
    9293        }
    9394        else{
    94                 if(verbose>3) throw ErrorException(__FUNCT__,exprintf("no Vertices found in the initial mesh"));
     95                if(verbose>3) throw ErrorException(__FUNCT__,exprintf("no Triangles found in the initial mesh"));
    9596        }
    9697
     
    252253                        if (i3!=23) throw ErrorException(__FUNCT__,exprintf("Bad Subdomain definition: first number should be 3"));
    253254                        if (head<0 || head>=nbt) throw ErrorException(__FUNCT__,exprintf("Bad Subdomain definition: head should in [1 %i] (triangle number)",nbt));
    254                         //subdomains[i].head=i3;   //TESTTESTETETETETETETETEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
     255                        subdomains[i].head = triangles+head;
    255256                }
    256257        }
     
    263264                printf("Warning: mesh present but no geometry found. Reconstructing...\n");
    264265                /*Recreate geometry: */
    265                 ConsGeometry(-1);       //MaximalAngleOfCorner is actually in BamgGeom...
     266                ConsGeometry(-1);       //TESTTESTTESTTEST MaximalAngleOfCorner is actually in BamgGeom...
    266267                Gh.AfterRead();
    267268        }
     
    11481149  SetIntCoor();
    11491150  FillHoleInMesh();
    1150   throw ErrorException(__FUNCT__,exprintf("TEST"));
     1151  printf("ok0\n");
    11511152}
    11521153
Note: See TracChangeset for help on using the changeset viewer.