Changeset 2855


Ignore:
Timestamp:
01/15/10 11:38:50 (15 years ago)
Author:
Mathieu Morlighem
Message:

removed all throwassert.hpp

Location:
issm/trunk/src/c/Bamgx
Files:
1 deleted
2 edited

Legend:

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

    r2806 r2855  
    1919#include <setjmp.h>
    2020#include <new>
    21 #include <cassert>
    2221#include <iomanip>
    2322#include <fstream>
  • issm/trunk/src/c/Bamgx/Mesh2.h

    r2852 r2855  
    1 // -*- Mode : c++ -*-
    2 //
    3 // SUMMARY  :     
    4 // USAGE    :       
    5 // ORG      :
    6 // AUTHOR   : Frederic Hecht
    7 // E-MAIL   : hecht@ann.jussieu.fr
    8 //
    9 
    10 /*
    11  
    12  This file is part of Freefem++
    13  
    14  Freefem++ is free software; you can redistribute it and/or modify
    15  it under the terms of the GNU Lesser General Public License as published by
    16  the Free Software Foundation; either version 2.1 of the License, or
    17  (at your option) any later version.
    18  
    19  Freefem++  is distributed in the hope that it will be useful,
    20  but WITHOUT ANY WARRANTY; without even the implied warranty of
    21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    22  GNU Lesser General Public License for more details.
    23  
    24  You should have received a copy of the GNU Lesser General Public License
    25  along with Freefem++; if not, write to the Free Software
    26  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    27  */
    281#ifndef _MESH2_H_
    292#define _MESH2_H_
    303
    314#include "../objects/objects.h"
     5#include "../shared/shared.h"
     6#include "../include/macros.h"
     7#include "../toolkits/toolkits.h"
    328
    339//From MeshIo
     
    3814#include <cstdlib>
    3915#include <cctype>
    40 using namespace std;
    41 
    4216#include <stdlib.h>
    4317#include <math.h>
    4418#include <limits.h>
    4519#include <time.h>
     20
    4621#if  (defined(unix) || defined(__unix)) && !defined(__AIX)
    4722#define SYSTIMES
     
    5328#include "R2.h"
    5429
     30using namespace std;
    5531namespace bamg {
    5632
     
    262238  //                                on the curve edge a t in [0:1]
    263239  Edge * adj[2]; // the 2 adj edges if on the same curve
     240
    264241  int Intersection(const  Edge & e) const {
    265     if (!(adj[0]==&e || adj[1]==&e))
    266       std::cerr << "Bug : Intersection " << (void*) &e <<  "  "
    267            << adj[0] << " " <<  adj[1] << std::endl;
    268     assert(adj[0]==&e || adj[1]==&e);
    269     return adj[0]==&e ? 0 : 1;}
     242    if (!(adj[0]==&e || adj[1]==&e)){
     243                 throw ErrorException(__FUNCT__,exprintf("Intersection bug"));
     244         }
     245         if (adj[0]!=&e && adj[1]!=&e){
     246                 throw ErrorException(__FUNCT__,exprintf("adj[0]!=&e && adj[1]!=&e"));
     247         }
     248    return adj[0]==&e ? 0 : 1;
     249  }
    270250  Real8 MetricLength() const ; 
    271251  inline void Set(const Triangles &,Int4,Triangles &);
     
    285265  void  Set(){cas=0;}
    286266  GeometricalVertex() :cas(0), link(this) {};
    287   GeometricalVertex * The() { assert(link); return link;}// return a unique vertices
     267
     268  GeometricalVertex * The() {
     269          if (!link){
     270                  throw ErrorException(__FUNCT__,exprintf("!link"));
     271          }
     272          return link;
     273  }// return a unique vertices
     274
    288275  int IsThe() const { return link == this;} 
    289276 
     
    496483  R2 F(Real8 s){
    497484    Real8 c01=lEnd-lBegin, c0=(lEnd-s)/c01, c1=(s-lBegin)/c01;
    498     assert(lBegin<= s && s <=lEnd);
     485         if (lBegin>s || s>lEnd){
     486                 throw ErrorException(__FUNCT__,exprintf("lBegin>s || s>lEnd"));
     487         }
    499488    return e->F(sBegin*c0+sEnd*c1);}
    500489};
     
    534523           int mneo= MaxNbSeg;
    535524           MaxNbSeg *= 2;
    536           if (verbosity>3) 
    537             std::cout <<" reshape lSegsI from " << mneo << " to "
    538                  << MaxNbSeg <<std::endl;
     525          if (verbosity>3){
     526                                 printf("   reshape lSegsI from %i to %i\n",mneo,MaxNbSeg);
     527                         }
    539528           SegInterpolation * lEn =  new SegInterpolation[MaxNbSeg];
    540            assert(lSegsI && NbSeg < MaxNbSeg);
     529                          if (!lSegsI || NbSeg>=MaxNbSeg){
     530                                  throw ErrorException(__FUNCT__,exprintf("!lSegsI || NbSeg>=MaxNbSeg"));
     531                          }
    541532           for (int i=0;i< NbSeg;i++)
    542533              lEn[i] = lSegsI[MaxNbSeg]; // copy old to new           
     
    557548  void ReShape() {
    558549    register int newsize = MaxSize*2;
    559     IntersectionTriangles * nw = new IntersectionTriangles[newsize];
    560     assert(nw);
     550    IntersectionTriangles* nw = new IntersectionTriangles[newsize];
     551         if (!nw){
     552                 throw ErrorException(__FUNCT__,exprintf("!nw"));
     553         }
    561554    for (int i=0;i<MaxSize;i++) // recopy
    562555      nw[i] = lIntTria[i];       
     
    672665    int i0=VerticesOfTriangularEdge[i][0];
    673666    int i1=VerticesOfTriangularEdge[i][0];
    674     assert(New[0] && New[1]);
     667         if (!New[0] && !New[1]){
     668                 throw ErrorException(__FUNCT__,exprintf("!New[0] && !New[1]"));
     669         }
    675670    T(i0) = New[0];
    676671    T(i1) = New[1];}   
     
    679674    int i0=VerticesOfTriangularEdge[i][0];
    680675    int i1=VerticesOfTriangularEdge[i][0];
    681     assert(New[0] && New[1]);
     676         if (!New[0] && !New[1]){
     677                 throw ErrorException(__FUNCT__,exprintf("!New[0] && !New[1]"));
     678         }
    682679    T(i0) = TheVertex(T(i0));
    683680    T(i1) = TheVertex(T(i1));}
     
    10681065{
    10691066  *this = Th.subdomains[i];
    1070   assert( head - Th.triangles >=0 && head - Th.triangles < Th.nbt);
     1067  if ( head-Th.triangles<0 || head-Th.triangles>=Th.nbt){
     1068          throw ErrorException(__FUNCT__,exprintf("head-Th.triangles<0 || head-Th.triangles>=Th.nbt"));
     1069  }
    10711070  head = ThNew.triangles + Th.Number(head) ;
    1072   assert(edge - Th.edges >=0 && edge - Th.edges < Th.nbe);
     1071  if (edge-Th.edges<0 || edge-Th.edges>=Th.nbe);{
     1072          throw ErrorException(__FUNCT__,exprintf("edge-Th.edges<0 || edge-Th.edges>=Th.nbe"));
     1073  }
    10731074  edge = ThNew.edges+ Th.Number(edge);
    10741075}
     
    12081209  Vertex *v=Th->vertices;
    12091210  Int4 nbv = Th->nbv;
    1210   assert(i >=0 && j >=0 && k >=0);
    1211   assert(i < nbv && j < nbv && k < nbv);
     1211  if (i<0 || j<0 || k<0){
     1212          throw ErrorException(__FUNCT__,exprintf("i<0 || j<0 || k<0"));
     1213  }
     1214  if (i>=nbv || j>=nbv || k>=nbv){
     1215          throw ErrorException(__FUNCT__,exprintf("i>=nbv || j>=nbv || k>=nbv"));
     1216  }
    12121217  ns[0]=v+i;
    12131218  ns[1]=v+j;
     
    12821287    int i = a->vint;
    12831288    TriangleAdjacent ta(t,EdgesVertexTriangle[i][0]); // Previous edge
    1284     assert(t && i>=0 && i < 3);
    1285     assert( a == (*t)(i));
     1289         if (!t || i<0 || i>=3){
     1290                 throw ErrorException(__FUNCT__,exprintf("!t || i<0 !! i>=3"));
     1291         }
     1292         if ( a!=(*t)(i)){
     1293                 throw ErrorException(__FUNCT__,exprintf("a!=(*t)(i)"));
     1294         }
    12861295    int k=0;
    12871296    do { // turn around vertex in direct sens (trigo)
    1288       k++;assert(k< 20000);
     1297      k++;
     1298                if (k>=20000){
     1299                        throw ErrorException(__FUNCT__,exprintf("k>=20000"));
     1300                }
    12891301      //  in no crack => ta.EdgeVertex(1) == a otherwise ???
    12901302      if (ta.EdgeVertex(1) ==  a && ta.EdgeVertex(0) ==  b) return ta; // find
     
    12931305      --ta;
    12941306      } while (t != (Triangle *)ta);
    1295     assert(0);
    1296     return TriangleAdjacent(0,0);// error
     1307         throw ErrorException(__FUNCT__,exprintf("FindTriangleAdjacent: triangle not found"));
     1308    return TriangleAdjacent(0,0);//for compiler
    12971309  }
    12981310 
     
    13031315    int i = a->vint;
    13041316    TriangleAdjacent ta(t,EdgesVertexTriangle[i][0]); // Previous edge
    1305     assert(t && i>=0 && i < 3);
    1306     assert( a == (*t)(i));
     1317         if (!t || i<0 || i>=3){
     1318                 throw ErrorException(__FUNCT__,exprintf("!t || i<0 !! i>=3"));
     1319         }
     1320         if ( a!=(*t)(i)){
     1321                 throw ErrorException(__FUNCT__,exprintf("a!=(*t)(i)"));
     1322         }
    13071323    int k=0;
    13081324    do { // turn around vertex in direct sens (trigo)
    1309       k++;assert(k< 20000);
     1325      k++;
     1326                if (k>=20000){
     1327                        throw ErrorException(__FUNCT__,exprintf("k>=20000"));
     1328                }
    13101329      //  in no crack => ta.EdgeVertex(1) == a
    13111330      if ((rr=ta.EdgeVertex(0)) < r) r = rr;
Note: See TracChangeset for help on using the changeset viewer.