index_builder

PURPOSE ^

INDEX_BUILDER - ????

SYNOPSIS ^

function f=index_builder(index,node_on_icefront,element_on_icefront)

DESCRIPTION ^

INDEX_BUILDER - ????

   Usage:
      f=index_builder(index,node_on_icefront,element_on_icefront)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function f=index_builder(index,node_on_icefront,element_on_icefront)
0002 %INDEX_BUILDER - ????
0003 %
0004 %   Usage:
0005 %      f=index_builder(index,node_on_icefront,element_on_icefront)
0006 
0007 index_icefront=[];
0008 nel=length(index);
0009 problematic_elements=[];
0010 for n=1:nel
0011     
0012    if element_on_icefront(n)
0013       if (node_on_icefront(index(n,1)) & node_on_icefront(index(n,2)) & node_on_icefront(index(n,3))),
0014          problematic_elements=[problematic_elements
0015             n];
0016        else,
0017       
0018         if (node_on_icefront(index(n,1)) & node_on_icefront(index(n,2)))
0019             index_icefront=[index_icefront
0020             index(n,1) index(n,2)];
0021         end
0022 
0023         if (node_on_icefront(index(n,2)) & node_on_icefront(index(n,3)))
0024            index_icefront=[index_icefront
0025             index(n,2) index(n,3)];
0026         end
0027         if (node_on_icefront(index(n,3)) & node_on_icefront(index(n,1)) & ...
0028                             (1-node_on_icefront(index(n,2))))
0029            index_icefront=[index_icefront
0030             index(n,3) index(n,1)];
0031         end
0032        end
0033     end
0034 end
0035 
0036 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%55
0037 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
0038 %we deal with the problematic elements
0039 type_prob_elem=zeros(length(problematic_elements),1);
0040 position=zeros(length(problematic_elements),3);
0041 for i=1:length(problematic_elements),
0042    for n=1:3,
0043       a=length(find(index_icefront == index(problematic_elements(i),n)));
0044       if a>=1, position(i,n)=1;
0045       else position(i,n)=0;
0046       end
0047       
0048    end
0049        a=length(find(position(i,:)));
0050       type_prob_elem(i)=a(1);
0051 end
0052 
0053 %we begin with the type_prob_elem =2
0054 index_front_spec=[];
0055 pos=find(type_prob_elem ==2);
0056 for j=1:length(pos),
0057    el=problematic_elements(pos(j));
0058    pos2=find(position(pos(j),:)==0);
0059    switch pos2,
0060    case 1,
0061       index_front_spec=[index_front_spec
0062          index(el,1) index(el,2)
0063       index(el,3) index(el,1)];
0064    case 2,
0065       index_front_spec=[index_front_spec
0066          index(el,2) index(el,3)
0067       index(el,1) index(el,2)];
0068    case 3,
0069       index_front_spec=[index_front_spec
0070          index(el,3) index(el,1)
0071       index(el,2) index(el,3)];
0072    end   
0073 end
0074 
0075 %now the type_prob_elem=1
0076 pos=find(type_prob_elem==1);
0077 for n=1:length(pos),
0078 el=problematic_elements(pos(n));
0079 
0080 pos2=find(position(pos(n),:)==0);
0081 for m=1:length(pos2),
0082    a=length(find(index_front_spec==index(el,pos2(m))));
0083    if a>=1,
0084       position(pos(n),pos2(m))=1;
0085    end
0086 end
0087 
0088 pos2=find(position(pos(n),:)==0);
0089 switch pos2,
0090    case 1,
0091       index_front_spec=[index_front_spec
0092          index(el,1) index(el,2)
0093       index(el,3) index(el,1)];
0094    case 2,
0095       index_front_spec=[index_front_spec
0096          index(el,2) index(el,3)
0097       index(el,1) index(el,2)];
0098    case 3,
0099       index_front_spec=[index_front_spec
0100          index(el,3) index(el,1)
0101       index(el,2) index(el,3)];
0102 end   
0103 end
0104    
0105    
0106 %now the type_prob_elem=0
0107 pos=find(type_prob_elem==0);
0108 for n=1:length(pos),
0109 el=problematic_elements(pos(n));
0110 
0111 pos2=find(position(pos(n),:)==0);
0112 for m=1:length(pos2),
0113    a=length(find(index_front_spec==index(el,pos2(m))));
0114    if a>=1,
0115       position(pos(n),pos2(m))=1;
0116    end
0117 end
0118 
0119 pos2=find(position(pos(n),:)==0);
0120 switch pos2,
0121    case 1,
0122       index_front_spec=[index_front_spec
0123          index(el,1) index(el,2)
0124       index(el,3) index(el,1)];
0125    case 2,
0126       index_front_spec=[index_front_spec
0127          index(el,2) index(el,3)
0128       index(el,1) index(el,2)];
0129    case 3,
0130       index_front_spec=[index_front_spec
0131          index(el,3) index(el,1)
0132       index(el,2) index(el,3)];
0133 end   
0134 end
0135 
0136 %now we have to eliminate the lines that appear in the index_front_spec and that are inner lines to the mesh
0137 flag_elim=zeros(length(index_front_spec),1);
0138 for n=1:length(index_front_spec),
0139    a=length(find_line(index,index_front_spec(n,:)));
0140    if a>=2,
0141       flag_elim(n)=1;
0142    end
0143 end
0144 index_front_spec=erase_lines(index_front_spec,flag_elim);
0145    
0146 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%55
0147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
0148 
0149    
0150    index_icefront=[index_icefront
0151       index_front_spec];
0152    
0153 f=index_icefront;
0154    
0155    
0156

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003