⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 city_block.c~

📁 混沌分析的C语言程序的
💻 C~
字号:
#include <stdio.h>#include "n_dim_traversal.h"/* dist is the "distance" for the search to operate over, and coord is *//* the centre coordinate.  If dist is negative, that indicates that *//* all the points inside the 'square' must be examined.  This is used *//* to make sure that the surfaces are all checked. */void addtotmplist(out_list,q)     LEAFTYPE *out_list;     LEAFTYPE q;{  LEAFTYPE tmp;  tmp=q;  if (tmp != NULL) {    printf("%d  ", tmp->val);    if (tmp->next != NULL)      tmp=tmp->next;  }  printf("\n");  exit(-1);  if (q != NULL) {    tmp = q;    while (tmp->next != NULL) {      printf("%d \n",tmp->val);      tmp = tmp->next;    }    tmp->next = *out_list;    *out_list = q;  }}void city_block(void **, int, int, LEAFTYPE *, int *);void city_block(list, dist, dims, out_list, x)     void **list;     LEAFTYPE *out_list;     int dist, dims;     int *x;{  int i, min, max;  if (*list == NULL) {    return;  }    if ((x[0] < 0) || (x[0] >= dimsize)) {    fprintf(stderr, "Coordinate entry %d is not between 0 and %d\n", x[0], dimsize-1);    exit(-1);  }  if (dims==1) {    if (dist == 0) {      addtotmplist(out_list, ((LEAFTYPE *) (*list))[x[0]]);    } else if (dist < 0) {      min=((x[0]+dist)<0)?0:(x[0]+dist);      max=((x[0]-dist)>=dimsize)?dimsize-1:(x[0]-dist);      for (i=min; i<=max; i++) {	addtotmplist(out_list, ((LEAFTYPE *) (*list))[i]);      }    } else {      if ((x[0]-dist)>=0) {	addtotmplist(out_list,((LEAFTYPE *) (*list))[x[0]-dist]);      }      if ((x[0]+dist)<dimsize) {	addtotmplist(out_list,((LEAFTYPE *) (*list))[x[0]+dist]);      }    }  } else {    if (dist == 0) {      city_block(&(((void **) (*list))[x[0]]), dist, dims-1,		  out_list, &(x[1]));    } else if (dist < 0) {      min=((x[0]+dist)<0)?0:(x[0]+dist);      max=((x[0]-dist)>=dimsize)?dimsize-1:(x[0]-dist);      for (i=min; i<=max; i++) {	city_block(&(((void **) (*list))[i]), dist, dims-1,		    out_list, &(x[1]));      }    } else {      min=((x[0]-dist)<0)?0:(x[0]-dist);      max=((x[0]+dist)>=dimsize)?dimsize-1:(x[0]+dist);      i=min;      if ((x[0]-dist) >= 0) {	city_block(&(((void **) (*list))[i]), -dist, dims-1,		    out_list, &(x[1]));	i++;      }      for (; i<max; i++) {	city_block(&(((void **) (*list))[i]), dist, dims-1,		    out_list, &(x[1]));      }      if ((x[0]+dist) < dimsize) {	city_block(&(((void **) (*list))[i]), -dist, dims-1,		    out_list, &(x[1]));      } else {	city_block(&(((void **) (*list))[i]), dist, dims-1,		    out_list, &(x[1]));      }    }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -