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

📄 main.cpp

📁 计算弹性模量的小程序
💻 CPP
字号:
#include <iostream.h>
#include <iomanip.h>
#include "stdio.h"
#include "function.h"

main()
{
  int i,j;
  int Iopt,nGauss;
  int Ele[8],jll[16];
  double xo[8],yo[8],ek[256],Kt[16][16],temp;
  double E,u,Thick;

  //测试节点
  xo[0]=1.0;xo[1]=4.0;xo[2]=7.0;xo[3]=2.0;xo[4]=0;xo[5]=0;xo[6]=0;xo[7]=0;
  yo[0]=1.0;yo[1]=1.5;yo[2]=5.5;yo[3]=4.5;yo[4]=0;yo[5]=0;yo[6]=0;yo[7]=0;

  Ele[0]=1;Ele[1]=2;Ele[2]=3;Ele[3]=4;Ele[4]=0;Ele[5]=0;Ele[6]=0;Ele[7]=0;
  
  for(i=0;i<8;i++) 
  {
	  if(Ele[i])
	  { jll[2*i]=2*Ele[i]-1;jll[2*i+1]=2*Ele[i];  }
      else
	  { jll[2*i]=0;jll[2*i+1]=0;}
  }
  cout<<"Please input the option Iopt=0,1,2\n";  
  cin>>Iopt;//选择平面应力,平面应变和轴对称

  if(Iopt==0)//平面应变
  { 
	  cout<<"Please input the element thick\n"; cin>>Thick;
  }
  else//平面应变和轴对称 
	  Thick=1.0;
      cout<<"Please input the number of the Gauss point\n";   
	  cin>>nGauss;//输入高斯积分点
      cout<<"Please input the modulus and the Poisson ration\n";  
	  cin>>E>>u;
      CacuEk(E,u,Thick,xo,yo,ek,Ele,Iopt,nGauss);

      for(i=0;i<16;i++) for(j=0;j<16;j++) Kt[i][j]=ek[16*i+j];
      for(i=0;i<16;i++) 
	  {
		  if(jll[i])
		  { 
			  for(j=0;j<8;j++) 
			  {if(jll[j]) cout<<"Kt["<<i+1<<"]"<<"["<<j+1<<"]="<<Kt[i][j]<<"\n";} 
			  cout<<"\n"; 
		  }
	  }
      for(i=0;i<16;i++)
	  { 
		  temp=0.0;
          for(j=0;j<16;j=j+1) temp+=Kt[i][j];
          cout<<"The summation of the "<<setw(1)<<i+1<<"row is "<<setw(12.7)<<temp<<"\n";
	  }
  return 0;
}

⌨️ 快捷键说明

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