亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? conviso.c

?? 卷積程序
?? C
字號(hào):
/****
 *  This files plot a series of contour lines for a 2D array of double.
 *  4/14/92.
 ****/

#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <time.h>
#include <string.h>
#include <ctype.h>

#ifndef PI
#define PI 3.1415926
#endif

/****
 *	Return true is val is between Z[i][j] and Z[i+1][j].
 ****/
#define INTERSECTI(val, Z, i, j) \
  (Z[i][j] <= val && val <= Z[i+1][j] || \
   Z[i][j] >= val && val >= Z[i+1][j])

/****
 *	Return true is val is between Z[i][j] and Z[i][j+1].
 ****/
#define INTERSECTJ(val, Z, i, j) \
  (Z[i][j] <= val && val <= Z[i][j+1] || \
   Z[i][j] >= val && val >= Z[i][j+1])

FILE       *GetWriteFile(char *Ext);	/* in conho.c. */

struct XY {
  double      x, y;
};

struct XYpairs {
  double      x, y;
  struct XYpairs *next;
};

typedef struct XYpairs *PairList;

/* set up a que for printing the pairs. */
typedef PairList QDATA;

struct Qlinked_list {
  QDATA       d;
  struct Qlinked_list *next;
};

typedef struct Qlinked_list QELEMENT;
typedef QELEMENT *QLINK;

typedef struct {		/* a que of pairs. */
  QLINK       front, rear;
}           QUE;
/* end of que definition. */


struct Isolines {
  double      iso_val;		/* z value of the contour line. */
  PairList    pairs;
  struct Isolines *next;
};

typedef struct Isolines *IsoList;



double 
ZMin(double **Z,
     long IXmax,
     long IYmax,
     double Dx,
     double Dy,
     struct XY * Pmin_Ptr)
{
  double      zmin;
  long        i, j;

  zmin = Z[0][0];
  for (i = 0; i < IXmax; i++)
    for (j = 0; j < IYmax; j++)
      if (Z[i][j] < zmin) {
	zmin = Z[i][j];
	Pmin_Ptr->x = i * Dx;
	Pmin_Ptr->y = j * Dy;
      }
  return (zmin);
}


double 
ZMax(double **Z,
     long IXmax,
     long IYmax,
     double Dx,
     double Dy,
     struct XY * Pmax_Ptr)
{
  double      zmax;
  long        i, j;

  zmax = Z[0][0];
  for (i = 0; i < IXmax; i++)
    for (j = 0; j < IYmax; j++)
      if (Z[i][j] > zmax) {
	zmax = Z[i][j];
	Pmax_Ptr->x = i * Dx;
	Pmax_Ptr->y = j * Dy;
      }
  return (zmax);
}


/* Get the isovalues from user. */
IsoList 
GetIsoValues(double Z_Min, double Z_Max)
{
  IsoList     head;
  char        in_str[256];

  printf("Input an isovalue or . to stop: ");
  scanf("%s", in_str);
  if (strlen(in_str) == 1 && in_str[0] == '.')
    return (NULL);

  head = (IsoList) malloc(sizeof(struct Isolines));
  if (head == NULL)
    return (NULL);

  /* get the elements for the node. */
  sscanf(in_str, "%lf", &head->iso_val);
  if (head->iso_val < Z_Min)
    head->iso_val = Z_Min;
  else if (head->iso_val > Z_Max)
    head->iso_val = Z_Max;
  head->pairs = NULL;
  head->next = GetIsoValues(Z_Min, Z_Max);
  return (head);
}


/****
 *  The isoposition is between [i][j] & [i+1][j]
 *
 *  Linear interpolation is used to locate the y component of
 *  the iso position.
 ****/
void 
IsoPositionI(PairList pair,
	     double iso_val, double **Z,
	     long i, long j,
	     double Dx, double Dy)
{
  pair->y = (j + 0.5) * Dy;
  if (Z[i][j] != Z[i + 1][j])
    pair->x = (i + 0.5) * Dx + Dx * (iso_val - Z[i][j]) / (Z[i + 1][j] - Z[i][j]);
  else
    pair->x = (i + 1) * Dx;	/* take the mid point. */
}


/****
 *  The isoposition is between [i][j] & [i][j+1]
 *
 *  Linear interpolation is used to locate the y component of
 *  the iso position.
 ****/
