From e36cfdea17ff2e702e9fe4ee2c85d16b7788da16 Mon Sep 17 00:00:00 2001 From: treecity Date: Sat, 22 Oct 2011 09:16:02 +0000 Subject: [PATCH] [src] neue Quadratur Implementiert (mit Nachbarn) [doc] Nachbarschafts Skizzen erstellt [doc] einige Meshes Aktualisiert (Nachbarn) git-svn-id: https://drops.fb12.tu-berlin.de/svn/bacc/trunk@56 26120e32-c555-405d-b3e1-1f783fb42516 --- doc/fig/Net_Split.svg | 251 +++++++++++++++++++++++++++++++++++ doc/fig/Net_SplitDN.eps | 109 +++++++++++++++ doc/fig/Net_SplitDO.eps | 107 +++++++++++++++ doc/fig/Net_SplitSN.eps | 107 +++++++++++++++ doc/fig/Net_SplitSO.eps | 95 +++++++++++++ src/nMesh/exmpl_2DLShape.mat | Bin 319 -> 633 bytes src/nMesh/exmpl_2DQuad2.mat | Bin 0 -> 375 bytes src/nMesh/quadNorm.m | 45 +++++++ src/nMesh/refineQuad.m | 168 ++++++++++++++++++++--- src/refineQuad.m | 2 +- 10 files changed, 868 insertions(+), 16 deletions(-) create mode 100644 doc/fig/Net_Split.svg create mode 100644 doc/fig/Net_SplitDN.eps create mode 100644 doc/fig/Net_SplitDO.eps create mode 100644 doc/fig/Net_SplitSN.eps create mode 100644 doc/fig/Net_SplitSO.eps create mode 100644 src/nMesh/exmpl_2DQuad2.mat create mode 100644 src/nMesh/quadNorm.m diff --git a/doc/fig/Net_Split.svg b/doc/fig/Net_Split.svg new file mode 100644 index 0000000..81876f0 --- /dev/null +++ b/doc/fig/Net_Split.svg @@ -0,0 +1,251 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/doc/fig/Net_SplitDN.eps b/doc/fig/Net_SplitDN.eps new file mode 100644 index 0000000..5253682 --- /dev/null +++ b/doc/fig/Net_SplitDN.eps @@ -0,0 +1,109 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%Creator: cairo 1.10.2 (http://cairographics.org) +%%CreationDate: Fri Oct 21 21:17:10 2011 +%%Pages: 1 +%%BoundingBox: 0 -1 144 147 +%%DocumentData: Clean7Bit +%%LanguageLevel: 2 +%%EndComments +%%BeginProlog +/cairo_eps_state save def +/dict_count countdictstack def +/op_count count 1 sub def +userdict begin +/q { gsave } bind def +/Q { grestore } bind def +/cm { 6 array astore concat } bind def +/w { setlinewidth } bind def +/J { setlinecap } bind def +/j { setlinejoin } bind def +/M { setmiterlimit } bind def +/d { setdash } bind def +/m { moveto } bind def +/l { lineto } bind def +/c { curveto } bind def +/h { closepath } bind def +/re { exch dup neg 3 1 roll 5 3 roll moveto 0 rlineto + 0 exch rlineto 0 rlineto closepath } bind def +/S { stroke } bind def +/f { fill } bind def +/f* { eofill } bind def +/n { newpath } bind def +/W { clip } bind def +/W* { eoclip } bind def +/BT { } bind def +/ET { } bind def +/pdfmark where { pop globaldict /?pdfmark /exec load put } + { globaldict begin /?pdfmark /pop load def /pdfmark + /cleartomark load def end } ifelse +/BDC { mark 3 1 roll /BDC pdfmark } bind def +/EMC { mark /EMC pdfmark } bind def +/cairo_store_point { /cairo_point_y exch def /cairo_point_x exch def } def +/Tj { show currentpoint cairo_store_point } bind def +/TJ { + { + dup + type /stringtype eq + { show } { -0.001 mul 0 cairo_font_matrix dtransform rmoveto } ifelse + } forall + currentpoint cairo_store_point +} bind def +/cairo_selectfont { cairo_font_matrix aload pop pop pop 0 0 6 array astore + cairo_font exch selectfont cairo_point_x cairo_point_y moveto } bind def +/Tf { pop /cairo_font exch def /cairo_font_matrix where + { pop cairo_selectfont } if } bind def +/Td { matrix translate cairo_font_matrix matrix concatmatrix dup + /cairo_font_matrix exch def dup 4 get exch 5 get cairo_store_point + /cairo_font where { pop cairo_selectfont } if } bind def +/Tm { 2 copy 8 2 roll 6 array astore /cairo_font_matrix exch def + cairo_store_point /cairo_font where { pop cairo_selectfont } if } bind def +/g { setgray } bind def +/rg { setrgbcolor } bind def +/d1 { setcachedevice } bind def +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +%%PageBoundingBox: 0 -1 144 147 +%%EndPageSetup +q 0 -1 144 148 rectclip q +0 146.4 144 -147 re W n +0 g +2.4 w +0 J +0 j +[] 0.0 d +4 M q 1 0 0 -1 0 146.399994 cm +144 1.199 m 104 1.199 l 96 57.199 l 136 57.199 l S Q +q 1 0 0 -1 0 146.399994 cm +136 89.199 m 96 89.199 l 88 145.199 l 128 145.199 l S Q +q 1 0 0 -1 0 146.399994 cm +99.918 13.199 m 99.918 15.41 98.129 17.199 95.918 17.199 c 93.711 +17.199 91.918 15.41 91.918 13.199 c 91.918 10.992 93.711 9.199 95.918 +9.199 c 98.129 9.199 99.918 10.992 99.918 13.199 c h +99.918 13.199 m S Q +q 1 0 0 -1 0 146.399994 cm +91.863 101.199 m 91.863 103.41 90.074 105.199 87.863 105.199 c 85.656 +105.199 83.863 103.41 83.863 101.199 c 83.863 98.992 85.656 97.199 +87.863 97.199 c 90.074 97.199 91.863 98.992 91.863 101.199 c h +91.863 101.199 m S Q +q 1 0 0 -1 0 146.399994 cm +0 145.199 m 40 145.199 l 48 89.199 l 8 89.199 l S Q +q 1 0 0 -1 0 146.399994 cm +8 57.199 m 48 57.199 l 56 1.199 l 16 1.199 l S Q +q 1 0 0 -1 0 146.399994 cm +64.715 13.199 m 64.715 15.41 62.922 17.199 60.715 17.199 c 58.504 +17.199 56.715 15.41 56.715 13.199 c 56.715 10.992 58.504 9.199 60.715 +9.199 c 62.922 9.199 64.715 10.992 64.715 13.199 c h +64.715 13.199 m S Q +q 1 0 0 -1 0 146.399994 cm +56.68 101.199 m 56.68 103.41 54.891 105.199 52.68 105.199 c 50.473 +105.199 48.68 103.41 48.68 101.199 c 48.68 98.992 50.473 97.199 52.68 +97.199 c 54.891 97.199 56.68 98.992 56.68 101.199 c h +56.68 101.199 m S Q +Q Q +showpage +%%Trailer +count op_count sub {pop} repeat +countdictstack dict_count sub {end} repeat +cairo_eps_state restore +%%EOF diff --git a/doc/fig/Net_SplitDO.eps b/doc/fig/Net_SplitDO.eps new file mode 100644 index 0000000..b9b204b --- /dev/null +++ b/doc/fig/Net_SplitDO.eps @@ -0,0 +1,107 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%Creator: cairo 1.10.2 (http://cairographics.org) +%%CreationDate: Fri Oct 21 21:16:40 2011 +%%Pages: 1 +%%BoundingBox: 0 -1 144 147 +%%DocumentData: Clean7Bit +%%LanguageLevel: 2 +%%EndComments +%%BeginProlog +/cairo_eps_state save def +/dict_count countdictstack def +/op_count count 1 sub def +userdict begin +/q { gsave } bind def +/Q { grestore } bind def +/cm { 6 array astore concat } bind def +/w { setlinewidth } bind def +/J { setlinecap } bind def +/j { setlinejoin } bind def +/M { setmiterlimit } bind def +/d { setdash } bind def +/m { moveto } bind def +/l { lineto } bind def +/c { curveto } bind def +/h { closepath } bind def +/re { exch dup neg 3 1 roll 5 3 roll moveto 0 rlineto + 0 exch rlineto 0 rlineto closepath } bind def +/S { stroke } bind def +/f { fill } bind def +/f* { eofill } bind def +/n { newpath } bind def +/W { clip } bind def +/W* { eoclip } bind def +/BT { } bind def +/ET { } bind def +/pdfmark where { pop globaldict /?pdfmark /exec load put } + { globaldict begin /?pdfmark /pop load def /pdfmark + /cleartomark load def end } ifelse +/BDC { mark 3 1 roll /BDC pdfmark } bind def +/EMC { mark /EMC pdfmark } bind def +/cairo_store_point { /cairo_point_y exch def /cairo_point_x exch def } def +/Tj { show currentpoint cairo_store_point } bind def +/TJ { + { + dup + type /stringtype eq + { show } { -0.001 mul 0 cairo_font_matrix dtransform rmoveto } ifelse + } forall + currentpoint cairo_store_point +} bind def +/cairo_selectfont { cairo_font_matrix aload pop pop pop 0 0 6 array astore + cairo_font exch selectfont cairo_point_x cairo_point_y moveto } bind def +/Tf { pop /cairo_font exch def /cairo_font_matrix where + { pop cairo_selectfont } if } bind def +/Td { matrix translate cairo_font_matrix matrix concatmatrix dup + /cairo_font_matrix exch def dup 4 get exch 5 get cairo_store_point + /cairo_font where { pop cairo_selectfont } if } bind def +/Tm { 2 copy 8 2 roll 6 array astore /cairo_font_matrix exch def + cairo_store_point /cairo_font where { pop cairo_selectfont } if } bind def +/g { setgray } bind def +/rg { setrgbcolor } bind def +/d1 { setcachedevice } bind def +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +%%PageBoundingBox: 0 -1 144 147 +%%EndPageSetup +q 0 -1 144 148 rectclip q +0 146.4 144 -147 re W n +0 g +2.4 w +0 J +0 j +[] 0.0 d +4 M q 1 0 0 -1 0 146.399994 cm +144 1.199 m 104 1.199 l 88 145.199 l 128 145.199 l S Q +q 1 0 0 -1 0 146.399994 cm +98.457 29.199 m 98.457 31.41 96.664 33.199 94.457 33.199 c 92.246 +33.199 90.457 31.41 90.457 29.199 c 90.457 26.992 92.246 25.199 94.457 +25.199 c 96.664 25.199 98.457 26.992 98.457 29.199 c h +98.457 29.199 m S Q +q 1 0 0 -1 0 146.399994 cm +0 145.199 m 40 145.199 l 48 89.199 l 8 89.199 l S Q +q 1 0 0 -1 0 146.399994 cm +8 57.199 m 48 57.199 l 56 1.199 l 16 1.199 l S Q +q 1 0 0 -1 0 146.399994 cm +64.715 13.199 m 64.715 15.41 62.922 17.199 60.715 17.199 c 58.504 +17.199 56.715 15.41 56.715 13.199 c 56.715 10.992 58.504 9.199 60.715 +9.199 c 62.922 9.199 64.715 10.992 64.715 13.199 c h +64.715 13.199 m S Q +q 1 0 0 -1 0 146.399994 cm +56.68 101.199 m 56.68 103.41 54.891 105.199 52.68 105.199 c 50.473 +105.199 48.68 103.41 48.68 101.199 c 48.68 98.992 50.473 97.199 52.68 +97.199 c 54.891 97.199 56.68 98.992 56.68 101.199 c h +56.68 101.199 m S Q +q 1 0 0 -1 0 146.399994 cm +88.68 117.199 m 88.68 119.41 86.891 121.199 84.68 121.199 c 82.473 +121.199 80.68 119.41 80.68 117.199 c 80.68 114.992 82.473 113.199 84.68 +113.199 c 86.891 113.199 88.68 114.992 88.68 117.199 c h +88.68 117.199 m S Q +Q Q +showpage +%%Trailer +count op_count sub {pop} repeat +countdictstack dict_count sub {end} repeat +cairo_eps_state restore +%%EOF diff --git a/doc/fig/Net_SplitSN.eps b/doc/fig/Net_SplitSN.eps new file mode 100644 index 0000000..51a8aeb --- /dev/null +++ b/doc/fig/Net_SplitSN.eps @@ -0,0 +1,107 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%Creator: cairo 1.10.2 (http://cairographics.org) +%%CreationDate: Fri Oct 21 21:17:32 2011 +%%Pages: 1 +%%BoundingBox: 0 -1 144 147 +%%DocumentData: Clean7Bit +%%LanguageLevel: 2 +%%EndComments +%%BeginProlog +/cairo_eps_state save def +/dict_count countdictstack def +/op_count count 1 sub def +userdict begin +/q { gsave } bind def +/Q { grestore } bind def +/cm { 6 array astore concat } bind def +/w { setlinewidth } bind def +/J { setlinecap } bind def +/j { setlinejoin } bind def +/M { setmiterlimit } bind def +/d { setdash } bind def +/m { moveto } bind def +/l { lineto } bind def +/c { curveto } bind def +/h { closepath } bind def +/re { exch dup neg 3 1 roll 5 3 roll moveto 0 rlineto + 0 exch rlineto 0 rlineto closepath } bind def +/S { stroke } bind def +/f { fill } bind def +/f* { eofill } bind def +/n { newpath } bind def +/W { clip } bind def +/W* { eoclip } bind def +/BT { } bind def +/ET { } bind def +/pdfmark where { pop globaldict /?pdfmark /exec load put } + { globaldict begin /?pdfmark /pop load def /pdfmark + /cleartomark load def end } ifelse +/BDC { mark 3 1 roll /BDC pdfmark } bind def +/EMC { mark /EMC pdfmark } bind def +/cairo_store_point { /cairo_point_y exch def /cairo_point_x exch def } def +/Tj { show currentpoint cairo_store_point } bind def +/TJ { + { + dup + type /stringtype eq + { show } { -0.001 mul 0 cairo_font_matrix dtransform rmoveto } ifelse + } forall + currentpoint cairo_store_point +} bind def +/cairo_selectfont { cairo_font_matrix aload pop pop pop 0 0 6 array astore + cairo_font exch selectfont cairo_point_x cairo_point_y moveto } bind def +/Tf { pop /cairo_font exch def /cairo_font_matrix where + { pop cairo_selectfont } if } bind def +/Td { matrix translate cairo_font_matrix matrix concatmatrix dup + /cairo_font_matrix exch def dup 4 get exch 5 get cairo_store_point + /cairo_font where { pop cairo_selectfont } if } bind def +/Tm { 2 copy 8 2 roll 6 array astore /cairo_font_matrix exch def + cairo_store_point /cairo_font where { pop cairo_selectfont } if } bind def +/g { setgray } bind def +/rg { setrgbcolor } bind def +/d1 { setcachedevice } bind def +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +%%PageBoundingBox: 0 -1 144 147 +%%EndPageSetup +q 0 -1 144 148 rectclip q +0 146.4 144 -147 re W n +0 g +2.4 w +0 J +0 j +[] 0.0 d +4 M q 1 0 0 -1 0 146.399994 cm +144 1.199 m 104 1.199 l 96 57.199 l 136 57.199 l S Q +q 1 0 0 -1 0 146.399994 cm +136 89.199 m 96 89.199 l 88 145.199 l 128 145.199 l S Q +q 1 0 0 -1 0 146.399994 cm +99.918 13.199 m 99.918 15.41 98.129 17.199 95.918 17.199 c 93.711 +17.199 91.918 15.41 91.918 13.199 c 91.918 10.992 93.711 9.199 95.918 +9.199 c 98.129 9.199 99.918 10.992 99.918 13.199 c h +99.918 13.199 m S Q +q 1 0 0 -1 0 146.399994 cm +91.863 101.199 m 91.863 103.41 90.074 105.199 87.863 105.199 c 85.656 +105.199 83.863 103.41 83.863 101.199 c 83.863 98.992 85.656 97.199 +87.863 97.199 c 90.074 97.199 91.863 98.992 91.863 101.199 c h +91.863 101.199 m S Q +q 1 0 0 -1 0 146.399994 cm +0 145.199 m 40 145.199 l 56 1.199 l 16 1.199 l S Q +q 1 0 0 -1 0 146.399994 cm +63.273 29.199 m 63.273 31.41 61.484 33.199 59.273 33.199 c 57.066 +33.199 55.273 31.41 55.273 29.199 c 55.273 26.992 57.066 25.199 59.273 +25.199 c 61.484 25.199 63.273 26.992 63.273 29.199 c h +63.273 29.199 m S Q +q 1 0 0 -1 0 146.399994 cm +53.555 117.199 m 53.555 119.41 51.766 121.199 49.555 121.199 c 47.348 +121.199 45.555 119.41 45.555 117.199 c 45.555 114.992 47.348 113.199 +49.555 113.199 c 51.766 113.199 53.555 114.992 53.555 117.199 c h +53.555 117.199 m S Q +Q Q +showpage +%%Trailer +count op_count sub {pop} repeat +countdictstack dict_count sub {end} repeat +cairo_eps_state restore +%%EOF diff --git a/doc/fig/Net_SplitSO.eps b/doc/fig/Net_SplitSO.eps new file mode 100644 index 0000000..38bf943 --- /dev/null +++ b/doc/fig/Net_SplitSO.eps @@ -0,0 +1,95 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%Creator: cairo 1.10.2 (http://cairographics.org) +%%CreationDate: Fri Oct 21 21:16:03 2011 +%%Pages: 1 +%%BoundingBox: 0 -1 144 147 +%%DocumentData: Clean7Bit +%%LanguageLevel: 2 +%%EndComments +%%BeginProlog +/cairo_eps_state save def +/dict_count countdictstack def +/op_count count 1 sub def +userdict begin +/q { gsave } bind def +/Q { grestore } bind def +/cm { 6 array astore concat } bind def +/w { setlinewidth } bind def +/J { setlinecap } bind def +/j { setlinejoin } bind def +/M { setmiterlimit } bind def +/d { setdash } bind def +/m { moveto } bind def +/l { lineto } bind def +/c { curveto } bind def +/h { closepath } bind def +/re { exch dup neg 3 1 roll 5 3 roll moveto 0 rlineto + 0 exch rlineto 0 rlineto closepath } bind def +/S { stroke } bind def +/f { fill } bind def +/f* { eofill } bind def +/n { newpath } bind def +/W { clip } bind def +/W* { eoclip } bind def +/BT { } bind def +/ET { } bind def +/pdfmark where { pop globaldict /?pdfmark /exec load put } + { globaldict begin /?pdfmark /pop load def /pdfmark + /cleartomark load def end } ifelse +/BDC { mark 3 1 roll /BDC pdfmark } bind def +/EMC { mark /EMC pdfmark } bind def +/cairo_store_point { /cairo_point_y exch def /cairo_point_x exch def } def +/Tj { show currentpoint cairo_store_point } bind def +/TJ { + { + dup + type /stringtype eq + { show } { -0.001 mul 0 cairo_font_matrix dtransform rmoveto } ifelse + } forall + currentpoint cairo_store_point +} bind def +/cairo_selectfont { cairo_font_matrix aload pop pop pop 0 0 6 array astore + cairo_font exch selectfont cairo_point_x cairo_point_y moveto } bind def +/Tf { pop /cairo_font exch def /cairo_font_matrix where + { pop cairo_selectfont } if } bind def +/Td { matrix translate cairo_font_matrix matrix concatmatrix dup + /cairo_font_matrix exch def dup 4 get exch 5 get cairo_store_point + /cairo_font where { pop cairo_selectfont } if } bind def +/Tm { 2 copy 8 2 roll 6 array astore /cairo_font_matrix exch def + cairo_store_point /cairo_font where { pop cairo_selectfont } if } bind def +/g { setgray } bind def +/rg { setrgbcolor } bind def +/d1 { setcachedevice } bind def +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +%%PageBoundingBox: 0 -1 144 147 +%%EndPageSetup +q 0 -1 144 148 rectclip q +0 146.4 144 -147 re W n +0 g +2.4 w +0 J +0 j +[] 0.0 d +4 M q 1 0 0 -1 0 146.399994 cm +144 1.199 m 104 1.199 l 88 145.199 l 128 145.199 l S Q +q 1 0 0 -1 0 146.399994 cm +98.457 29.199 m 98.457 31.41 96.664 33.199 94.457 33.199 c 92.246 +33.199 90.457 31.41 90.457 29.199 c 90.457 26.992 92.246 25.199 94.457 +25.199 c 96.664 25.199 98.457 26.992 98.457 29.199 c h +98.457 29.199 m S Q +q 1 0 0 -1 0 146.399994 cm +0 145.199 m 40 145.199 l 56 1.199 l 16 1.199 l S Q +q 1 0 0 -1 0 146.399994 cm +63.273 29.199 m 63.273 31.41 61.484 33.199 59.273 33.199 c 57.066 +33.199 55.273 31.41 55.273 29.199 c 55.273 26.992 57.066 25.199 59.273 +25.199 c 61.484 25.199 63.273 26.992 63.273 29.199 c h +63.273 29.199 m S Q +Q Q +showpage +%%Trailer +count op_count sub {pop} repeat +countdictstack dict_count sub {end} repeat +cairo_eps_state restore +%%EOF diff --git a/src/nMesh/exmpl_2DLShape.mat b/src/nMesh/exmpl_2DLShape.mat index 5a82bf5d89e9e1537dd679fa801d3eac7e96bc7c..35f0ff82ede436925b2beb430e65411416c3762a 100644 GIT binary patch delta 376 zcmdnb^pjHiGq=Vq2a_p?THDj6KgoE%^4UND&{;+ zPDpr=kdlzVe33^$iX~!Ujh{jqTauf?%o*W4&+aEEu*ls=UT*(j!NsqET7Gs64Dkg5 z4ig)C7!4=$GOE^Z@N!e@&~jr-VPL4a!?c$lXr=?)+yJn-mt>#@>p=~kGynVn&Xjtv z(Tgw17hK@s%P?W)t1KxLx*EvGFn1fDGRPc+`wAG6%oLtATv9l|^>nj?p)#|vbC#bL zv+xAndWJ`v4L5Em*tB_LQQ-#TjmDdq7@W2-NrChm!rj4vqCeA(Ev;?O6(2S=g=oel z4V{uY?5sUJ84L_*TNrSQtR4_EMGBCF?Fjg=!Ff>#k5il@%`tma{Ft`J8#hk~<2?-Yxk`fY_ zFUjx-NU=mLtO-;|V@q;Vm^mZ-%mL1n{|PAyf;Jn}`~Eqo{AFf8`=FuOt(bk6<(Dvb zkD3om49d5aCV-5yfg8uckYuLttl^Tv0j{T;84QgDjF}A01=OEE7hjt4Om*54vF59W zjE4No5sU$x%E}?u%nau;Ssg%T=)%p|fMfhaMz!{8*z j{1~K39j>VWS(DO5g^hczocY3|aF#{1osq$N1=AD&EH-e$ literal 0 HcmV?d00001 diff --git a/src/nMesh/quadNorm.m b/src/nMesh/quadNorm.m new file mode 100644 index 0000000..18b0f85 --- /dev/null +++ b/src/nMesh/quadNorm.m @@ -0,0 +1,45 @@ +function n = quadNorm(coordinates, elements,varargin) +% +% norm = quadNorm(coordinates, elements) +% norm = quadNorm(coordinates, elements, 'FLAG') +% +% Diese Funktion Berechnet die Orthogonalen mit Laenge 1 über alle Flächen +% FLAG: +% w -> Laenge entspricht Flaecheninhalt +% +% P.Schaefer + +%% Parameterueberpruefung +w = 1; + +optargin = size(varargin,2); +if(optargin>1) + error('Zu viele Argumente'); +elseif(optargin==1) + if(ismember('w',varargin{1})) + w = 0; + end +end + + %Numbers needed + s_ele = size(elements,1); + + +%% calculate the Norm + n = zeros(size(elements,1),3); + for i = 1:s_ele + % normalized Vector on every triangle + tri = elements(i,:); + a = (coordinates(tri(2),:)-coordinates(tri(1),:)); + b = (coordinates(tri(4),:)-coordinates(tri(1),:)); + N = cross(a',b'); + if(w) + N = N/norm(N); + end + n(i,:) = N; + end + +end + + + diff --git a/src/nMesh/refineQuad.m b/src/nMesh/refineQuad.m index 8bc9d88..4fde40a 100644 --- a/src/nMesh/refineQuad.m +++ b/src/nMesh/refineQuad.m @@ -1,4 +1,4 @@ -function [coo,ele,f2s] = refineQuad(coordinates,elements,type) +function [coo,ele,nei,f2s] = refineQuad(coordinates,elements,neigh,type) % % [coordinates,elements,fa2so] = refineQuad(coordinates,elements,type) % @@ -14,36 +14,48 @@ function [coo,ele,f2s] = refineQuad(coordinates,elements,type) % % P. Schaefer + +%Type wenn nur ein Wert: aufblaehen if([1 1] == size(type)) type = repmat(type, size(elements,1),1); end +%Globale Variabelen aufbauen global G_ref_E; global G_ref_C; global G_ref_N; global G_ref_f2s; global G_ref_t; +%Elementanzahl speichern c_loop = size(elements,1); - +%Globale Variablen zuweisen G_ref_E = elements; G_ref_C = coordinates; +G_ref_N = neigh; G_ref_t = type; G_ref_f2s = repmat([1:c_loop]',1,4); +%Parameter Freigeben (Speicher...) +clear elements coordinates neigh type + +%Jedes Element verfeinern for i = 1:c_loop refine(i); end +%Rueckgabe zuweisen coo = G_ref_C; ele = G_ref_E; +nei = G_ref_N; f2s = G_ref_f2s; -%igitigit +%Doppelte Koordinaten loeschen [coo l pos] = unique(coo,'rows'); ele = pos(ele); + %Globale Variablen freigeben clear G_ref_E G_ref_C G_ref_N G_ref_f2s G_ref_t end @@ -51,7 +63,7 @@ end function refine(ele) % global G_ref_E; % global G_ref_C; -% global G_ref_N; +global G_ref_N; % global G_ref_f2s; global G_ref_t; @@ -59,12 +71,26 @@ if(G_ref_t(ele)==1) return; end -% Ueberpruefe Nachbarn - +% Ueberpruefe Nachbarn auf Nodes +N = G_ref_N(ele,G_ref_N(ele,5:8)==0); +N2 = N(N~=0); +if(~isempty(N2)) + N3=mod(find((G_ref_N(N2',:)==ele)')-1,4)+5; % ACHTUNG noch mal überprüfen + N4=N2(diag(G_ref_N(N2',N3'))~=0); + + % wenn ungueltig verfeinere sie (link auf Soll verfeinert werden?) + if(~isempty(N4)) + for i = 1:length(N4) +% if(G_ref_t(N4(i))<=2) + G_ref_t(N4(i))=2; %WIRD GNADENLOS AUF 2 GESETZT + refine(N4(i)); +% else +% mod(find(G_ref_N(N4(i),:)==ele)-1,2) +% end + end + end +end -% wenn ungueltig verfeinere sie (link auf Soll verfeinert werden?) -% G_ref_M(k) = -% refine(k); % verfeinere dieses element refineE(ele); @@ -102,7 +128,7 @@ global G_ref_t; 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; + G_ref_f2s(ele,1:3)=c_ele+3:-1:c_ele+1; 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; @@ -111,7 +137,7 @@ global G_ref_t; 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; + G_ref_f2s(ele,[1 2])=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; @@ -120,7 +146,7 @@ global G_ref_t; 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; + G_ref_f2s(ele,[2 3])=c_ele+1; end G_ref_t(ele) = 1; @@ -129,10 +155,122 @@ end function updateN(ele) % Nachbarschaften werden neu gesetzt (nach N und f2s) -% global G_ref_E; +global G_ref_E; % global G_ref_C; -% global G_ref_N; -% global G_ref_f2s; +global G_ref_N; +global G_ref_f2s; + + +%Innere Beziehungen setzen +% ... + +this = G_ref_N(ele,:); +split = G_ref_f2s(ele,:); +S = find(mod((this(1:4)~=0).*(this(5:8)==0),2))' %An welchen Kanten habe ich Nachbarn +D = find(this(5:8)~=0)' +MS = mod(find((G_ref_N(this(S),:)==ele)')-1,4)+1 %An welchen Kanten bin ich Nachbar +MD = mod(find((G_ref_N(this([D D+4]),:)==ele)')-1,4)+1 + +G_ref_N(split,1:8) = 0; + +if(split(1)==split(2)) + G_ref_N(split([1 3])',1:4) = [ 0 0 split(3) 0;split(1) 0 0 0]; + % Beziehungen fuer Kanten mit einem Nachbar + for i = 1:length(S) + if(mod(S(i),2)==0) + G_ref_N(this(S(i)),[MS(i) MS(i)+4]) = [split(S(i)) split(mod(S(i),4)+1)]; + G_ref_N([split(S(i)) split(mod(S(i),4)+1)]',S(i))=this(S(i)); + else + G_ref_N(this(S(i)),MS(i)) = split(S(i)); + G_ref_N(split(S(i)),S(i)) = this(S(i)); + end + end + + % Beziehungen fuer Kanten mit zwei Nachbarn + for i = 1:length(D) + if(mod(S(i),2)==0) + if(length(unique([G_ref_E(this(D(i)),:) G_ref_E(split(D(i)),:)]))==7) + G_ref_N(this(D(i)),MD(1,i)) = split(D(i)); + G_ref_N(this(D(i)+4),MD(2,i)) = split(mod(D(i),4)+1); + G_ref_N(split(D(i)),D(i)) = this(D(i)); + G_ref_N(split(mod(D(i),4)+1),D(i)) = this(D(i)+4); + else + G_ref_N(this(D(i)),MD(1,i)) = split(mod(D(i),4)+1); + G_ref_N(this(D(i)+4),MD(2,i)) = split(D(i)); + G_ref_N(split(D(i)),D(i)) = this(D(i)+4); + G_ref_N(split(mod(D(i),4)+1),D(i)) = this(D(i)); + end + else + G_ref_N(this(D(i)),MD(1,i)) = split(D(i)); + G_ref_N(this(D(i)+4),MD(2,i)) = split(D(i)); + G_ref_N(split(D(i)),[D(i) D(i)+4]) = [this(D(i)) this(D(i)+4)]; + end + end + +elseif(split(1)==split(4)) + G_ref_N(split([1 2])',1:4) = [ 0 split(2) 0 0;0 0 0 split(1)]; + % Beziehungen fuer Kanten mit einem Nachbar + for i = 1:length(S) + if(mod(S(i),2)==1) + G_ref_N(this(S(i)),[MS(i) MS(i)+4]) = [split(S(i)) split(mod(S(i),4)+1)]; + G_ref_N([split(S(i)) split(mod(S(i),4)+1)]',S(i))=this(S(i)); + else + G_ref_N(this(S(i)),MS(i)) = split(S(i)); + G_ref_N(split(S(i)),S(i)) = this(S(i)); + end + end + + % Beziehungen fuer Kanten mit zwei Nachbarn + for i = 1:length(D) + if(mod(S(i),2)==1) + if(length(unique([G_ref_E(this(D(i)),:) G_ref_E(split(D(i)),:)]))==7) + G_ref_N(this(D(i)),MD(1,i)) = split(D(i)); + G_ref_N(this(D(i)+4),MD(2,i)) = split(mod(D(i),4)+1); + G_ref_N(split(D(i)),D(i)) = this(D(i)); + G_ref_N(split(mod(D(i),4)+1),D(i)) = this(D(i)+4); + else + G_ref_N(this(D(i)),MD(1,i)) = split(mod(D(i),4)+1); + G_ref_N(this(D(i)+4),MD(2,i)) = split(D(i)); + G_ref_N(split(D(i)),D(i)) = this(D(i)+4); + G_ref_N(split(mod(D(i),4)+1),D(i)) = this(D(i)); + end + else + G_ref_N(this(D(i)),MD(1,i)) = split(D(i)); + G_ref_N(this(D(i)+4),MD(2,i)) = split(D(i)); + G_ref_N(split(D(i)),[D(i) D(i)+4]) = [this(D(i)) this(D(i)+4)]; + end + end + +else + G_ref_N(split',1:4) = [0 split(2) split(4) 0; 0 0 split(3) split(1);... + split(2) 0 0 split(4); split(1) split(3) 0 0]; + + % Beziehungen fuer Kanten mit einem Nachbar + for i = 1:length(S) + G_ref_N(this(S(i)),[MS(i) MS(i)+4]) = [split(S(i)) split(mod(S(i),4)+1)]; + G_ref_N([split(S(i)) split(mod(S(i),4)+1)]',S(i))=this(S(i)); + end + + % Beziehungen fuer Kanten mit zwei Nachbarn + for i = 1:length(D) + if(length(unique([G_ref_E(this(D(i)),:) G_ref_E(split(D(i)),:)]))==7) + G_ref_N(this(D(i)),MD(1,i)) = split(D(i)); + G_ref_N(this(D(i)+4),MD(2,i)) = split(mod(D(i),4)+1); + G_ref_N(split(D(i)),D(i)) = this(D(i)); + G_ref_N(split(mod(D(i),4)+1),D(i)) = this(D(i)+4); + else + G_ref_N(this(D(i)),MD(1,i)) = split(mod(D(i),4)+1); + G_ref_N(this(D(i)+4),MD(2,i)) = split(D(i)); + G_ref_N(split(D(i)),D(i)) = this(D(i)+4); + G_ref_N(split(mod(D(i),4)+1),D(i)) = this(D(i)); + end + end + +end + + + + end diff --git a/src/refineQuad.m b/src/refineQuad.m index 666acf3..f5f68cb 100644 --- a/src/refineQuad.m +++ b/src/refineQuad.m @@ -60,7 +60,7 @@ for i = 1:c_loop elements(i,3) = c_coo+2; elements(c_ele+1,:) = [c_coo+1,el(2),el(3),c_coo+2]; - fa2so(i,[2 4])=c_ele+1; + fa2so(i,[2 3])=c_ele+1; end end -- 2.47.3