Changeset 6345


Ignore:
Timestamp:
10/19/10 15:09:43 (14 years ago)
Author:
Mathieu Morlighem
Message:

improved requiredvertices option

Location:
issm/trunk/src/m/model
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/model/bamg.m

    r5861 r6345  
    1010%   - hminVertices: minimum edge length for each vertex (mesh)
    1111%   - hmaxVertices: maximum edge length for each vertex (mesh)
    12 %   - prescribedVertices:  vertices that should be kept by bamg. [x,y,marker]; marker is optional
    1312%
    1413%   - anisomax    : maximum ration between the smallest and largest edges (default is 10^30)
     
    4140%   - toltip: tolerance to move tip on an existing point of the domain outline
    4241%   - tracks: followed by an ARGUS file that prescribes the tracks that the mesh will stick to
     42%   - RequiredVertices: mesh vertices that are required. [x,y,ref]; ref is optional
    4343%   - tol:    if the distance between 2 points of the domain outline is less than tol, they
    4444%             will be merged
     
    207207        if exist(options,'tracks'),
    208208
    209                 %Check that file exists
    210                 trackfile=getfieldvalue(options,'tracks');
    211                 if ~exist(trackfile,'file')
    212                         error(['bamg error message: file ' trackfile ' not found ']);
    213                 end
    214                 track=expread(trackfile);
    215 
    216                 for i=1:length(track),
    217 
    218                         %Add all points to bamg_geometry
    219                         nods=track(i).nods;
    220                         bamg_geometry.Vertices=[bamg_geometry.Vertices; [track(i).x(1:nods) track(i).y(1:nods) 3*ones(nods,1)]];
    221                         bamg_geometry.Edges=[bamg_geometry.Edges; [transpose(count+1:count+nods-1) transpose([count+2:count+nods])  3*ones(nods-1,1)]];
    222 
    223                         %update counter
    224                         count=count+nods;
    225                 end
     209                %read tracks
     210                track=getfieldvalue(options,'tracks');
     211                if all(ischar(track)),
     212                        A=expread(track);
     213                        track=[A.x A.y];
     214                else
     215                        track=double(track); %for some reason, it is of class "single"
     216                end
     217                if(size(track,2)==2), track=[track 3*ones(size(track,1),1)]; end
     218
     219                %only keep those inside
     220                flags=ContourToNodes(track(:,1),track(:,2),domainfile,0);
     221                track=track(find(flags),:);
     222
     223                %Add all points to bamg_geometry
     224                nods=size(track,1);
     225                bamg_geometry.Vertices=[bamg_geometry.Vertices; track];
     226                bamg_geometry.Edges=[bamg_geometry.Edges; [transpose(count+1:count+nods-1) transpose([count+2:count+nods])  3*ones(nods-1,1)]];
     227
     228                %update counter
     229                count=count+nods;
    226230        end
    227231
    228232        %Deal with vertices that need to be kept by mesher
    229         if exist(options,'prescribedVertices'),
    230 
    231                 %recover xvertices yvertices
    232                 prescribedVertices=getfieldvalue(options,'prescribedVertices');
    233                 xvertices=prescribedVertices(:,1);
    234                 yvertices=prescribedVertices(:,2);
    235                 if(size(prescribedVertices,2)==3),
    236                         markers=prescribedVertices(:,3);
    237                 else
    238                         markers=[];
    239                 end
     233        if exist(options,'RequiredVertices'),
     234
     235                %recover RequiredVertices
     236                requiredvertices=double(getfieldvalue(options,'RequiredVertices')); %for some reason, it is of class "single"
     237                if(size(requiredvertices,2)==2), requiredvertices=[requiredvertices 4*ones(size(requiredvertices,1),1)]; end
    240238       
    241239                %only keep those inside
    242                 flags=ContourToNodes(xvertices,yvertices,domain(1),0);
    243                 pos=find(flags);
    244                 xvertices=xvertices(pos);
    245                 yvertices=yvertices(pos);
    246                 if ~isempty(markers),
    247                         markers=markers(pos);
    248                 end
     240                flags=ContourToNodes(requiredvertices(:,1),requiredvertices(:,2),domain(1),0);
     241                requiredvertices=requiredvertices(find(flags),:);
    249242
    250243                %Add all points to bamg_geometry
    251                 nods=length(xvertices);
    252                 if isempty(markers),
    253                         markers=4*ones(nods,1);
    254                 end
    255 
    256                 bamg_geometry.Vertices=[bamg_geometry.Vertices; [xvertices yvertices markers]];
    257 
     244                nods=size(requiredvertices,1);
     245                bamg_geometry.Vertices=[bamg_geometry.Vertices; requiredvertices];
     246
     247                %update counter
     248                count=count+nods;
    258249        end
    259250
  • issm/trunk/src/m/model/ismodelselfconsistent.m

    r6304 r6345  
    319319
    320320        %SPC                             
    321         if ~md.prognostic_DG,
    322                 if any(md.spcthickness(find(md.gridonboundary))~=1),             
    323                         error(['model not consistent: model ' md.name ' should have all the nodes on boundary constrained in field spcthickness']);                     
    324                 end
    325         end
     321%       if ~md.prognostic_DG,
     322%               if any(md.spcthickness(find(md.gridonboundary))~=1),             
     323%                       error(['model not consistent: model ' md.name ' should have all the nodes on boundary constrained in field spcthickness']);                     
     324%               end
     325%       end
    326326
    327327        %Triangle with zero velocity
     
    358358        checksize(md,fields,[md.nsteps num_controls]);
    359359        fields={'cm_min','cm_max'};
    360         checksize(md,fields,[num_controls 1]);
     360        checksize(md,fields,[1 num_controls]);
    361361
    362362        %RESPONSES
Note: See TracChangeset for help on using the changeset viewer.