void 
IsoPositionJ(PairList pair,
	     double iso_val, double **Z,
	     long i, long j,
	     double Dx, double Dy)
{
  pair->x = (i + 0.5) * Dx;
  if (Z[i][j + 1] != Z[i][j])
    pair->y = (j + 0.5) * Dy + Dy * (iso_val - Z[i][j]) / (Z[i][j + 1] - Z[i][j]);
  else
    pair->y = (j + 1) * Dy;	/* take the mid point. */
}

void 
IsoPosition(PairList pair,
	    double iso_val, double **Z,
	    long i, long j,
	    double Dx, double Dy)
{

  if (INTERSECTI(iso_val, Z, i, j))
    IsoPositionI(pair, iso_val, Z, i, j, Dx, Dy);
  else if (INTERSECTJ(iso_val, Z, i, j))
    IsoPositionJ(pair, iso_val, Z, i, j, Dx, Dy);
}

PairList 
AllocPair(void)
{
  PairList    pair;

  pair = (PairList) malloc(sizeof(struct XYpairs));
  if (pair == NULL)
    puts("...malloc error. Contour lines are not complete");
  return (pair);
}

void 
GetAnIsoLine(IsoList IsoNode, double **Z,
	     long IXmax, long IYmax,
	     double Dx, double Dy)
{
  long        i, j;
  double      ival = IsoNode->iso_val;
  PairList    pair_tail;

  for (j = 0; j < IYmax - 1; j++)
    for (i = 0; i < IXmax - 2; i++)
      if (INTERSECTI(ival, Z, i, j) ||
	  INTERSECTJ(ival, Z, i, j)) {	/* found a pair. */
	if (IsoNode->pairs == NULL) {	/* 1st pair. */
	  if (!(IsoNode->pairs = AllocPair()))
	    return;
	  pair_tail = IsoNode->pairs;
	} else {		/* subsequent  pairs. */
	  if (!(pair_tail->next = AllocPair()))
	    return;
	  pair_tail = pair_tail->next;
	}
	IsoPosition(pair_tail, ival, Z, i, j, Dx, Dy);
      }
  pair_tail->next = NULL;	/* end of the pair list. */
}


/****
 *	Return the quadrant.
 *	For Frz or Arz, the peak point is usually on z axis which is
 *	y here. We want start the isoline from the 4th quadrant.
 *	Therefore, we use -1 for the 4th quadrant instead of 4.
 ****/
short 
GetQuadrant(double x, double y)
{
  if (x > 0 && y >= 0)
    return (1);			/* Include +x-axis. */
  else if (x <= 0 && y > 0)
    return (2);			/* Include +y-axis. */
  else if (x < 0 && y <= 0)
    return (3);			/* Include -x-axis. */
  else if (x >= 0 && y < 0)
    return (-1);		/* Include -y-axis. */
}

/****
 *  Compare the angle wrt Pmax.  If the angle of "This" is larger
 *  than that of the "Next", return 1.  Otherwise, return 0.
 *
 *  Although atan2 returns value in the range -pi to pi, we want
 *	to avoid it because it is slow.  We compare the quadrants of
 *	the two points first.  If they are in the same quadrant, we
 *	compare the relative positions.
 ****/
char 
OutOfOrder(PairList This,	/* current pair. */
	   PairList Next,
	   struct XY Pmax)
{
  double      x0, y0, x1, y1;
  short       q0, q1;		/* Quadrants. */
  char        out_order;

  if (This == NULL || Next == NULL)
    return (0);			/* This shouldn't happen. */
  x0 = This->x - Pmax.x;
  y0 = This->y - Pmax.y;
  q0 = GetQuadrant(x0, y0);
  x1 = Next->x - Pmax.x;
  y1 = Next->y - Pmax.y;
  q1 = GetQuadrant(x1, y1);

  if (q0 < q1)
    out_order = 0;
  else if (q0 > q1)
    out_order = 1;
  else {			/* In the same quadrant. */
    if (y0 * x1 < y1 * x0)
      out_order = 0;
    else
      out_order = 1;
  }

  return (out_order);
}


/****
 *  Sort the isopositions according to the angle with respect to
 *  the position of the maximum value.
 ****/
