Changeset 3252


Ignore:
Timestamp:
03/11/10 09:16:07 (15 years ago)
Author:
Mathieu Morlighem
Message:

Added some functions in BamgShared

Location:
issm/trunk/src/c
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/Bamgx/BamgObjects.h

    r3245 r3252  
    3434       
    3535        /*INLINE functions{{{1*/
    36         inline double det3x3(double A[3] ,double B[3],double C[3]){
    37                 return A[0]*( B[1]*C[2]-B[2]*C[1])
    38                   - A[1]*( B[0]*C[2]-B[2]*C[0])
    39                   + A[2]*( B[0]*C[1]-B[1]*C[0]);
    40         }
    4136        inline  TriangleAdjacent Adj(const TriangleAdjacent & a)
    4237          { return  a.Adj();}
     
    7368        /*}}}1*/
    7469
    75         /*INLINE functions of CLASS GeometricalVertex{{{1*/
    76         inline void GeometricalVertex::Set(const GeometricalVertex & rec,const Geometry & ,const Geometry & ){
    77                 *this  = rec;
    78           }
    79         /*}}}1*/
    8070        /*INLINE functions of CLASS VertexOnVertex{{{1*/
    8171        inline void VertexOnVertex::Set(const Triangles & Th ,long i,Triangles & ThNew) {
     
    335325
    336326        /*Other prototypes IN TRIANGLES.CPP (TO BE REORGANIZED){{{1*/
    337         long AGoodNumberPrimeWith(long n);
    338327        TriangleAdjacent CloseBoundaryEdge(I2 ,Triangle *, double &,double &) ;
    339328        TriangleAdjacent CloseBoundaryEdgeV2(I2 A,Triangle *t, double &a,double &b);
  • issm/trunk/src/c/Bamgx/objects/GeometricalVertex.h

    r3232 r3252  
    3636
    3737                        //Inline methods
    38                         inline void Set(const GeometricalVertex & rec,const Geometry & Gh ,const Geometry & GhNew);
     38                        inline void Set(const GeometricalVertex & rec,const Geometry & ,const Geometry & ){
     39                                *this  = rec;
     40                        }
    3941        };
    4042
  • issm/trunk/src/c/Bamgx/objects/R2.h

    r3246 r3252  
    33#define _R2_H
    44
    5 #include "../../shared/shared.h"
    6 #include "../../include/macros.h"
    7 #include "../../toolkits/toolkits.h"
     5#include <cstdio>
    86
    97namespace bamg {
  • issm/trunk/src/c/Bamgx/objects/Triangles.cpp

    r3246 r3252  
    35963596                 *  [0 nbv[ all distincts*/
    35973597                for (i=0;i<nbv;i++) ordre[i]= &vertices[i] ;
    3598                 const long PrimeNumber= AGoodNumberPrimeWith(nbv) ;
     3598                const long PrimeNumber= BigPrimeNumber(nbv) ;
    35993599                int   k0=rand()%nbv;
    36003600                for (int is3=0; is3<nbv; is3++){
     
    37223722
    37233723                /*construction of a random order*/
    3724                 const long PrimeNumber= AGoodNumberPrimeWith(nbv)  ;
     3724                const long PrimeNumber= BigPrimeNumber(nbv)  ;
    37253725                //remainder of the division of rand() by nbvnew
    37263726                long k3 = rand()%nbvnew;
     
    43044304                //allocate memory to r
    43054305                r=(int*)xmalloc(nbv*sizeof(int));
    4306                 int PrimeNumber= AGoodNumberPrimeWith(nbv) ;
     4306                int PrimeNumber= BigPrimeNumber(nbv) ;
    43074307                int k0=rand()%nbv;
    43084308                for (int i=0; i<nbv; i++){
     
    56555655        }
    56565656        /*}}}1*/
    5657         /*FUNCTION AGoodNumberPrimeWith{{{1*/
    5658         long AGoodNumberPrimeWith(long n){
    5659                 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/AGoodNumberPrimeWith)*/
    5660 
    5661                 //list of big prime numbers
    5662                 const long BigPrimeNumber[] ={ 567890359L,
    5663                         567890431L,  567890437L,  567890461L,  567890471L,
    5664                         567890483L,  567890489L,  567890497L,  567890507L,
    5665                         567890591L,  567890599L,  567890621L,  567890629L , 0};
    5666 
    5667                 //initialize o and pi
    5668                 long o =0;
    5669                 long pi=BigPrimeNumber[1];
    5670 
    5671                 //loop until BigPrimeNumber[i]==0 (end of BigPrimeNumber)
    5672                 for (int i=0; BigPrimeNumber[i]; i++){
    5673 
    5674                         //compute r, rest of the remainder of the division of BigPrimeNumber[i] by n
    5675                         long r = BigPrimeNumber[i] % n;
    5676 
    5677                         /*compute oo = min ( r , n-r , |n - 2r|, |n-3r|)*/
    5678                         long oo = Min(Min(r,n-r),Min(Abs(n-2*r),Abs(n-3*r)));
    5679                         if ( o < oo){
    5680                                 o=oo;
    5681                                 pi=BigPrimeNumber[i];
    5682                         }
    5683                 }
    5684                 return pi;
    5685         }
    5686         /*}}}1*/
    56875657        /*FUNCTION SwapForForcingEdge{{{1*/
    56885658        int SwapForForcingEdge(Vertex   *  & pva ,Vertex  * &   pvb ,TriangleAdjacent & tt1,Icoor2 & dets1, Icoor2 & detsa,Icoor2 & detsb, int & NbSwap) {
  • issm/trunk/src/c/Bamgx/shared/shared.h

    r3239 r3252  
    77#define _SHAREDBamg_H_
    88
     9#include "BigPrimeNumber.h"
    910#include "TheVertex.h"
    1011#include "FindTriangleAdjacent.h"
  • issm/trunk/src/c/Makefile.am

    r3245 r3252  
    358358                                        ./Bamgx/objects/Triangle.cpp\
    359359                                        ./Bamgx/objects/Triangle.h\
     360                                        ./Bamgx/shared/BigPrimeNumber.h\
     361                                        ./Bamgx/shared/BigPrimeNumber.cpp\
    360362                                        ./Bamgx/objects/Triangles.cpp\
    361363                                        ./Bamgx/objects/Triangles.h\
     
    724726                                        ./Bamgx/objects/Triangle.cpp\
    725727                                        ./Bamgx/objects/Triangle.h\
     728                                        ./Bamgx/shared/BigPrimeNumber.h\
     729                                        ./Bamgx/shared/BigPrimeNumber.cpp\
    726730                                        ./Bamgx/objects/Triangles.cpp\
    727731                                        ./Bamgx/objects/Triangles.h\
  • issm/trunk/src/c/include/macros.h

    r2250 r3252  
    2424        catch(ErrorException &exception){\
    2525                exception.Report(); \
    26                 mexErrMsgTxt(" ");\
     26                mexErrMsgTxt(" "); \
    2727        }\
    2828        catch (exception& e) {\
  • issm/trunk/src/c/shared/TriMesh/TriMeshUtils.cpp

    r1904 r3252  
    33 */
    44
     5#include <stdio.h>
     6#include <assert.h>
     7
    58#include "./trimesh.h"
    69
    710#include "../Alloc/alloc.h"
    8 
     11#include "../../include/macros.h"
     12#include "../../include/typedefs.h"
    913
    1014int IsGridOnRift(int* riftsegments, int nriftsegs, int grid){
     
    985989                /*Using the order vector, and the riftsegments_copy and riftspairs_copy, reorder the segments and the pairs: */
    986990                for (j=0;j<numsegs;j++){
     991                        assert(order[j]<numsegs);
    987992                        *(riftsegments_copy+3*j+0)=*(riftsegments+3*order[j]+0);
    988993                        *(riftsegments_copy+3*j+1)=*(riftsegments+3*order[j]+1);
Note: See TracChangeset for help on using the changeset viewer.