Changeset 2778
- Timestamp:
- 01/06/10 16:49:04 (15 years ago)
- Location:
- issm/trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Bamgx/MeshRead.cpp
r2772 r2778 1239 1239 i2=(int)bamggeom->SubDomain[i*4+2]; 1240 1240 i3=(int)bamggeom->SubDomain[i*4+3]; 1241 if (i0!=2) throw ErrorException(__FUNCT__,exprintf("Bad Subdomain definition: first number should be 2 "));1242 if (i1>nbe || i1<=0) throw ErrorException(__FUNCT__,exprintf("Bad Subdomain definition: second number should in [1 %i] ",nbe));1241 if (i0!=2) throw ErrorException(__FUNCT__,exprintf("Bad Subdomain definition: first number should be 2 (for Edges)")); 1242 if (i1>nbe || i1<=0) throw ErrorException(__FUNCT__,exprintf("Bad Subdomain definition: second number should in [1 %i] (edge number)",nbe)); 1243 1243 subdomains[i].edge=edges + (i1-1); 1244 1244 subdomains[i].sens = (int) i2; -
issm/trunk/src/m/classes/public/bamg.m
r2771 r2778 5 5 % md=bamg(md,varargin); 6 6 7 %process options {{{17 %process options 8 8 options=pairoptions(varargin{:}); 9 9 … … 11 11 bamg_options=struct(); 12 12 bamg_geometry=struct(); 13 bamg_mesh=struct(); 13 14 14 %fill out the geometry 15 bamg_geometry.Vertices=getfieldvalue(options,'Vertices',NaN); 16 bamg_geometry.NumVertices=size(bamg_geometry.Vertices,1); 17 bamg_geometry.Edges=getfieldvalue(options,'Edges',NaN); 18 bamg_geometry.NumEdges=size(bamg_geometry.Edges,1); 19 bamg_geometry.hVertices=getfieldvalue(options,'hVertices',NaN); 15 %get domainoutline 16 domainfile=getfieldvalueerr(options,'domain'); 17 resolution=getfieldvalue(options,'resolution',5000); 18 if ~exist(domainfile,'file') 19 error(['bamg error message: file ' domainfile ' not found ']); 20 else 21 domain=expread(domainfile); 20 22 21 bamg_options.fgeom=getfieldvalueerr(options,'fgeom'); 22 %}}} 23 %build geometry 24 count=0; 25 bamg_geometry.Vertices=zeros(0,3); 26 bamg_geometry.Edges=zeros(0,3); 27 bamg_geometry.hVertices=zeros(0,1); 28 bamg_geometry.SubDomain=zeros(0,3); 29 for i=1:length(domain), 30 nods=domain(i).nods-1; %the domain are closed 1=end; 31 bamg_geometry.Vertices=[bamg_geometry.Vertices; [domain(i).x(1:nods) domain(i).y(1:nods) ones(nods,1)]]; 32 bamg_geometry.Edges=[bamg_geometry.Edges; [transp(count+1:count+nods) transp([count+2:count+nods count+1]) ones(nods,1)]]; 33 bamg_geometry.hVertices=[bamg_geometry.hVertices; resolution*ones(nods,1)]; 34 if i>1, 35 bamg_geometry.SubDomain=[2 count+1 1 1]; 36 end 37 count=count+nods; 38 end 39 bamg_geometry.NumVertices=size(bamg_geometry.Vertices,1); 40 bamg_geometry.NumEdges=size(bamg_geometry.Edges,1); 41 bamg_geometry.NumSubDomain=size(bamg_geometry.SubDomain,1); 42 end 23 43 24 44 %call Bamg 25 45 [elements,x,y]=Bamg(bamg_geometry,bamg_options); 26 46 27 % plug results onto model {{{147 % plug results onto model 28 48 md.x=x; 29 49 md.y=y; … … 35 55 md.z=zeros(md.numberofgrids,1); 36 56 md.type='2d'; 37 %}}} -
issm/trunk/src/mex/Bamg/Bamg.cpp
r2772 r2778 20 20 double* Edges=NULL; 21 21 double* hVertices=NULL; 22 int NumSubDomain; 23 double* SubDomain=NULL; 22 24 23 25 … … 29 31 30 32 /*process inputs*/ 31 FetchData(&geomfile,mxGetField(BAMGOPTIONS,0,"fgeom"));33 //FetchData(&geomfile,mxGetField(BAMGOPTIONS,0,"fgeom")); 32 34 33 35 FetchData(&NumVertices,mxGetField(BAMGGEOMETRY,0,"NumVertices")); … … 36 38 FetchData(&Edges,NULL,NULL,mxGetField(BAMGGEOMETRY,0,"Edges")); 37 39 FetchData(&hVertices,NULL,NULL,mxGetField(BAMGGEOMETRY,0,"hVertices")); 40 FetchData(&NumSubDomain,mxGetField(BAMGGEOMETRY,0,"NumSubDomain")); 41 FetchData(&SubDomain,NULL,NULL,mxGetField(BAMGGEOMETRY,0,"SubDomain")); 38 42 39 43 /*create bamg geometry input*/ … … 55 59 bamggeom.NumRequiredEdges=0; 56 60 bamggeom.RequiredEdges=NULL; 57 bamggeom.NumSubDomain= 0;58 bamggeom.SubDomain= NULL;61 bamggeom.NumSubDomain=NumSubDomain; 62 bamggeom.SubDomain=SubDomain; 59 63 60 64 /*create bamg mesh input*/ 61 bamgargs.geomfile=geomfile;65 //bamgargs.geomfile=geomfile; 62 66 63 67 /*create bamg mesh input*/ … … 72 76 73 77 /*Free ressources: */ 74 xfree((void**)&geomfile);78 //xfree((void**)&geomfile); 75 79 xfree((void**)&Vertices); 76 80 xfree((void**)&Edges); 77 81 xfree((void**)&hVertices); 82 xfree((void**)&SubDomain); 78 83 79 84 /*end module: */
Note:
See TracChangeset
for help on using the changeset viewer.