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);
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
--- /dev/null
+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
+
--- /dev/null
+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
+
-function [coo,ele,fa2so] = refineQuad(coordinates,elements,type)
+function [coordinates,elements,fa2so] = refineQuad(coordinates,elements,type)
%
% [coordinates,elements,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);
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