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

📄 input1.c

📁 an introduction to boundary element methods一书源码
💻 C
字号:
#include "cbox1.h"void Input1(X,Y,Xi,Yi,Code,Bc)	float X[102], Y[102],Xi[21],Yi[21],Bc[101];	int Code[101];{	FILE  *infile, *outfile;	int i,j,k,lnsize;	char Title[80],line1[100]; 	lnsize = 100; /*[  N = number of boundary elements       L = number of interior points where the results are computed  ]*/	printf("\nNOTE: FIRST LINE IN THE INPUT FILE SHOULD BE EITHER BLANK OR THE TITLE NOT DATA \n");         printf("\n Enter the name of the input file:");        scanf("%s", inname);        printf("\n Enter the name of the output file:");        scanf("%s", outname);        printf("\n");               infile = fopen(inname, "r" );        outfile = fopen(outname,"w" );	fgets(line1,lnsize,infile);	fprintf(outfile,"%s \n",line1);	fprintf(outfile," Input \n");/*[  Read boundary elements and internal points ]*/ 	fscanf(infile,"%d %d",&N,&L);	fprintf(outfile," \nNumber of Boundary Elements = %2d \n",N);	fprintf(outfile,"Number of Interior Points = %2d \n",L);/*[ Read coordinates of extreme points in arrays X and Y  ]*/	fprintf(outfile," \nCordinates of Extreme Points \n"); 	fprintf(outfile,"\nPoint    X          Y\n");	for(i=1;i<=N;i++)	{ 	  fscanf(infile,"%f %f",&X[i],&Y[i]);	  fprintf(outfile,"%2d %10.4f %10.4f \n",i,X[i],Y[i]);	}	  fprintf(outfile," \n \n");/*[ Read boundary conditions in the vector Bc[i].]*/	fprintf(outfile,"Boundary Conditions \n");	fprintf(outfile,"\nNode Code  Prescribed Value\n");	for(i=1;i<=N;i++)	{	  fscanf(infile,"%d %f",&Code[i],&Bc[i]);	  fprintf(outfile,"%2d  %2d %10.4f \n",i,Code[i],Bc[i]);	}	fprintf(outfile," \n \n");/*[  Read coordinates of the interior points   ]*/	if( L)	{	  fprintf(outfile," \nInterior Point Coordinates \n");	  fprintf(outfile,"\nPoint    Xi      Yi\n"); 	  for(i=1;i<=L;i++)		    {		     fscanf(infile,"%f %f",&Xi[i],&Yi[i]);		     fprintf(outfile,"%2d     %2.4f %2.4f \n",i,Xi[i],Yi[i]);		    }	}    	for(i=1;i<=80;i++)	fprintf(outfile,"*");	fprintf(outfile," \n");  	fclose(infile);	fclose(outfile);  }

⌨️ 快捷键说明

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