00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 #ifndef SUNDANCE_SERIALPARTITIONERBASE_H
00032 #define SUNDANCE_SERIALPARTITIONERBASE_H
00033 
00034 #include "SundanceDefs.hpp"
00035 #include "SundanceMap.hpp"
00036 #include "SundanceMesh.hpp"
00037 #include "SundanceMeshType.hpp"
00038 #include "PlayaHandle.hpp"
00039 
00040 namespace Sundance
00041 {
00042 
00043 
00044 
00045 
00046 
00047 class SerialPartitionerBase
00048 {
00049 public:
00050 
00051   SerialPartitionerBase(bool ignoreGhosts=false)
00052     : ignoreGhosts_(ignoreGhosts){}
00053   
00054 
00055   virtual ~SerialPartitionerBase(){;}
00056 
00057 
00058   void getNeighbors(const Mesh& mesh, 
00059     Array<Array<int> >& neighbors, int& nEdges) const ;
00060 
00061 
00062   Set<int> arrayToSet(const Array<int>& a) const ;
00063 
00064 
00065   virtual void getAssignments(const Mesh& mesh, int np, 
00066     Array<int>& assignments) const = 0 ;
00067 
00068 
00069   Array<Mesh> makeMeshParts(const Mesh& mesh, int np,
00070     Array<Sundance::Map<int, int> >& oldElemLIDToNewLIDMap,
00071     Array<Sundance::Map<int, int> >& oldVertLIDToNewLIDMap
00072     ) const ;
00073 
00074 
00075   void getOffProcData(int p, 
00076     const Array<int>& elemAssignments,
00077     const Array<int>& nodeAssignments,
00078     Set<int>& offProcNodes,
00079     Set<int>& offProcElems) const ;
00080 
00081 
00082 
00083 
00084   void getNodeAssignments(int nProc, 
00085     const Array<int>& elemAssignments,
00086     Array<int>& nodeAssignments,
00087     Array<int>& nodeOwnerElems,
00088     Array<int>& nodesPerProc) const ;
00089 
00090 
00091   void getElemsPerProc(int nProc, 
00092     const Array<int>& elemAssignments,
00093     Array<int>& elemsPerProc) const ;
00094 
00095 
00096 
00097 
00098   void remapEntities(const Array<int>& assignments, int nProc,
00099     Array<int>& entityMap) const ;
00100 
00101 
00102 private:
00103 
00104   bool ignoreGhosts_;
00105   int max(const Set<int>& s) const ;
00106   mutable Array<Set<int> > elemVerts_;
00107   mutable Array<Set<int> > elemEdgewiseNbors_;
00108   mutable Array<Set<int> > vertElems_;
00109 };
00110 }
00111 
00112 #endif