12 struct ExtractColumnCompare
20 bool operator()(
const int i,
const int j)
62 std::map<int, int> global_to_local;
66 int i_cart = index % dims[0];
67 int k_cart = index / dims[0] / dims[1];
68 int j_cart = (index - k_cart*dims[0]*dims[1])/ dims[0];
71 std::map<int, int>::iterator local_index_iterator = global_to_local.find(i_cart+j_cart*dims[0]);
72 if (local_index_iterator != global_to_local.end()) {
73 local_index = local_index_iterator->second;
75 local_index = columns.size();
76 global_to_local[i_cart+j_cart*dims[0]] = local_index;
77 columns.push_back(std::vector<int>());
79 columns[local_index].push_back(cell);
82 int num_cols = columns.size();
83 for (
int col = 0; col < num_cols; ++col) {
84 std::sort(columns[col].begin(), columns[col].end(), ExtractColumnCompare(grid));
89 std::vector< std::vector<int> > new_columns;
90 for (
int col = 0; col < num_cols; ++col) {
91 const int colsz = columns[col].size();
93 for (
int k = 1; k < colsz; ++k) {
94 const int c0 = columns[col][k-1];
95 const int c1 = columns[col][k];
96 if (!neighbours(grid, c0, c1)) {
99 new_columns.push_back(std::vector<int>());
100 new_columns.back().assign(columns[col].begin() + first_of_col, columns[col].begin() + k);
105 if (first_of_col != 0) {
109 columns[col].erase(columns[col].begin(), columns[col].begin() + first_of_col);
114 const int num_cols_all = num_cols + new_columns.size();
115 columns.resize(num_cols_all);
116 for (
int col = num_cols; col < num_cols_all; ++col) {
117 columns[col].swap(new_columns[col - num_cols]);
Definition: AnisotropicEikonal.hpp:43
int * face_cells
Definition: grid.h:138
void extractColumn(const UnstructuredGrid &grid, std::vector< std::vector< int > > &columns)
Definition: ColumnExtract.hpp:57
int number_of_cells
Definition: grid.h:109
int cartdims[3]
Definition: grid.h:227
int * cell_faces
Definition: grid.h:146
const UnstructuredGrid & grid
Definition: ColumnExtract.hpp:31
int * global_cell
Definition: grid.h:214
int * cell_facepos
Definition: grid.h:152