MOAB: Mesh Oriented datABase  (version 5.3.1)
SimplexTemplateRefiner.cpp
Go to the documentation of this file.
00001 #include "SimplexTemplateRefiner.hpp"
00002 
00003 #include "EdgeSizeEvaluator.hpp"
00004 #include "RefinerTagManager.hpp"
00005 
00006 #include "moab/Interface.hpp"
00007 
00008 #include <iostream>
00009 #include <stack>
00010 
00011 // Static arrays holding parametric coordinates of element vertices
00012 static double MBVertexParametric[] = { 0., 0., 0. };
00013 static double MBEdgeParametric[]   = { 0., 0., 0., 1., 0., 0. };
00014 static double MBTriParametric[]    = { 0., 0., 0., 1., 0., 0., 0., 1., 0. };
00015 static double MBTetParametric[]    = { 0., 0., 0., 1., 0., 0., 0., 1., 0., 0., 0., 1. };
00016 
00017 #ifdef MB_DEBUG_TESSELLATOR
00018 #define MB_TESSELLATOR_INCR_CASE_COUNT( cs )        this->case_counts[cs]++
00019 #define MB_TESSELLATOR_INCR_SUBCASE_COUNT( cs, sc ) this->subcase_counts[cs][sc]++
00020 #else  // MB_DEBUG_TESSELLATOR
00021 #define MB_TESSELLATOR_INCR_CASE_COUNT( cs )
00022 #define MB_TESSELLATOR_INCR_SUBCASE_COUNT( cs, sc )
00023 #endif  // MB_DEBUG_TESSELLATOR
00024 
00025 namespace moab
00026 {
00027 
00028 /// Construct a template refiner.
00029 SimplexTemplateRefiner::SimplexTemplateRefiner()
00030 {
00031     this->tag_manager  = 0;
00032     this->tag_assigner = new SimplexTemplateTagAssigner( this );
00033     this->corner_coords.resize( 6 * 8 );  // Hex has 8 verts w/ 6 coordinates each
00034     this->corner_tags.resize( 8 );        // Hex has 8 verts (this is a pointer, not the actual tag data)
00035     this->corner_handles.resize( 8 );     // Hex has 8 verts (this is a pointer, not actual hash data)
00036     this->input_is_output = false;        // Until we know better
00037 }
00038 
00039 /// Empty destructor for good form.
00040 SimplexTemplateRefiner::~SimplexTemplateRefiner()
00041 {
00042     delete this->tag_assigner;
00043 }
00044 
00045 /**\brief Stream a single mesh entity through the refiner.
00046  */
00047 bool SimplexTemplateRefiner::refine_entity( EntityType etyp, EntityHandle entity )
00048 {
00049     this->reset_heap_pointers();
00050     bool rval = true;
00051     const EntityHandle* conn;
00052     int num_nodes;
00053     Interface* imesh = this->tag_manager->get_input_mesh();
00054     if( imesh->get_connectivity( entity, conn, num_nodes ) != MB_SUCCESS ) { return false; }
00055     this->corner_coords.resize( 6 * num_nodes );
00056     this->corner_tags.resize( num_nodes );
00057     this->corner_handles.resize( num_nodes );
00058 
00059     // Have to make num_nodes calls to get_coords() because we need xyz interleaved with rst coords.
00060     Tag tag_handle;
00061     int tag_offset;
00062     void* tag_data;
00063     for( int n = 0; n < num_nodes; ++n )
00064     {
00065         if( imesh->get_coords( &conn[n], 1, &corner_coords[6 * n + 3] ) != MB_SUCCESS ) { return false; }
00066         tag_data = this->heap_tag_storage();
00067         for( int i = 0; i < this->tag_manager->get_number_of_vertex_tags(); ++i )
00068         {
00069             this->tag_manager->get_input_vertex_tag( i, tag_handle, tag_offset );
00070             if( imesh->tag_get_data( tag_handle, &conn[n], 1, (char*)tag_data + tag_offset ) != MB_SUCCESS )
00071             {
00072                 return false;
00073             }
00074         }
00075         if( this->input_is_output ) { this->corner_handles[n] = conn[n]; }
00076         else
00077         {
00078             this->corner_handles[n] = this->output_functor->map_vertex( conn[n], &corner_coords[6 * n], tag_data );
00079 #if 0
00080       std::cout << "#+# " << this->corner_handles[n] << " < "
00081         << corner_coords[ 6 * n + 3 ] << ", "
00082         << corner_coords[ 6 * n + 4 ] << ", "
00083         << corner_coords[ 6 * n + 5 ] << ">\n";
00084 #endif  // 0
00085         }
00086         this->corner_tags[n] = tag_data;
00087     }
00088 
00089     switch( etyp )
00090     {
00091         case MBVERTEX:
00092             this->assign_parametric_coordinates( 1, MBVertexParametric, &this->corner_coords[0] );
00093             this->refine_0_simplex( &this->corner_coords[0], this->corner_tags[0], this->corner_handles[0] );
00094             rval = false;
00095             break;
00096         case MBEDGE:
00097             this->assign_parametric_coordinates( 2, MBEdgeParametric, &this->corner_coords[0] );
00098             rval = this->refine_1_simplex( this->maximum_number_of_subdivisions, &this->corner_coords[0],
00099                                            this->corner_tags[0], this->corner_handles[0], &this->corner_coords[6],
00100                                            this->corner_tags[1], this->corner_handles[1] );
00101             break;
00102         case MBTRI:
00103             this->assign_parametric_coordinates( 3, MBTriParametric, &this->corner_coords[0] );
00104             rval = this->refine_2_simplex( this->maximum_number_of_subdivisions, 7, &this->corner_coords[0],
00105                                            this->corner_tags[0], this->corner_handles[0], &this->corner_coords[6],
00106                                            this->corner_tags[1], this->corner_handles[1], &this->corner_coords[12],
00107                                            this->corner_tags[2], this->corner_handles[2] );
00108             break;
00109         case MBQUAD:
00110             std::cerr << "Quadrilaterals not handled yet\n";
00111             rval = false;
00112             break;
00113         case MBPOLYGON:
00114             std::cerr << "Polygons not handled yet\n";
00115             rval = false;
00116             break;
00117         case MBTET:
00118             this->assign_parametric_coordinates( 4, MBTetParametric, &this->corner_coords[0] );
00119             rval = this->refine_3_simplex( this->maximum_number_of_subdivisions, &this->corner_coords[0],
00120                                            this->corner_tags[0], this->corner_handles[0], &this->corner_coords[6],
00121                                            this->corner_tags[1], this->corner_handles[1], &this->corner_coords[12],
00122                                            this->corner_tags[2], this->corner_handles[2], &this->corner_coords[18],
00123                                            this->corner_tags[3], this->corner_handles[3] );
00124             break;
00125         case MBPYRAMID:
00126             std::cerr << "Pyramid schemes not handled yet\n";
00127             rval = false;
00128             break;
00129         case MBPRISM:
00130             std::cerr << "Prisms not handled yet\n";
00131             rval = false;
00132             break;
00133         case MBKNIFE:
00134             std::cerr << "Knifahedra not handled yet\n";
00135             rval = false;
00136             break;
00137         case MBHEX:
00138             std::cerr << "Hexahedra not handled yet\n";
00139             rval = false;
00140             break;
00141         case MBPOLYHEDRON:
00142             std::cerr << "Polyhedra not handled yet\n";
00143             rval = false;
00144             break;
00145         case MBENTITYSET:
00146             std::cerr << "How should entity sets be handled? We might iterate over its entries or "
00147                          "skip it."
00148                          "Must coordinate with MeshRefiner's loop over entities...\n";
00149             rval = false;
00150             break;
00151         case MBMAXTYPE:
00152             rval = false;
00153             break;
00154     }
00155     return rval;
00156 }
00157 
00158 /**\brief Set the function object used to decide which tag values an edge or face midpoint is
00159  * assigned.
00160  *
00161  * This will change the tag assigner's edge size evaluator to match the refiner's.
00162  * @param[in] ta The new tag assigner. This must be non-NULL.
00163  * @retval True if the tag assigner was changed and false otherwise.
00164  */
00165 bool SimplexTemplateRefiner::set_tag_assigner( SimplexTemplateTagAssigner* ta )
00166 {
00167     if( !ta || ta == this->tag_assigner ) return false;
00168 
00169     this->tag_assigner = ta;
00170     return true;
00171 }
00172 
00173 /**\brief Set the function object used to decide whether an edge is subdivided or not.
00174  */
00175 bool SimplexTemplateRefiner::prepare( RefinerTagManager* tmgr, EntityRefinerOutputFunctor* ofunc )
00176 {
00177     this->tag_manager = tmgr;
00178     this->tag_assigner->set_tag_manager( tmgr );
00179     this->input_is_output = ( this->tag_manager->get_input_mesh() == this->tag_manager->get_output_mesh() );
00180     // this->tag_assigner->set_edge_size_evaluator( this->edge_size_evaluator );
00181     return this->EntityRefiner::prepare( tmgr, ofunc );
00182 }
00183 
00184 /**\fn unsigned long SimplexTemplateRefiner::get_heap_size_bound( int max_recursions ) const
00185  *\brief Bound on the number of new vertices used to allocate the heap.
00186  *
00187  * This bound is based on a hexahedron that is divided into 48 tetrahedra (a point is added to
00188  * the center of each face so that compatible boundaries are guaranteed on neighboring hexahedra),
00189  * each of which has 4 edges.
00190  */
00191 
00192 /**\brief "Refine" a vertex by passing it through to the output.
00193  *
00194  * FIXME: There is some question as to whether this should pass vertices through
00195  * since there does not appear to be a distinction between vertices as points
00196  * in space and vertices as degrees-of-freedom in a mesh (i.e. a vertex that is
00197  * treated as a lumped-parameter model).
00198  */
00199 void SimplexTemplateRefiner::refine_0_simplex( const double* v0, const void* t0, EntityHandle h0 )
00200 {
00201     // Ignore these arguments... the caller is responsible for calling the output functor to ensure
00202     // the vertex exists on the output.
00203     (void)v0;
00204     (void)t0;
00205 
00206     ( *this->output_functor )( h0 );
00207     ( *this->output_functor )( MBVERTEX );
00208 }
00209 
00210 /**\brief Refine an edge.
00211  */
00212 bool SimplexTemplateRefiner::refine_1_simplex( int max_depth, const double* v0, const void* t0, EntityHandle h0,
00213                                                const double* v1, const void* t1, EntityHandle h1 )
00214 {
00215     int edge_code = 0;
00216 
00217     double* midptc;
00218     void* midptt;
00219     // NB: If support for multiple recursive subdivisions (without a merge in between) is required,
00220     //     this will have to change as it assumes that h0 and h1 have only a single entry.
00221     EntityHandle midpth = 0;
00222 
00223     if( max_depth-- > 0 )
00224     {
00225         midptc = this->heap_coord_storage();
00226         midptt = this->heap_tag_storage();
00227         int i;
00228         // make valgrind happy
00229         // vtkstd::fill( midpt0, midpt0 + 6, 0. );
00230         for( i = 0; i < 6; i++ )
00231             midptc[i] = ( v0[i] + v1[i] ) / 2.;
00232 
00233         ( *this->tag_assigner )( v0, t0, h0, midptc, midptt, v1, t1, h1 );
00234         if( this->edge_size_evaluator->evaluate_edge( v0, t0, midptc, midptt, v1, t1 ) )
00235         {
00236             edge_code = 1;
00237             midpth    = ( *this->output_functor )( h0, h1, midptc, midptt );
00238         }
00239     }
00240 
00241     switch( edge_code )
00242     {
00243             // No edges to subdivide
00244         case 0:
00245             ( *this->output_functor )( h0 );
00246             ( *this->output_functor )( h1 );
00247             ( *this->output_functor )( MBEDGE );
00248             break;
00249 
00250             // One edge to subdivide
00251         case 1:
00252             this->refine_1_simplex( max_depth, v0, t0, h0, midptc, midptt, midpth );
00253             this->refine_1_simplex( max_depth, midptc, midptt, midpth, v1, t1, h1 );
00254             break;
00255     }
00256 
00257     return ( 0 == edge_code ) ? false : true;
00258 }
00259 
00260 /**\brief Refine a triangle.
00261  */
00262 bool SimplexTemplateRefiner::refine_2_simplex( int max_depth, int move, const double* v0, const void* t0,
00263                                                EntityHandle h0, const double* v1, const void* t1, EntityHandle h1,
00264                                                const double* v2, const void* t2, EntityHandle h2 )
00265 {
00266     int edge_code = 0;
00267 
00268     double* midpt0c;
00269     double* midpt1c;
00270     double* midpt2c;
00271     void* midpt0t;
00272     void* midpt1t;
00273     void* midpt2t;
00274     EntityHandle midpt0h = 0;
00275     EntityHandle midpt1h = 0;
00276     EntityHandle midpt2h = 0;
00277 
00278     if( max_depth-- > 0 )
00279     {
00280         int i;
00281         midpt0c = this->heap_coord_storage();
00282         midpt1c = this->heap_coord_storage();
00283         midpt2c = this->heap_coord_storage();
00284         midpt0t = this->heap_tag_storage();
00285         midpt1t = this->heap_tag_storage();
00286         midpt2t = this->heap_tag_storage();
00287         midpt0h = 0;
00288         midpt1h = 0;
00289         midpt2h = 0;
00290         for( i = 0; i < 6; ++i )
00291         {
00292             midpt0c[i] = ( v0[i] + v1[i] ) / 2.;
00293             midpt1c[i] = ( v1[i] + v2[i] ) / 2.;
00294             midpt2c[i] = ( v2[i] + v0[i] ) / 2.;
00295         }
00296         ( *this->tag_assigner )( v0, t0, h0, midpt0c, midpt0t, v1, t1, h1 );
00297         ( *this->tag_assigner )( v1, t1, h1, midpt1c, midpt1t, v2, t2, h2 );
00298         ( *this->tag_assigner )( v2, t2, h2, midpt2c, midpt2t, v0, t0, h0 );
00299         if( ( move & 1 ) && this->edge_size_evaluator->evaluate_edge( v0, t0, midpt0c, midpt0t, v1, t1 ) )
00300         {
00301             edge_code += 1;
00302             midpt0h = ( *this->output_functor )( h0, h1, midpt0c, midpt0t );
00303         }
00304         if( ( move & 2 ) && this->edge_size_evaluator->evaluate_edge( v1, t1, midpt1c, midpt1t, v2, t2 ) )
00305         {
00306             edge_code += 2;
00307             midpt1h = ( *this->output_functor )( h1, h2, midpt1c, midpt1t );
00308         }
00309         if( ( move & 4 ) && this->edge_size_evaluator->evaluate_edge( v2, t2, midpt2c, midpt2t, v0, t0 ) )
00310         {
00311             edge_code += 4;
00312             midpt2h = ( *this->output_functor )( h2, h0, midpt2c, midpt2t );
00313         }
00314     }
00315 
00316     switch( edge_code )
00317     {
00318             // No edges to subdivide
00319         case 0:
00320             ( *this->output_functor )( h0 );
00321             ( *this->output_functor )( h1 );
00322             ( *this->output_functor )( h2 );
00323             ( *this->output_functor )( MBTRI );
00324             break;
00325 
00326             // One edge to subdivide
00327         case 1:
00328             this->refine_2_simplex( max_depth, move | 2, v0, t0, h0, midpt0c, midpt0t, midpt0h, v2, t2, h2 );
00329             this->refine_2_simplex( max_depth, move | 4, midpt0c, midpt0t, midpt0h, v1, t1, h1, v2, t2, h2 );
00330             break;
00331         case 2:
00332             this->refine_2_simplex( max_depth, move | 4, v0, t0, h0, v1, t1, h1, midpt1c, midpt1t, midpt1h );
00333             this->refine_2_simplex( max_depth, move | 1, v0, t0, h0, midpt1c, midpt1t, midpt1h, v2, t2, h2 );
00334             break;
00335         case 4:
00336             this->refine_2_simplex( max_depth, move | 2, v0, t0, h0, v1, t1, h1, midpt2c, midpt2t, midpt2h );
00337             this->refine_2_simplex( max_depth, move | 1, midpt2c, midpt2t, midpt2h, v1, t1, h1, v2, t2, h2 );
00338             break;
00339 
00340             // Two edges to subdivide
00341         case 3:
00342             this->refine_2_simplex( max_depth, move | 4, midpt0c, midpt0t, midpt0h, v1, t1, h1, midpt1c, midpt1t,
00343                                     midpt1h );
00344             if( this->compare_Hopf_cross_string_dist( v2, midpt0c, v0, midpt1c ) )
00345             {
00346                 this->refine_2_simplex( max_depth, move | 5, midpt0c, midpt0t, midpt0h, midpt1c, midpt1t, midpt1h, v2,
00347                                         t2, h2 );
00348                 this->refine_2_simplex( max_depth, move | 2, v0, t0, h0, midpt0c, midpt0t, midpt0h, v2, t2, h2 );
00349             }
00350             else
00351             {
00352                 this->refine_2_simplex( max_depth, move | 6, v0, t0, h0, midpt0c, midpt0t, midpt0h, midpt1c, midpt1t,
00353                                         midpt1h );
00354                 this->refine_2_simplex( max_depth, move | 1, v0, t0, h0, midpt1c, midpt1t, midpt1h, v2, t2, h2 );
00355             }
00356             break;
00357         case 5:
00358             this->refine_2_simplex( max_depth, move | 2, v0, t0, h0, midpt0c, midpt0t, midpt0h, midpt2c, midpt2t,
00359                                     midpt2h );
00360             if( this->compare_Hopf_cross_string_dist( v2, midpt0c, v1, midpt2c ) )
00361             {
00362                 this->refine_2_simplex( max_depth, move | 4, midpt0c, midpt0t, midpt0h, v1, t1, h1, v2, t2, h2 );
00363                 this->refine_2_simplex( max_depth, move | 3, midpt2c, midpt2t, midpt2h, midpt0c, midpt0t, midpt0h, v2,
00364                                         t2, h2 );
00365             }
00366             else
00367             {
00368                 this->refine_2_simplex( max_depth, move | 6, midpt0c, midpt0t, midpt0h, v1, t1, h1, midpt2c, midpt2t,
00369                                         midpt2h );
00370                 this->refine_2_simplex( max_depth, move | 1, midpt2c, midpt2t, midpt2h, v1, t1, h1, v2, t2, h2 );
00371             }
00372             break;
00373         case 6:
00374             this->refine_2_simplex( max_depth, move | 1, midpt2c, midpt2t, midpt2h, midpt1c, midpt1t, midpt1h, v2, t2,
00375                                     h2 );
00376             if( this->compare_Hopf_cross_string_dist( v0, midpt1c, v1, midpt2c ) )
00377             {
00378                 this->refine_2_simplex( max_depth, move | 3, v0, t0, h0, midpt1c, midpt1t, midpt1h, midpt2c, midpt2t,
00379                                         midpt2h );
00380                 this->refine_2_simplex( max_depth, move | 4, v0, t0, h0, v1, t1, h1, midpt1c, midpt1t, midpt1h );
00381             }
00382             else
00383             {
00384                 this->refine_2_simplex( max_depth, move | 2, v0, t0, h0, v1, t1, h1, midpt2c, midpt2t, midpt2h );
00385                 this->refine_2_simplex( max_depth, move | 5, midpt2c, midpt2t, midpt2h, v1, t1, h1, midpt1c, midpt1t,
00386                                         midpt1h );
00387             }
00388             break;
00389 
00390             // Three edges to subdivide
00391         case 7:
00392             this->refine_2_simplex( max_depth, 7, midpt0c, midpt0t, midpt0h, midpt1c, midpt1t, midpt1h, midpt2c,
00393                                     midpt2t, midpt2h );
00394             this->refine_2_simplex( max_depth, move | 2, v0, t0, h0, midpt0c, midpt0t, midpt0h, midpt2c, midpt2t,
00395                                     midpt2h );
00396             this->refine_2_simplex( max_depth, move | 4, midpt0c, midpt0t, midpt0h, v1, t1, h1, midpt1c, midpt1t,
00397                                     midpt1h );
00398             this->refine_2_simplex( max_depth, move | 1, midpt2c, midpt2t, midpt2h, midpt1c, midpt1t, midpt1h, v2, t2,
00399                                     h2 );
00400             break;
00401     }
00402 
00403     return true;
00404 }
00405 
00406 /**\brief Refine a tetrahedron.
00407  */
00408 bool SimplexTemplateRefiner::refine_3_simplex( int max_depth, double* v0, void* t0, EntityHandle h0, double* v1,
00409                                                void* t1, EntityHandle h1, double* v2, void* t2, EntityHandle h2,
00410                                                double* v3, void* t3, EntityHandle h3 )
00411 {
00412     int edge_code = 0;
00413 
00414     double* midpt0c;
00415     double* midpt1c;
00416     double* midpt2c;
00417     double* midpt3c;
00418     double* midpt4c;
00419     double* midpt5c;
00420 
00421     void* midpt0t;
00422     void* midpt1t;
00423     void* midpt2t;
00424     void* midpt3t;
00425     void* midpt4t;
00426     void* midpt5t;
00427 
00428     EntityHandle midpt0h = 0;
00429     EntityHandle midpt1h = 0;
00430     EntityHandle midpt2h = 0;
00431     EntityHandle midpt3h = 0;
00432     EntityHandle midpt4h = 0;
00433     EntityHandle midpt5h = 0;
00434 
00435     if( max_depth-- > 0 )
00436     {
00437         midpt0c = this->heap_coord_storage();
00438         midpt1c = this->heap_coord_storage();
00439         midpt2c = this->heap_coord_storage();
00440         midpt3c = this->heap_coord_storage();
00441         midpt4c = this->heap_coord_storage();
00442         midpt5c = this->heap_coord_storage();
00443 
00444         midpt0t = this->heap_tag_storage();
00445         midpt1t = this->heap_tag_storage();
00446         midpt2t = this->heap_tag_storage();
00447         midpt3t = this->heap_tag_storage();
00448         midpt4t = this->heap_tag_storage();
00449         midpt5t = this->heap_tag_storage();
00450 
00451         for( int i = 0; i < 6; ++i )
00452         {
00453             midpt0c[i] = ( v0[i] + v1[i] ) * .5;
00454             midpt1c[i] = ( v1[i] + v2[i] ) * .5;
00455             midpt2c[i] = ( v2[i] + v0[i] ) * .5;
00456             midpt3c[i] = ( v0[i] + v3[i] ) * .5;
00457             midpt4c[i] = ( v1[i] + v3[i] ) * .5;
00458             midpt5c[i] = ( v2[i] + v3[i] ) * .5;
00459         }
00460 
00461         ( *this->tag_assigner )( v0, t0, h0, midpt0c, midpt0t, v1, t1, h1 );
00462         ( *this->tag_assigner )( v1, t1, h1, midpt1c, midpt1t, v2, t2, h2 );
00463         ( *this->tag_assigner )( v2, t2, h2, midpt2c, midpt2t, v0, t0, h0 );
00464         ( *this->tag_assigner )( v0, t0, h0, midpt3c, midpt3t, v3, t3, h3 );
00465         ( *this->tag_assigner )( v1, t1, h1, midpt4c, midpt4t, v3, t3, h3 );
00466         ( *this->tag_assigner )( v2, t2, h2, midpt5c, midpt5t, v3, t3, h3 );
00467 
00468         if( this->edge_size_evaluator->evaluate_edge( v0, t0, midpt0c, midpt0t, v1, t1 ) )
00469         {
00470             edge_code |= 1;
00471             midpt0h = ( *this->output_functor )( h0, h1, midpt0c, midpt0t );
00472         }
00473         if( this->edge_size_evaluator->evaluate_edge( v1, t1, midpt1c, midpt1t, v2, t2 ) )
00474         {
00475             edge_code |= 2;
00476             midpt1h = ( *this->output_functor )( h1, h2, midpt1c, midpt1t );
00477         }
00478         if( this->edge_size_evaluator->evaluate_edge( v2, t2, midpt2c, midpt2t, v0, t0 ) )
00479         {
00480             edge_code |= 4;
00481             midpt2h = ( *this->output_functor )( h2, h0, midpt2c, midpt2t );
00482         }
00483         if( this->edge_size_evaluator->evaluate_edge( v0, t0, midpt3c, midpt3t, v3, t3 ) )
00484         {
00485             edge_code |= 8;
00486             midpt3h = ( *this->output_functor )( h0, h3, midpt3c, midpt3t );
00487         }
00488         if( this->edge_size_evaluator->evaluate_edge( v1, t1, midpt4c, midpt4t, v3, t3 ) )
00489         {
00490             edge_code |= 16;
00491             midpt4h = ( *this->output_functor )( h1, h3, midpt4c, midpt4t );
00492         }
00493         if( this->edge_size_evaluator->evaluate_edge( v2, t2, midpt5c, midpt5t, v3, t3 ) )
00494         {
00495             edge_code |= 32;
00496             midpt5h = ( *this->output_functor )( h2, h3, midpt5c, midpt5t );
00497         }
00498     }
00499 
00500     double edge_length2[6];
00501     for( int ei = 0; ei < 6; ++ei )
00502         edge_length2[ei] = 0.;
00503 
00504     for( int c = 0; c < 3; ++c )
00505     {
00506         double tmp;
00507         tmp = v1[c] - v0[c];
00508         edge_length2[0] += tmp * tmp;
00509         tmp = v2[c] - v1[c];
00510         edge_length2[1] += tmp * tmp;
00511         tmp = v2[c] - v0[c];
00512         edge_length2[2] += tmp * tmp;
00513         tmp = v3[c] - v0[c];
00514         edge_length2[3] += tmp * tmp;
00515         tmp = v3[c] - v1[c];
00516         edge_length2[4] += tmp * tmp;
00517         tmp = v3[c] - v2[c];
00518         edge_length2[5] += tmp * tmp;
00519     }
00520 
00521     if( 0 == edge_code )
00522     {
00523         // No edges to subdivide
00524         ( *this->output_functor )( h0 );
00525         ( *this->output_functor )( h1 );
00526         ( *this->output_functor )( h2 );
00527         ( *this->output_functor )( h3 );
00528         ( *this->output_functor )( MBTET );
00529 
00530         return false;
00531     }
00532 
00533     double* facept0c;
00534     double* facept1c;
00535     double* facept2c;
00536     double* facept3c;
00537     facept0c                  = this->heap_coord_storage();
00538     facept1c                  = this->heap_coord_storage();
00539     facept2c                  = this->heap_coord_storage();
00540     facept3c                  = this->heap_coord_storage();
00541     double* vertex_coords[14] = { v0,      v1,      v2,      v3,       midpt0c,  midpt1c,  midpt2c,
00542                                   midpt3c, midpt4c, midpt5c, facept0c, facept1c, facept2c, facept3c };
00543 
00544     void* facept0t        = this->heap_tag_storage();
00545     void* facept1t        = this->heap_tag_storage();
00546     void* facept2t        = this->heap_tag_storage();
00547     void* facept3t        = this->heap_tag_storage();
00548     void* vertex_tags[14] = { t0,      t1,      t2,      t3,       midpt0t,  midpt1t,  midpt2t,
00549                               midpt3t, midpt4t, midpt5t, facept0t, facept1t, facept2t, facept3t };
00550 
00551     EntityHandle vertex_hash[14] = { h0, h1, h2, h3, midpt0h, midpt1h, midpt2h, midpt3h, midpt4h, midpt5h, 0, 0, 0, 0 };
00552 
00553     // Generate tetrahedra that are compatible except when edge
00554     // lengths are equal on indeterminately subdivided faces.
00555     double* permuted_coords[14];
00556     void* permuted_tags[14];
00557     EntityHandle permuted_hash[14];
00558     double permlen[6];  // permuted edge lengths
00559     int C = SimplexTemplateRefiner::template_index[edge_code][0];
00560     int P = SimplexTemplateRefiner::template_index[edge_code][1];
00561 
00562     // 1. Permute the tetrahedron into our canonical configuration
00563     for( int i = 0; i < 14; ++i )
00564     {
00565         permuted_coords[i] = vertex_coords[SimplexTemplateRefiner::permutations_from_index[P][i]];
00566         permuted_tags[i]   = vertex_tags[SimplexTemplateRefiner::permutations_from_index[P][i]];
00567         permuted_hash[i]   = vertex_hash[SimplexTemplateRefiner::permutations_from_index[P][i]];
00568     }
00569 
00570     for( int i = 4; i < 10; ++i )
00571     {
00572         // permute edge lengths too
00573         permlen[i - 4] = edge_length2[SimplexTemplateRefiner::permutations_from_index[P][i] - 4];
00574     }
00575 
00576     int comparison_bits;
00577     std::stack< int* > output_tets;
00578     std::stack< int* > output_perm;
00579     std::stack< int > output_sign;
00580 
00581     // cout << "Case " << C << "  Permutation " << P << endl;
00582     // 2. Generate tetrahedra based on the configuration.
00583     //    Note that case 0 is handled above (edgeCode == 0).
00584 
00585     switch( C )
00586     {
00587         case 1:  // Ruprecht-Müller Case 1
00588             MB_TESSELLATOR_INCR_CASE_COUNT( 0 );
00589             output_tets.push( SimplexTemplateRefiner::templates + 0 );
00590             output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00591             output_sign.push( 1 );
00592             MB_TESSELLATOR_INCR_SUBCASE_COUNT( 0, 0 );
00593             break;
00594         case 2:  // Ruprecht-Müller Case 2a
00595             comparison_bits = ( permlen[0] <= permlen[1] ? 1 : 0 ) | ( permlen[0] >= permlen[1] ? 2 : 0 ) | 0;
00596             if( ( comparison_bits & 3 ) == 3 )
00597             {
00598                 // Compute face point and tag
00599                 for( int i = 0; i < 6; ++i )
00600                 {
00601                     permuted_coords[10][i] =
00602                         ( permuted_coords[0][i] + permuted_coords[2][i] ) * .375 + permuted_coords[1][i] * .25;
00603                 }
00604                 ( *this->tag_assigner )( permuted_tags[0], permuted_tags[2], permuted_tags[1], permuted_tags[10] );
00605                 permuted_hash[10] = ( *this->output_functor )( permuted_hash[0], permuted_hash[2], permuted_hash[1],
00606                                                                permuted_coords[10], permuted_tags[10] );
00607             }
00608             MB_TESSELLATOR_INCR_CASE_COUNT( 1 );
00609             output_tets.push( SimplexTemplateRefiner::templates + 9 );
00610             output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00611             output_sign.push( 1 );
00612             MB_TESSELLATOR_INCR_SUBCASE_COUNT( 1, 0 );
00613             switch( comparison_bits )
00614             {
00615                 case 2:  // 0>1
00616                     output_tets.push( SimplexTemplateRefiner::templates + 14 );
00617                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00618                     output_sign.push( 1 );
00619                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 1, 1 );
00620                     break;
00621                 case 1:  // 1>0
00622                     output_tets.push( SimplexTemplateRefiner::templates + 14 );
00623                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[13] );
00624                     output_sign.push( -1 );
00625                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 1, 2 );
00626                     break;
00627                 case 3:  // 0=1
00628                     output_tets.push( SimplexTemplateRefiner::templates + 23 );
00629                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00630                     output_sign.push( 1 );
00631                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 1, 3 );
00632                     break;
00633             }
00634             break;
00635         case 3:  // Ruprecht-Müller Case 2b
00636             MB_TESSELLATOR_INCR_CASE_COUNT( 2 );
00637             output_tets.push( SimplexTemplateRefiner::templates + 40 );
00638             output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00639             output_sign.push( 1 );
00640             MB_TESSELLATOR_INCR_SUBCASE_COUNT( 2, 0 );
00641             break;
00642         case 4:  // Ruprecht-Müller Case 3a
00643             comparison_bits = ( permlen[0] <= permlen[3] ? 1 : 0 ) | ( permlen[0] >= permlen[3] ? 2 : 0 ) |
00644                               ( permlen[2] <= permlen[3] ? 4 : 0 ) | ( permlen[2] >= permlen[3] ? 8 : 0 ) |
00645                               ( permlen[0] <= permlen[2] ? 16 : 0 ) | ( permlen[0] >= permlen[2] ? 32 : 0 ) | 0;
00646             if( ( comparison_bits & 3 ) == 3 )
00647             {
00648                 // Compute face point and tag
00649                 for( int i = 0; i < 6; ++i )
00650                 {
00651                     permuted_coords[11][i] =
00652                         ( permuted_coords[1][i] + permuted_coords[3][i] ) * .375 + permuted_coords[0][i] * .25;
00653                 }
00654                 ( *this->tag_assigner )( permuted_tags[1], permuted_tags[3], permuted_tags[0], permuted_tags[11] );
00655                 permuted_hash[11] = ( *this->output_functor )( permuted_hash[1], permuted_hash[3], permuted_hash[0],
00656                                                                permuted_coords[11], permuted_tags[11] );
00657             }
00658             if( ( comparison_bits & 12 ) == 12 )
00659             {
00660                 // Compute face point and tag
00661                 for( int i = 0; i < 6; ++i )
00662                 {
00663                     permuted_coords[13][i] =
00664                         ( permuted_coords[2][i] + permuted_coords[3][i] ) * .375 + permuted_coords[0][i] * .25;
00665                 }
00666                 ( *this->tag_assigner )( permuted_tags[2], permuted_tags[3], permuted_tags[0], permuted_tags[13] );
00667                 permuted_hash[13] = ( *this->output_functor )( permuted_hash[2], permuted_hash[3], permuted_hash[0],
00668                                                                permuted_coords[13], permuted_tags[13] );
00669             }
00670             if( ( comparison_bits & 48 ) == 48 )
00671             {
00672                 // Compute face point and tag
00673                 for( int i = 0; i < 6; ++i )
00674                 {
00675                     permuted_coords[10][i] =
00676                         ( permuted_coords[1][i] + permuted_coords[2][i] ) * .375 + permuted_coords[0][i] * .25;
00677                 }
00678                 ( *this->tag_assigner )( permuted_tags[1], permuted_tags[2], permuted_tags[0], permuted_tags[10] );
00679                 permuted_hash[10] = ( *this->output_functor )( permuted_hash[1], permuted_hash[2], permuted_hash[0],
00680                                                                permuted_coords[10], permuted_tags[10] );
00681             }
00682             MB_TESSELLATOR_INCR_CASE_COUNT( 3 );
00683             output_tets.push( SimplexTemplateRefiner::templates + 57 );
00684             output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00685             output_sign.push( 1 );
00686             MB_TESSELLATOR_INCR_SUBCASE_COUNT( 3, 0 );
00687             switch( comparison_bits )
00688             {
00689                 case 42:  // 0>2>3<0
00690                     output_tets.push( SimplexTemplateRefiner::templates + 62 );
00691                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00692                     output_sign.push( 1 );
00693                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 3, 1 );
00694                     break;
00695                 case 25:  // 2>3>0<2
00696                     output_tets.push( SimplexTemplateRefiner::templates + 62 );
00697                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[11] );
00698                     output_sign.push( 1 );
00699                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 3, 2 );
00700                     break;
00701                 case 37:  // 3>0>2<3
00702                     output_tets.push( SimplexTemplateRefiner::templates + 62 );
00703                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[3] );
00704                     output_sign.push( 1 );
00705                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 3, 3 );
00706                     break;
00707                 case 21:  // 3>2>0<3
00708                     output_tets.push( SimplexTemplateRefiner::templates + 62 );
00709                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[22] );
00710                     output_sign.push( -1 );
00711                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 3, 4 );
00712                     break;
00713                 case 26:  // 2>0>3<2
00714                     output_tets.push( SimplexTemplateRefiner::templates + 62 );
00715                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[12] );
00716                     output_sign.push( -1 );
00717                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 3, 5 );
00718                     break;
00719                 case 38:  // 0>3>2<0
00720                     output_tets.push( SimplexTemplateRefiner::templates + 62 );
00721                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[15] );
00722                     output_sign.push( -1 );
00723                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 3, 6 );
00724                     break;
00725                 case 58:  // 0=2>3<0
00726                     output_tets.push( SimplexTemplateRefiner::templates + 75 );
00727                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00728                     output_sign.push( 1 );
00729                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 3, 7 );
00730                     break;
00731                 case 29:  // 2=3>0<2
00732                     output_tets.push( SimplexTemplateRefiner::templates + 75 );
00733                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[11] );
00734                     output_sign.push( 1 );
00735                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 3, 8 );
00736                     break;
00737                 case 39:  // 0=3>2<0
00738                     output_tets.push( SimplexTemplateRefiner::templates + 75 );
00739                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[3] );
00740                     output_sign.push( 1 );
00741                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 3, 9 );
00742                     break;
00743                 case 53:  // 3>0=2<3
00744                     output_tets.push( SimplexTemplateRefiner::templates + 96 );
00745                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00746                     output_sign.push( 1 );
00747                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 3, 10 );
00748                     break;
00749                 case 46:  // 0>2=3<0
00750                     output_tets.push( SimplexTemplateRefiner::templates + 96 );
00751                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[11] );
00752                     output_sign.push( 1 );
00753                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 3, 11 );
00754                     break;
00755                 case 27:  // 2>0=3<2
00756                     output_tets.push( SimplexTemplateRefiner::templates + 96 );
00757                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[3] );
00758                     output_sign.push( 1 );
00759                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 3, 12 );
00760                     break;
00761                 case 63:  // 0=2=3=0
00762                     output_tets.push( SimplexTemplateRefiner::templates + 117 );
00763                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00764                     output_sign.push( 1 );
00765                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 3, 13 );
00766                     break;
00767             }
00768             break;
00769         case 5:  // Ruprecht-Müller Case 3b
00770             MB_TESSELLATOR_INCR_CASE_COUNT( 4 );
00771             output_tets.push( SimplexTemplateRefiner::templates + 162 );
00772             output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00773             output_sign.push( 1 );
00774             MB_TESSELLATOR_INCR_SUBCASE_COUNT( 4, 0 );
00775             break;
00776         case 6:  // Ruprecht-Müller Case 3c
00777             comparison_bits = ( permlen[0] <= permlen[1] ? 1 : 0 ) | ( permlen[0] >= permlen[1] ? 2 : 0 ) |
00778                               ( permlen[0] <= permlen[3] ? 4 : 0 ) | ( permlen[0] >= permlen[3] ? 8 : 0 ) | 0;
00779             if( ( comparison_bits & 3 ) == 3 )
00780             {
00781                 // Compute face point and tag
00782                 for( int i = 0; i < 6; ++i )
00783                 {
00784                     permuted_coords[10][i] =
00785                         ( permuted_coords[0][i] + permuted_coords[2][i] ) * .375 + permuted_coords[1][i] * .25;
00786                 }
00787                 ( *this->tag_assigner )( permuted_tags[0], permuted_tags[2], permuted_tags[1], permuted_tags[10] );
00788                 permuted_hash[10] = ( *this->output_functor )( permuted_hash[0], permuted_hash[2], permuted_hash[1],
00789                                                                permuted_coords[10], permuted_tags[10] );
00790             }
00791             if( ( comparison_bits & 12 ) == 12 )
00792             {
00793                 // Compute face point and tag
00794                 for( int i = 0; i < 6; ++i )
00795                 {
00796                     permuted_coords[11][i] =
00797                         ( permuted_coords[1][i] + permuted_coords[3][i] ) * .375 + permuted_coords[0][i] * .25;
00798                 }
00799                 ( *this->tag_assigner )( permuted_tags[1], permuted_tags[3], permuted_tags[0], permuted_tags[11] );
00800                 permuted_hash[11] = ( *this->output_functor )( permuted_hash[1], permuted_hash[3], permuted_hash[0],
00801                                                                permuted_coords[11], permuted_tags[11] );
00802             }
00803             MB_TESSELLATOR_INCR_CASE_COUNT( 5 );
00804             switch( comparison_bits )
00805             {
00806                 case 10:  // 0>1,0>3
00807                     output_tets.push( SimplexTemplateRefiner::templates + 179 );
00808                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00809                     output_sign.push( 1 );
00810                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 5, 0 );
00811                     break;
00812                 case 5:  // 1>0,3>0
00813                     output_tets.push( SimplexTemplateRefiner::templates + 200 );
00814                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00815                     output_sign.push( 1 );
00816                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 5, 1 );
00817                     break;
00818                 case 6:  // 0>1,3>0
00819                     output_tets.push( SimplexTemplateRefiner::templates + 221 );
00820                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00821                     output_sign.push( 1 );
00822                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 5, 2 );
00823                     break;
00824                 case 9:  // 1>0,0>3
00825                     output_tets.push( SimplexTemplateRefiner::templates + 242 );
00826                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00827                     output_sign.push( 1 );
00828                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 5, 3 );
00829                     break;
00830                 case 11:  // 0=1,0>3
00831                     output_tets.push( SimplexTemplateRefiner::templates + 263 );
00832                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00833                     output_sign.push( 1 );
00834                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 5, 4 );
00835                     break;
00836                 case 14:  // 0=3,0>1
00837                     output_tets.push( SimplexTemplateRefiner::templates + 263 );
00838                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[5] );
00839                     output_sign.push( 1 );
00840                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 5, 5 );
00841                     break;
00842                 case 7:  // 3>0,0=1
00843                     output_tets.push( SimplexTemplateRefiner::templates + 292 );
00844                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00845                     output_sign.push( 1 );
00846                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 5, 6 );
00847                     break;
00848                 case 13:  // 1>0,0=3
00849                     output_tets.push( SimplexTemplateRefiner::templates + 292 );
00850                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[5] );
00851                     output_sign.push( 1 );
00852                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 5, 7 );
00853                     break;
00854                 case 15:  // 0=1,0=3
00855                     output_tets.push( SimplexTemplateRefiner::templates + 321 );
00856                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00857                     output_sign.push( 1 );
00858                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 5, 8 );
00859                     break;
00860             }
00861             break;
00862         case 7:  // Ruprecht-Müller Case 3d
00863             comparison_bits = ( permlen[0] <= permlen[2] ? 1 : 0 ) | ( permlen[0] >= permlen[2] ? 2 : 0 ) |
00864                               ( permlen[0] <= permlen[4] ? 4 : 0 ) | ( permlen[0] >= permlen[4] ? 8 : 0 ) | 0;
00865             if( ( comparison_bits & 3 ) == 3 )
00866             {
00867                 // Compute face point and tag
00868                 for( int i = 0; i < 6; ++i )
00869                 {
00870                     permuted_coords[10][i] =
00871                         ( permuted_coords[1][i] + permuted_coords[2][i] ) * .375 + permuted_coords[0][i] * .25;
00872                 }
00873                 ( *this->tag_assigner )( permuted_tags[1], permuted_tags[2], permuted_tags[0], permuted_tags[10] );
00874                 permuted_hash[10] = ( *this->output_functor )( permuted_hash[1], permuted_hash[2], permuted_hash[0],
00875                                                                permuted_coords[10], permuted_tags[10] );
00876             }
00877             if( ( comparison_bits & 12 ) == 12 )
00878             {
00879                 // Compute face point and tag
00880                 for( int i = 0; i < 6; ++i )
00881                 {
00882                     permuted_coords[11][i] =
00883                         ( permuted_coords[0][i] + permuted_coords[3][i] ) * .375 + permuted_coords[1][i] * .25;
00884                 }
00885                 ( *this->tag_assigner )( permuted_tags[0], permuted_tags[3], permuted_tags[1], permuted_tags[11] );
00886                 permuted_hash[11] = ( *this->output_functor )( permuted_hash[0], permuted_hash[3], permuted_hash[1],
00887                                                                permuted_coords[11], permuted_tags[11] );
00888             }
00889             MB_TESSELLATOR_INCR_CASE_COUNT( 6 );
00890             switch( comparison_bits )
00891             {
00892                 case 10:  // 0>4,0>2
00893                     output_tets.push( SimplexTemplateRefiner::templates + 362 );
00894                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00895                     output_sign.push( 1 );
00896                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 6, 0 );
00897                     break;
00898                 case 5:  // 4>0,2>0
00899                     output_tets.push( SimplexTemplateRefiner::templates + 383 );
00900                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00901                     output_sign.push( 1 );
00902                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 6, 1 );
00903                     break;
00904                 case 9:  // 0>4,2>0
00905                     output_tets.push( SimplexTemplateRefiner::templates + 404 );
00906                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00907                     output_sign.push( 1 );
00908                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 6, 2 );
00909                     break;
00910                 case 6:  // 4>0,0>2
00911                     output_tets.push( SimplexTemplateRefiner::templates + 425 );
00912                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00913                     output_sign.push( 1 );
00914                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 6, 3 );
00915                     break;
00916                 case 14:  // 0=4,0>2
00917                     output_tets.push( SimplexTemplateRefiner::templates + 446 );
00918                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00919                     output_sign.push( 1 );
00920                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 6, 4 );
00921                     break;
00922                 case 11:  // 0=2,0>4
00923                     output_tets.push( SimplexTemplateRefiner::templates + 446 );
00924                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[5] );
00925                     output_sign.push( 1 );
00926                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 6, 5 );
00927                     break;
00928                 case 13:  // 2>0,0=4
00929                     output_tets.push( SimplexTemplateRefiner::templates + 475 );
00930                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00931                     output_sign.push( 1 );
00932                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 6, 6 );
00933                     break;
00934                 case 7:  // 4>0,0=2
00935                     output_tets.push( SimplexTemplateRefiner::templates + 475 );
00936                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[5] );
00937                     output_sign.push( 1 );
00938                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 6, 7 );
00939                     break;
00940                 case 15:  // 0=4,0=2
00941                     output_tets.push( SimplexTemplateRefiner::templates + 504 );
00942                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00943                     output_sign.push( 1 );
00944                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 6, 8 );
00945                     break;
00946             }
00947             break;
00948         case 8:  // Ruprecht-Müller Case 4a
00949             comparison_bits = ( permlen[4] <= permlen[5] ? 1 : 0 ) | ( permlen[4] >= permlen[5] ? 2 : 0 ) |
00950                               ( permlen[3] <= permlen[4] ? 4 : 0 ) | ( permlen[3] >= permlen[4] ? 8 : 0 ) | 0;
00951             if( ( comparison_bits & 3 ) == 3 )
00952             {
00953                 // Compute face point and tag
00954                 for( int i = 0; i < 6; ++i )
00955                 {
00956                     permuted_coords[12][i] =
00957                         ( permuted_coords[1][i] + permuted_coords[2][i] ) * .375 + permuted_coords[3][i] * .25;
00958                 }
00959                 ( *this->tag_assigner )( permuted_tags[1], permuted_tags[2], permuted_tags[3], permuted_tags[12] );
00960                 permuted_hash[12] = ( *this->output_functor )( permuted_hash[1], permuted_hash[2], permuted_hash[3],
00961                                                                permuted_coords[12], permuted_tags[12] );
00962             }
00963             if( ( comparison_bits & 12 ) == 12 )
00964             {
00965                 // Compute face point and tag
00966                 for( int i = 0; i < 6; ++i )
00967                 {
00968                     permuted_coords[11][i] =
00969                         ( permuted_coords[0][i] + permuted_coords[1][i] ) * .375 + permuted_coords[3][i] * .25;
00970                 }
00971                 ( *this->tag_assigner )( permuted_tags[0], permuted_tags[1], permuted_tags[3], permuted_tags[11] );
00972                 permuted_hash[11] = ( *this->output_functor )( permuted_hash[0], permuted_hash[1], permuted_hash[3],
00973                                                                permuted_coords[11], permuted_tags[11] );
00974             }
00975             MB_TESSELLATOR_INCR_CASE_COUNT( 7 );
00976             output_tets.push( SimplexTemplateRefiner::templates + 545 );
00977             output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00978             output_sign.push( 1 );
00979             MB_TESSELLATOR_INCR_SUBCASE_COUNT( 7, 0 );
00980             switch( comparison_bits )
00981             {
00982                 case 5:  // 5>4>3
00983                     output_tets.push( SimplexTemplateRefiner::templates + 554 );
00984                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00985                     output_sign.push( 1 );
00986                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 7, 1 );
00987                     break;
00988                 case 10:  // 3>4>5
00989                     output_tets.push( SimplexTemplateRefiner::templates + 554 );
00990                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[13] );
00991                     output_sign.push( -1 );
00992                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 7, 2 );
00993                     break;
00994                 case 6:  // 3<4>5
00995                     output_tets.push( SimplexTemplateRefiner::templates + 571 );
00996                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
00997                     output_sign.push( 1 );
00998                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 7, 3 );
00999                     break;
01000                 case 9:  // 3>4<5
01001                     output_tets.push( SimplexTemplateRefiner::templates + 588 );
01002                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
01003                     output_sign.push( 1 );
01004                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 7, 4 );
01005                     break;
01006                 case 14:  // 3=4>5
01007                     output_tets.push( SimplexTemplateRefiner::templates + 605 );
01008                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
01009                     output_sign.push( 1 );
01010                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 7, 5 );
01011                     break;
01012                 case 7:  // 4=5,4>3
01013                     output_tets.push( SimplexTemplateRefiner::templates + 605 );
01014                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[13] );
01015                     output_sign.push( -1 );
01016                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 7, 6 );
01017                     break;
01018                 case 13:  // 5>4,3=4
01019                     output_tets.push( SimplexTemplateRefiner::templates + 630 );
01020                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
01021                     output_sign.push( 1 );
01022                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 7, 7 );
01023                     break;
01024                 case 11:  // 3>4=5
01025                     output_tets.push( SimplexTemplateRefiner::templates + 630 );
01026                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[13] );
01027                     output_sign.push( -1 );
01028                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 7, 8 );
01029                     break;
01030                 case 15:  // 3=4=5
01031                     output_tets.push( SimplexTemplateRefiner::templates + 655 );
01032                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
01033                     output_sign.push( 1 );
01034                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 7, 9 );
01035                     break;
01036             }
01037             break;
01038         case 9:  // Ruprecht-Müller Case 4b
01039             comparison_bits = ( permlen[1] <= permlen[2] ? 1 : 0 ) | ( permlen[1] >= permlen[2] ? 2 : 0 ) |
01040                               ( permlen[2] <= permlen[3] ? 4 : 0 ) | ( permlen[2] >= permlen[3] ? 8 : 0 ) |
01041                               ( permlen[3] <= permlen[4] ? 16 : 0 ) | ( permlen[3] >= permlen[4] ? 32 : 0 ) |
01042                               ( permlen[1] <= permlen[4] ? 64 : 0 ) | ( permlen[1] >= permlen[4] ? 128 : 0 ) | 0;
01043             if( ( comparison_bits & 3 ) == 3 )
01044             {
01045                 // Compute face point and tag
01046                 for( int i = 0; i < 6; ++i )
01047                 {
01048                     permuted_coords[10][i] =
01049                         ( permuted_coords[1][i] + permuted_coords[0][i] ) * .375 + permuted_coords[2][i] * .25;
01050                 }
01051                 ( *this->tag_assigner )( permuted_tags[1], permuted_tags[0], permuted_tags[2], permuted_tags[10] );
01052                 permuted_hash[10] = ( *this->output_functor )( permuted_hash[1], permuted_hash[0], permuted_hash[2],
01053                                                                permuted_coords[10], permuted_tags[10] );
01054             }
01055             if( ( comparison_bits & 12 ) == 12 )
01056             {
01057                 // Compute face point and tag
01058                 for( int i = 0; i < 6; ++i )
01059                 {
01060                     permuted_coords[13][i] =
01061                         ( permuted_coords[2][i] + permuted_coords[3][i] ) * .375 + permuted_coords[0][i] * .25;
01062                 }
01063                 ( *this->tag_assigner )( permuted_tags[2], permuted_tags[3], permuted_tags[0], permuted_tags[13] );
01064                 permuted_hash[13] = ( *this->output_functor )( permuted_hash[2], permuted_hash[3], permuted_hash[0],
01065                                                                permuted_coords[13], permuted_tags[13] );
01066             }
01067             if( ( comparison_bits & 48 ) == 48 )
01068             {
01069                 // Compute face point and tag
01070                 for( int i = 0; i < 6; ++i )
01071                 {
01072                     permuted_coords[11][i] =
01073                         ( permuted_coords[0][i] + permuted_coords[1][i] ) * .375 + permuted_coords[3][i] * .25;
01074                 }
01075                 ( *this->tag_assigner )( permuted_tags[0], permuted_tags[1], permuted_tags[3], permuted_tags[11] );
01076                 permuted_hash[11] = ( *this->output_functor )( permuted_hash[0], permuted_hash[1], permuted_hash[3],
01077                                                                permuted_coords[11], permuted_tags[11] );
01078             }
01079             if( ( comparison_bits & 192 ) == 192 )
01080             {
01081                 // Compute face point and tag
01082                 for( int i = 0; i < 6; ++i )
01083                 {
01084                     permuted_coords[12][i] =
01085                         ( permuted_coords[2][i] + permuted_coords[3][i] ) * .375 + permuted_coords[1][i] * .25;
01086                 }
01087                 ( *this->tag_assigner )( permuted_tags[2], permuted_tags[3], permuted_tags[1], permuted_tags[12] );
01088                 permuted_hash[12] = ( *this->output_functor )( permuted_hash[2], permuted_hash[3], permuted_hash[1],
01089                                                                permuted_coords[12], permuted_tags[12] );
01090             }
01091             MB_TESSELLATOR_INCR_CASE_COUNT( 8 );
01092             switch( comparison_bits )
01093             {
01094                 case 85:  // 2>1,3>2,4>3,4>1
01095                     output_tets.push( SimplexTemplateRefiner::templates + 688 );
01096                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
01097                     output_sign.push( 1 );
01098                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 0 );
01099                     break;
01100                 case 102:  // 1>2,3>2,3>4,4>1
01101                     output_tets.push( SimplexTemplateRefiner::templates + 688 );
01102                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[14] );
01103                     output_sign.push( -1 );
01104                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 1 );
01105                     break;
01106                 case 170:  // 1>2,2>3,3>4,1>4
01107                     output_tets.push( SimplexTemplateRefiner::templates + 688 );
01108                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[15] );
01109                     output_sign.push( -1 );
01110                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 2 );
01111                     break;
01112                 case 153:  // 2>1,2>3,4>3,1>4
01113                     output_tets.push( SimplexTemplateRefiner::templates + 688 );
01114                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[5] );
01115                     output_sign.push( 1 );
01116                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 3 );
01117                     break;
01118                 case 90:  // 1>2,2>3,4>3,4>1
01119                     output_tets.push( SimplexTemplateRefiner::templates + 688 );
01120                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[9] );
01121                     output_sign.push( 1 );
01122                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 4 );
01123                     break;
01124                 case 105:  // 2>1,2>3,3>4,4>1
01125                     output_tets.push( SimplexTemplateRefiner::templates + 688 );
01126                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[7] );
01127                     output_sign.push( 1 );
01128                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 5 );
01129                     break;
01130                 case 165:  // 2>1,3>2,3>4,1>4
01131                     output_tets.push( SimplexTemplateRefiner::templates + 688 );
01132                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[19] );
01133                     output_sign.push( -1 );
01134                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 6 );
01135                     break;
01136                 case 150:  // 1>2,3>2,4>3,1>4
01137                     output_tets.push( SimplexTemplateRefiner::templates + 688 );
01138                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[23] );
01139                     output_sign.push( -1 );
01140                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 7 );
01141                     break;
01142                 case 101:  // 2>1,3>2,3>4,4>1
01143                 {
01144                     int alternates[] = { 713, 738, -1 };
01145                     output_tets.push( SimplexTemplateRefiner::templates +
01146                                       this->best_tets( alternates, permuted_coords, 0, 1 ) );
01147                 }
01148                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
01149                     output_sign.push( 1 );
01150                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 8 );
01151                     break;
01152                 case 86:  // 1>2,3>2,4>3,4>1
01153                 {
01154                     int alternates[] = { 713, 738, -1 };
01155                     output_tets.push( SimplexTemplateRefiner::templates +
01156                                       this->best_tets( alternates, permuted_coords, 14, -1 ) );
01157                 }
01158                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[14] );
01159                     output_sign.push( -1 );
01160                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 9 );
01161                     break;
01162                 case 154:  // 1>2,2>3,4>3,1>4
01163                 {
01164                     int alternates[] = { 713, 738, -1 };
01165                     output_tets.push( SimplexTemplateRefiner::templates +
01166                                       this->best_tets( alternates, permuted_coords, 5, 1 ) );
01167                 }
01168                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[5] );
01169                     output_sign.push( 1 );
01170                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 10 );
01171                     break;
01172                 case 169:  // 2>1,2>3,3>4,1>4
01173                 {
01174                     int alternates[] = { 713, 738, -1 };
01175                     output_tets.push( SimplexTemplateRefiner::templates +
01176                                       this->best_tets( alternates, permuted_coords, 15, -1 ) );
01177                 }
01178                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[15] );
01179                     output_sign.push( -1 );
01180                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 11 );
01181                     break;
01182                 case 89:  // 2>1,2>3,4>3,4>1
01183                     output_tets.push( SimplexTemplateRefiner::templates + 763 );
01184                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
01185                     output_sign.push( 1 );
01186                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 12 );
01187                     break;
01188                 case 166:  // 1>2,3>2,3>4,1>4
01189                     output_tets.push( SimplexTemplateRefiner::templates + 763 );
01190                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[15] );
01191                     output_sign.push( -1 );
01192                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 13 );
01193                     break;
01194                 case 103:  // 1=2,3>2,3>4,4>1
01195                     output_tets.push( SimplexTemplateRefiner::templates + 788 );
01196                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
01197                     output_sign.push( 1 );
01198                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 14 );
01199                     break;
01200                 case 87:  // 1=2,3>2,4>3,4>1
01201                     output_tets.push( SimplexTemplateRefiner::templates + 788 );
01202                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[14] );
01203                     output_sign.push( -1 );
01204                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 15 );
01205                     break;
01206                 case 185:  // 2>1,2>3,3=4,1>4
01207                     output_tets.push( SimplexTemplateRefiner::templates + 788 );
01208                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[15] );
01209                     output_sign.push( -1 );
01210                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 16 );
01211                     break;
01212                 case 186:  // 1>2,2>3,3=4,1>4
01213                     output_tets.push( SimplexTemplateRefiner::templates + 788 );
01214                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[5] );
01215                     output_sign.push( 1 );
01216                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 17 );
01217                     break;
01218                 case 158:  // 1>2,2=3,4>3,1>4
01219                     output_tets.push( SimplexTemplateRefiner::templates + 788 );
01220                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[9] );
01221                     output_sign.push( 1 );
01222                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 18 );
01223                     break;
01224                 case 229:  // 2>1,3>2,3>4,1=4
01225                     output_tets.push( SimplexTemplateRefiner::templates + 788 );
01226                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[7] );
01227                     output_sign.push( 1 );
01228                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 19 );
01229                     break;
01230                 case 233:  // 2>1,2>3,3>4,1=4
01231                     output_tets.push( SimplexTemplateRefiner::templates + 788 );
01232                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[19] );
01233                     output_sign.push( -1 );
01234                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 20 );
01235                     break;
01236                 case 94:  // 1>2,2=3,4>3,4>1
01237                     output_tets.push( SimplexTemplateRefiner::templates + 788 );
01238                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[23] );
01239                     output_sign.push( -1 );
01240                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 21 );
01241                     break;
01242                 case 155:  // 1=2,2>3,4>3,1>4
01243                     output_tets.push( SimplexTemplateRefiner::templates + 825 );
01244                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
01245                     output_sign.push( 1 );
01246                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 22 );
01247                     break;
01248                 case 171:  // 1=2,2>3,3>4,1>4
01249                     output_tets.push( SimplexTemplateRefiner::templates + 825 );
01250                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[14] );
01251                     output_sign.push( -1 );
01252                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 23 );
01253                     break;
01254                 case 118:  // 1>2,3>2,3=4,4>1
01255                     output_tets.push( SimplexTemplateRefiner::templates + 825 );
01256                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[15] );
01257                     output_sign.push( -1 );
01258                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 24 );
01259                     break;
01260                 case 117:  // 2>1,3>2,3=4,4>1
01261                     output_tets.push( SimplexTemplateRefiner::templates + 825 );
01262                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[5] );
01263                     output_sign.push( 1 );
01264                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 25 );
01265                     break;
01266                 case 109:  // 2>1,2=3,3>4,4>1
01267                     output_tets.push( SimplexTemplateRefiner::templates + 825 );
01268                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[9] );
01269                     output_sign.push( 1 );
01270                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 26 );
01271                     break;
01272                 case 218:  // 1>2,2>3,4>3,1=4
01273                     output_tets.push( SimplexTemplateRefiner::templates + 825 );
01274                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[7] );
01275                     output_sign.push( 1 );
01276                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 27 );
01277                     break;
01278                 case 214:  // 1>2,3>2,4>3,1=4
01279                     output_tets.push( SimplexTemplateRefiner::templates + 825 );
01280                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[19] );
01281                     output_sign.push( -1 );
01282                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 28 );
01283                     break;
01284                 case 173:  // 2>1,2=3,3>4,1>4
01285                     output_tets.push( SimplexTemplateRefiner::templates + 825 );
01286                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[23] );
01287                     output_sign.push( -1 );
01288                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 29 );
01289                     break;
01290                 case 91:  // 1=2,2>3,4>3,4>1
01291                     output_tets.push( SimplexTemplateRefiner::templates + 862 );
01292                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
01293                     output_sign.push( 1 );
01294                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 30 );
01295                     break;
01296                 case 167:  // 1=2,3>2,3>4,1>4
01297                     output_tets.push( SimplexTemplateRefiner::templates + 862 );
01298                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[14] );
01299                     output_sign.push( -1 );
01300                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 31 );
01301                     break;
01302                 case 182:  // 1>2,3>2,3=4,1>4
01303                     output_tets.push( SimplexTemplateRefiner::templates + 862 );
01304                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[15] );
01305                     output_sign.push( -1 );
01306                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 32 );
01307                     break;
01308                 case 121:  // 2>1,2>3,3=4,4>1
01309                     output_tets.push( SimplexTemplateRefiner::templates + 862 );
01310                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[5] );
01311                     output_sign.push( 1 );
01312                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 33 );
01313                     break;
01314                 case 93:  // 2>1,2=3,4>3,4>1
01315                     output_tets.push( SimplexTemplateRefiner::templates + 862 );
01316                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[9] );
01317                     output_sign.push( 1 );
01318                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 34 );
01319                     break;
01320                 case 217:  // 2>1,2>3,4>3,1=4
01321                     output_tets.push( SimplexTemplateRefiner::templates + 862 );
01322                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[7] );
01323                     output_sign.push( 1 );
01324                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 35 );
01325                     break;
01326                 case 230:  // 1>2,3>2,3>4,1=4
01327                     output_tets.push( SimplexTemplateRefiner::templates + 862 );
01328                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[19] );
01329                     output_sign.push( -1 );
01330                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 36 );
01331                     break;
01332                 case 174:  // 1>2,2=3,3>4,1>4
01333                     output_tets.push( SimplexTemplateRefiner::templates + 862 );
01334                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[23] );
01335                     output_sign.push( -1 );
01336                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 37 );
01337                     break;
01338                 case 119:  // 1=2,3>2,3=4,4>1
01339                     output_tets.push( SimplexTemplateRefiner::templates + 899 );
01340                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
01341                     output_sign.push( 1 );
01342                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 38 );
01343                     break;
01344                 case 187:  // 1=2>3=4,1>4
01345                     output_tets.push( SimplexTemplateRefiner::templates + 899 );
01346                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[15] );
01347                     output_sign.push( -1 );
01348                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 39 );
01349                     break;
01350                 case 222:  // 1>2,2=3,4>3,1=4
01351                     output_tets.push( SimplexTemplateRefiner::templates + 899 );
01352                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[9] );
01353                     output_sign.push( 1 );
01354                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 40 );
01355                     break;
01356                 case 237:  // 2>1,2=3,3>4,1=4
01357                     output_tets.push( SimplexTemplateRefiner::templates + 899 );
01358                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[7] );
01359                     output_sign.push( 1 );
01360                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 41 );
01361                     break;
01362                 case 95:  // 4>1=2=3,4>3
01363                     output_tets.push( SimplexTemplateRefiner::templates + 944 );
01364                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
01365                     output_sign.push( 1 );
01366                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 42 );
01367                     break;
01368                 case 231:  // 1=2,3>2,3>4,1=4
01369                     output_tets.push( SimplexTemplateRefiner::templates + 944 );
01370                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[14] );
01371                     output_sign.push( -1 );
01372                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 43 );
01373                     break;
01374                 case 190:  // 1>2=3=4,1>4
01375                     output_tets.push( SimplexTemplateRefiner::templates + 944 );
01376                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[15] );
01377                     output_sign.push( -1 );
01378                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 44 );
01379                     break;
01380                 case 249:  // 2>1,2>3,3=4,1=4
01381                     output_tets.push( SimplexTemplateRefiner::templates + 944 );
01382                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[5] );
01383                     output_sign.push( 1 );
01384                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 45 );
01385                     break;
01386                 case 175:  // 1=2=3>4,1>4
01387                     output_tets.push( SimplexTemplateRefiner::templates + 993 );
01388                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
01389                     output_sign.push( 1 );
01390                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 46 );
01391                     break;
01392                 case 219:  // 1=2>3,4>3,1=4
01393                     output_tets.push( SimplexTemplateRefiner::templates + 993 );
01394                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[14] );
01395                     output_sign.push( -1 );
01396                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 47 );
01397                     break;
01398                 case 125:  // 2>1,2=3=4>1
01399                     output_tets.push( SimplexTemplateRefiner::templates + 993 );
01400                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[15] );
01401                     output_sign.push( -1 );
01402                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 48 );
01403                     break;
01404                 case 246:  // 1>2,3>2,3=4=1
01405                     output_tets.push( SimplexTemplateRefiner::templates + 993 );
01406                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[5] );
01407                     output_sign.push( 1 );
01408                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 49 );
01409                     break;
01410                 case 255:  // 1=2=3=4=1
01411                     output_tets.push( SimplexTemplateRefiner::templates + 1042 );
01412                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
01413                     output_sign.push( 1 );
01414                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 8, 50 );
01415                     break;
01416             }
01417             break;
01418         case 10:  // Ruprecht-Müller Case 5
01419             comparison_bits = ( permlen[1] <= permlen[2] ? 1 : 0 ) | ( permlen[1] >= permlen[2] ? 2 : 0 ) |
01420                               ( permlen[3] <= permlen[4] ? 4 : 0 ) | ( permlen[3] >= permlen[4] ? 8 : 0 ) | 0;
01421             if( ( comparison_bits & 3 ) == 3 )
01422             {
01423                 // Compute face point and tag
01424                 for( int i = 0; i < 6; ++i )
01425                 {
01426                     permuted_coords[10][i] =
01427                         ( permuted_coords[1][i] + permuted_coords[0][i] ) * .375 + permuted_coords[2][i] * .25;
01428                 }
01429                 ( *this->tag_assigner )( permuted_tags[1], permuted_tags[0], permuted_tags[2], permuted_tags[10] );
01430                 permuted_hash[10] = ( *this->output_functor )( permuted_hash[1], permuted_hash[0], permuted_hash[2],
01431                                                                permuted_coords[10], permuted_tags[10] );
01432             }
01433             if( ( comparison_bits & 12 ) == 12 )
01434             {
01435                 // Compute face point and tag
01436                 for( int i = 0; i < 6; ++i )
01437                 {
01438                     permuted_coords[11][i] =
01439                         ( permuted_coords[0][i] + permuted_coords[1][i] ) * .375 + permuted_coords[3][i] * .25;
01440                 }
01441                 ( *this->tag_assigner )( permuted_tags[0], permuted_tags[1], permuted_tags[3], permuted_tags[11] );
01442                 permuted_hash[11] = ( *this->output_functor )( permuted_hash[0], permuted_hash[1], permuted_hash[3],
01443                                                                permuted_coords[11], permuted_tags[11] );
01444             }
01445             MB_TESSELLATOR_INCR_CASE_COUNT( 9 );
01446             output_tets.push( SimplexTemplateRefiner::templates + 1107 );
01447             output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
01448             output_sign.push( 1 );
01449             MB_TESSELLATOR_INCR_SUBCASE_COUNT( 9, 0 );
01450             switch( comparison_bits )
01451             {
01452                 case 10:  // 1>2,3>4
01453                     output_tets.push( SimplexTemplateRefiner::templates + 1116 );
01454                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
01455                     output_sign.push( 1 );
01456                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 9, 1 );
01457                     break;
01458                 case 5:  // 2>1,4>3
01459                     output_tets.push( SimplexTemplateRefiner::templates + 1116 );
01460                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[14] );
01461                     output_sign.push( -1 );
01462                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 9, 2 );
01463                     break;
01464                 case 6:  // 1>2,4>3
01465                 {
01466                     int alternates[] = { 1137, 1158, -1 };
01467                     output_tets.push( SimplexTemplateRefiner::templates +
01468                                       this->best_tets( alternates, permuted_coords, 0, 1 ) );
01469                 }
01470                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
01471                     output_sign.push( 1 );
01472                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 9, 3 );
01473                     break;
01474                 case 9:  // 2>1,3>4
01475                 {
01476                     int alternates[] = { 1137, 1158, -1 };
01477                     output_tets.push( SimplexTemplateRefiner::templates +
01478                                       this->best_tets( alternates, permuted_coords, 14, -1 ) );
01479                 }
01480                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[14] );
01481                     output_sign.push( -1 );
01482                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 9, 4 );
01483                     break;
01484                 case 11:  // 1=2,3>4
01485                 {
01486                     int alternates[] = { 1179, 1212, 1245, -1 };
01487                     output_tets.push( SimplexTemplateRefiner::templates +
01488                                       this->best_tets( alternates, permuted_coords, 0, 1 ) );
01489                 }
01490                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
01491                     output_sign.push( 1 );
01492                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 9, 5 );
01493                     break;
01494                 case 7:  // 1=2,4>3
01495                 {
01496                     int alternates[] = { 1179, 1212, 1245, -1 };
01497                     output_tets.push( SimplexTemplateRefiner::templates +
01498                                       this->best_tets( alternates, permuted_coords, 14, -1 ) );
01499                 }
01500                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[14] );
01501                     output_sign.push( -1 );
01502                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 9, 6 );
01503                     break;
01504                 case 14:  // 3=4,1>2
01505                 {
01506                     int alternates[] = { 1179, 1212, 1245, -1 };
01507                     output_tets.push( SimplexTemplateRefiner::templates +
01508                                       this->best_tets( alternates, permuted_coords, 5, 1 ) );
01509                 }
01510                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[5] );
01511                     output_sign.push( 1 );
01512                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 9, 7 );
01513                     break;
01514                 case 13:  // 3=4,2>1
01515                 {
01516                     int alternates[] = { 1179, 1212, 1245, -1 };
01517                     output_tets.push( SimplexTemplateRefiner::templates +
01518                                       this->best_tets( alternates, permuted_coords, 15, -1 ) );
01519                 }
01520                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[15] );
01521                     output_sign.push( -1 );
01522                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 9, 8 );
01523                     break;
01524                 case 15:  // 1=2,3=4
01525                     output_tets.push( SimplexTemplateRefiner::templates + 1278 );
01526                     output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
01527                     output_sign.push( 1 );
01528                     MB_TESSELLATOR_INCR_SUBCASE_COUNT( 9, 9 );
01529                     break;
01530             }
01531             break;
01532         case 11:  // Ruprecht-Müller Case 6
01533             MB_TESSELLATOR_INCR_CASE_COUNT( 10 );
01534             output_tets.push( SimplexTemplateRefiner::templates + 1319 );
01535             output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
01536             output_sign.push( 1 );
01537             MB_TESSELLATOR_INCR_SUBCASE_COUNT( 10, 0 );
01538             {
01539                 int alternates[] = { 1336, 1353, 1370, -1 };
01540                 output_tets.push( SimplexTemplateRefiner::templates +
01541                                   this->best_tets( alternates, permuted_coords, 0, 1 ) );
01542             }
01543             output_perm.push( SimplexTemplateRefiner::permutations_from_index[0] );
01544             output_sign.push( 1 );
01545             MB_TESSELLATOR_INCR_SUBCASE_COUNT( 10, 1 );
01546             break;
01547     }
01548 
01549     int* tets;
01550     int ntets;
01551     int* perm;
01552     int sgn;
01553 #ifdef MB_DEBUG_TESSELLATOR
01554     if( output_tets.empty() ) { cout << "Argh! Case " << C << " Perm " << P << " has no output!" << endl; }
01555 #endif  // MB_DEBUG_TESSELLATOR
01556     while( !output_tets.empty() )
01557     {
01558         tets  = output_tets.top();
01559         ntets = *tets;
01560         tets++;
01561         perm = output_perm.top();
01562         sgn  = output_sign.top();
01563 
01564         output_tets.pop();
01565         output_perm.pop();
01566         output_sign.pop();
01567 
01568         int t;
01569         if( sgn > 0 )
01570         {
01571             for( t = 0; t < ntets; ++t )
01572             {
01573                 this->refine_3_simplex( max_depth, permuted_coords[perm[tets[0]]], permuted_tags[perm[tets[0]]],
01574                                         permuted_hash[perm[tets[0]]], permuted_coords[perm[tets[1]]],
01575                                         permuted_tags[perm[tets[1]]], permuted_hash[perm[tets[1]]],
01576                                         permuted_coords[perm[tets[2]]], permuted_tags[perm[tets[2]]],
01577                                         permuted_hash[perm[tets[2]]], permuted_coords[perm[tets[3]]],
01578                                         permuted_tags[perm[tets[3]]], permuted_hash[perm[tets[3]]] );
01579                 tets += 4;
01580             }
01581         }
01582         else
01583         {
01584             // we have an inverted tet... reverse the first 2 vertices
01585             // so the orientation is positive.
01586             for( t = 0; t < ntets; ++t )
01587             {
01588                 this->refine_3_simplex( max_depth, permuted_coords[perm[tets[1]]], permuted_tags[perm[tets[1]]],
01589                                         permuted_hash[perm[tets[1]]], permuted_coords[perm[tets[0]]],
01590                                         permuted_tags[perm[tets[0]]], permuted_hash[perm[tets[0]]],
01591                                         permuted_coords[perm[tets[2]]], permuted_tags[perm[tets[2]]],
01592                                         permuted_hash[perm[tets[2]]], permuted_coords[perm[tets[3]]],
01593                                         permuted_tags[perm[tets[3]]], permuted_hash[perm[tets[3]]] );
01594                 tets += 4;
01595             }
01596         }
01597     }
01598 
01599     return true;
01600 }
01601 
01602 /**\brief This is used by refine_entity to assign parametric coordinates to corners of each element.
01603  */
01604 void SimplexTemplateRefiner::assign_parametric_coordinates( int num_nodes, const double* src, double* tgt )
01605 {
01606     for( int i = 0; i < num_nodes; ++i, src += 3, tgt += 6 )
01607         for( int j = 0; j < 3; ++j )
01608             tgt[j] = src[j];
01609 }
01610 
01611 /**\brief Returns true if || a0a1 || < || b0b1 ||
01612  *
01613  * We use this to test which triangulation has the best
01614  * aspect ratio when there are 2 to choose from.
01615  */
01616 bool SimplexTemplateRefiner::compare_Hopf_cross_string_dist( const double* a0, const double* a1, const double* b0,
01617                                                              const double* b1 )
01618 {
01619     double sq_mag_a = 0.;
01620     double sq_mag_b = 0.;
01621     for( int i = 0; i < 3; ++i )
01622     {
01623         double tmp;
01624         tmp = a0[i] - a1[i];
01625         sq_mag_a += tmp * tmp;
01626         tmp = b0[i] - b1[i];
01627         sq_mag_b += tmp * tmp;
01628     }
01629     return sq_mag_a < sq_mag_b;
01630 }
01631 
01632 /*
01633  * The array below is indexed by the edge code for a tetrahedron.
01634  * Looking up a row with a tet's edge code will return C and P.
01635  * C is a configuration number and P is a permutation index.
01636  *
01637  * C is based on the case number from Ruprecht and
01638  * Müller's (1998) paper on adaptive tetrahedra. (The case
01639  * numbers are shown to the left of the row in the column
01640  * labeled case. The only difference is that we introduce
01641  * a case 3d which is part of case 3c in the paper.)
01642  *
01643  * P is an index into the permutations_from_index array below,
01644  * and is used to transform the current tetrahedron into
01645  * the canonical configuration associated with C.
01646  *
01647  * The 6-digit binary number to the left (which is shown in
01648  * the horribly UNconventional LSB->MSB order) is the edge
01649  * code for the row. The 6 digits correspond to the 6 edges
01650  * of the tetrahedron; a '0' implies no subdivision while
01651  * a '1' implies subdivision should occur. The ordering of
01652  * the bits is
01653  *
01654  * Edge 0-1, Edge 1-2, Edge 2-0, Edge 0-3, Edge 1-3, Edge 2-3,
01655  *
01656  * where the numbers are vertices of the tetrahedron 0-1-2-3.
01657  * Note that Tet 0-1-2-3 must be positive (i.e., the plane
01658  * specified by Triangle 0-1-2 must have a normal pointing
01659  * towards vertex 3, and Triangle 0-1-2's normal must be
01660  * calculated using the cross-product (Edge 0-1) x (Edge 0-2)).
01661  *
01662  * ===========
01663  * References:
01664  * (Ruprect and Müller, 1998) A Scheme for Edge-based Adaptive
01665  *   Tetrahedron Subdivision, Mathematical Visualization (eds.
01666  *   Hege and Polthier), pp. 61--70. Springer-Verlag. 1998.
01667  */
01668 int SimplexTemplateRefiner::template_index[64][2] = {
01669     /*      code case      C    P */
01670     /* 000000  0  0  */ { 0, 0 },
01671     /* 100000  1  1  */ { 1, 0 },
01672     /* 010000  2  1  */ { 1, 1 },
01673     /* 110000  3  2a */ { 2, 0 },
01674     /* 001000  4  1  */ { 1, 2 },
01675     /* 101000  5  2a */ { 2, 2 },
01676     /* 011000  6  2a */ { 2, 1 },
01677     /* 111000  7  3b */ { 5, 11 },
01678     /* 000100  8  1  */ { 1, 10 },
01679     /* 100100  9  2a */ { 2, 5 },
01680     /* 010100 10  2b */ { 3, 1 },
01681     /* 110100 11  3c */ { 6, 0 },
01682     /* 001100 12  2a */ { 2, 10 },
01683     /* 101100 13  3a */ { 4, 0 },
01684     /* 011100 14  3d */ { 7, 2 },
01685     /* 111100 15  4a */ { 8, 6 },
01686     /* 000010 16  1  */ { 1, 6 },
01687     /* 100010 17  2a */ { 2, 4 },
01688     /* 010010 18  2a */ { 2, 8 },
01689     /* 110010 19  3a */ { 4, 1 },
01690     /* 001010 20  2b */ { 3, 2 },
01691     /* 101010 21  3d */ { 7, 0 },
01692     /* 011010 22  3c */ { 6, 1 },
01693     /* 111010 23  4a */ { 8, 9 },
01694     /* 000110 24  2a */ { 2, 3 },
01695     /* 100110 25  3b */ { 5, 0 },
01696     /* 010110 26  3d */ { 7, 4 },
01697     /* 110110 27  4a */ { 8, 11 },
01698     /* 001110 28  3c */ { 6, 10 },
01699     /* 101110 29  4a */ { 8, 7 },
01700     /* 011110 30  4b */ { 9, 0 },
01701     /* 111110 31  5  */ { 10, 7 },
01702     /* 000001 32  1  */ { 1, 7 },
01703     /* 100001 33  2b */ { 3, 0 },
01704     /* 010001 34  2a */ { 2, 7 },
01705     /* 110001 35  3d */ { 7, 1 },
01706     /* 001001 36  2a */ { 2, 11 },
01707     /* 101001 37  3c */ { 6, 2 },
01708     /* 011001 38  3a */ { 4, 2 },
01709     /* 111001 39  4a */ { 8, 3 },
01710     /* 000101 40  2a */ { 2, 9 },
01711     /* 100101 41  3d */ { 7, 10 },
01712     /* 010101 42  3c */ { 6, 7 },
01713     /* 110101 43  4b */ { 9, 2 },
01714     /* 001101 44  3b */ { 5, 7 },
01715     /* 101101 45  4a */ { 8, 8 },
01716     /* 011101 46  4a */ { 8, 4 },
01717     /* 111101 47  5  */ { 10, 6 },
01718     /* 000011 48  2a */ { 2, 6 },
01719     /* 100011 49  3c */ { 6, 4 },
01720     /* 010011 50  3b */ { 5, 1 },
01721     /* 110011 51  4a */ { 8, 10 },
01722     /* 001011 52  3d */ { 7, 7 },
01723     /* 101011 53  4b */ { 9, 1 },
01724     /* 011011 54  4a */ { 8, 5 },
01725     /* 111011 55  5  */ { 10, 10 },
01726     /* 000111 56  3a */ { 4, 10 },
01727     /* 100111 57  4a */ { 8, 1 },
01728     /* 010111 58  4a */ { 8, 2 },
01729     /* 110111 59  5  */ { 10, 2 },
01730     /* 001111 60  4a */ { 8, 0 },
01731     /* 101111 61  5  */ { 10, 1 },
01732     /* 011111 62  5  */ { 10, 0 },
01733     /* 111111 63  6  */ { 11, 0 },
01734 };
01735 
01736 /* Does this mean anything? If so, then you are either
01737  * superstitious or much more clever than I (or both?).
01738  */
01739 /* permutation index, P:  0  1  2  3  4  5  6  7  8  9 10 11 */
01740 /* number of references: 12  9  9  3  4  2  5  6  2  3  7  2 */
01741 
01742 /*
01743  * The array below is a list of all the _positive_
01744  * permutations of Tetrahedron 0-1-2-3. Given a
01745  * permutation index, it returns a row of 14 values:
01746  * these are the vertex numbers of the permuted
01747  * tetrahedron. The first 4 values are the permuted
01748  * corner indices, the next 6 values are the
01749  * permuted edge midpoint indices, and the final
01750  * entries reference mid-face points inserted
01751  * to maintain a compatible tetrahedralization.
01752  *
01753  * There are 24 entries, 6 for each of the 4 faces of
01754  * the tetrahedron.
01755  */
01756 int SimplexTemplateRefiner::permutations_from_index[24][14] = {
01757     /* corners      midpoints          face points   */
01758     /* POSITIVE ARRANGEMENTS                         */
01759     { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }, /* Face 0-1-2 */
01760     { 1, 2, 0, 3, 5, 6, 4, 8, 9, 7, 10, 12, 13, 11 },
01761     { 2, 0, 1, 3, 6, 4, 5, 9, 7, 8, 10, 13, 11, 12 },
01762 
01763     { 0, 3, 1, 2, 7, 8, 4, 6, 9, 5, 11, 13, 12, 10 }, /* Face 0-3-1 */
01764     { 3, 1, 0, 2, 8, 4, 7, 9, 5, 6, 11, 12, 10, 13 },
01765     { 1, 0, 3, 2, 4, 7, 8, 5, 6, 9, 11, 10, 13, 12 },
01766 
01767     { 1, 3, 2, 0, 8, 9, 5, 4, 7, 6, 12, 11, 13, 10 }, /* Face 1-3-2 */
01768     { 3, 2, 1, 0, 9, 5, 8, 7, 6, 4, 12, 13, 10, 11 },
01769     { 2, 1, 3, 0, 5, 8, 9, 6, 4, 7, 12, 10, 11, 13 },
01770 
01771     { 2, 3, 0, 1, 9, 7, 6, 5, 8, 4, 13, 12, 11, 10 }, /* Face 2-3-0 */
01772     { 3, 0, 2, 1, 7, 6, 9, 8, 4, 5, 13, 11, 10, 12 },
01773     { 0, 2, 3, 1, 6, 9, 7, 4, 5, 8, 13, 10, 12, 11 },
01774 
01775     /* NEGATIVE ARRANGEMENTS                         */
01776     { 0, 2, 1, 3, 6, 5, 4, 7, 9, 8, 10, 13, 12, 11 }, /* Face 0-1-2 */
01777     { 2, 1, 0, 3, 5, 4, 6, 9, 8, 7, 10, 12, 11, 13 },
01778     { 1, 0, 2, 3, 4, 6, 5, 8, 7, 9, 10, 11, 13, 12 },
01779 
01780     { 0, 1, 3, 2, 4, 8, 7, 6, 5, 9, 11, 10, 12, 13 }, /* Face 0-3-1 */
01781     { 1, 3, 0, 2, 8, 7, 4, 5, 9, 6, 11, 12, 13, 10 },
01782     { 3, 0, 1, 2, 7, 4, 8, 9, 6, 5, 11, 13, 10, 12 },
01783 
01784     { 1, 2, 3, 0, 5, 9, 8, 4, 6, 7, 12, 10, 13, 11 }, /* Face 1-3-2 */
01785     { 2, 3, 1, 0, 9, 8, 5, 6, 7, 4, 12, 13, 11, 10 },
01786     { 3, 1, 2, 0, 8, 5, 9, 7, 4, 6, 12, 11, 10, 13 },
01787 
01788     { 2, 0, 3, 1, 6, 7, 9, 5, 4, 8, 13, 10, 11, 12 }, /* Face 2-3-0 */
01789     { 0, 3, 2, 1, 7, 9, 6, 4, 8, 5, 13, 11, 12, 10 },
01790     { 3, 2, 0, 1, 9, 6, 7, 8, 5, 4, 13, 12, 10, 11 }
01791 };
01792 
01793 /*
01794  * Below is a list of output tetrahedra. The array is
01795  * generated by TessellatorGenerator.py
01796  * which also generates the code that references it.
01797  * Each set of tetrahedra begins with a single integer
01798  * that is the number of tetrahedra for that particular
01799  * case. It is followed by 5 integers for each output
01800  * tetrahedron; the first four numbers on each row are
01801  * indices of the output tetrahedron. The final number
01802  * is a bit vector specifying which edges of the
01803  * tetrahedron are internal to the parent tetrahedron
01804  * being decomposed.
01805  *
01806  * Multiple lists of output tetrahedra may be
01807  * combined to create the tessellation of a single
01808  * input tetrahedron.
01809  */
01810 
01811 int SimplexTemplateRefiner::templates[] = {
01812     // case 1_0
01813     2,
01814     0,
01815     4,
01816     2,
01817     3,
01818     4,
01819     1,
01820     2,
01821     3,
01822 
01823     // case 2a_0
01824     1,
01825     3,
01826     4,
01827     5,
01828     1,
01829 
01830     // case 2a, 0>1
01831     2,
01832     0,
01833     4,
01834     2,
01835     3,
01836     4,
01837     5,
01838     2,
01839     3,
01840 
01841     // case 2a, 0=1
01842     4,
01843     10,
01844     3,
01845     0,
01846     4,
01847     10,
01848     3,
01849     4,
01850     5,
01851     10,
01852     3,
01853     5,
01854     2,
01855     10,
01856     3,
01857     2,
01858     0,
01859 
01860     // case 2b_0
01861     4,
01862     0,
01863     4,
01864     9,
01865     3,
01866     4,
01867     1,
01868     9,
01869     3,
01870     0,
01871     4,
01872     2,
01873     9,
01874     4,
01875     1,
01876     2,
01877     9,
01878 
01879     // case 3a_0
01880     1,
01881     4,
01882     7,
01883     6,
01884     0,
01885 
01886     // case 3a, 0>2>3<0
01887     3,
01888     1,
01889     3,
01890     2,
01891     4,
01892     4,
01893     6,
01894     3,
01895     2,
01896     4,
01897     6,
01898     7,
01899     3,
01900 
01901     // case 3a, 0=2>3<0
01902     5,
01903     4,
01904     6,
01905     7,
01906     3,
01907     10,
01908     1,
01909     2,
01910     3,
01911     10,
01912     2,
01913     6,
01914     3,
01915     10,
01916     6,
01917     4,
01918     3,
01919     10,
01920     4,
01921     1,
01922     3,
01923 
01924     // case 3a, 3>0=2<3
01925     5,
01926     1,
01927     3,
01928     2,
01929     7,
01930     10,
01931     1,
01932     2,
01933     7,
01934     10,
01935     2,
01936     6,
01937     7,
01938     10,
01939     6,
01940     4,
01941     7,
01942     10,
01943     4,
01944     1,
01945     7,
01946 
01947     // case 3a, 0=2=3=0
01948     11,
01949     2,
01950     6,
01951     10,
01952     13,
01953     3,
01954     7,
01955     13,
01956     11,
01957     4,
01958     1,
01959     10,
01960     11,
01961     11,
01962     6,
01963     10,
01964     4,
01965     11,
01966     6,
01967     13,
01968     10,
01969     11,
01970     6,
01971     7,
01972     13,
01973     11,
01974     6,
01975     4,
01976     7,
01977     2,
01978     10,
01979     11,
01980     13,
01981     1,
01982     10,
01983     11,
01984     2,
01985     2,
01986     11,
01987     3,
01988     13,
01989     3,
01990     2,
01991     1,
01992     11,
01993 
01994     // case 3b_0
01995     4,
01996     0,
01997     7,
01998     4,
01999     2,
02000     4,
02001     7,
02002     8,
02003     2,
02004     4,
02005     8,
02006     1,
02007     2,
02008     7,
02009     3,
02010     8,
02011     2,
02012 
02013     // case 3c, 0>1,0>3
02014     5,
02015     4,
02016     2,
02017     7,
02018     5,
02019     4,
02020     2,
02021     0,
02022     7,
02023     4,
02024     3,
02025     1,
02026     5,
02027     4,
02028     3,
02029     5,
02030     7,
02031     3,
02032     5,
02033     7,
02034     2,
02035 
02036     // case 3c, 1>0,3>0
02037     5,
02038     0,
02039     5,
02040     2,
02041     7,
02042     0,
02043     5,
02044     7,
02045     4,
02046     7,
02047     1,
02048     4,
02049     5,
02050     7,
02051     1,
02052     5,
02053     3,
02054     3,
02055     5,
02056     7,
02057     2,
02058 
02059     // case 3c, 0>1,3>0
02060     5,
02061     4,
02062     2,
02063     7,
02064     5,
02065     4,
02066     2,
02067     0,
02068     7,
02069     7,
02070     1,
02071     4,
02072     5,
02073     7,
02074     1,
02075     5,
02076     3,
02077     3,
02078     5,
02079     7,
02080     2,
02081 
02082     // case 3c, 1>0,0>3
02083     5,
02084     0,
02085     5,
02086     2,
02087     7,
02088     0,
02089     5,
02090     7,
02091     4,
02092     4,
02093     3,
02094     1,
02095     5,
02096     4,
02097     3,
02098     5,
02099     7,
02100     3,
02101     5,
02102     7,
02103     2,
02104 
02105     // case 3c, 0=1,0>3
02106     7,
02107     4,
02108     1,
02109     5,
02110     3,
02111     10,
02112     0,
02113     4,
02114     7,
02115     10,
02116     2,
02117     0,
02118     7,
02119     10,
02120     7,
02121     4,
02122     3,
02123     10,
02124     2,
02125     7,
02126     3,
02127     10,
02128     5,
02129     2,
02130     3,
02131     10,
02132     4,
02133     5,
02134     3,
02135 
02136     // case 3c, 3>0,0=1
02137     7,
02138     7,
02139     1,
02140     5,
02141     3,
02142     7,
02143     5,
02144     2,
02145     3,
02146     10,
02147     0,
02148     4,
02149     7,
02150     10,
02151     2,
02152     0,
02153     7,
02154     10,
02155     5,
02156     2,
02157     7,
02158     10,
02159     4,
02160     5,
02161     7,
02162     1,
02163     5,
02164     4,
02165     7,
02166 
02167     // case 3c, 0=1,0=3
02168     10,
02169     4,
02170     1,
02171     5,
02172     11,
02173     11,
02174     1,
02175     5,
02176     3,
02177     10,
02178     0,
02179     4,
02180     7,
02181     10,
02182     2,
02183     0,
02184     7,
02185     10,
02186     5,
02187     2,
02188     3,
02189     10,
02190     2,
02191     7,
02192     3,
02193     10,
02194     7,
02195     4,
02196     11,
02197     10,
02198     7,
02199     11,
02200     3,
02201     10,
02202     4,
02203     5,
02204     11,
02205     10,
02206     11,
02207     5,
02208     3,
02209 
02210     // case 3d, 0>4,0>2
02211     5,
02212     4,
02213     3,
02214     6,
02215     0,
02216     4,
02217     3,
02218     8,
02219     6,
02220     4,
02221     2,
02222     8,
02223     1,
02224     4,
02225     2,
02226     6,
02227     8,
02228     2,
02229     3,
02230     6,
02231     8,
02232 
02233     // case 3d, 4>0,2>0
02234     5,
02235     8,
02236     0,
02237     6,
02238     4,
02239     8,
02240     0,
02241     3,
02242     6,
02243     6,
02244     1,
02245     8,
02246     4,
02247     6,
02248     1,
02249     2,
02250     8,
02251     2,
02252     3,
02253     6,
02254     8,
02255 
02256     // case 3d, 0>4,2>0
02257     5,
02258     4,
02259     3,
02260     6,
02261     0,
02262     4,
02263     3,
02264     8,
02265     6,
02266     6,
02267     1,
02268     8,
02269     4,
02270     6,
02271     1,
02272     2,
02273     8,
02274     2,
02275     3,
02276     6,
02277     8,
02278 
02279     // case 3d, 4>0,0>2
02280     5,
02281     8,
02282     0,
02283     6,
02284     4,
02285     8,
02286     0,
02287     3,
02288     6,
02289     4,
02290     2,
02291     8,
02292     1,
02293     4,
02294     2,
02295     6,
02296     8,
02297     2,
02298     3,
02299     6,
02300     8,
02301 
02302     // case 3d, 0=4,0>2
02303     7,
02304     4,
02305     1,
02306     2,
02307     8,
02308     11,
02309     4,
02310     0,
02311     6,
02312     11,
02313     0,
02314     3,
02315     6,
02316     11,
02317     2,
02318     4,
02319     6,
02320     11,
02321     3,
02322     2,
02323     6,
02324     11,
02325     3,
02326     8,
02327     2,
02328     11,
02329     8,
02330     4,
02331     2,
02332 
02333     // case 3d, 2>0,0=4
02334     7,
02335     6,
02336     2,
02337     8,
02338     1,
02339     6,
02340     8,
02341     2,
02342     3,
02343     11,
02344     4,
02345     0,
02346     6,
02347     11,
02348     0,
02349     3,
02350     6,
02351     8,
02352     11,
02353     3,
02354     6,
02355     8,
02356     4,
02357     11,
02358     6,
02359     1,
02360     6,
02361     4,
02362     8,
02363 
02364     // case 3d, 0=4,0=2
02365     10,
02366     4,
02367     1,
02368     10,
02369     8,
02370     10,
02371     2,
02372     8,
02373     1,
02374     11,
02375     4,
02376     0,
02377     6,
02378     11,
02379     0,
02380     3,
02381     6,
02382     11,
02383     3,
02384     8,
02385     2,
02386     11,
02387     3,
02388     2,
02389     6,
02390     11,
02391     10,
02392     4,
02393     6,
02394     11,
02395     10,
02396     6,
02397     2,
02398     8,
02399     4,
02400     11,
02401     10,
02402     11,
02403     10,
02404     2,
02405     8,
02406 
02407     // case 4a_0
02408     2,
02409     7,
02410     8,
02411     9,
02412     3,
02413     7,
02414     9,
02415     8,
02416     6,
02417 
02418     // case 4a, 5>4>3
02419     4,
02420     8,
02421     0,
02422     6,
02423     1,
02424     8,
02425     0,
02426     7,
02427     6,
02428     9,
02429     1,
02430     6,
02431     2,
02432     9,
02433     1,
02434     8,
02435     6,
02436 
02437     // case 4a, 3<4>5
02438     4,
02439     8,
02440     0,
02441     6,
02442     1,
02443     8,
02444     0,
02445     7,
02446     6,
02447     8,
02448     2,
02449     6,
02450     9,
02451     8,
02452     2,
02453     1,
02454     6,
02455 
02456     // case 4a, 3>4<5
02457     4,
02458     6,
02459     9,
02460     8,
02461     1,
02462     6,
02463     9,
02464     1,
02465     2,
02466     6,
02467     7,
02468     0,
02469     1,
02470     6,
02471     7,
02472     1,
02473     8,
02474 
02475     // case 4a, 3=4>5
02476     6,
02477     6,
02478     7,
02479     0,
02480     11,
02481     6,
02482     0,
02483     1,
02484     11,
02485     6,
02486     7,
02487     11,
02488     8,
02489     6,
02490     11,
02491     1,
02492     8,
02493     1,
02494     2,
02495     6,
02496     8,
02497     2,
02498     6,
02499     8,
02500     9,
02501 
02502     // case 4a, 5>4,3=4
02503     6,
02504     6,
02505     7,
02506     0,
02507     11,
02508     6,
02509     0,
02510     1,
02511     11,
02512     6,
02513     7,
02514     11,
02515     8,
02516     6,
02517     11,
02518     1,
02519     8,
02520     1,
02521     2,
02522     6,
02523     9,
02524     1,
02525     6,
02526     8,
02527     9,
02528 
02529     // case 4a, 3=4=5
02530     8,
02531     6,
02532     7,
02533     0,
02534     11,
02535     6,
02536     0,
02537     1,
02538     11,
02539     6,
02540     7,
02541     11,
02542     8,
02543     6,
02544     11,
02545     1,
02546     8,
02547     6,
02548     1,
02549     2,
02550     12,
02551     6,
02552     2,
02553     9,
02554     12,
02555     6,
02556     9,
02557     8,
02558     12,
02559     6,
02560     8,
02561     1,
02562     12,
02563 
02564     // case 4b, 2>1,3>2,4>3,4>1
02565     6,
02566     6,
02567     8,
02568     1,
02569     5,
02570     6,
02571     8,
02572     0,
02573     1,
02574     6,
02575     8,
02576     7,
02577     0,
02578     6,
02579     8,
02580     2,
02581     7,
02582     7,
02583     8,
02584     2,
02585     3,
02586     6,
02587     8,
02588     5,
02589     2,
02590 
02591     // case 4b, 2>1,3>2,3>4,4>1
02592     6,
02593     6,
02594     8,
02595     1,
02596     5,
02597     6,
02598     8,
02599     7,
02600     1,
02601     6,
02602     7,
02603     0,
02604     1,
02605     8,
02606     7,
02607     3,
02608     2,
02609     6,
02610     8,
02611     5,
02612     2,
02613     6,
02614     8,
02615     2,
02616     7,
02617 
02618     // case 4b, 2>1,3>2,3>4,4>1, a
02619     6,
02620     7,
02621     8,
02622     1,
02623     5,
02624     6,
02625     5,
02626     7,
02627     1,
02628     6,
02629     7,
02630     0,
02631     1,
02632     8,
02633     7,
02634     3,
02635     2,
02636     7,
02637     8,
02638     5,
02639     2,
02640     6,
02641     5,
02642     2,
02643     7,
02644 
02645     // case 4b, 2>1,2>3,4>3,4>1
02646     6,
02647     6,
02648     8,
02649     5,
02650     2,
02651     6,
02652     8,
02653     2,
02654     3,
02655     6,
02656     8,
02657     3,
02658     7,
02659     6,
02660     8,
02661     7,
02662     0,
02663     6,
02664     8,
02665     0,
02666     1,
02667     6,
02668     8,
02669     1,
02670     5,
02671 
02672     // case 4b, 1=2,3>2,3>4,4>1
02673     9,
02674     10,
02675     6,
02676     0,
02677     7,
02678     10,
02679     1,
02680     5,
02681     8,
02682     10,
02683     0,
02684     1,
02685     7,
02686     10,
02687     7,
02688     1,
02689     8,
02690     6,
02691     7,
02692     10,
02693     8,
02694     6,
02695     10,
02696     5,
02697     8,
02698     6,
02699     2,
02700     7,
02701     8,
02702     6,
02703     5,
02704     2,
02705     8,
02706     7,
02707     8,
02708     2,
02709     3,
02710 
02711     // case 4b, 1=2,2>3,4>3,1>4
02712     9,
02713     10,
02714     6,
02715     0,
02716     7,
02717     10,
02718     1,
02719     5,
02720     8,
02721     10,
02722     0,
02723     1,
02724     8,
02725     10,
02726     7,
02727     0,
02728     8,
02729     6,
02730     7,
02731     10,
02732     8,
02733     6,
02734     10,
02735     5,
02736     8,
02737     6,
02738     3,
02739     7,
02740     8,
02741     6,
02742     5,
02743     3,
02744     8,
02745     6,
02746     5,
02747     2,
02748     3,
02749 
02750     // case 4b, 1=2,2>3,4>3,4>1
02751     9,
02752     10,
02753     6,
02754     0,
02755     7,
02756     10,
02757     1,
02758     5,
02759     8,
02760     10,
02761     0,
02762     1,
02763     8,
02764     10,
02765     7,
02766     0,
02767     8,
02768     6,
02769     7,
02770     10,
02771     8,
02772     6,
02773     10,
02774     5,
02775     8,
02776     6,
02777     3,
02778     7,
02779     8,
02780     6,
02781     5,
02782     2,
02783     8,
02784     6,
02785     2,
02786     3,
02787     8,
02788 
02789     // case 4b, 1=2,3>2,3=4,4>1
02790     11,
02791     10,
02792     6,
02793     0,
02794     7,
02795     10,
02796     1,
02797     5,
02798     8,
02799     10,
02800     0,
02801     1,
02802     11,
02803     10,
02804     11,
02805     1,
02806     8,
02807     10,
02808     0,
02809     11,
02810     7,
02811     10,
02812     7,
02813     11,
02814     8,
02815     6,
02816     7,
02817     10,
02818     8,
02819     6,
02820     10,
02821     5,
02822     8,
02823     6,
02824     2,
02825     7,
02826     8,
02827     6,
02828     5,
02829     2,
02830     8,
02831     7,
02832     8,
02833     2,
02834     3,
02835 
02836     // case 4b, 4>1=2=3,4>3
02837     12,
02838     10,
02839     6,
02840     0,
02841     7,
02842     10,
02843     1,
02844     5,
02845     8,
02846     10,
02847     0,
02848     1,
02849     8,
02850     10,
02851     7,
02852     0,
02853     8,
02854     13,
02855     6,
02856     2,
02857     5,
02858     13,
02859     3,
02860     7,
02861     8,
02862     13,
02863     2,
02864     3,
02865     8,
02866     13,
02867     2,
02868     8,
02869     5,
02870     6,
02871     7,
02872     10,
02873     8,
02874     6,
02875     10,
02876     5,
02877     8,
02878     6,
02879     13,
02880     7,
02881     8,
02882     6,
02883     5,
02884     13,
02885     8,
02886 
02887     // case 4b, 1=2=3>4,1>4
02888     12,
02889     10,
02890     6,
02891     0,
02892     7,
02893     10,
02894     1,
02895     5,
02896     8,
02897     10,
02898     0,
02899     1,
02900     7,
02901     10,
02902     7,
02903     1,
02904     8,
02905     13,
02906     6,
02907     2,
02908     5,
02909     13,
02910     3,
02911     7,
02912     8,
02913     13,
02914     2,
02915     3,
02916     5,
02917     13,
02918     3,
02919     8,
02920     5,
02921     6,
02922     7,
02923     10,
02924     8,
02925     6,
02926     10,
02927     5,
02928     8,
02929     6,
02930     13,
02931     7,
02932     8,
02933     6,
02934     5,
02935     13,
02936     8,
02937 
02938     // case 4b, 1=2=3=4=1
02939     16,
02940     10,
02941     6,
02942     0,
02943     7,
02944     10,
02945     1,
02946     5,
02947     8,
02948     10,
02949     0,
02950     1,
02951     11,
02952     10,
02953     11,
02954     1,
02955     8,
02956     10,
02957     0,
02958     11,
02959     7,
02960     10,
02961     7,
02962     11,
02963     8,
02964     13,
02965     6,
02966     2,
02967     5,
02968     13,
02969     3,
02970     7,
02971     8,
02972     13,
02973     2,
02974     3,
02975     12,
02976     13,
02977     2,
02978     12,
02979     5,
02980     13,
02981     12,
02982     3,
02983     8,
02984     13,
02985     12,
02986     5,
02987     8,
02988     6,
02989     7,
02990     10,
02991     8,
02992     6,
02993     10,
02994     5,
02995     8,
02996     6,
02997     5,
02998     13,
02999     8,
03000     6,
03001     13,
03002     7,
03003     8,
03004 
03005     // case 5_0
03006     2,
03007     7,
03008     8,
03009     9,
03010     3,
03011     6,
03012     5,
03013     2,
03014     9,
03015 
03016     // case 5, 1>2,3>4
03017     5,
03018     5,
03019     7,
03020     1,
03021     8,
03022     5,
03023     7,
03024     0,
03025     1,
03026     5,
03027     7,
03028     6,
03029     0,
03030     5,
03031     7,
03032     9,
03033     6,
03034     5,
03035     7,
03036     8,
03037     9,
03038 
03039     // case 5, 1>2,4>3
03040     5,
03041     0,
03042     5,
03043     6,
03044     7,
03045     0,
03046     5,
03047     7,
03048     8,
03049     0,
03050     5,
03051     8,
03052     1,
03053     5,
03054     7,
03055     9,
03056     6,
03057     5,
03058     7,
03059     8,
03060     9,
03061 
03062     // case 5, 1>2,4>3, a
03063     5,
03064     0,
03065     5,
03066     6,
03067     8,
03068     0,
03069     6,
03070     7,
03071     8,
03072     0,
03073     5,
03074     8,
03075     1,
03076     5,
03077     8,
03078     9,
03079     6,
03080     6,
03081     7,
03082     8,
03083     9,
03084 
03085     // case 5, 1=2,3>4
03086     8,
03087     10,
03088     6,
03089     0,
03090     7,
03091     10,
03092     1,
03093     5,
03094     8,
03095     10,
03096     0,
03097     1,
03098     7,
03099     10,
03100     7,
03101     1,
03102     8,
03103     10,
03104     8,
03105     5,
03106     9,
03107     10,
03108     6,
03109     7,
03110     9,
03111     10,
03112     7,
03113     8,
03114     9,
03115     10,
03116     5,
03117     6,
03118     9,
03119 
03120     // case 5, 1=2,3>4, a
03121     8,
03122     10,
03123     6,
03124     0,
03125     7,
03126     10,
03127     1,
03128     5,
03129     8,
03130     10,
03131     0,
03132     1,
03133     7,
03134     10,
03135     7,
03136     1,
03137     8,
03138     7,
03139     8,
03140     5,
03141     9,
03142     10,
03143     6,
03144     7,
03145     5,
03146     10,
03147     7,
03148     8,
03149     5,
03150     5,
03151     9,
03152     6,
03153     7,
03154 
03155     // case 5, 1=2,3>4, b
03156     8,
03157     10,
03158     6,
03159     0,
03160     7,
03161     10,
03162     1,
03163     5,
03164     8,
03165     10,
03166     0,
03167     1,
03168     7,
03169     10,
03170     7,
03171     1,
03172     8,
03173     6,
03174     8,
03175     5,
03176     9,
03177     10,
03178     6,
03179     7,
03180     8,
03181     10,
03182     6,
03183     8,
03184     5,
03185     8,
03186     9,
03187     6,
03188     7,
03189 
03190     // case 5, 1=2,3=4
03191     10,
03192     10,
03193     6,
03194     0,
03195     7,
03196     10,
03197     1,
03198     5,
03199     8,
03200     10,
03201     0,
03202     1,
03203     11,
03204     10,
03205     11,
03206     1,
03207     8,
03208     10,
03209     0,
03210     11,
03211     7,
03212     10,
03213     7,
03214     11,
03215     8,
03216     10,
03217     8,
03218     5,
03219     9,
03220     10,
03221     6,
03222     7,
03223     9,
03224     10,
03225     7,
03226     8,
03227     9,
03228     10,
03229     5,
03230     6,
03231     9,
03232 
03233     // case 6_0
03234     4,
03235     7,
03236     8,
03237     9,
03238     3,
03239     6,
03240     5,
03241     2,
03242     9,
03243     4,
03244     1,
03245     5,
03246     8,
03247     0,
03248     4,
03249     6,
03250     7,
03251 
03252     // case 6_1
03253     4,
03254     6,
03255     4,
03256     5,
03257     8,
03258     6,
03259     5,
03260     9,
03261     8,
03262     6,
03263     9,
03264     7,
03265     8,
03266     6,
03267     7,
03268     4,
03269     8,
03270 
03271     // case 6_1, a
03272     4,
03273     5,
03274     8,
03275     9,
03276     7,
03277     5,
03278     9,
03279     6,
03280     7,
03281     5,
03282     6,
03283     4,
03284     7,
03285     5,
03286     4,
03287     8,
03288     7,
03289 
03290     // case 6_1, b
03291     4,
03292     4,
03293     5,
03294     6,
03295     9,
03296     4,
03297     6,
03298     7,
03299     9,
03300     4,
03301     7,
03302     8,
03303     9,
03304     4,
03305     8,
03306     5,
03307     9,
03308 
03309 };
03310 
03311 }  // namespace moab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines