]> git.leopard-lacewing.eu Git - bacc.git/commitdiff
[src] refineQuad zurück gesetzt (ohne Nachbarn)
authortreecity <treecity@26120e32-c555-405d-b3e1-1f783fb42516>
Thu, 20 Oct 2011 20:06:17 +0000 (20:06 +0000)
committertreecity <treecity@26120e32-c555-405d-b3e1-1f783fb42516>
Thu, 20 Oct 2011 20:06:17 +0000 (20:06 +0000)
[src] nMesh/refineQuad umstruckturiert für Nachbarschafts relationen
[src] kleine kopien nach nMesh

git-svn-id: https://drops.fb12.tu-berlin.de/svn/bacc/trunk@55 26120e32-c555-405d-b3e1-1f783fb42516

src/A_stepIso.m
src/exmpl_2DLShape.mat
src/nMesh/exmpl_2DLShape.mat [new file with mode: 0644]
src/nMesh/exmpl_2DQuad.mat [new file with mode: 0644]
src/nMesh/exmpl_3DCube.mat [new file with mode: 0644]
src/nMesh/exmpl_3DFichCube.mat [new file with mode: 0644]
src/nMesh/plotShape.m [new file with mode: 0644]
src/nMesh/refineQuad.m [new file with mode: 0644]
src/refineQuad.m

index 264f2458e93fefb0b53d3026b718377f02af1e62..5175ffbafa69d508d1685262c689d9317b764bf6 100644 (file)
@@ -8,7 +8,7 @@ if (isempty(G_E) || isempty(G_C))
   return
 end
 
-  [coordinates_fine,elements_fine, f2s]=refineQuad(G_C,G_E,2*ones(1,size(G_E,1)));
+  [coordinates_fine,elements_fine, f2s]=refineQuad(G_C,G_E,2);
   
   A_fine = mex_build_AU(coordinates_fine,elements_fine,mu,type);
   
@@ -21,7 +21,7 @@ end
   ind = computeEstSlpMuTilde(x_fine,G_C,G_E,f2s);
   
   dataIso = [size(G_E,1) sqrt(sum(ind)) xe_fine];
-  [G_C, G_E] = refineQuad(G_C,G_E,2*ones(1,size(G_E,1)));
+  [G_C, G_E] = refineQuad(G_C,G_E,2);
 
 
 end
