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