Mesh Oriented datABase  (version 5.4.1)
Array-based unstructured mesh datastructure
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,
00076                            const double* v0,
00077                            const void* t0,
00078                            EntityHandle h0,
00079                            const double* v1,
00080                            const void* t1,
00081                            EntityHandle h1 );
00082     bool refine_2_simplex( int max_depth,
00083                            int move,
00084                            const double* v0,
00085                            const void* t0,
00086                            EntityHandle h0,
00087                            const double* v1,
00088                            const void* t1,
00089                            EntityHandle h1,
00090                            const double* v2,
00091                            const void* t2,
00092                            EntityHandle h2 );
00093     bool refine_3_simplex( int max_depth,
00094                            double* v0,
00095                            void* t0,
00096                            EntityHandle h0,
00097                            double* v1,
00098                            void* t1,
00099                            EntityHandle h1,
00100                            double* v2,
00101                            void* t2,
00102                            EntityHandle h2,
00103                            double* v3,
00104                            void* t3,
00105                            EntityHandle h3 );
00106 
00107     int best_tets( int* alternates, double* [14], int, int )
00108     {
00109         return alternates[0];
00110     }
00111     void assign_parametric_coordinates( int num_nodes, const double* src, double* tgt );
00112     static bool compare_Hopf_cross_string_dist( const double* v00,
00113                                                 const double* v01,
00114                                                 const double* v10,
00115                                                 const double* v11 );
00116 };
00117 
00118 }  // namespace moab
00119 
00120 #endif  // MB_SIMPLEX_TEMPLATE_REFINER_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines