Changeset 1239


Ignore:
Timestamp:
07/06/09 14:52:27 (16 years ago)
Author:
Mathieu Morlighem
Message:

extended BasinConstrain for ~domain

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/classes/public/BasinConstrain.m

    r1237 r1239  
    1212%   Example:
    1313%      md=BasinConstrain(md,'DomainOutline.exp');
     14%      md=BasinConstrain(md,'~Iceshelves.exp');
    1415
    1516%now, flag grids and elements outside the domain outline.
    16 [gridondomain elementondomain]=ContourToMesh(md.elements,md.x,md.y,expread(domain,1),'element and node',2);
     17if ischar(domain),
     18        if isempty(domain),
     19                elementondomain=zeros(md.numberofelements,1);
     20                gridondomain=zeros(md.numberofgrids,1);
     21                invert=0;
     22        elseif strcmpi(domain,'all')
     23                elementondomain=ones(md.numberofelements,1);
     24                gridondomain=ones(md.numberofgrids,1);
     25                invert=0;
     26        else
     27                %make sure that we actually don't want the elements outside the domain outline!
     28                if strcmpi(domain(1),'~'),
     29                        domain=domain(2:length(domain));
     30                        invert=1;
     31                else
     32                        invert=0;
     33                end
     34                %ok, flag elements and nodes
     35                [gridondomain elementondomain]=ContourToMesh(md.elements,md.x,md.y,expread(domain,1),'element and node',2);
     36        end
     37        if invert,
     38                gridondomain=~gridondomain;
     39                elementondomain=~elementondomain;
     40        end
     41else
     42        error('BasinConstrain error message: domain type not supported yet');
     43end
     44
     45%list of elements and nodes not on domain
    1746gridnotondomain=find(~gridondomain);
    1847elementnotondomain=find(~elementondomain);
Note: See TracChangeset for help on using the changeset viewer.