MOAB: Mesh Oriented datABase  (version 5.2.1)
SimplexTemplateRefiner.hpp
Go to the documentation of this file.
00001 /*
00002  * MOAB, a Mesh-Oriented datABase, is a software component for creating,
00003  * storing and accessing finite element mesh data.
00004  *
00005  * Copyright 2007 Sandia Corporation.  Under the terms of Contract
00006  * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
00007  * retains certain rights in this software.
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2.1 of the License, or (at your option) any later version.
00013  *
00014  */
00015 
00016 /**\class moab::SimplexTemplateRefiner
00017  *
00018  * This is a concrete subclass of EntityRefiner that implements
00019  * refinement using templates applied to simplices.
00020  * Entities that are not simplices are divided into tetrahedra,
00021  * triangles, or lines before being processed.
00022  * Points are passed through unchanged.
00023  *
00024  * \author David Thompson
00025  * \author Philippe Pebay
00026  *
00027  * \date 24 December 2007
00028  */
00029 #ifndef MB_SIMPLEX_TEMPLATE_REFINER_HPP
00030 #define MB_SIMPLEX_TEMPLATE_REFINER_HPP
00031 
00032 #include "EntityRefiner.hpp"
00033 #include "SimplexTemplateTagAssigner.hpp"
00034 
00035 #include "moab/Types.hpp"  // for MB_DLL_EXPORT
00036 
00037 namespace moab
00038 {
00039 
00040 class RefinerTagManager;
00041 
00042 class SimplexTemplateRefiner : public EntityRefiner
00043 {
00044   public:
00045     SimplexTemplateRefiner();
00046     virtual ~SimplexTemplateRefiner();
00047 
00048     virtual bool refine_entity( EntityType etyp, EntityHandle entity );
00049     virtual unsigned long get_heap_size_bound( int max_recursions ) const
00050     {
00051         return 48 * 4 * ( 1 << max_recursions ) + 8;
00052     }
00053 
00054     virtual bool set_tag_assigner( SimplexTemplateTagAssigner* ta );
00055     SimplexTemplateTagAssigner* get_tag_assigner() const
00056     {
00057         return this->tag_assigner;
00058     }
00059 
00060     virtual bool prepare( RefinerTagManager* tmgr, EntityRefinerOutputFunctor* ofunc );
00061 
00062   protected:
00063     SimplexTemplateTagAssigner* tag_assigner;
00064     RefinerTagManager* tag_manager;
00065     std::vector< double > corner_coords;
00066     std::vector< void* > corner_tags;
00067     std::vector< EntityHandle > corner_handles;
00068     bool input_is_output;
00069 
00070     static int template_index[64][2];
00071     static int permutations_from_index[24][14];
00072     static int templates[];
00073 
00074     void refine_0_simplex( const double* v0, const void* t0, EntityHandle h0 );
00075     bool refine_1_simplex( int max_depth, const double* v0, const void* t0, EntityHandle h0, const double* v1,
00076                            const void* t1, EntityHandle h1 );
00077     bool refine_2_simplex( int max_depth, int move, const double* v0, const void* t0, EntityHandle h0, const double* v1,
00078                            const void* t1, EntityHandle h1, const double* v2, const void* t2, EntityHandle h2 );
00079     bool refine_3_simplex( int max_depth, double* v0, void* t0, EntityHandle h0, double* v1, void* t1, EntityHandle h1,
00080                            double* v2, void* t2, EntityHandle h2, double* v3, void* t3, EntityHandle h3 );
00081 
00082     int best_tets( int* alternates, double* [14], int, int )
00083     {
00084         return alternates[0];
00085     }
00086     void assign_parametric_coordinates( int num_nodes, const double* src, double* tgt );
00087     static bool compare_Hopf_cross_string_dist( const double* v00, const double* v01, const double* v10,
00088                                                 const double* v11 );
00089 };
00090 
00091 }  // namespace moab
00092 
00093 #endif  // MB_SIMPLEX_TEMPLATE_REFINER_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines