1 /* 2 * MOAB, a Mesh-Oriented datABase, is a software component for creating, 3 * storing and accessing finite element mesh data. 4 * 5 * Copyright 2007 Sandia Corporation. Under the terms of Contract 6 * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government 7 * retains certain rights in this software. 8 * 9 * This library is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU Lesser General Public 11 * License as published by the Free Software Foundation; either 12 * version 2.1 of the License, or (at your option) any later version. 13 * 14 */ 15 16 /**\class moab::SimplexTemplateRefiner 17 * 18 * This is a concrete subclass of EntityRefiner that implements 19 * refinement using templates applied to simplices. 20 * Entities that are not simplices are divided into tetrahedra, 21 * triangles, or lines before being processed. 22 * Points are passed through unchanged. 23 * 24 * \author David Thompson 25 * \author Philippe Pebay 26 * 27 * \date 24 December 2007 28 */ 29 #ifndef MB_SIMPLEX_TEMPLATE_REFINER_HPP 30 #define MB_SIMPLEX_TEMPLATE_REFINER_HPP 31 32 #include "EntityRefiner.hpp" 33 #include "SimplexTemplateTagAssigner.hpp" 34 35 #include "moab/Types.hpp" // for MB_DLL_EXPORT 36 37 namespace moab { 38 39 class RefinerTagManager; 40 41 class SimplexTemplateRefiner : public EntityRefiner 42 { 43 public: 44 SimplexTemplateRefiner(); 45 virtual ~SimplexTemplateRefiner(); 46 47 virtual bool refine_entity( EntityType etyp, EntityHandle entity ); get_heap_size_bound(int max_recursions) const48 virtual unsigned long get_heap_size_bound( int max_recursions ) const { return 48 * 4 * ( 1 << max_recursions ) + 8; } 49 50 virtual bool set_tag_assigner( SimplexTemplateTagAssigner* ta ); get_tag_assigner() const51 SimplexTemplateTagAssigner* get_tag_assigner() const { return this->tag_assigner; } 52 53 virtual bool prepare( RefinerTagManager* tmgr, EntityRefinerOutputFunctor* ofunc ); 54 55 protected: 56 SimplexTemplateTagAssigner* tag_assigner; 57 RefinerTagManager* tag_manager; 58 std::vector<double> corner_coords; 59 std::vector<void*> corner_tags; 60 std::vector<EntityHandle> corner_handles; 61 bool input_is_output; 62 63 static int template_index[64][2]; 64 static int permutations_from_index[24][14]; 65 static int templates[]; 66 67 void refine_0_simplex( const double* v0, const void* t0, EntityHandle h0 ); 68 bool refine_1_simplex( int max_depth, 69 const double* v0, const void* t0, EntityHandle h0, 70 const double* v1, const void* t1, EntityHandle h1 ); 71 bool refine_2_simplex( int max_depth, int move, 72 const double* v0, const void* t0, EntityHandle h0, 73 const double* v1, const void* t1, EntityHandle h1, 74 const double* v2, const void* t2, EntityHandle h2 ); 75 bool refine_3_simplex( int max_depth, 76 double* v0, void* t0, EntityHandle h0, 77 double* v1, void* t1, EntityHandle h1, 78 double* v2, void* t2, EntityHandle h2, 79 double* v3, void* t3, EntityHandle h3 ); 80 best_tets(int * alternates,double * [14],int,int)81 int best_tets( int* alternates, double*[14], int, int ) { return alternates[0]; } 82 void assign_parametric_coordinates( int num_nodes, const double* src, double* tgt ); 83 static bool compare_Hopf_cross_string_dist( const double* v00, const double* v01, const double* v10, const double* v11 ); 84 }; 85 86 } // namespace moab 87 88 #endif // MB_SIMPLEX_TEMPLATE_REFINER_HPP 89 90