Changeset 2778


Ignore:
Timestamp:
01/06/10 16:49:04 (15 years ago)
Author:
Mathieu Morlighem
Message:

Added holes in bamg

Location:
issm/trunk/src
Files:
3 edited

Legend:

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

    r2772 r2778  
    12391239                        i2=(int)bamggeom->SubDomain[i*4+2];
    12401240                        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));
    12431243                        subdomains[i].edge=edges + (i1-1);
    12441244                        subdomains[i].sens = (int) i2;
  • issm/trunk/src/m/classes/public/bamg.m

    r2771 r2778  
    55%      md=bamg(md,varargin);
    66
    7 %process options {{{1
     7%process options
    88options=pairoptions(varargin{:});
    99
     
    1111bamg_options=struct();
    1212bamg_geometry=struct();
     13bamg_mesh=struct();
    1314
    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
     16domainfile=getfieldvalueerr(options,'domain');
     17resolution=getfieldvalue(options,'resolution',5000);
     18if ~exist(domainfile,'file')
     19        error(['bamg error message: file ' domainfile ' not found ']);
     20else
     21        domain=expread(domainfile);
    2022
    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);
     42end
    2343
    2444%call Bamg
    2545[elements,x,y]=Bamg(bamg_geometry,bamg_options);
    2646
    27 % plug results onto model {{{1
     47% plug results onto model
    2848md.x=x;
    2949md.y=y;
     
    3555md.z=zeros(md.numberofgrids,1);
    3656md.type='2d';
    37 %}}}
  • issm/trunk/src/mex/Bamg/Bamg.cpp

    r2772 r2778  
    2020        double* Edges=NULL;
    2121        double* hVertices=NULL;
     22        int     NumSubDomain;
     23        double* SubDomain=NULL;
    2224
    2325
     
    2931
    3032        /*process inputs*/
    31         FetchData(&geomfile,mxGetField(BAMGOPTIONS,0,"fgeom"));
     33        //FetchData(&geomfile,mxGetField(BAMGOPTIONS,0,"fgeom"));
    3234
    3335        FetchData(&NumVertices,mxGetField(BAMGGEOMETRY,0,"NumVertices"));
     
    3638        FetchData(&Edges,NULL,NULL,mxGetField(BAMGGEOMETRY,0,"Edges"));
    3739        FetchData(&hVertices,NULL,NULL,mxGetField(BAMGGEOMETRY,0,"hVertices"));
     40        FetchData(&NumSubDomain,mxGetField(BAMGGEOMETRY,0,"NumSubDomain"));
     41        FetchData(&SubDomain,NULL,NULL,mxGetField(BAMGGEOMETRY,0,"SubDomain"));
    3842
    3943        /*create bamg geometry input*/
     
    5559        bamggeom.NumRequiredEdges=0;
    5660        bamggeom.RequiredEdges=NULL;
    57         bamggeom.NumSubDomain=0;
    58         bamggeom.SubDomain=NULL;
     61        bamggeom.NumSubDomain=NumSubDomain;
     62        bamggeom.SubDomain=SubDomain;
    5963
    6064        /*create bamg mesh input*/
    61         bamgargs.geomfile=geomfile;
     65        //bamgargs.geomfile=geomfile;
    6266
    6367        /*create bamg mesh input*/
     
    7276
    7377        /*Free ressources: */
    74         xfree((void**)&geomfile);
     78        //xfree((void**)&geomfile);
    7579        xfree((void**)&Vertices);
    7680        xfree((void**)&Edges);
    7781        xfree((void**)&hVertices);
     82        xfree((void**)&SubDomain);
    7883
    7984        /*end module: */
Note: See TracChangeset for help on using the changeset viewer.