00001 #ifndef RCMCELLREORDERER_H 00002 #define RCMCELLREORDERER_H 00003 00004 #include "SundanceDefs.h" 00005 #include "CellReordererBase.h" 00006 00007 namespace Sundance 00008 { 00009 00010 using namespace TSF; 00011 using std::string; 00012 00013 using std::ostream; 00014 00015 /** \ingroup LowLevelGeometry 00016 Reorder cells using the reverse Cuthill-McKee algorithm. 00017 */ 00018 00019 00020 class RCMCellReorderer : public CellReordererBase 00021 { 00022 public: 00023 RCMCellReorderer() : CellReordererBase() {;} 00024 virtual ~RCMCellReorderer() {;} 00025 00026 virtual void permute(const TSFArray<TSFNonDupArray<int> >& neighbors, 00027 TSFArray<int>& permutation) const ; 00028 00029 private: 00030 void sortByDegree(TSFArray<int>& set, 00031 const TSFArray<TSFNonDupArray<int> >& neighbors) const ; 00032 }; 00033 00034 class CellDegree 00035 { 00036 public: 00037 CellDegree(int id, int degree) : id_(id), degree_(degree) {;} 00038 00039 bool operator<(const CellDegree& other) const {return degree_ < other.degree_;} 00040 00041 int getID() const {return id_;} 00042 private: 00043 int id_; 00044 int degree_; 00045 }; 00046 00047 } 00048 #endif 00049 00050 00051 00052 00053