index 5a82bf5d89e9e1537dd679fa801d3eac7e96bc7c..9c9f86097cb660f6456cc5604866caa0ad92b34f 100644 (file)
Binary files a/src/exmpl_2DLShape.mat and b/src/exmpl_2DLShape.mat differ
diff --git a/src/nMesh/exmpl_2DLShape.mat b/src/nMesh/exmpl_2DLShape.mat
new file mode 100644 (file)
index 0000000..5a82bf5
Binary files /dev/null and b/src/nMesh/exmpl_2DLShape.mat differ
diff --git a/src/nMesh/exmpl_2DQuad.mat b/src/nMesh/exmpl_2DQuad.mat
new file mode 100644 (file)
index 0000000..743b64c
Binary files /dev/null and b/src/nMesh/exmpl_2DQuad.mat differ
diff --git a/src/nMesh/exmpl_3DCube.mat b/src/nMesh/exmpl_3DCube.mat
new file mode 100644 (file)
index 0000000..d2e8234
Binary files /dev/null and b/src/nMesh/exmpl_3DCube.mat differ
diff --git a/src/nMesh/exmpl_3DFichCube.mat b/src/nMesh/exmpl_3DFichCube.mat
new file mode 100644 (file)
index 0000000..3c5c502
Binary files /dev/null and b/src/nMesh/exmpl_3DFichCube.mat differ
diff --git a/src/nMesh/plotShape.m b/src/nMesh/plotShape.m
new file mode 100644 (file)
index 0000000..cf5f42e
--- /dev/null
@@ -0,0 +1,82 @@
+function plotShape(coordinates, elements, varargin)
+%
+% plotShape(coordinates,elements)
+% plotShape(coordinates,elements,'FLAG')
+%
+% Diese Funktion Zeichnet alle Vierecke mit ausgefuellten Flaechen.
+% FLAG:
+% c -> Koordinaten als rote Kreise darstellen
+% b -> nur Kanten der Elemente einzeichnen
+% n -> Normen auf ein Element einzeichnen (mit Laenge 1)
+% a -> Normen auf ein Element einzeichnen (Laenge durch Flaecheninhalt)
+%
+% P.Schaefer
+
+%% Parameterueberpruefung
+c = 0;
+e = 1;
+n = 0;
+optargin = size(varargin,2);
+if(optargin>1)
+    error('Zu viele Argumente');
+elseif(optargin==1)
+    if(ismember('b',varargin{1}))
+        e = 0;
+    end
+    if(ismember('c',varargin{1}))
+        c = 1;
+    end
+    if(ismember('a',varargin{1}))
+        n = 2;
+    elseif(ismember('n',varargin{1}))
+        n = 1;
+    end
+end
+
+%% Koordinaten einzeichnen
+if(c)
+    scatter3(coordinates(:,1),coordinates(:,2),coordinates(:,3),'r');
+    hold on
+end
+
+%% Flächen
+eles = size(elements,1);
+if(e)
+    for idx = 1:eles
+        current = coordinates(elements(idx,[1:4,1])',:);
+%         current(3,:) = current(3,:)-current(1,:)+current(2,:);
+        fill3(current(:,1),current(:,2),current(:,3),'b'); % Zeichnet Oberflaeche
+        hold on
+    end
+else
+    for idx = 1:eles
+        current = coordinates(elements(idx,[1:4,1])',:);
+%         current(3,:) = current(3,:)-current(1,:)+current(2,:);
+        plot3(current(:,1),current(:,2),current(:,3),'b'); % Zeichnet nur Kanten
+        hold on
+    end
+end
+
+if(n)
+    if(n==2)
+        anorm = quadNorm(coordinates,elements,'w');
+    else
+        anorm = quadNorm(coordinates,elements);
+    end
+    for idx = 1:eles
+        current = sum(coordinates(elements(idx,[2,4])',:),1)/2;
+        current = [current ; current+anorm(idx,:);coordinates(elements(idx,1)',:)];
+        plot3(current(:,1),current(:,2),current(:,3),'r'); % Zeichnet Oberflaeche
+        scatter3(current(2,1),current(2,2),current(2,3),'xr');
+        hold on
+    end
+end
+
+xlabel 'x'
+ylabel 'y'
+zlabel 'z'
+
+hold off
+
+end
+
diff --git a/src/nMesh/refineQuad.m b/src/nMesh/refineQuad.m
new file mode 100644 (file)
index 0000000..8bc9d88
--- /dev/null
@@ -0,0 +1,138 @@
+function [coo,ele,f2s] = refineQuad(coordinates,elements,type)
+%
+%  [coordinates,elements,fa2so] = refineQuad(coordinates,elements,type)
+%
+% Verfeinert die markierten Elemente mit dem entsprechenden TYP und gibt
+% auch die F2S Beziehungen zurück. type muss von der Länge der Anzahl der
+% Elemente entsprechen oder genau 1 und die Einträge können 1,2,3,4 sein.
+%
+% der Typ zu jedem Element entspricht dabei:
+% 1- keine Verfeinerung
+% 2- 4 neue Elemente
+% 3- 2 neue Elemente, übereinander
+% 4- 2 neue Elemente, nebeneinander
+%
+% P. Schaefer
+
+if([1 1] == size(type))
+    type = repmat(type, size(elements,1),1);
+end
+
+global G_ref_E;
+global G_ref_C;
+global G_ref_N;
+global G_ref_f2s;
+global G_ref_t;
+
+c_loop = size(elements,1);
+
+
+G_ref_E = elements;
+G_ref_C = coordinates;
+G_ref_t = type;
+G_ref_f2s = repmat([1:c_loop]',1,4);
+
+for i = 1:c_loop
+  refine(i);
+end
+
+coo = G_ref_C;
+ele = G_ref_E;
+f2s = G_ref_f2s;
+
+%igitigit
+ [coo l pos] = unique(coo,'rows');
+ ele = pos(ele);
+
+clear G_ref_E G_ref_C G_ref_N G_ref_f2s G_ref_t
+end
+
+
+function refine(ele)
+% global G_ref_E;
+% global G_ref_C;
+% global G_ref_N;
+% global G_ref_f2s;
+global G_ref_t;
+
+if(G_ref_t(ele)==1)
+  return;
+end
+
+% Ueberpruefe Nachbarn
+
+
+% wenn ungueltig verfeinere sie (link auf Soll verfeinert werden?)
+% G_ref_M(k) =
+% refine(k);
+
+% verfeinere dieses element
+refineE(ele);
+
+% setze Nachbarschafts relationen
+updateN(ele);
+
+end
+
+function refineE(ele)
+% Element wird gnadenlos Verfeinert
+global G_ref_E;
+global G_ref_C;
+%global G_ref_N;
+global G_ref_f2s;
+global G_ref_t;
+
+    c_ele = size(G_ref_E,1);
+    c_coo = size(G_ref_C,1);
+    
+    
+    el = G_ref_E(ele,:);
+    if(G_ref_t(ele)==1)
+      disp 'Warning: Type = 1';
+        return;
+    elseif(G_ref_t(ele)==2)
+        G_ref_C(c_coo+1,:) = (G_ref_C(el(1),:)+G_ref_C(el(2),:))/2;
+        G_ref_C(c_coo+2,:) = (G_ref_C(el(2),:)+G_ref_C(el(3),:))/2;
+        G_ref_C(c_coo+3,:) = (G_ref_C(el(3),:)+G_ref_C(el(4),:))/2;
+        G_ref_C(c_coo+4,:) = (G_ref_C(el(1),:)+G_ref_C(el(4),:))/2;
+        G_ref_C(c_coo+5,:) = (G_ref_C(el(1),:)+G_ref_C(el(3),:))/2;
+
+        G_ref_E(ele,:) = [c_coo+4,c_coo+5,c_coo+3,el(4)];
+        G_ref_E(c_ele+1,:) = [c_coo+5,c_coo+2,el(3),c_coo+3];
+        G_ref_E(c_ele+2,:) = [c_coo+1,el(2),c_coo+2,c_coo+5];
+        G_ref_E(c_ele+3,:) = [el(1),c_coo+1,c_coo+5,c_coo+4];
+    
+        G_ref_f2s(ele,2:4)=c_ele+1:c_ele+3;
+    elseif(G_ref_t(ele)==3)
+        G_ref_C(c_coo+1,:) = (G_ref_C(el(1),:)+G_ref_C(el(4),:))/2;
+        G_ref_C(c_coo+2,:) = (G_ref_C(el(2),:)+G_ref_C(el(3),:))/2;
+        
+        G_ref_E(ele,1) = c_coo+1;
+        G_ref_E(ele,2) = c_coo+2;
+        
+        G_ref_E(c_ele+1,:) = [el(1),el(2),c_coo+2,c_coo+1];
+        G_ref_f2s(ele,[3 4])=c_ele+1;
+     elseif(G_ref_t(ele)==4)
+        G_ref_C(c_coo+1,:) = (G_ref_C(el(1),:)+G_ref_C(el(2),:))/2;
+        G_ref_C(c_coo+2,:) = (G_ref_C(el(4),:)+G_ref_C(el(3),:))/2;
+        
+        G_ref_E(ele,2) = c_coo+1;
+        G_ref_E(ele,3) = c_coo+2;
+        
+        G_ref_E(c_ele+1,:) = [c_coo+1,el(2),el(3),c_coo+2];
+        G_ref_f2s(ele,[2 4])=c_ele+1;
+    end
+    
+    G_ref_t(ele) = 1;
+    
+end
+
+function updateN(ele)
+% Nachbarschaften werden neu gesetzt (nach N und f2s)
+% global G_ref_E;
+% global G_ref_C;
+% global G_ref_N;
+% global G_ref_f2s;
+
+end
+
index c65140f6f2ef12c91615f6994397f242f87f38ed..666acf3f11c7c3b9399c217259f1330b06ebace9 100644 (file)
@@ -1,4 +1,4 @@
-function [coo,ele,fa2so] = refineQuad(coordinates,elements,type)
+function [coordinates,elements,fa2so] = refineQuad(coordinates,elements,type)
 %
 %  [coordinates,elements,fa2so] = refineQuad(coordinates,elements,type)
 %
@@ -14,25 +14,13 @@ function [coo,ele,fa2so] = refineQuad(coordinates,elements,type)
 %
 % P. Schaefer
 
-% globale Struktur aufbauen
-global E;
-global C;
-global N;
-global F2S;
-
-E=elements;
-C=coordinates;
-
-% Typ aufbauen
 if([1 1] == size(type))
-    type = repmat(type, size(E,1),1);
+    type = repmat(type, size(elements,1),1);
 end
 
-c_loop = size(E,1);
+c_loop = size(elements,1);
 
-F2S = repmat([1:c_loop]',1,4);
-
-type = check(neigh,type);
+fa2so = repmat([1:c_loop]',1,4);
 
 for i = 1:c_loop
     c_ele = size(elements,1);
@@ -77,29 +65,8 @@ for i = 1:c_loop
 end
 
 %igitigit
- [coo l pos] = unique(coordinates,'rows');
- ele = pos(elements);
-
-
-end
-
-function splitH(elem)
-global E
-global C
-global N
-
+ [G_ref_C l pos] = unique(G_ref_C,'rows');
+ G_ref_E = pos(G_ref_E);
 end
 
-function splitV(elem)
-global E
-global C
-global N
-
-end
-
-
-function check(elem)
-
-  
-
-end