Changeset 2781
- Timestamp:
- 01/07/10 14:27:14 (15 years ago)
- Location:
- issm/trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Bamgx/Bamgx.cpp
r2780 r2781 39 39 int nelout, nodsout; 40 40 41 /*Bamg options*/ 42 int iso; 43 int maxnbv; 44 double hmin,hmax; 45 double gradation; 46 double cutoff; 47 int verbosity; 48 int splitcorners; 49 41 50 /*Bamg variables: */ 42 51 int i,j,num; 43 52 hinterpole=1; // by def interpolation a h 44 53 int fileout=0; 45 int nbvx = 1000000; 46 int iso =0,AbsError=0,nbjacoby=1,allquad=0; 54 int AbsError=0,nbjacoby=1,allquad=0; 47 55 int NoMeshReconstruction=0; 48 56 int Rescaling = 1; … … 50 58 Real8 cutoffradian=-1; 51 59 double anisomax = 1e6; 52 double err=0.01,errg=0.1,coef=1 ,hmin=1.e-100,hmax=1.e17,gradation=1.2,cutoff=1e-5;60 double err=0.01,errg=0.1,coef=1; 53 61 int KeepBackVertices=1; 54 62 double hminaniso=1e-100; … … 61 69 Int4 nbsolbb=0,lsolbb=0; 62 70 Int4 nbsolBB=0,lsolBB=0; 63 int SplitEdgeWith2Boundary=0;64 71 int rbbeqMbb=0,rBBeqMBB=0; 65 72 int ChoiseHessien = 0; … … 69 76 *fnopo=0,*fftq=0,*fam=0,*famdba=0,*rbb=0,*rBB=0,*wbb=0,*wBB=0, 70 77 *fMbb=0,*foM=0,*fMBB=0; 71 long int verbosity =10;72 78 char *datargv[128] ; 73 79 int datargc=1; 74 80 datargv[0]= datargv[1]=0;// for create a error if no parameter 75 81 76 /*testing*/77 int splitpbedge=1;78 79 82 /*Bamg options*/ 80 83 iso=bamgargs->iso; 84 maxnbv=bamgargs->maxnbv; 81 85 hmin=bamgargs->hmin; 82 86 hmax=bamgargs->hmax; 83 87 gradation=bamgargs->gradation; 84 88 cutoff=bamgargs->cutoff; 85 86 /*Recover options from inputs: */ 87 if(splitpbedge)SplitEdgeWith2Boundary=1; 89 verbosity=bamgargs->verbose; 90 splitcorners=bamgargs->splitcorners; 88 91 89 92 // some verification 90 93 NoMeshReconstruction= fmeshr !=0; 91 94 if (!fmeshback) fmeshback=fmeshr; 92 93 95 if ( maxsubdiv > boundmaxsubdiv || maxsubdiv <= 1.0) 94 96 { … … 96 98 exit(3); 97 99 } 98 if (iso) 99 anisomax=1; 100 if (iso) anisomax=1; 100 101 if (!(fmetrix||fMbb)) 101 102 NbSmooth=0; // no metric -> no smoothing … … 113 114 /*Mesh generation {{{1*/ 114 115 if (verbosity>0) printf("Construction of a mesh from a given geometry\n"); 115 Geometry Gh(bamggeom );116 Geometry Gh(bamggeom,bamgargs); 116 117 hmin = Max(hmin,Gh.MinimalHmin()); 117 118 hmax = Min(hmax,Gh.MaximalHmax()); … … 128 129 129 130 //generate mesh 130 Triangles Th(nbvx,Gh); 131 Triangles Th(maxnbv,Gh); 132 if(splitcorners) Th.SplitInternalEdgeWithBorderVertices(); 133 Th.ReNumberingTheTriangleBySubDomain(); 134 //if(NbSmooth>0) Th.SmoothingVertex(NbSmooth,omega); 135 Th.SmoothingVertex(3,omega); 131 136 132 137 //Build output … … 161 166 162 167 /*Read background mesh from simple delaunay triangulation: */ 163 Triangles BTh(bamgmesh ->index,bamgmesh->x,bamgmesh->y,bamgmesh->numberofelements,bamgmesh->numberofnodes,nbvx,cutoffradian); // read the background mesh168 Triangles BTh(bamgmesh,bamgargs); // read the background mesh 164 169 165 170 hmin = Max(hmin,BTh.MinimalHmin()); … … 232 237 233 238 Triangles & Th( *(NoMeshReconstruction 234 ? new Triangles(*Thr,&Thr->Gh,Thb, nbvx) // copy the mesh + free space to modification235 : new Triangles( nbvx,BTh,KeepBackVertices) // construct a new mesh239 ? new Triangles(*Thr,&Thr->Gh,Thb,maxnbv) // copy the mesh + free space to modification 240 : new Triangles(maxnbv,BTh,KeepBackVertices) // construct a new mesh 236 241 )); 237 242 if (Thr != &BTh) delete Thr; … … 241 246 if (allquad) 242 247 Th.SplitElement(allquad==2); 243 if( SplitEdgeWith2Boundary)248 if(splitcorners) 244 249 Th.SplitInternalEdgeWithBorderVertices(); 245 250 Th.ReNumberingTheTriangleBySubDomain(); -
issm/trunk/src/c/Bamgx/Mesh2.h
r2772 r2781 802 802 ~Triangles(); 803 803 Triangles(const char * ,Real8=-1) ; 804 Triangles( double* elements, double* x, double* y, int nel, int nods,int NBV, Real8=-1);804 Triangles(BamgMesh* bamgmesh,BamgArgs* bamgargs); 805 805 806 806 Triangles(Int4 nbvx,Triangles & BT,int keepBackVertices=1) … … 898 898 899 899 void Read(MeshIstream &,int version,Real8 cutoffradian); 900 void ReadFromMatlabMesh( double* elements,double* x,double* y,int nel,int nods,int inbvx,Real8 cutoffradian);900 void ReadFromMatlabMesh(BamgMesh* bamgmesh, BamgArgs* bamgargs); 901 901 void Read_am_fmt(MeshIstream &); 902 902 void Read_amdba(MeshIstream &); … … 984 984 Real8 MaximalHmax() {return Max(pmax.x-pmin.x,pmax.y-pmin.y);} 985 985 void ReadGeometry(const char * ) ; 986 void ReadGeometry(BamgGeom* bamggeom );986 void ReadGeometry(BamgGeom* bamggeom, BamgArgs* bamgargs); 987 987 void ReadGeometry(MeshIstream & ,const char *) ; 988 988 … … 990 990 Geometry() {EmptyGeometry();}// empty Geometry 991 991 void AfterRead(); 992 Geometry(BamgGeom* bamggeom ) {EmptyGeometry();OnDisk=1;ReadGeometry(bamggeom);AfterRead();}992 Geometry(BamgGeom* bamggeom, BamgArgs* bamgargs) {EmptyGeometry();OnDisk=1;ReadGeometry(bamggeom,bamgargs);AfterRead();} 993 993 Geometry(const char * filename) {EmptyGeometry();OnDisk=1;ReadGeometry(filename);AfterRead();} 994 994 -
issm/trunk/src/c/Bamgx/MeshRead.cpp
r2778 r2781 39 39 static const Direction NoDirOfSearch=Direction(); 40 40 41 void Triangles::ReadFromMatlabMesh(double* elements,double* x,double* y,int nel,int nods,int NBV,Real8 cutoffradian){ 42 43 long int verbosity=0; 44 41 void Triangles::ReadFromMatlabMesh(BamgMesh* bamgmesh, BamgArgs* bamgargs){ 42 43 int verbosity; 45 44 Real8 hmin = HUGE_VAL;// the infinie value 46 45 Int4 i1,i2,i3,iref; 47 46 Int4 i; 48 Int4 dim=0;49 47 Int4 hvertices =0; 50 48 Int4 ifgeom=0; 51 49 Metric M1(1); 52 int field=0; 53 int showfield=0; 54 55 field=0; 56 dim=2; 57 nbv=NBV; 58 nbvx=NBV; 59 nbiv = NBV; 60 61 62 vertices=(Vertex*)xmalloc(nbvx*sizeof(Vertex)); 63 ordre=(Vertex**)xmalloc(nbvx*sizeof(Vertex*)); 64 65 for (i=0;i<nods;i++){ 66 67 vertices[i].r.x=x[i]; 68 vertices[i].r.y=y[i]; 50 Int4 dim=2; 51 52 nbv=bamgmesh->numberofnodes; 53 nbvx=bamgargs->maxnbv; 54 nbt=bamgmesh->numberofelements; 55 nbtx=2*nbvx-2; // for filling The Holes and quadrilaterals 56 nbiv=nbvx; 57 58 vertices=(Vertex*)xmalloc(nbv*sizeof(Vertex)); 59 ordre=(Vertex**)xmalloc(nbv*sizeof(Vertex*)); 60 61 /*Create Vertices*/ 62 for (i=0;i<bamgmesh->numberofnodes;i++){ 63 vertices[i].r.x=bamgmesh->x[i]; 64 vertices[i].r.y=bamgmesh->y[i]; 69 65 vertices[i].ReferenceNumber=1; 70 66 vertices[i].DirOfSearch =NoDirOfSearch; … … 73 69 } 74 70 75 nbtx = 2*nbvx-2; // for filling The Holes and quadrilaterals 76 77 triangles =(Triangle*)xmalloc(nbtx*sizeof(Triangle)); 78 nbt =0; 79 for (i=0;i<nel;i++){ 80 Int4 i1,i2,i3,iref; 81 Triangle & t = triangles[nbt++]; 82 i1=(Int4)*(elements+i*3+0); 83 i2=(Int4)*(elements+i*3+1); 84 i3=(Int4)*(elements+i*3+2); 85 86 iref=1; 87 t = Triangle(this,i1-1,i2-1,i3-1); 88 t.color=iref; 89 } 90 91 /*build geometry: */ 92 ConsGeometry(cutoffradian); 71 /*Create triangles*/ 72 triangles=(Triangle*)xmalloc(nbt*sizeof(Triangle)); 73 for (i=0;i<bamgmesh->numberofelements;i++){ 74 Triangle & t = triangles[i]; 75 i1=(Int4)bamgmesh->index[i*3+0]-1; //for C indexing 76 i2=(Int4)bamgmesh->index[i*3+1]-1; //for C indexing 77 i3=(Int4)bamgmesh->index[i*3+2]-1; //for C indexing 78 t=Triangle(this,i1,i2,i3); 79 t.color=1; 80 } 81 82 /*Recreate geometry: */ 83 ConsGeometry(-1); //MaximalAngleOfCorner is actually in BamgGeom... 93 84 Gh.AfterRead(); 94 95 85 } 96 86 … … 969 959 } 970 960 971 Triangles::Triangles( double* elements, double* x, double* y, int nel, int nods,int NBV,Real8 cutoffradian) : Gh(*(new Geometry())),BTh(*this){961 Triangles::Triangles(BamgMesh* bamgmesh, BamgArgs* bamgargs):Gh(*(new Geometry())),BTh(*this){ 972 962 973 963 PreInit(0,"none"); 974 964 OnDisk = 1; 975 printf("ok1\n"); 976 977 ReadFromMatlabMesh(elements,x,y,nel,nods,NBV,cutoffradian); 965 966 ReadFromMatlabMesh(bamgmesh,bamgargs); 978 967 printf("ok2\n"); 979 968 980 969 SetIntCoor(); 981 printf("ok3\n");982 970 983 971 FillHoleInMesh(); 984 printf("ok4\n");972 throw ErrorException(__FUNCT__,exprintf("test test")); 985 973 986 974 … … 998 986 } 999 987 1000 void Geometry::ReadGeometry(BamgGeom* bamggeom){ 1001 1002 int verbose=1; 1003 assert(empty()); 988 void Geometry::ReadGeometry(BamgGeom* bamggeom,BamgArgs* bamgargs){ 989 990 int verbose; 1004 991 nbiv=nbv=nbvx=0; 1005 992 nbe=nbt=nbtx=0; … … 1016 1003 nbvx = nbv; 1017 1004 nbiv = nbv; 1005 verbose=bamgargs->verbose; 1018 1006 1019 1007 //some checks … … 1231 1219 if(bamggeom->SubDomain){ 1232 1220 Int4 i0,i1,i2,i3; 1233 if(verbose>3) printf("Reading SubDomain ");1221 if(verbose>3) printf("Reading SubDomain\n"); 1234 1222 NbSubDomains=bamggeom->NumSubDomain; 1235 1223 subdomains = new GeometricalSubDomain[NbSubDomains]; -
issm/trunk/src/c/objects/BamgArgs.h
r2780 r2781 8 8 struct BamgArgs{ 9 9 10 int iso; 11 double hmin; 12 double hmax; 13 double gradation; 14 double cutoff; 10 int iso; 11 int maxnbv; 12 double hmin; 13 double hmax; 14 double gradation; 15 double cutoff; 16 int splitcorners; 17 int verbose; 18 double* metric; 15 19 16 20 }; -
issm/trunk/src/m/classes/public/bamg.m
r2780 r2781 19 19 bamg_geometry.Edges=zeros(0,3); 20 20 bamg_geometry.hVertices=zeros(0,1); 21 bamg_geometry.MaximalAngleOfCorner=getfieldvalue(options,'MaximalAngleOfCorner',10); 21 22 bamg_geometry.NumSubDomain=0; 22 23 bamg_geometry.SubDomain=zeros(0,3); … … 66 67 % Bamg Options {{{1 67 68 bamg_options.iso=getfieldvalue(options,'iso',0); 69 bamg_options.maxnbv=getfieldvalue(options,'maxnbv',10^6); 68 70 bamg_options.hmin=getfieldvalue(options,'hmin',10^-100); 69 71 bamg_options.hmax=getfieldvalue(options,'hmax',10^100); 70 72 bamg_options.gradation=getfieldvalue(options,'gradation',1.2); 71 73 bamg_options.cutoff=getfieldvalue(options,'cutoff',10^-5); 74 bamg_options.verbose=getfieldvalue(options,'verbose',1); 75 bamg_options.splitcorners=getfieldvalue(options,'splitcorners',1); 76 bamg_options.metric=getfieldvalue(options,'metric',zeros(0,3)); 72 77 %}}} 73 78 -
issm/trunk/src/mex/Bamg/Bamg.cpp
r2780 r2781 26 26 double* Edges=NULL; 27 27 double* hVertices=NULL; 28 double MaximalAngleOfCorner; 28 29 int NumSubDomain; 29 30 double* SubDomain=NULL; 30 31 31 32 /*Options inputs*/ 32 int iso ;33 int iso,maxnbv,verbose,splitcorners; 33 34 double hmin,hmax; 34 35 double gradation; 35 36 double cutoff; 37 double* metric; 36 38 37 39 /*Boot module: */ … … 55 57 bamggeom.MetricVertices=NULL; 56 58 bamggeom.h1h2VpVertices=NULL; 57 bamggeom.MaximalAngleOfCorner=10; 59 FetchData(&MaximalAngleOfCorner,mxGetField(BAMGGEOMETRY,0,"MaximalAngleOfCorner")); 60 bamggeom.MaximalAngleOfCorner=MaximalAngleOfCorner; 58 61 bamggeom.NumTangentAtEdges=0; 59 62 bamggeom.TangentAtEdges=NULL; … … 84 87 FetchData(&iso,mxGetField(BAMGOPTIONS,0,"iso")); 85 88 bamgargs.iso=iso; 89 FetchData(&maxnbv,mxGetField(BAMGOPTIONS,0,"maxnbv")); 90 bamgargs.maxnbv=maxnbv; 86 91 FetchData(&hmin,mxGetField(BAMGOPTIONS,0,"hmin")); 87 92 bamgargs.hmin=hmin; … … 92 97 FetchData(&cutoff,mxGetField(BAMGOPTIONS,0,"cutoff")); 93 98 bamgargs.cutoff=cutoff; 99 FetchData(&verbose,mxGetField(BAMGOPTIONS,0,"verbose")); 100 bamgargs.verbose=verbose; 101 FetchData(&splitcorners,mxGetField(BAMGOPTIONS,0,"splitcorners")); 102 bamgargs.splitcorners=splitcorners; 103 FetchData(&metric,NULL,NULL,mxGetField(BAMGOPTIONS,0,"metric")); 104 bamgargs.metric=metric; 94 105 95 106 /*!Generate internal degree of freedom numbers: */
Note:
See TracChangeset
for help on using the changeset viewer.