$extrastylesheet
cell_tet10.C
Go to the documentation of this file.
00001 // The libMesh Finite Element Library.
00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
00003 
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Lesser General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2.1 of the License, or (at your option) any later version.
00008 
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Lesser General Public License for more details.
00013 
00014 // You should have received a copy of the GNU Lesser General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 
00018 
00019 // C++ includes
00020 
00021 // Local includes
00022 #include "libmesh/side.h"
00023 #include "libmesh/cell_tet10.h"
00024 #include "libmesh/edge_edge3.h"
00025 #include "libmesh/face_tri6.h"
00026 
00027 namespace libMesh
00028 {
00029 
00030 
00031 
00032 // ------------------------------------------------------------
00033 // Tet10 class static member initializations
00034 const unsigned int Tet10::side_nodes_map[4][6] =
00035   {
00036     {0, 2, 1, 6, 5, 4}, // Side 0
00037     {0, 1, 3, 4, 8, 7}, // Side 1
00038     {1, 2, 3, 5, 9, 8}, // Side 2
00039     {2, 0, 3, 6, 7, 9}  // Side 3
00040   };
00041 
00042 const unsigned int Tet10::edge_nodes_map[6][3] =
00043   {
00044     {0, 1, 4}, // Side 0
00045     {1, 2, 5}, // Side 1
00046     {0, 2, 6}, // Side 2
00047     {0, 3, 7}, // Side 3
00048     {1, 3, 8}, // Side 4
00049     {2, 3, 9}  // Side 5
00050   };
00051 
00052 
00053 
00054 // ------------------------------------------------------------
00055 // Tet10 class member functions
00056 
00057 bool Tet10::is_vertex(const unsigned int i) const
00058 {
00059   if (i < 4)
00060     return true;
00061   return false;
00062 }
00063 
00064 bool Tet10::is_edge(const unsigned int i) const
00065 {
00066   if (i < 4)
00067     return false;
00068   return true;
00069 }
00070 
00071 bool Tet10::is_face(const unsigned int) const
00072 {
00073   return false;
00074 }
00075 
00076 bool Tet10::is_node_on_side(const unsigned int n,
00077                             const unsigned int s) const
00078 {
00079   libmesh_assert_less (s, n_sides());
00080   for (unsigned int i = 0; i != 6; ++i)
00081     if (side_nodes_map[s][i] == n)
00082       return true;
00083   return false;
00084 }
00085 
00086 bool Tet10::is_node_on_edge(const unsigned int n,
00087                             const unsigned int e) const
00088 {
00089   libmesh_assert_less (e, n_edges());
00090   for (unsigned int i = 0; i != 3; ++i)
00091     if (edge_nodes_map[e][i] == n)
00092       return true;
00093   return false;
00094 }
00095 
00096 
00097 #ifdef LIBMESH_ENABLE_AMR
00098 
00099 // This function only works if LIBMESH_ENABLE_AMR...
00100 bool Tet10::is_child_on_side(const unsigned int c,
00101                              const unsigned int s) const
00102 {
00103   // Table of local IDs for the midege nodes on the side opposite a given node.
00104   // See the ASCII art in the header file for this class to confirm this.
00105   const unsigned int midedge_nodes_opposite[4][3] =
00106     {
00107       {5,8,9}, // midedge nodes opposite node 0
00108       {6,7,9}, // midedge nodes opposite node 1
00109       {4,7,8}, // midedge nodes opposite node 2
00110       {4,5,6}  // midedge nodes opposite node 3
00111     };
00112 
00113   // Call the base class helper function
00114   return Tet::is_child_on_side_helper(c, s, midedge_nodes_opposite);
00115 }
00116 
00117 #else
00118 
00119 bool Tet10::is_child_on_side(const unsigned int /*c*/,
00120                              const unsigned int /*s*/) const
00121 {
00122   libmesh_not_implemented();
00123   return false;
00124 }
00125 
00126 #endif //LIBMESH_ENABLE_AMR
00127 
00128 
00129 
00130 bool Tet10::has_affine_map() const
00131 {
00132   // Make sure edges are straight
00133   if (!this->point(4).relative_fuzzy_equals
00134       ((this->point(0) + this->point(1))/2))
00135     return false;
00136   if (!this->point(5).relative_fuzzy_equals
00137       ((this->point(1) + this->point(2))/2))
00138     return false;
00139   if (!this->point(6).relative_fuzzy_equals
00140       ((this->point(2) + this->point(0))/2))
00141     return false;
00142   if (!this->point(7).relative_fuzzy_equals
00143       ((this->point(3) + this->point(0))/2))
00144     return false;
00145   if (!this->point(8).relative_fuzzy_equals
00146       ((this->point(3) + this->point(1))/2))
00147     return false;
00148   if (!this->point(9).relative_fuzzy_equals
00149       ((this->point(3) + this->point(2))/2))
00150     return false;
00151   return true;
00152 }
00153 
00154 
00155 
00156 UniquePtr<Elem> Tet10::build_side (const unsigned int i,
00157                                    bool proxy) const
00158 {
00159   libmesh_assert_less (i, this->n_sides());
00160 
00161   if (proxy)
00162     return UniquePtr<Elem>(new Side<Tri6,Tet10>(this,i));
00163 
00164   else
00165     {
00166       Elem* face = new Tri6;
00167       face->subdomain_id() = this->subdomain_id();
00168 
00169       switch (i)
00170         {
00171         case 0:
00172           {
00173             face->set_node(0) = this->get_node(0);
00174             face->set_node(1) = this->get_node(2);
00175             face->set_node(2) = this->get_node(1);
00176             face->set_node(3) = this->get_node(6);
00177             face->set_node(4) = this->get_node(5);
00178             face->set_node(5) = this->get_node(4);
00179 
00180             break;
00181           }
00182         case 1:
00183           {
00184             face->set_node(0) = this->get_node(0);
00185             face->set_node(1) = this->get_node(1);
00186             face->set_node(2) = this->get_node(3);
00187             face->set_node(3) = this->get_node(4);
00188             face->set_node(4) = this->get_node(8);
00189             face->set_node(5) = this->get_node(7);
00190 
00191             break;
00192           }
00193         case 2:
00194           {
00195             face->set_node(0) = this->get_node(1);
00196             face->set_node(1) = this->get_node(2);
00197             face->set_node(2) = this->get_node(3);
00198             face->set_node(3) = this->get_node(5);
00199             face->set_node(4) = this->get_node(9);
00200             face->set_node(5) = this->get_node(8);
00201 
00202             break;
00203           }
00204         case 3:
00205           {
00206             face->set_node(0) = this->get_node(2);
00207             face->set_node(1) = this->get_node(0);
00208             face->set_node(2) = this->get_node(3);
00209             face->set_node(3) = this->get_node(6);
00210             face->set_node(4) = this->get_node(7);
00211             face->set_node(5) = this->get_node(9);
00212 
00213             break;
00214           }
00215         default:
00216           libmesh_error_msg("Invalid side i = " << i);
00217         }
00218 
00219       return UniquePtr<Elem>(face);
00220     }
00221 
00222   libmesh_error_msg("We'll never get here!");
00223   return UniquePtr<Elem>();
00224 }
00225 
00226 
00227 
00228 UniquePtr<Elem> Tet10::build_edge (const unsigned int i) const
00229 {
00230   libmesh_assert_less (i, this->n_edges());
00231 
00232   return UniquePtr<Elem>(new SideEdge<Edge3,Tet10>(this,i));
00233 }
00234 
00235 
00236 
00237 void Tet10::connectivity(const unsigned int sc,
00238                          const IOPackage iop,
00239                          std::vector<dof_id_type>& conn) const
00240 {
00241   libmesh_assert(_nodes);
00242   libmesh_assert_less (sc, this->n_sub_elem());
00243   libmesh_assert_not_equal_to (iop, INVALID_IO_PACKAGE);
00244 
00245   switch (iop)
00246     {
00247     case TECPLOT:
00248       {
00249         conn.resize(8);
00250         switch (sc)
00251           {
00252 
00253 
00254             // Linear sub-tet 0
00255           case 0:
00256 
00257             conn[0] = this->node(0)+1;
00258             conn[1] = this->node(4)+1;
00259             conn[2] = this->node(6)+1;
00260             conn[3] = this->node(6)+1;
00261             conn[4] = this->node(7)+1;
00262             conn[5] = this->node(7)+1;
00263             conn[6] = this->node(7)+1;
00264             conn[7] = this->node(7)+1;
00265 
00266             return;
00267 
00268             // Linear sub-tet 1
00269           case 1:
00270 
00271             conn[0] = this->node(4)+1;
00272             conn[1] = this->node(1)+1;
00273             conn[2] = this->node(5)+1;
00274             conn[3] = this->node(5)+1;
00275             conn[4] = this->node(8)+1;
00276             conn[5] = this->node(8)+1;
00277             conn[6] = this->node(8)+1;
00278             conn[7] = this->node(8)+1;
00279 
00280             return;
00281 
00282             // Linear sub-tet 2
00283           case 2:
00284 
00285             conn[0] = this->node(5)+1;
00286             conn[1] = this->node(2)+1;
00287             conn[2] = this->node(6)+1;
00288             conn[3] = this->node(6)+1;
00289             conn[4] = this->node(9)+1;
00290             conn[5] = this->node(9)+1;
00291             conn[6] = this->node(9)+1;
00292             conn[7] = this->node(9)+1;
00293 
00294             return;
00295 
00296             // Linear sub-tet 3
00297           case 3:
00298 
00299             conn[0] = this->node(7)+1;
00300             conn[1] = this->node(8)+1;
00301             conn[2] = this->node(9)+1;
00302             conn[3] = this->node(9)+1;
00303             conn[4] = this->node(3)+1;
00304             conn[5] = this->node(3)+1;
00305             conn[6] = this->node(3)+1;
00306             conn[7] = this->node(3)+1;
00307 
00308             return;
00309 
00310             // Linear sub-tet 4
00311           case 4:
00312 
00313             conn[0] = this->node(4)+1;
00314             conn[1] = this->node(8)+1;
00315             conn[2] = this->node(6)+1;
00316             conn[3] = this->node(6)+1;
00317             conn[4] = this->node(7)+1;
00318             conn[5] = this->node(7)+1;
00319             conn[6] = this->node(7)+1;
00320             conn[7] = this->node(7)+1;
00321 
00322             return;
00323 
00324             // Linear sub-tet 5
00325           case 5:
00326 
00327             conn[0] = this->node(4)+1;
00328             conn[1] = this->node(5)+1;
00329             conn[2] = this->node(6)+1;
00330             conn[3] = this->node(6)+1;
00331             conn[4] = this->node(8)+1;
00332             conn[5] = this->node(8)+1;
00333             conn[6] = this->node(8)+1;
00334             conn[7] = this->node(8)+1;
00335 
00336             return;
00337 
00338             // Linear sub-tet 6
00339           case 6:
00340 
00341             conn[0] = this->node(5)+1;
00342             conn[1] = this->node(9)+1;
00343             conn[2] = this->node(6)+1;
00344             conn[3] = this->node(6)+1;
00345             conn[4] = this->node(8)+1;
00346             conn[5] = this->node(8)+1;
00347             conn[6] = this->node(8)+1;
00348             conn[7] = this->node(8)+1;
00349 
00350             return;
00351 
00352             // Linear sub-tet 7
00353           case 7:
00354 
00355             conn[0] = this->node(7)+1;
00356             conn[1] = this->node(6)+1;
00357             conn[2] = this->node(9)+1;
00358             conn[3] = this->node(9)+1;
00359             conn[4] = this->node(8)+1;
00360             conn[5] = this->node(8)+1;
00361             conn[6] = this->node(8)+1;
00362             conn[7] = this->node(8)+1;
00363 
00364             return;
00365 
00366 
00367           default:
00368             libmesh_error_msg("Invalid sc = " << sc);
00369           }
00370       }
00371 
00372     case VTK:
00373       {
00374         conn.resize(10);
00375         conn[0] = this->node(0);
00376         conn[1] = this->node(1);
00377         conn[2] = this->node(2);
00378         conn[3] = this->node(3);
00379         conn[4] = this->node(4);
00380         conn[5] = this->node(5);
00381         conn[6] = this->node(6);
00382         conn[7] = this->node(7);
00383         conn[8] = this->node(8);
00384         conn[9] = this->node(9);
00385         return;
00386         /*
00387           conn.resize(4);
00388           switch (sc)
00389           {
00390           // Linear sub-tet 0
00391           case 0:
00392 
00393           conn[0] = this->node(0);
00394           conn[1] = this->node(4);
00395           conn[2] = this->node(6);
00396           conn[3] = this->node(7);
00397 
00398           return;
00399 
00400           // Linear sub-tet 1
00401           case 1:
00402 
00403           conn[0] = this->node(4);
00404           conn[1] = this->node(1);
00405           conn[2] = this->node(5);
00406           conn[3] = this->node(8);
00407 
00408           return;
00409 
00410           // Linear sub-tet 2
00411           case 2:
00412 
00413           conn[0] = this->node(5);
00414           conn[1] = this->node(2);
00415           conn[2] = this->node(6);
00416           conn[3] = this->node(9);
00417 
00418           return;
00419 
00420           // Linear sub-tet 3
00421           case 3:
00422 
00423           conn[0] = this->node(7);
00424           conn[1] = this->node(8);
00425           conn[2] = this->node(9);
00426           conn[3] = this->node(3);
00427 
00428           return;
00429 
00430           // Linear sub-tet 4
00431           case 4:
00432 
00433           conn[0] = this->node(4);
00434           conn[1] = this->node(8);
00435           conn[2] = this->node(6);
00436           conn[3] = this->node(7);
00437 
00438           return;
00439 
00440           // Linear sub-tet 5
00441           case 5:
00442 
00443           conn[0] = this->node(4);
00444           conn[1] = this->node(5);
00445           conn[2] = this->node(6);
00446           conn[3] = this->node(8);
00447 
00448           return;
00449 
00450           // Linear sub-tet 6
00451           case 6:
00452 
00453           conn[0] = this->node(5);
00454           conn[1] = this->node(9);
00455           conn[2] = this->node(6);
00456           conn[3] = this->node(8);
00457 
00458           return;
00459 
00460           // Linear sub-tet 7
00461           case 7:
00462 
00463           conn[0] = this->node(7);
00464           conn[1] = this->node(6);
00465           conn[2] = this->node(9);
00466           conn[3] = this->node(8);
00467 
00468           return;
00469 
00470 
00471           default:
00472 
00473           libmesh_error_msg("Invalid sc = " << sc);
00474           }
00475         */
00476       }
00477 
00478     default:
00479       libmesh_error_msg("Unsupported IO package " << iop);
00480     }
00481 }
00482 
00483 
00484 
00485 const unsigned short int Tet10::_second_order_vertex_child_number[10] =
00486   {
00487     99,99,99,99, // Vertices
00488     0,1,0,0,1,2  // Edges
00489   };
00490 
00491 
00492 
00493 const unsigned short int Tet10::_second_order_vertex_child_index[10] =
00494   {
00495     99,99,99,99, // Vertices
00496     1,2,2,3,3,3  // Edges
00497   };
00498 
00499 
00500 
00501 std::pair<unsigned short int, unsigned short int>
00502 Tet10::second_order_child_vertex (const unsigned int n) const
00503 {
00504   libmesh_assert_greater_equal (n, this->n_vertices());
00505   libmesh_assert_less (n, this->n_nodes());
00506   return std::pair<unsigned short int, unsigned short int>
00507     (_second_order_vertex_child_number[n],
00508      _second_order_vertex_child_index[n]);
00509 }
00510 
00511 
00512 
00513 unsigned short int Tet10::second_order_adjacent_vertex (const unsigned int n,
00514                                                         const unsigned int v) const
00515 {
00516   libmesh_assert_greater_equal (n, this->n_vertices());
00517   libmesh_assert_less (n, this->n_nodes());
00518   libmesh_assert_less (v, 2);
00519   return _second_order_adjacent_vertices[n-this->n_vertices()][v];
00520 }
00521 
00522 
00523 
00524 const unsigned short int Tet10::_second_order_adjacent_vertices[6][2] =
00525   {
00526     {0, 1}, // vertices adjacent to node 4
00527     {1, 2}, // vertices adjacent to node 5
00528     {0, 2}, // vertices adjacent to node 6
00529     {0, 3}, // vertices adjacent to node 7
00530     {1, 3}, // vertices adjacent to node 8
00531     {2, 3}  // vertices adjacent to node 9
00532   };
00533 
00534 
00535 
00536 
00537 
00538 #ifdef LIBMESH_ENABLE_AMR
00539 
00540 const float Tet10::_embedding_matrix[8][10][10] =
00541   {
00542     // embedding matrix for child 0
00543     {
00544       //    0      1      2      3      4      5      6      7      8      9
00545       {    1.,    0.,    0.,    0.,    0.,    0.,    0.,    0.,    0.,    0.}, // 0
00546       {    0.,    0.,    0.,    0.,    1.,    0.,    0.,    0.,    0.,    0.}, // 1
00547       {    0.,    0.,    0.,    0.,    0.,    0.,    1.,    0.,    0.,    0.}, // 2
00548       {    0.,    0.,    0.,    0.,    0.,    0.,    0.,    1.,    0.,    0.}, // 3
00549       { 0.375,-0.125,    0.,    0.,  0.75,    0.,    0.,    0.,    0.,    0.}, // 4
00550       {    0.,-0.125,-0.125,    0.,   0.5,  0.25,   0.5,    0.,    0.,    0.}, // 5
00551       { 0.375,    0.,-0.125,    0.,    0.,    0.,  0.75,    0.,    0.,    0.}, // 6
00552       { 0.375,    0.,    0.,-0.125,    0.,    0.,    0.,  0.75,    0.,    0.}, // 7
00553       {    0.,-0.125,    0.,-0.125,   0.5,    0.,    0.,   0.5,  0.25,    0.}, // 8
00554       {    0.,    0.,-0.125,-0.125,    0.,    0.,   0.5,   0.5,    0.,  0.25}  // 9
00555     },
00556 
00557     // embedding matrix for child 1
00558     {
00559       //    0      1      2      3      4      5      6      7      8      9
00560       {    0.,    0.,    0.,    0.,    1.,    0.,    0.,    0.,    0.,    0.}, // 0
00561       {    0.,    1.,    0.,    0.,    0.,    0.,    0.,    0.,    0.,    0.}, // 1
00562       {    0.,    0.,    0.,    0.,    0.,    1.,    0.,    0.,    0.,    0.}, // 2
00563       {    0.,    0.,    0.,    0.,    0.,    0.,    0.,    0.,    1.,    0.}, // 3
00564       {-0.125, 0.375,    0.,    0.,  0.75,    0.,    0.,    0.,    0.,    0.}, // 4
00565       {    0., 0.375,-0.125,    0.,    0.,  0.75,    0.,    0.,    0.,    0.}, // 5
00566       {-0.125,    0.,-0.125,    0.,   0.5,   0.5,  0.25,    0.,    0.,    0.}, // 6
00567       {-0.125,    0.,    0.,-0.125,   0.5,    0.,    0.,  0.25,   0.5,    0.}, // 7
00568       {    0., 0.375,    0.,-0.125,    0.,    0.,    0.,    0.,  0.75,    0.}, // 8
00569       {    0.,    0.,-0.125,-0.125,    0.,   0.5,    0.,    0.,   0.5,  0.25}  // 9
00570     },
00571 
00572     // embedding matrix for child 2
00573     {
00574       //    0      1      2      3      4      5      6      7      8      9
00575       {    0.,    0.,    0.,    0.,    0.,    0.,    1.,    0.,    0.,    0.}, // 0
00576       {    0.,    0.,    0.,    0.,    0.,    1.,    0.,    0.,    0.,    0.}, // 1
00577       {    0.,    0.,    1.,    0.,    0.,    0.,    0.,    0.,    0.,    0.}, // 2
00578       {    0.,    0.,    0.,    0.,    0.,    0.,    0.,    0.,    0.,    1.}, // 3
00579       {-0.125,-0.125,    0.,    0.,  0.25,   0.5,   0.5,    0.,    0.,    0.}, // 4
00580       {    0.,-0.125, 0.375,    0.,    0.,  0.75,    0.,    0.,    0.,    0.}, // 5
00581       {-0.125,    0., 0.375,    0.,    0.,    0.,  0.75,    0.,    0.,    0.}, // 6
00582       {-0.125,    0.,    0.,-0.125,    0.,    0.,   0.5,  0.25,    0.,   0.5}, // 7
00583       {    0.,-0.125,    0.,-0.125,    0.,   0.5,    0.,    0.,  0.25,   0.5}, // 8
00584       {    0.,    0., 0.375,-0.125,    0.,    0.,    0.,    0.,    0.,  0.75}  // 9
00585     },
00586 
00587     // embedding matrix for child 3
00588     {
00589       //    0      1      2      3      4      5      6      7      8      9
00590       {    0.,    0.,    0.,    0.,    0.,    0.,    0.,    1.,    0.,    0.}, // 0
00591       {    0.,    0.,    0.,    0.,    0.,    0.,    0.,    0.,    1.,    0.}, // 1
00592       {    0.,    0.,    0.,    0.,    0.,    0.,    0.,    0.,    0.,    1.}, // 2
00593       {    0.,    0.,    0.,    1.,    0.,    0.,    0.,    0.,    0.,    0.}, // 3
00594       {-0.125,-0.125,    0.,    0.,  0.25,    0.,    0.,   0.5,   0.5,    0.}, // 4
00595       {    0.,-0.125,-0.125,    0.,    0.,  0.25,    0.,    0.,   0.5,   0.5}, // 5
00596       {-0.125,    0.,-0.125,    0.,    0.,    0.,  0.25,   0.5,    0.,   0.5}, // 6
00597       {-0.125,    0.,    0., 0.375,    0.,    0.,    0.,  0.75,    0.,    0.}, // 7
00598       {    0.,-0.125,    0., 0.375,    0.,    0.,    0.,    0.,  0.75,    0.}, // 8
00599       {    0.,    0.,-0.125, 0.375,    0.,    0.,    0.,    0.,    0.,  0.75}  // 9
00600     },
00601 
00602     // embedding matrix for child 4
00603     {
00604       //    0      1      2      3      4      5      6      7      8      9
00605       {    0.,    0.,    0.,    0.,    1.,    0.,    0.,    0.,    0.,    0.}, // 0
00606       {    0.,    0.,    0.,    0.,    0.,    0.,    0.,    0.,    1.,    0.}, // 1
00607       {    0.,    0.,    0.,    0.,    0.,    0.,    1.,    0.,    0.,    0.}, // 2
00608       {    0.,    0.,    0.,    0.,    0.,    0.,    0.,    1.,    0.,    0.}, // 3
00609       {-0.125,    0.,    0.,-0.125,   0.5,    0.,    0.,  0.25,   0.5,    0.}, // 4
00610       {-0.125,-0.125,-0.125,-0.125,  0.25,  0.25,  0.25,  0.25,  0.25,  0.25}, // 5
00611       {    0.,-0.125,-0.125,    0.,   0.5,  0.25,   0.5,    0.,    0.,    0.}, // 6
00612       {    0.,-0.125,    0.,-0.125,   0.5,    0.,    0.,   0.5,  0.25,    0.}, // 7
00613       {-0.125,-0.125,    0.,    0.,  0.25,    0.,    0.,   0.5,   0.5,    0.}, // 8
00614       {    0.,    0.,-0.125,-0.125,    0.,    0.,   0.5,   0.5,    0.,  0.25}  // 9
00615     },
00616 
00617     // embedding matrix for child 5
00618     {
00619       //    0      1      2      3      4      5      6      7      8      9
00620       {    0.,    0.,    0.,    0.,    1.,    0.,    0.,    0.,    0.,    0.}, // 0
00621       {    0.,    0.,    0.,    0.,    0.,    1.,    0.,    0.,    0.,    0.}, // 1
00622       {    0.,    0.,    0.,    0.,    0.,    0.,    1.,    0.,    0.,    0.}, // 2
00623       {    0.,    0.,    0.,    0.,    0.,    0.,    0.,    0.,    1.,    0.}, // 3
00624       {-0.125,    0.,-0.125,    0.,   0.5,   0.5,  0.25,    0.,    0.,    0.}, // 4
00625       {-0.125,-0.125,    0.,    0.,  0.25,   0.5,   0.5,    0.,    0.,    0.}, // 5
00626       {    0.,-0.125,-0.125,    0.,   0.5,  0.25,   0.5,    0.,    0.,    0.}, // 6
00627       {-0.125,    0.,    0.,-0.125,   0.5,    0.,    0.,  0.25,   0.5,    0.}, // 7
00628       {    0.,    0.,-0.125,-0.125,    0.,   0.5,    0.,    0.,   0.5,  0.25}, // 8
00629       {-0.125,-0.125,-0.125,-0.125,  0.25,  0.25,  0.25,  0.25,  0.25,  0.25}  // 9
00630     },
00631 
00632     // embedding matrix for child 6
00633     {
00634       //    0      1      2      3      4      5      6      7      8      9
00635       {    0.,    0.,    0.,    0.,    0.,    0.,    1.,    0.,    0.,    0.}, // 0
00636       {    0.,    0.,    0.,    0.,    0.,    1.,    0.,    0.,    0.,    0.}, // 1
00637       {    0.,    0.,    0.,    0.,    0.,    0.,    0.,    0.,    0.,    1.}, // 2
00638       {    0.,    0.,    0.,    0.,    0.,    0.,    0.,    0.,    1.,    0.}, // 3
00639       {-0.125,-0.125,    0.,    0.,  0.25,   0.5,   0.5,    0.,    0.,    0.}, // 4
00640       {    0.,-0.125,    0.,-0.125,    0.,   0.5,    0.,    0.,  0.25,   0.5}, // 5
00641       {-0.125,    0.,    0.,-0.125,    0.,    0.,   0.5,  0.25,    0.,   0.5}, // 6
00642       {-0.125,-0.125,-0.125,-0.125,  0.25,  0.25,  0.25,  0.25,  0.25,  0.25}, // 7
00643       {    0.,    0.,-0.125,-0.125,    0.,   0.5,    0.,    0.,   0.5,  0.25}, // 8
00644       {    0.,-0.125,-0.125,    0.,    0.,  0.25,    0.,    0.,   0.5,   0.5}  // 9
00645     },
00646 
00647     // embedding matrix for child 7
00648     {
00649       //    0      1      2      3      4      5      6      7      8      9
00650       {    0.,    0.,    0.,    0.,    0.,    0.,    1.,    0.,    0.,    0.}, // 0
00651       {    0.,    0.,    0.,    0.,    0.,    0.,    0.,    0.,    1.,    0.}, // 1
00652       {    0.,    0.,    0.,    0.,    0.,    0.,    0.,    0.,    0.,    1.}, // 2
00653       {    0.,    0.,    0.,    0.,    0.,    0.,    0.,    1.,    0.,    0.}, // 3
00654       {-0.125,-0.125,-0.125,-0.125,  0.25,  0.25,  0.25,  0.25,  0.25,  0.25}, // 4
00655       {    0.,-0.125,-0.125,    0.,    0.,  0.25,    0.,    0.,   0.5,   0.5}, // 5
00656       {-0.125,    0.,    0.,-0.125,    0.,    0.,   0.5,  0.25,    0.,   0.5}, // 6
00657       {    0.,    0.,-0.125,-0.125,    0.,    0.,   0.5,   0.5,    0.,  0.25}, // 7
00658       {-0.125,-0.125,    0.,    0.,  0.25,    0.,    0.,   0.5,   0.5,    0.}, // 8
00659       {-0.125,    0.,-0.125,    0.,    0.,    0.,  0.25,   0.5,    0.,   0.5}  // 9
00660     }
00661   };
00662 
00663 
00664 
00665 
00666 
00667 
00668 float Tet10::embedding_matrix (const unsigned int i,
00669                                const unsigned int j,
00670                                const unsigned int k) const
00671 {
00672   // Choose an optimal diagonal, if one has not already been selected
00673   this->choose_diagonal();
00674 
00675   // Permuted j and k indices
00676   unsigned int
00677     jp=j,
00678     kp=k;
00679 
00680   if ((i>3) && (this->_diagonal_selection!=DIAG_02_13))
00681     {
00682       // Just the enum value cast to an unsigned int...
00683       const unsigned ds = static_cast<unsigned int>(this->_diagonal_selection); // == 1 or 2
00684 
00685       // Instead of doing a lot of arithmetic, use these
00686       // straightforward arrays for the permutations.  Note that 3 ->
00687       // 3, and the first array consists of "forward" permutations of
00688       // the sets {0,1,2}, {4,5,6}, and {7,8,9} while the second array
00689       // consists of "reverse" permutations of the same sets.
00690       const unsigned int perms[2][10] =
00691         {
00692           {1, 2, 0, 3, 5, 6, 4, 8, 9, 7},
00693           {2, 0, 1, 3, 6, 4, 5, 9, 7, 8}
00694         };
00695 
00696       // Permute j
00697       jp = perms[ds-1][j];
00698       //      if (jp<3)
00699       //        jp = (jp+ds)%3;
00700       //      else if (jp>3)
00701       //        jp = (jp-1+ds)%3 + 1 + 3*((jp-1)/3);
00702 
00703       // Permute k
00704       kp = perms[ds-1][k];
00705       //      if (kp<3)
00706       //        kp = (kp+ds)%3;
00707       //      else if (kp>3)
00708       //        kp = (kp-1+ds)%3 + 1 + 3*((kp-1)/3);
00709     }
00710 
00711   // Debugging:
00712   // libMesh::err << "Selected diagonal " << _diagonal_selection << std::endl;
00713   // libMesh::err << "j=" << j << std::endl;
00714   // libMesh::err << "k=" << k << std::endl;
00715   // libMesh::err << "jp=" << jp << std::endl;
00716   // libMesh::err << "kp=" << kp << std::endl;
00717 
00718   // Call embedding matrx with permuted indices
00719   return this->_embedding_matrix[i][jp][kp];
00720 }
00721 
00722 #endif // #ifdef LIBMESH_ENABLE_AMR
00723 
00724 } // namespace libMesh