Changeset 2790
- Timestamp:
- 01/08/10 17:31:18 (15 years ago)
- Location:
- issm/trunk/src
- Files:
-
- 1 added
- 1 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Bamgx/Bamgx.cpp
r2789 r2790 29 29 using namespace std; 30 30 31 int Bamgx(BamgMesh* bamgmesh,BamgGeom* bamggeom,Bamg Args* bamgargs){31 int Bamgx(BamgMesh* bamgmesh,BamgGeom* bamggeom,BamgOpts* bamgopts){ 32 32 33 33 int noerr=1; … … 43 43 int maxnbv; 44 44 double hmin,hmax; 45 double gradation;46 45 double cutoff; 47 46 int verbosity; 48 int splitcorners;49 47 50 48 /*Bamg variables: */ 51 49 int i,j,num; 52 hinterpole=1; // by def interpolation a h53 int fileout=0;54 50 int AbsError=0,nbjacoby=1,allquad=0; 55 int Rescaling = 1;56 51 double costheta=2; 57 Real8 cutoffradian=-1;58 52 double anisomax = 1e6; 59 53 double err=0.01,errg=0.1,coef=1; … … 64 58 double omega=1.8; 65 59 int NbSmooth=3; 66 double *solMbb =0,*solMBB=0; 67 int *typesolsBB =0; 68 Int4 nbsolbb=0,lsolbb=0; 69 Int4 nbsolBB=0,lsolBB=0; 70 int rbbeqMbb=0,rBBeqMBB=0; 71 int ChoiseHessien = 0; 72 double power=1; 73 Triangles *Thr=0,*Thb=0; 74 char *fmeshback=0,*fmeshout=0,*fmeshr=0,*fmetrix=0,*famfmt=0,*fmsh=0, 75 *fnopo=0,*fftq=0,*fam=0,*famdba=0,*rbb=0,*rBB=0,*wbb=0,*wBB=0, 76 *fMbb=0,*foM=0,*fMBB=0; 77 char *datargv[128] ; 78 int datargc=1; 79 datargv[0]= datargv[1]=0;// for create a error if no parameter 60 Triangles* Thr=NULL; 61 Triangles* Thb=NULL; 80 62 81 63 /*Bamg options*/ 82 iso=bamgargs->iso; 83 maxnbv=bamgargs->maxnbv; 84 hmin=bamgargs->hmin; 85 hmax=bamgargs->hmax; 86 gradation=bamgargs->gradation; 87 cutoff=bamgargs->cutoff; 88 verbosity=bamgargs->verbose; 89 splitcorners=bamgargs->splitcorners; 64 iso=bamgopts->iso; 65 maxnbv=bamgopts->maxnbv; 66 hmin=bamgopts->hmin; 67 hmax=bamgopts->hmax; 68 cutoff=bamgopts->cutoff; 69 verbosity=bamgopts->verbose; 90 70 91 71 // some verification 92 if ( maxsubdiv > boundmaxsubdiv || maxsubdiv <= 1.0) 93 { 72 if ( maxsubdiv > boundmaxsubdiv || maxsubdiv <= 1.0){ 94 73 cerr << " -maxsubdiv " << maxsubdiv << " is not in ]1,"<< boundmaxsubdiv << "]" << endl; 95 74 exit(3); 96 75 } 97 76 if (iso) anisomax=1; 98 if (!(fmetrix||fMbb)) 99 NbSmooth=0; // no metric -> no smoothing 100 if( ! rbb) // to set the rbb filename by default 101 rbb=fMbb; 102 if( ! rBB) // to set the rbb filename by default 103 rBB=fMBB; 104 105 if (fMbb && rbb) 106 rbbeqMbb = !strcmp(rbb,fMbb); 107 if (fMBB && rBB) 108 rBBeqMBB = !strcmp(rBB,fMBB); 77 // no metric -> no smoothing 78 if (bamgopts->metric==NULL){ 79 NbSmooth=0; 80 } 109 81 110 82 if(bamgmesh->NumTriangles==0){ … … 113 85 if (verbosity>0) printf("Construction of a mesh from a given geometry\n"); 114 86 if (verbosity>1) printf(" Processing geometry...\n"); 115 Geometry Gh(bamggeom,bamg args);87 Geometry Gh(bamggeom,bamgopts); 116 88 hmin = Max(hmin,Gh.MinimalHmin()); 117 89 hmax = Min(hmax,Gh.MaximalHmax()); … … 131 103 if (verbosity>1) printf(" Generating Mesh...\n"); 132 104 Triangles Th(maxnbv,Gh); 133 if( splitcorners) Th.SplitInternalEdgeWithBorderVertices();105 if(bamgopts->splitcorners) Th.SplitInternalEdgeWithBorderVertices(); 134 106 Th.ReNumberingTheTriangleBySubDomain(); 135 107 //if(NbSmooth>0) Th.SmoothingVertex(NbSmooth,omega); … … 169 141 if (verbosity>0) printf("Anisotropic mesh adaptation\n"); 170 142 if (verbosity>1) printf(" Processing initial mesh and geometry...\n"); 171 Triangles BTh(bamgmesh,bamg args);143 Triangles BTh(bamgmesh,bamgopts); 172 144 hmin = Max(hmin,BTh.MinimalHmin()); 173 145 hmax = Min(hmax,BTh.MaximalHmax()); … … 178 150 //build metric if not given in input 179 151 if (verbosity>1) printf(" Processing Metric...\n"); 180 if (bamg args->metric){181 BTh.ReadMetric(bamg args,hmin,hmax,coef);152 if (bamgopts->metric){ 153 BTh.ReadMetric(bamgopts,hmin,hmax,coef); 182 154 } 183 155 else { // init with hmax … … 188 160 189 161 BTh.IntersectGeomMetric(errg,iso); 190 if( gradation) BTh.SmoothMetric(gradation);162 if(bamgopts->gradation) BTh.SmoothMetric(bamgopts->gradation); 191 163 BTh.MaxSubDivision(maxsubdiv); 192 164 BTh.BoundAnisotropy(anisomax,hminaniso); … … 196 168 Triangles & Th( *(0 ? new Triangles(*Thr,&Thr->Gh,Thb,maxnbv) : new Triangles(maxnbv,BTh,KeepBackVertices))); 197 169 if (Thr != &BTh) delete Thr; 198 199 if(costheta<=1.0){ 200 Th.MakeQuadrangles(costheta); 201 } 202 if (allquad){ 203 Th.SplitElement(allquad==2); 204 } 205 if(splitcorners){ 206 Th.SplitInternalEdgeWithBorderVertices(); 207 } 170 if(costheta<=1.0) Th.MakeQuadrangles(costheta); 171 if (allquad) Th.SplitElement(allquad==2); 172 if(bamgopts->splitcorners) Th.SplitInternalEdgeWithBorderVertices(); 208 173 Th.ReNumberingTheTriangleBySubDomain(); 209 210 174 if(NbSmooth>0) Th.SmoothingVertex(NbSmooth,omega); 211 212 175 Th.BTh.ReMakeTriangleContainingTheVertex(); 213 176 214 // info177 //display info 215 178 if(verbosity>0) { 216 179 if (Th.nbt-Th.NbOutT-Th.NbOfQuad*2){ … … 247 210 248 211 /*clean up*/ 249 //delete &Th;212 delete &Th; //TEST crash 250 213 /*}}}*/ 251 214 } -
issm/trunk/src/c/Bamgx/Bamgx.h
r2771 r2790 9 9 10 10 /* local prototypes: */ 11 int Bamgx(BamgMesh* bamgmesh,BamgGeom* bamggeom,Bamg Args* bamgargs);11 int Bamgx(BamgMesh* bamgmesh,BamgGeom* bamggeom,BamgOpts* bamgopts); 12 12 13 13 #endif /* _BAMGX_H */ -
issm/trunk/src/c/Bamgx/Mesh2.h
r2789 r2790 802 802 ~Triangles(); 803 803 Triangles(const char * ,Real8=-1) ; 804 Triangles(BamgMesh* bamgmesh,Bamg Args* bamgargs);804 Triangles(BamgMesh* bamgmesh,BamgOpts* bamgopts); 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(BamgMesh* bamgmesh, Bamg Args* bamgargs);900 void ReadFromMatlabMesh(BamgMesh* bamgmesh, BamgOpts* bamgopts); 901 901 void Read_am_fmt(MeshIstream &); 902 902 void Read_amdba(MeshIstream &); … … 906 906 void Read_msh(MeshIstream &); 907 907 908 void ReadMetric(Bamg Args* bamgargs,const Real8 hmin,const Real8 hmax,const Real8 coef);908 void ReadMetric(BamgOpts* bamgopts,const Real8 hmin,const Real8 hmax,const Real8 coef); 909 909 void IntersectConsMetric(const double * s,const Int4 nbsol,const int * typsols, 910 910 const Real8 hmin,const Real8 hmax, const Real8 coef, … … 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, Bamg Args* bamgargs);986 void ReadGeometry(BamgGeom* bamggeom, BamgOpts* bamgopts); 987 987 void ReadGeometry(MeshIstream & ,const char *) ; 988 988 … … 990 990 Geometry() {EmptyGeometry();}// empty Geometry 991 991 void AfterRead(); 992 Geometry(BamgGeom* bamggeom, Bamg Args* bamgargs) {EmptyGeometry();OnDisk=1;ReadGeometry(bamggeom,bamgargs);AfterRead();}992 Geometry(BamgGeom* bamggeom, BamgOpts* bamgopts) {EmptyGeometry();OnDisk=1;ReadGeometry(bamggeom,bamgopts);AfterRead();} 993 993 Geometry(const char * filename) {EmptyGeometry();OnDisk=1;ReadGeometry(filename);AfterRead();} 994 994 -
issm/trunk/src/c/Bamgx/MeshRead.cpp
r2789 r2790 39 39 static const Direction NoDirOfSearch=Direction(); 40 40 41 void Triangles::ReadFromMatlabMesh(BamgMesh* bamgmesh, Bamg Args* bamgargs){41 void Triangles::ReadFromMatlabMesh(BamgMesh* bamgmesh, BamgOpts* bamgopts){ 42 42 43 43 int verbose; … … 50 50 int Version=1,dim=2; 51 51 52 verbose=bamg args->verbose;52 verbose=bamgopts->verbose; 53 53 54 54 nbv=bamgmesh->NumVertices; … … 264 264 printf("Warning: mesh present but no geometry found. Reconstructing...\n"); 265 265 /*Recreate geometry: */ 266 ConsGeometry( -1); //TESTTESTTESTTEST MaximalAngleOfCorner is actually in BamgGeom...266 ConsGeometry(bamgopts->MaximalAngleOfCorner*Pi/180); 267 267 Gh.AfterRead(); 268 268 } … … 1141 1141 } 1142 1142 1143 Triangles::Triangles(BamgMesh* bamgmesh, Bamg Args* bamgargs):Gh(*(new Geometry())),BTh(*this){1143 Triangles::Triangles(BamgMesh* bamgmesh, BamgOpts* bamgopts):Gh(*(new Geometry())),BTh(*this){ 1144 1144 1145 1145 PreInit(0,"none"); 1146 1146 OnDisk = 1; 1147 1147 1148 ReadFromMatlabMesh(bamgmesh,bamg args);1148 ReadFromMatlabMesh(bamgmesh,bamgopts); 1149 1149 SetIntCoor(); 1150 1150 FillHoleInMesh(); … … 1161 1161 } 1162 1162 1163 void Geometry::ReadGeometry(BamgGeom* bamggeom,Bamg Args* bamgargs){1163 void Geometry::ReadGeometry(BamgGeom* bamggeom,BamgOpts* bamgopts){ 1164 1164 1165 1165 int verbose; … … 1178 1178 nbvx = nbv; 1179 1179 nbiv = nbv; 1180 verbose=bamg args->verbose;1180 verbose=bamgopts->verbose; 1181 1181 1182 1182 //some checks … … 1314 1314 1315 1315 //MaximalAngleOfCorner 1316 if (bamg geom->MaximalAngleOfCorner){1316 if (bamgopts->MaximalAngleOfCorner){ 1317 1317 if(verbose>3) printf(" processing MaximalAngleOfCorner\n"); 1318 MaximalAngleOfCorner=bamg geom->MaximalAngleOfCorner*Pi/180;1318 MaximalAngleOfCorner=bamgopts->MaximalAngleOfCorner*Pi/180; 1319 1319 } 1320 1320 else{ -
issm/trunk/src/c/Bamgx/Metric.cpp
r2789 r2790 805 805 806 806 807 void Triangles::ReadMetric(Bamg Args* bamgargs,const Real8 hmin1=1.0e-30,const Real8 hmax1=1.0e30,const Real8 coef=1)807 void Triangles::ReadMetric(BamgOpts* bamgopts,const Real8 hmin1=1.0e-30,const Real8 hmax1=1.0e30,const Real8 coef=1) 808 808 { 809 809 int i,j; 810 810 811 if(bamg args->verbose>3) printf(" processing metric\n");811 if(bamgopts->verbose>3) printf(" processing metric\n"); 812 812 813 813 Real8 hmin = Max(hmin1,MinimalHmin()); … … 820 820 Real8 h; 821 821 if (j == 1){ 822 h=bamg args->metric[i];822 h=bamgopts->metric[i]; 823 823 vertices[i].m=Metric(Max(hmin,Min(hmax, h*coef))); 824 824 } 825 825 else if (j==3){ 826 826 Real8 a,b,c; 827 a=bamg args->metric[i*3+0];828 b=bamg args->metric[i*3+1];829 c=bamg args->metric[i*3+2];827 a=bamgopts->metric[i*3+0]; 828 b=bamgopts->metric[i*3+1]; 829 c=bamgopts->metric[i*3+2]; 830 830 MetricAnIso M(a,b,c); 831 831 MatVVP2x2 Vp(M/coef); -
issm/trunk/src/c/objects/BamgGeom.h
r2772 r2790 18 18 double* h1h2VpVertices; 19 19 20 double MaximalAngleOfCorner;21 22 20 int NumTangentAtEdges; 23 21 double* TangentAtEdges; -
issm/trunk/src/c/objects/objects.h
r2771 r2790 41 41 #include "./BamgGeom.h" 42 42 #include "./BamgMesh.h" 43 #include "./BamgArgs.h" 44 43 #include "./BamgOpts.h" 45 44 46 45 #endif -
issm/trunk/src/m/classes/public/bamg.m
r2789 r2790 19 19 bamg_geometry.Edges=zeros(0,3); 20 20 bamg_geometry.hVertices=zeros(0,1); 21 bamg_geometry.MaximalAngleOfCorner=getfieldvalue(options,'MaximalAngleOfCorner',10);22 21 bamg_geometry.NumSubDomain=0; 23 22 bamg_geometry.SubDomain=zeros(0,3); … … 67 66 bamg_options.iso=getfieldvalue(options,'iso',0); 68 67 bamg_options.maxnbv=getfieldvalue(options,'maxnbv',10^6); 68 bamg_options.MaximalAngleOfCorner=getfieldvalue(options,'MaximalAngleOfCorner',10); 69 69 bamg_options.hmin=getfieldvalue(options,'hmin',10^-100); 70 70 bamg_options.hmax=getfieldvalue(options,'hmax',10^100); -
issm/trunk/src/mex/Bamg/Bamg.cpp
r2789 r2790 9 9 int noerr=1; 10 10 int i; 11 Bamg Args bamgargs;11 BamgOpts bamgopts; 12 12 BamgMesh bamgmesh; 13 13 BamgGeom bamggeom; … … 55 55 bamggeom.MetricVertices=NULL; 56 56 bamggeom.h1h2VpVertices=NULL; 57 FetchData(&MaximalAngleOfCorner,mxGetField(BAMGGEOMETRY,0,"MaximalAngleOfCorner"));58 bamggeom.MaximalAngleOfCorner=MaximalAngleOfCorner;59 57 bamggeom.NumTangentAtEdges=0; 60 58 bamggeom.TangentAtEdges=NULL; … … 93 91 /*create bamg options input*/ 94 92 FetchData(&iso,mxGetField(BAMGOPTIONS,0,"iso")); 95 bamg args.iso=iso;93 bamgopts.iso=iso; 96 94 FetchData(&maxnbv,mxGetField(BAMGOPTIONS,0,"maxnbv")); 97 bamg args.maxnbv=maxnbv;95 bamgopts.maxnbv=maxnbv; 98 96 FetchData(&hmin,mxGetField(BAMGOPTIONS,0,"hmin")); 99 bamg args.hmin=hmin;97 bamgopts.hmin=hmin; 100 98 FetchData(&hmax,mxGetField(BAMGOPTIONS,0,"hmax")); 101 bamg args.hmax=hmax;99 bamgopts.hmax=hmax; 102 100 FetchData(&gradation,mxGetField(BAMGOPTIONS,0,"gradation")); 103 bamg args.gradation=gradation;101 bamgopts.gradation=gradation; 104 102 FetchData(&cutoff,mxGetField(BAMGOPTIONS,0,"cutoff")); 105 bamg args.cutoff=cutoff;103 bamgopts.cutoff=cutoff; 106 104 FetchData(&verbose,mxGetField(BAMGOPTIONS,0,"verbose")); 107 bamg args.verbose=verbose;105 bamgopts.verbose=verbose; 108 106 FetchData(&splitcorners,mxGetField(BAMGOPTIONS,0,"splitcorners")); 109 bamgargs.splitcorners=splitcorners; 107 bamgopts.splitcorners=splitcorners; 108 FetchData(&MaximalAngleOfCorner,mxGetField(BAMGOPTIONS,0,"MaximalAngleOfCorner")); 109 bamgopts.MaximalAngleOfCorner=MaximalAngleOfCorner; 110 110 FetchData(&metric,NULL,NULL,mxGetField(BAMGOPTIONS,0,"metric")); 111 bamg args.metric=metric;111 bamgopts.metric=metric; 112 112 113 113 /*!Generate internal degree of freedom numbers: */ 114 Bamgx(&bamgmesh,&bamggeom,&bamg args);114 Bamgx(&bamgmesh,&bamggeom,&bamgopts); 115 115 116 116 /*write output datasets: */
Note:
See TracChangeset
for help on using the changeset viewer.