1#ifndef PARALLELMERGEMESH_HPP2#define PARALLELMERGEMESH_HPP34#include"moab/Types.hpp"5#include<vector>6#include"moab/Range.hpp"7#include"moab/ParallelComm.hpp"89#include"moab/TupleList.hpp"10#include"moab/gs.hpp"1112/*
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 */1718namespace moab
19 {
2021classParallelComm;
22classTupleList;
2324classParallelMergeMesh25 {
26public:
27ParallelMergeMesh( ParallelComm* pc, constdouble epsilon );
2829// Public Function to identify shared elements30ErrorCode merge( EntityHandle levelset = 0, bool skip_local_merge = false, int dim = -1 );
3132private:
33 ParallelComm* myPcomm;
34 Interface* myMB;
35 std::vector< Range > mySkinEnts;
36double myEps;
37 TupleList myTup, myMatches;
38 gs_data::crystal_data myCD;
3940// Wrapper of merge() that performs the merge41ErrorCode PerformMerge( EntityHandle levelset = 0, bool skip_local_merge = false, int dim = -1 );
42// Determine the local skin entities (fills mySkinEnts)43ErrorCode PopulateMySkinEnts( const EntityHandle meshset, int dim, bool skip_local_merge = false );
44// Get the global bounding box45ErrorCode GetGlobalBox( double* gbox );
46// Fill out the local myTup before the first gather-scatter47ErrorCode PopulateMyTup( double* gbox );
48// Once myTup is filled and gather scattered, figure out the matches49ErrorCode PopulateMyMatches();
50// Sort the matching tuples51ErrorCode SortMyMatches();
52// Tag the shared elements once the myMatches has been filled53ErrorCode TagSharedElements( int dim );
54// Cleanup any data allocated by class members55voidCleanUp();
56// Partition the global box by the number of procs57// Returns results in lengths and parts, which needs to be of length 358ErrorCode PartitionGlobalBox( double* gbox, double* lengths, int* parts );
59// A function for determining how many parts a side should be split into60staticintPartitionSide( double sideLeng, double restLen, unsigned numProcs, bool altRatio );
6162// Swap 2 tuples63staticvoidSwapTuples( TupleList& tup, unsignedlong a, unsignedlong b );
6465// Sort a tuple list by its real values66staticvoidSortTuplesByReal( TupleList& tup, double eps2 = 0 );
6768// The recursive sorting function69staticvoidPerformRealSort( TupleList& tup, unsignedlong left, unsignedlong right, double eps2, uint tup_mr );
7071// Determines whether tuple i is greater than tuple j72staticboolTupleGreaterThan( TupleList& tup, unsignedlong vrI, unsignedlong vrJ, double eps2, uint tup_mr );
73 };
7475 } // namespace moab7677#endif