void 
SortAnIsoLine(PairList * PairHeadPtr,
	      struct XY Pmax)
{
  char        sorted = 0;
  PairList    this, last;	/* this=the pair being compared w/ the
				 * next one. */
  PairList    sorted_head = NULL;	/* the head to the sublist of
					 * sorted pairs. */

  while (!sorted && sorted_head != *PairHeadPtr) {
    sorted = 1;			/* assume sublist is sorted. */
    last = NULL;
    this = *PairHeadPtr;	/* sublist starts at *PairHeadPtr, ends at
				 * sorted_head. */

    while (this->next != sorted_head) {	/* traverse the sublist. */
      if (OutOfOrder(this, this->next, Pmax)) {	/* swap and move to next. */
	sorted = 0;
	if (last == NULL)
	  *PairHeadPtr = this->next;
	else
	  last->next = this->next;

	last = this->next;
	this->next = last->next;
	last->next = this;
      } else {			/* move to next. */
	last = this;
	this = this->next;
      }
    }				/* end of sublist traversing. */

    sorted_head = this;
  }				/* end of big while. */
}

#if 0
/****
 *	Repeat the first pair of the isoline at the end of the list
 *	so that the isoline is a loop.
 *	Sometimes this may not be desired.
 ****/
void 
LoopAnIsoLine(PairList * PairHeadPtr)
{
  PairList    tail;

  tail = *PairHeadPtr;
  while (tail->next != NULL)
    tail = tail->next;

  tail->next = (PairList) malloc(sizeof(struct XYpairs));
  if (tail->next == NULL)
    return;
  tail = tail->next;
  tail->x = (*PairHeadPtr)->x;
  tail->y = (*PairHeadPtr)->y;
  tail->next = NULL;
}
#endif

void 
GetIsoLines(IsoList isos,
	    double **Z,
	    long IXmax,
	    long IYmax,
	    double Dx,
	    double Dy,
	    struct XY Pmax)
{
  IsoList     node = isos;

  while (node != NULL) {
    GetAnIsoLine(node, Z, IXmax, IYmax, Dx, Dy);
    SortAnIsoLine(&node->pairs, Pmax);
    /* LoopAnIsoLine(&node->pairs); */
    node = node->next;
  }
}

char 
IsEmpty(QUE q)
{
  return (q.front == NULL);
}


void 
Deque(QUE * q, QDATA * x)
{
  QLINK       temp = q->front;

  if (!IsEmpty(*q)) {
    *x = temp->d;
    q->front = temp->next;
    free(temp);
  } else
    printf("Empty que.\n");
}

void 
Enque(QUE * q, QDATA x)
{
  QLINK       temp;

  temp = (QLINK) malloc(sizeof(QELEMENT));
  temp->d = x;
  temp->next = NULL;
  if (IsEmpty(*q))
    q->front = q->rear = temp;
  else {
    q->rear->next = temp;
    q->rear = temp;
  }
}


void 
WriteIsoLines(FILE * Isofile,
	      IsoList IsoHead)
{
  QUE         qprint = {NULL, NULL};	/* que to be printed. */
  QUE         qsave = {NULL, NULL};
  QDATA       p;		/* QDATA is PairList. */
  char        all_nulls;

  while (IsoHead != NULL) {
    fprintf(Isofile, "X%-8lG\tY%-8lG\t", IsoHead->iso_val, IsoHead->iso_val);
    Enque(&qprint, IsoHead->pairs);
    IsoHead = IsoHead->next;
  }
  fprintf(Isofile, "\n");

  do {
    all_nulls = 1;
    while (!IsEmpty(qprint)) {
      Deque(&qprint, &p);
      if (p != NULL) {
	fprintf(Isofile, "%9.2lE\t%9.2lE\t", p->x, p->y);
	Enque(&qsave, p->next);	/* add the next to a new que for a new
				 * row. */
	if (all_nulls == 1)
	  all_nulls = 0;
      } else {
	/* fprintf(Isofile, "%9s\t%9s\t", " ", " "); */
	fprintf(Isofile, "\t\t");
	Enque(&qsave, p);	/* add a null to the new que. */
      }
    }
    fprintf(Isofile, "\n");
    qprint = qsave;
    qsave.front = NULL;
    qsave.rear = NULL;
  } while (!all_nulls);
}

