36void make_nei_ele(
const int m,
const int n,
const int l,
int **nei_ele)
42 int ny, py, nx, px, nz, pz;
44 for (
int j=0; j<n; j++) {
45 for (
int i=0; i<m; i++) {
46 for (
int k=0; k<l; k++) {
56 if (ny<0) nei_ele[0][idx] = idx;
else nei_ele[0][idx] = ny;
57 if (nx<j*ml) nei_ele[1][idx] = idx;
else nei_ele[1][idx] = nx;
58 if (pz >= j*ml+(i+1)*l) nei_ele[2][idx] = idx;
else nei_ele[2][idx] = pz;
59 if (px >= (j+1)*ml) nei_ele[3][idx] = idx;
else nei_ele[3][idx] = px;
60 if (nz < j*ml+i*l) nei_ele[4][idx] = idx;
else nei_ele[4][idx] = nz;
61 if (py >= nml) nei_ele[5][idx] = idx;
else nei_ele[5][idx] = py;
80 for (
int i=0; i<size; i++) {
99void make_reordering(
const int nele,
const int nface,
int **nei_ele,
int *mapping,
int *unmapping)
103 int idx, jdx, ele, neib;
115 for (jdx=0; jdx<nface; jdx++) {
116 neib = nei_ele[jdx][ele];
129 for (
int i=0; i<nele; i++) {
133 while (mapping[idx] != i)
154 int *icolor,
int *lcolor)
162 int ind, j, ist, iend, tmp;
165 while (ele < neles) {
166 for (j=0; j<n; j++) {
169 for (ind=ist; ind<iend; ind++) {
170 icolor[ca+ind] = ele;
171 lcolor[ele] = ca/denom;
173 icolor[cb+ind] = ele;
174 lcolor[ele] = cb/denom;
int searcharr(int val, int *arr, int size)
Search element in the given array. If element exists, return 1.
void make_coloring(const int m, const int n, const int l, int *icolor, int *lcolor)
Coloring algorithm for unstructured grid.
void make_reordering(const int nele, const int nface, int **nei_ele, int *mapping, int *unmapping)
Reverse Cuthill-McKee algorithm using neighbor elements.
void make_nei_ele(const int m, const int n, const int l, int **nei_ele)
Computes neighbor cell elements array.
void initQueue(struct Queue *queue)
Initialize queue structure with NULL value.
int isEmpty(struct Queue *queue)
Check if queue structure is empty.
int dequeue(struct Queue *queue)
Take out the first added element.
void enqueue(struct Queue *queue, int data)
Allocate new node and add to queue structure.