moab
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 Coroporation, 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 
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 class RefinerTagManager;
00040 
00041 class MB_DLL_EXPORT SimplexTemplateRefiner : public EntityRefiner
00042 {
00043 public:
00044   SimplexTemplateRefiner();
00045   virtual ~SimplexTemplateRefiner();
00046 
00047   virtual bool refine_entity( EntityType etyp, EntityHandle entity );
00048   virtual unsigned long get_heap_size_bound( int max_recursions ) const { return 48 * 4 * ( 1 << max_recursions ) + 8; }
00049 
00050   virtual bool set_tag_assigner( SimplexTemplateTagAssigner* ta );
00051   SimplexTemplateTagAssigner* get_tag_assigner() const { return this->tag_assigner; }
00052 
00053   virtual bool prepare( RefinerTagManager* tmgr, EntityRefinerOutputFunctor* ofunc );
00054 
00055 protected:
00056   SimplexTemplateTagAssigner* tag_assigner;
00057   RefinerTagManager* tag_manager;
00058   std::vector<double> corner_coords;
00059   std::vector<void*> corner_tags;
00060   std::vector<EntityHandle> corner_handles;
00061   bool input_is_output;
00062 
00063   static int template_index[64][2];
00064   static int permutations_from_index[24][14];
00065   static int templates[];
00066 
00067   void refine_0_simplex( const double* v0, const void* t0, EntityHandle h0 );
00068   bool refine_1_simplex( int max_depth,
00069                          const double* v0, const void* t0, EntityHandle h0,
00070                          const double* v1, const void* t1, EntityHandle h1 );
00071   bool refine_2_simplex( int max_depth, int move,
00072                          const double* v0, const void* t0, EntityHandle h0,
00073                          const double* v1, const void* t1, EntityHandle h1,
00074                          const double* v2, const void* t2, EntityHandle h2 );
00075   bool refine_3_simplex( int max_depth,
00076                          double* v0, void* t0, EntityHandle h0,
00077                          double* v1, void* t1, EntityHandle h1,
00078                          double* v2, void* t2, EntityHandle h2,
00079                          double* v3, void* t3, EntityHandle h3 );
00080 
00081   int best_tets( int* alternates, double*[14], int, int ) { return alternates[0]; }
00082   void assign_parametric_coordinates( int num_nodes, const double* src, double* tgt );
00083   static bool compare_Hopf_cross_string_dist( const double* v00, const double* v01, const double* v10, const double* v11 );
00084 };
00085 
00086 } // namespace moab 
00087 
00088 #endif // MB_SIMPLEX_TEMPLATE_REFINER_HPP
00089 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines