00001
00002 #ifndef SRC_AMG_MKB_AMG_MATRIX_UTILITY_FUNCTIONS_HPP_
00003 #define SRC_AMG_MKB_AMG_MATRIX_UTILITY_FUNCTIONS_HPP_
00004 #include <petscksp.h>
00005 #include "AMGRows.hpp"
00006 #include "RowData.hpp"
00007 #include "RowDataCollector.hpp"
00008 #include "AMGMatrixUtilityFunctions.hpp"
00009 #include <stdexcept>
00010
00011 extern int max_unfiltered_row_size;
00012 extern double value_filter_threshold;
00013
00014
00015 typedef struct {
00016 int columns_number;
00017 int* columns;
00018 double* values;
00019 PetscInt unfiltered_columns_number;
00020 PetscInt* unfiltered_columns;
00021 PetscScalar* unfiltered_values;
00022 } filtered_row;
00023
00024 bool isInCSet(PetscInt row_index, RowData* rowData, PetscInt first_row_in_range, PetscInt range_end,
00025 struct influenced_info* influenced_info_array);
00026
00027 PetscInt getColumnIndex(PetscInt row_index, RowData* rowData, PetscInt first_row_in_range, PetscInt range_end,
00028 struct influenced_info* influenced_info_array);
00029
00030 void increase_nonzero_number(int column_number_in_coarse, int row_number,
00031 int from_coarse_to_fine_ownership_column_begin, int from_coarse_to_fine_ownership_column_end,
00032 int* nondiagonal_nonzero_numbers, int* diagonal_nonzero_numbers);
00033
00034 bool isStrongDependenceWithinRange(PetscScalar value, PetscScalar row_min, PetscInt row_index, PetscInt column_index,
00035 PetscInt first_row_in_range, PetscInt range_end, double strength_threshold);
00036
00037 bool isStrongDependence(PetscScalar value, PetscScalar row_min, PetscInt row_index, PetscInt column_index, double strength_threshold);
00038
00039 bool isInFSetOutOfRange(PetscInt row_index, RowData* rowData, PetscInt first_row_in_range, PetscInt range_end,
00040 struct influenced_info* influenced_info_array);
00041
00042 PetscScalar getMin(const PetscScalar* values, PetscInt size, PetscInt row_index,const PetscInt* columns, int first_row_in_range, int range_end);
00043
00044 bool isGeneralStrongDependenceWithinRange(PetscScalar value, PetscScalar row_min, PetscInt row_index, PetscInt column_index,
00045 PetscInt first_row_in_range, PetscInt range_end, double strength_threshold);
00046
00047 bool isGeneralStrongDependence(PetscScalar value, PetscScalar row_min, PetscInt row_index, PetscInt column_index, double strength_threshold);
00048
00049 PetscScalar getExtremalValue(const PetscScalar* values, PetscInt size, PetscInt row_index,const PetscInt* columns, int first_row_in_range, int range_end);
00050
00051 void getFilteredRow(Mat mat, int row_number, filtered_row *row);
00052 void restoreFilteredRow(Mat mat, int row_number, filtered_row *row);
00053
00054 #endif