Loading [MathJax]/extensions/tex2jax.js
Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ParallelMergeMesh.hpp
Go to the documentation of this file.
1 #ifndef PARALLELMERGEMESH_HPP 2 #define PARALLELMERGEMESH_HPP 3  4 #include "moab/Types.hpp" 5 #include <vector> 6 #include "moab/Range.hpp" 7 #include "moab/ParallelComm.hpp" 8  9 #include "moab/TupleList.hpp" 10 #include "moab/gs.hpp" 11  12 /* 13  Class to merge meshes in parallel 14  Requires a ParallelComm and tolerance epsilon 15  Currently uses a 1 dimensional partition of the global box 16 */ 17  18 namespace moab 19 { 20  21 class ParallelComm; 22 class TupleList; 23  24 class ParallelMergeMesh 25 { 26  public: 27  ParallelMergeMesh( ParallelComm* pc, const double epsilon ); 28  29  // Public Function to identify shared elements 30  ErrorCode merge( EntityHandle levelset = 0, bool skip_local_merge = false, int dim = -1 ); 31  32  private: 33  ParallelComm* myPcomm; 34  Interface* myMB; 35  std::vector< Range > mySkinEnts; 36  double myEps; 37  TupleList myTup, myMatches; 38  gs_data::crystal_data myCD; 39  40  // Wrapper of merge() that performs the merge 41  ErrorCode PerformMerge( EntityHandle levelset = 0, bool skip_local_merge = false, int dim = -1 ); 42  // Determine the local skin entities (fills mySkinEnts) 43  ErrorCode PopulateMySkinEnts( const EntityHandle meshset, int dim, bool skip_local_merge = false ); 44  // Get the global bounding box 45  ErrorCode GetGlobalBox( double* gbox ); 46  // Fill out the local myTup before the first gather-scatter 47  ErrorCode PopulateMyTup( double* gbox ); 48  // Once myTup is filled and gather scattered, figure out the matches 49  ErrorCode PopulateMyMatches(); 50  // Sort the matching tuples 51  ErrorCode SortMyMatches(); 52  // Tag the shared elements once the myMatches has been filled 53  ErrorCode TagSharedElements( int dim ); 54  // Cleanup any data allocated by class members 55  void CleanUp(); 56  // Partition the global box by the number of procs 57  // Returns results in lengths and parts, which needs to be of length 3 58  ErrorCode PartitionGlobalBox( double* gbox, double* lengths, int* parts ); 59  // A function for determining how many parts a side should be split into 60  static int PartitionSide( double sideLeng, double restLen, unsigned numProcs, bool altRatio ); 61  62  // Swap 2 tuples 63  static void SwapTuples( TupleList& tup, unsigned long a, unsigned long b ); 64  65  // Sort a tuple list by its real values 66  static void SortTuplesByReal( TupleList& tup, double eps2 = 0 ); 67  68  // The recursive sorting function 69  static void PerformRealSort( TupleList& tup, unsigned long left, unsigned long right, double eps2, uint tup_mr ); 70  71  // Determines whether tuple i is greater than tuple j 72  static bool TupleGreaterThan( TupleList& tup, unsigned long vrI, unsigned long vrJ, double eps2, uint tup_mr ); 73 }; 74  75 } // namespace moab 76  77 #endif