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

📄 input2.c

📁 an introduction to boundary element methods一书源码
💻 C
字号:
#include "cbox2.h"void Input2(Xi,Yi,X,Y,Code,Bc)			float Xi[21],Yi[21],X[82],Y[82],Bc[161];	int Code[161];{	FILE  *infile, *outfile;	int   i,j,k,lnsize;	char Title[80],line1[100]; 	lnsize = 100;		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);               infile = fopen(inname, "r" );        outfile = fopen(outname,"w" );				fgets(line1,lnsize,infile);		fprintf(outfile,"%s \n",line1);		fprintf(outfile,"Input \n");			fscanf(infile,"%d %d",&N,&L);				fprintf(outfile," \nNumber of Boundary Elements = %d \n",N);		fprintf(outfile," \nNumber of InteriorPoints = %d \n",L);			fprintf(outfile," \nCoordinates of the Extreme Points");		fprintf(outfile,"  of the  Boundary Elements  \n \n"); 		fprintf(outfile,"Point      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]);		}		/*[	Read boundary conditions in Bc[] vector. If Code[i] = 0, the Bc value is a known potential;  if Code[i] = 1, the Bc[] value is a known potential derivative (flux). Two Boundary conditions are read per element.  One node may have two values of the potential derivative but only one vlue of the potential ]*/	fprintf(outfile," \nBoundary  Conditions \n\n");	fprintf(outfile,"               First Node             Second Node\n");	fprintf(outfile,"               Prescribed             Prescribed\n");	fprintf(outfile,"Element     CODE   Value           CODE    Value\n");		for(i=1;i<=N;i++)	{		fscanf(infile,"%d %f %d %f",&Code[2*i -1],&Bc[2*i -1],					&Code[2*i],&Bc[2*i]);							fprintf(outfile,"%2d\t\t\t%2d %10.4f\t\t\t%2d %10.4f\n",				i,Code[2*i -1],Bc[2*i -1],Code[2*i],Bc[2*i]);	}	/*[ Read coordinates of the interior points ]*/	fprintf(outfile,"\nInterior Point Coordinates\n\n");	fprintf(outfile,"       Xi         Yi\n");			for(i=1;i<=L;i++)		{			fscanf(infile,"%f %f \n",&Xi[i],&Yi[i]);			fprintf(outfile," %10.4f %10.4f\n",Xi[i],Yi[i]);		}	fclose(infile);	fclose(outfile);			}

⌨️ 快捷键说明

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