void 
FreePairs(PairList Pairs)
{
  PairList    this_pair;

  while (Pairs != NULL) {
    this_pair = Pairs;
    Pairs = Pairs->next;
    free(this_pair);
  }
}

void 
FreeIsoLines(IsoList IsoHead)
{
  IsoList     this_iso;
  PairList    pair_head;

  while (IsoHead != NULL) {
    FreePairs(IsoHead->pairs);
    this_iso = IsoHead;
    IsoHead = IsoHead->next;
    free(this_iso);
  }
}


void 
IsoPlot(double **Z,		/* the 2D array Z[i][j]. */
	long int IXmax,
	long int IYmax,		/* the 0<=i<=IXmax, 0<=j<=IYmax. */
	double Dx,
	double Dy)
{				/* the gridline separations. */
  FILE       *isofile;		/* send isolines to this file. */
  struct XY   pmin, pmax;	/* the xy positions of the min & max. */
  double      zmin, zmax;
  IsoList     isos;
  char        fname[128] = "iso";

  /* Locate the min & max. */
  zmin = ZMin(Z, IXmax, IYmax, Dx, Dy, &pmin);
  zmax = ZMax(Z, IXmax, IYmax, Dx, Dy, &pmax);

  if (zmin == zmax || IXmax * IYmax < 4) {
    printf("...Not enough data for contour plot\n");
    return;
  }
  isofile = GetWriteFile(fname);
  if (isofile == NULL)
    return;

  printf("The range of the value is %lf to %lf.\n", zmin, zmax);
  isos = GetIsoValues(zmin, zmax);

  GetIsoLines(isos, Z, IXmax, IYmax, Dx, Dy, pmax);
  WriteIsoLines(isofile, isos);

  FreeIsoLines(isos);

  fclose(isofile);
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
免费成人av资源网| 欧美日韩精品福利| 国产精品小仙女| 精品亚洲国产成人av制服丝袜| 性做久久久久久免费观看| 亚洲高清免费观看高清完整版在线观看| 中文字幕亚洲成人| 亚洲欧美日韩中文播放| 亚洲精品一二三| 精品一区二区免费| 国产一区二区不卡老阿姨| 国产做a爰片久久毛片| 激情欧美日韩一区二区| 国产乱码精品一区二区三区五月婷| 黄色精品一二区| 大陆成人av片| 91在线无精精品入口| 色播五月激情综合网| 欧美午夜在线观看| 欧美一区二区视频观看视频| 日韩美女在线视频| 欧美高清在线精品一区| 日韩理论片网站| 亚洲成人一区二区在线观看| 日韩av成人高清| 国产一区二区看久久| 99久久精品免费看国产| 一本大道久久a久久综合婷婷| 欧美偷拍一区二区| 日韩欧美国产电影| 国产精品高潮久久久久无| 亚洲欧美日韩国产另类专区| 亚洲午夜私人影院| 青青草视频一区| 成人av在线电影| 欧美日韩一区二区三区在线| 日韩欧美亚洲国产另类| 久久久久久久久岛国免费| 中文字幕日韩av资源站| 视频一区国产视频| 国产999精品久久| 欧美三级韩国三级日本一级| 精品国产一区二区三区av性色| 中文字幕国产一区| 亚洲制服丝袜av| 精品影视av免费| 91在线国产福利| 欧美一区二区精品| 国产精品久久三| 青青草视频一区| 国产精品美女久久久久久久久久久| 一区二区国产视频| 精品无人区卡一卡二卡三乱码免费卡| 成人黄动漫网站免费app| 欧美日韩精品欧美日韩精品一综合| 日韩精品在线一区二区| 亚洲人吸女人奶水| 国产麻豆精品在线观看| 欧洲生活片亚洲生活在线观看| 精品日韩99亚洲| 樱花影视一区二区| 高清成人免费视频| 日韩欧美一区二区在线视频| 中文字幕日韩av资源站| 精品午夜一区二区三区在线观看| 欧洲一区在线观看| 国产精品免费视频网站| 极品销魂美女一区二区三区| 欧洲一区二区av| 国产精品久久久久久久第一福利| 日本三级韩国三级欧美三级| 成人爱爱电影网址| 欧美精品一区二区三区很污很色的| 亚洲精品日韩一| 丁香一区二区三区| 精品欧美黑人一区二区三区| 午夜欧美在线一二页| 91视频国产资源| 日本一区二区久久| 国产精品综合一区二区三区| 91精品福利在线一区二区三区 | 欧美中文字幕亚洲一区二区va在线| 久久久一区二区| 毛片av中文字幕一区二区| 欧美综合天天夜夜久久| 国产精品国产三级国产普通话蜜臀| 老司机午夜精品99久久| 777午夜精品免费视频| 亚洲一区二区三区国产| 色乱码一区二区三区88| 亚洲色图欧洲色图婷婷| 成人激情免费电影网址| 国产欧美日韩另类一区| 国产最新精品免费| 精品国产电影一区二区| 蜜桃视频第一区免费观看| 欧美精品v日韩精品v韩国精品v| 亚洲在线免费播放| 欧美视频一区二| 亚洲一区二区中文在线| 色视频欧美一区二区三区| 亚洲人成网站色在线观看| 99久精品国产| 亚洲三级小视频| 91免费版在线| 亚洲精品成a人| 欧美在线视频你懂得| 亚洲精品视频自拍| 欧洲精品在线观看| 亚洲成人手机在线| 91精品国产一区二区三区香蕉| 午夜精品视频在线观看| 欧美一级夜夜爽| 狠狠色狠狠色综合日日91app| 精品国产91乱码一区二区三区 | 51精品秘密在线观看| 日韩成人dvd| 欧美电影免费观看完整版| 国产精一品亚洲二区在线视频| 国产日本欧洲亚洲| 99这里只有久久精品视频| 亚洲免费av在线| 欧美日韩亚州综合| 精品一区二区三区在线播放| 久久久久久97三级| bt欧美亚洲午夜电影天堂| 亚洲免费观看高清完整版在线观看| 欧美性猛交xxxxxxxx| 日本不卡的三区四区五区| 久久亚洲综合色一区二区三区| 国产黑丝在线一区二区三区| 中文字幕一区二区三| 欧美优质美女网站| 麻豆精品一区二区三区| 中文字幕欧美日韩一区| 91久久国产最好的精华液| 天天影视色香欲综合网老头| 日韩精品一区二区三区中文不卡 | 亚洲桃色在线一区| 欧美手机在线视频| 蜜臀久久99精品久久久久久9| 欧美激情一区三区| 欧美系列亚洲系列| 国产综合久久久久影院| 亚洲精品免费在线观看| 日韩亚洲欧美高清| 成人午夜私人影院| 香蕉久久夜色精品国产使用方法| 亚洲精品一区二区三区精华液| www.久久久久久久久| 日韩成人dvd| 综合婷婷亚洲小说| 日韩精品一区二区三区视频| 99re这里只有精品6| 蜜桃视频在线观看一区二区| 国产精品国产三级国产a| 欧美一卡2卡3卡4卡| 91丨porny丨首页| 国模大尺度一区二区三区| 亚洲欧美日韩系列| 精品国产污污免费网站入口 | 久久国产麻豆精品| 怡红院av一区二区三区| 久久综合久久综合久久| 欧美在线观看你懂的| 成人涩涩免费视频| 美女www一区二区| 亚洲自拍偷拍网站| 国产精品三级av| 欧美精品一区二区三区蜜桃视频| 欧美日韩在线不卡| 成人黄色软件下载| 久久99国产精品久久99 | 成人激情图片网| 麻豆国产欧美一区二区三区| 一区二区三区四区不卡在线| 国产偷国产偷精品高清尤物| 91精品国产综合久久福利软件| 91香蕉视频黄| 成人av第一页| 国产九色精品成人porny| 日韩一区精品字幕| 一区二区三区精品在线| 国产精品不卡在线观看| 国产丝袜美腿一区二区三区| 91精品国产综合久久久久久| 在线观看成人免费视频| 99re热这里只有精品免费视频| 国产一区不卡视频| 美腿丝袜亚洲三区| 天天色 色综合| 亚洲大型综合色站| 亚洲激情一二三区| 亚洲丝袜制服诱惑| 国产精品美女久久久久aⅴ国产馆| 2024国产精品视频| 精品国一区二区三区| 91精品一区二区三区久久久久久 | 7777精品久久久大香线蕉| 欧美日韩国产免费|