00001
00002
00003
00004
00005
00006
00007
00008 #ifndef RSCFSPLITTER_H_
00009 #define RSCFSPLITTER_H_
00010
00011 #include "CFSplitter.hpp"
00012 #include "AMGRows.hpp"
00013 #include "RowDataCollector.hpp"
00014 #include <petscmat.h>
00015 #include <algorithm>
00016 #include <exception>
00017 #include <stdexcept>
00018 #include <map>
00019 #include "Interpolation/DirectInterpolation.hpp"
00020 #include "Interpolation/AdvancedRSCFInterpolation.hpp"
00021 #include "uth_log.h"
00022
00023
00024 class RSCFSplitter : public CFSplitter
00025 {
00026 public:
00027 RSCFSplitter(Mat mat, double strength_threshold, InterpolationStrategy* strategy);
00028 virtual ~RSCFSplitter();
00029 virtual void MakeCFSplitting();
00030 void GetSetsWithInfluencedNumebr(std::map<int, int> *c_set, std::map<int, int> *f_set);
00031 Mat GetMatrixFromCoarseToFine();
00032 virtual std::list<int>* GetNumbersOfCoarseRows();
00033
00034 protected:
00035 virtual PetscScalar GetExtremalValue(const PetscScalar* values, PetscInt size, PetscInt row_index,
00036 const PetscInt* columns, int first_row_in_range, int range_end);
00037 virtual bool IsStrongDependenceWithinRange(PetscScalar value, PetscScalar row_min, PetscInt row_index, PetscInt column_index,
00038 PetscInt first_row_in_range, PetscInt range_end, double strength_threshold);
00039
00040 private:
00041 InterpolationStrategy* strategy;
00042 double strength_threshold;
00043 struct row_info* row_info_array;
00044 struct influenced_info* influenced_info_array;
00045 PetscInt first_row_in_range;
00046 PetscInt range_end;
00047 void ReplaceAfterInfluencedNumberChange(struct row_info* row_info, bool switch_root);
00048 struct row_info* getHeapParent(int index);
00049 void replaceRowInfos(struct row_info* row_info1, struct row_info* row_info2);
00050 void makeHeap(int size);
00051 void PrepareFromCoarseToFineMat(Mat* from_coarse_to_fine_mat, int rows_number, int columns_number);
00052
00053
00054 };
00055
00056 #endif