Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

src/expde/formulas/subdivI.h

Go to the documentation of this file.
00001 //    expde: expression templates for partial differential equations.
00002 //    Copyright (C) 2001  Christoph Pflaum
00003 //    This program is free software; you can redistribute it and/or modify
00004 //    it under the terms of the GNU General Public License as published by
00005 //    the Free Software Foundation; either version 2 of the License, or
00006 //    (at your option) any later version.
00007 //
00008 //    This program is distributed in the hope that it will be useful,
00009 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 //    GNU General Public License for more details.
00012 //
00013 //                 SEE  Notice1.doc made by 
00014 //                 LAWRENCE LIVERMORE NATIONAL LABORATORY
00015 //
00016 
00017 // ------------------------------------------------------------
00018 //
00019 // subdivI.h
00020 //
00021 // ------------------------------------------------------------
00022 
00023 #ifndef SUBDIVI_H_
00024 #define SUBDIVI_H_
00025 
00026 void Act_on_subdivision_partI(Bo_description* Description, 
00027                               Calculator_FE* Act, bool* corners) {
00028   int i, k;
00029 
00030   Edge_Corner_point poi_0,   poi_1,   poi_2,   poi_3,   poi_4;
00031   Edge_Corner_point poi_5,   poi_6,   poi_7,   poi_8;
00032   Edge_Corner_point poi_A,   poi_B,   poi_C,   poi_D;
00033   Edge_Corner_point poi_A2,  poi_B2;
00034   Edge_Corner_point poi_boA, poi_boB;
00035   Edge_Corner_point poi_boA2, poi_boB2;
00036   Edge_Corner_point poi_oppA,   poi_oppB;
00037 
00038   dir_sons    oppA, oppB, corner;
00039   dir_3D    dirA, dirB, dirC;
00040   bool stop;
00041   int ori;
00042 
00043   f_type x_face_type;
00044   f_type y_face_type;
00045 
00046   f_type A_face_type, B_face_type;
00047 
00048   // leere Initialisierung
00049   ori = 0;
00050 
00051   stop = false;
00052   // stop = true;
00053   //  Boundary cell: 3.2.
00054   // ---------------------
00055   //  Ganz einfache Tetraeder in der Ecke
00056   poi_4.edge_point = corner_poi_typ;
00057   poi_1.edge_point = edge_poi_typ;
00058   poi_2.edge_point = edge_poi_typ;
00059   poi_3.edge_point = edge_poi_typ;
00060 
00061   for(i=0;i<8 && !stop;++i) {
00062     poi_1.corner = poi_2.corner = poi_3.corner = poi_4.corner = (dir_sons)i;
00063     poi_1.d = opposite3D(xCoord((dir_sons)i));
00064     poi_2.d = opposite3D(yCoord((dir_sons)i));
00065     poi_3.d = opposite3D(zCoord((dir_sons)i));
00066 
00067     if(Description->edge_point(poi_1) &&
00068        Description->edge_point(poi_2) &&
00069        Description->edge_point(poi_3))    {
00070       corners[i] = false;
00071       // stop=true;
00072       if((((i&1) + ((i>>1)&1) + ((i>>2)&1))&1)==0) { // Orientierung 
00073         //  1. Version 
00074         Act->Tetraeder(poi_1,poi_4,poi_2,poi_3);
00075       }
00076       else {
00077         // 2. Version
00078         Act->Tetraeder(poi_1,poi_4,poi_3,poi_2);
00079       }
00080     }
00081   }
00082 
00083   //  stop = false;
00084   //  stop = true;
00085   //  Boundary cell : 3.1.
00086   // ----------------------
00087   // III. Ein Prisma
00088   for(i=0;i<12 && !stop;++i) {
00089     // Ganze Kante im Gebiet
00090     if(Description->Edge((Edges_cell)i)) {
00091       // Zwei Ecken der Kante
00092       poi_A.edge_point = poi_B.edge_point = corner_poi_typ;
00093 
00094       poi_A.corner = Transform((Edges_cell)i,Ld);
00095       poi_B.corner = Transform((Edges_cell)i,Rd);
00096 
00097       // Richtungen
00098       dirC = Trans_dir((Edges_cell)i,Rd);
00099       dirA = OrthoA((Edges_cell)i);
00100       dirB = OrthoB((Edges_cell)i);
00101 
00102       // Vier Kantepunkte
00103       poi_boA.edge_point  = poi_boB.edge_point  = edge_poi_typ;
00104       poi_boA2.edge_point = poi_boB2.edge_point = edge_poi_typ;
00105 
00106       // dL: A
00107       poi_boA.corner = poi_A.corner;
00108       poi_boA.d = opposite3D(OrthoB((Edges_cell)i));
00109       poi_boA2.corner = poi_A.corner;
00110       poi_boA2.d = opposite3D(OrthoA((Edges_cell)i));
00111       // dR: B
00112       poi_boB.corner = poi_B.corner;
00113       poi_boB.d = opposite3D(OrthoB((Edges_cell)i));
00114       poi_boB2.corner = poi_B.corner;
00115       poi_boB2.d = opposite3D(OrthoA((Edges_cell)i));
00116 
00117       if(Description->edge_point(poi_boA) &&
00118          Description->edge_point(poi_boA2) &&
00119          Description->edge_point(poi_boB) &&
00120          Description->edge_point(poi_boB2)) {
00121         corners[poi_A.corner] = false;
00122         corners[poi_B.corner] = false;
00123 
00124         //      stop = true;
00125         // Orientierung:
00126         if(dirC==Wdir) ori=0;
00127         if(dirC==Edir) ori=0;
00128         if(dirC==Ndir) ori=1;
00129         if(dirC==Sdir) ori=1;
00130         if(dirC==Tdir) ori=0;
00131         if(dirC==Ddir) ori=0;
00132         
00133         
00134         if(((OneDpart(dirA)+OneDpart(dirB))&1)==ori) {
00135           poi_1 = poi_boA;        poi_2 = poi_boA2;
00136           poi_0 = poi_A;          poi_4 = poi_boB;
00137           poi_5 = poi_boB2;       poi_3 = poi_B;
00138         }
00139         else {
00140           poi_1 = poi_boA2;       poi_2 = poi_boA;
00141           poi_0 = poi_A;          poi_4 = poi_boB2;
00142           poi_5 = poi_boB;        poi_3 = poi_B;
00143 
00144         }
00145         dirC = direction_from_to(poi_0.corner,poi_3.corner);
00146         dirA = poi_1.d;
00147         dirB = poi_2.d;
00148         x_face_type = Calc_f_type(dirA,dirC);
00149         y_face_type = Calc_f_type(dirB,dirC);
00150         //      Act_on_Prism(Description,Act,x_face_type,y_face_type,
00151         //                   poi_0,poi_1,poi_2,poi_3,poi_4,poi_5);
00152         Act_on_Prism_best(Description,Act,x_face_type,y_face_type,
00153                           poi_0,poi_1,poi_2,poi_3,poi_4,poi_5);
00154       }
00155     }
00156   }
00157 
00158 
00159   //  stop = false;
00160   //  stop = true;
00161   //  Boundary cell : 2.1.
00162   // ----------------------
00163   // Zweibein
00164   // Bemerkung: Test ob Kanten im Gebiet nicht notwendig wegen corners
00165   for(i=0;i<12 && !stop;++i) {
00166     for(k=0;k<2;++k) {
00167       // Punkt am Eck des Zweibeins
00168       corner = Transform((Edges_cell)i,(dir1D)k);
00169 
00170       poi_D.edge_point = corner_poi_typ;
00171       poi_D.corner = corner;
00172 
00173       // Richtungen des Zweibeins:
00174       dirA = opposite3D(OrthoA((Edges_cell)i));
00175       dirB = opposite3D(OrthoB((Edges_cell)i));
00176       dirC = Trans_dir((Edges_cell)i,(dir1D)k);
00177 
00178       // Zwei Ecken des Zweibeins
00179       poi_oppA.edge_point = poi_oppB.edge_point = corner_poi_typ;
00180 
00181       oppA = Next_corner(corner,dirA);
00182       oppB = Next_corner(corner,dirB);
00183 
00184       poi_oppA.corner = oppA;
00185       poi_oppB.corner = oppB;
00186 
00187       // Kantenpunkte des Zweibeins
00188       poi_A.edge_point  = poi_B.edge_point  = edge_poi_typ;
00189       poi_A2.edge_point = poi_B2.edge_point = edge_poi_typ;
00190       poi_C.edge_point  = edge_poi_typ;
00191 
00192       poi_A.corner  = oppA; poi_A.d  = dirB;
00193       poi_A2.corner = oppA; poi_A2.d = opposite3D(dirC);
00194       poi_B.corner  = oppB; poi_B.d  = dirA;
00195       poi_B2.corner = oppB; poi_B2.d = opposite3D(dirC);
00196       poi_C.corner  = corner; poi_C.d  = opposite3D(dirC);
00197 
00198       if(Description->edge_point(poi_A) && Description->edge_point(poi_A2) &&
00199          Description->edge_point(poi_B) && Description->edge_point(poi_B2) &&
00200          Description->edge_point(poi_C) &&
00201          corners[corner] && corners[oppA] && corners[oppB] ) {
00202         corners[corner] = corners[oppA] = corners[oppB] = false;
00203         //      stop = true;
00204         ori=0;
00205         // Orientierung:
00206         ori = 0;
00207         if(dirC==Wdir) ori=0;
00208         if(dirC==Edir) ori=1;
00209         if(dirC==Ndir) ori=0;
00210         if(dirC==Sdir) ori=1;
00211         if(dirC==Tdir) ori=1;
00212         if(dirC==Ddir) ori=0;
00213         
00214         if(((OneDpart(dirA)+OneDpart(dirB))&1)==ori) {
00215           poi_5 = poi_D;
00216           poi_2 = poi_C;
00217           
00218           poi_4 = poi_oppA;
00219           poi_6 = poi_oppB;
00220 
00221           poi_8 = poi_A;          poi_1 = poi_A2;
00222           poi_7 = poi_B;          poi_3 = poi_B2;       
00223         }
00224         else {
00225           poi_5 = poi_D;
00226           poi_2 = poi_C;
00227 
00228           poi_6 = poi_oppA;
00229           poi_4 = poi_oppB;
00230 
00231           poi_7 = poi_A;          poi_3 = poi_A2;
00232           poi_8 = poi_B;          poi_1 = poi_B2;
00233         }
00234   
00235         dirA = direction_from_to(poi_4.corner,poi_5.corner);
00236         dirB = poi_1.d;
00237         A_face_type = Calc_f_type(dirA,dirB);
00238 
00239         dirA = direction_from_to(poi_6.corner,poi_5.corner);
00240         dirB = poi_3.d;
00241         B_face_type = Calc_f_type(dirA,dirB);
00242 
00243         // Case 1.
00244         if(parallel_version)
00245           Tell_about_round_of_problem(Description->h(poi_1.corner, poi_1.d),
00246                                       Description->h(poi_8.corner, poi_8.d));
00247         if(Description->h(poi_1.corner, poi_1.d) <
00248            Description->h(poi_8.corner, poi_8.d) ||
00249            A_face_type == spitz) {
00250           // Anstelle: Act->Pyramid(poi_8,poi_5,poi_2,poi_1,poi_4); 
00251           if(A_face_type==an) {
00252             Act->Tetraeder(poi_8,poi_5,poi_1,poi_4);
00253             Act->Tetraeder(poi_8,poi_5,poi_2,poi_1);
00254           }
00255           else {
00256             Act->Tetraeder(poi_8,poi_4,poi_5,poi_2);
00257             Act->Tetraeder(poi_8,poi_4,poi_2,poi_1);
00258           }
00259           // Case 1.1.
00260           if(parallel_version)
00261             Tell_about_round_of_problem(Description->h(poi_7.corner, poi_7.d),
00262                                         Description->h(poi_3.corner, poi_3.d));
00263           if(Description->h(poi_7.corner, poi_7.d) <
00264              Description->h(poi_3.corner, poi_3.d) &&
00265              B_face_type == an) {
00266             Act->Tetraeder(poi_7,poi_8,poi_5,poi_3);
00267             Act->Tetraeder(poi_6,poi_7,poi_5,poi_3);
00268             Act->Tetraeder(poi_5,poi_3,poi_8,poi_2);
00269           }
00270           else {
00271             // Case 1.2.
00272             Act->Tetraeder(poi_5,poi_7,poi_8,poi_2);
00273             // Anstelle: Act->Pyramid(poi_7,poi_6,poi_3,poi_2,poi_5);
00274             if(B_face_type==an) {
00275               Act->Tetraeder(poi_7,poi_6,poi_3,poi_5);
00276               Act->Tetraeder(poi_7,poi_5,poi_3,poi_2);
00277             }
00278             else {
00279               Act->Tetraeder(poi_7,poi_6,poi_3,poi_2);
00280               Act->Tetraeder(poi_7,poi_6,poi_2,poi_5);
00281             }
00282           }
00283         }
00284         else {
00285           // Case 2.
00286           // Case 2.1.
00287           if(parallel_version)
00288             Tell_about_round_of_problem(Description->h(poi_3.corner, poi_3.d),
00289                                         Description->h(poi_7.corner, poi_7.d));
00290           if(Description->h(poi_3.corner, poi_3.d) <
00291              Description->h(poi_7.corner, poi_7.d) ||
00292              B_face_type == spitz) {
00293             Act->Tetraeder(poi_5,poi_1,poi_2,poi_7);
00294             Act->Tetraeder(poi_5,poi_7,poi_8,poi_1);
00295             Act->Tetraeder(poi_5,poi_4,poi_1,poi_8);
00296 
00297             // Anstelle: Act->Pyramid(poi_7,poi_5,poi_2,poi_3,poi_6);
00298             if(B_face_type==an) {
00299               Act->Tetraeder(poi_7,poi_6,poi_3,poi_5);
00300               Act->Tetraeder(poi_7,poi_5,poi_3,poi_2);
00301             }
00302             else {
00303               Act->Tetraeder(poi_7,poi_6,poi_3,poi_2);
00304               Act->Tetraeder(poi_7,poi_6,poi_2,poi_5);
00305             }
00306           }
00307           else {
00308             // Case 2.2.
00309             Act->Tetraeder(poi_5,poi_1,poi_2,poi_3);
00310             Act->Tetraeder(poi_5,poi_6,poi_7,poi_3);
00311             Act->Tetraeder(poi_5,poi_7,poi_8,poi_3);
00312             Act->Tetraeder(poi_5,poi_8,poi_1,poi_3);
00313             Act->Tetraeder(poi_5,poi_4,poi_1,poi_8);
00314           }
00315         }
00316       }
00317     }
00318   }
00319 }
00320 
00321 
00322 
00323 #endif
00324    
00325 
00326 
00327 
00328 
00329 
00330 

Generated on Fri Nov 2 01:25:59 2007 for IPPL by doxygen 1.3.5