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

📄 diagmtrx.cpp

📁 不错的国外的有限元程序代码,附带详细的manual,可以节省很多的底层工作.
💻 CPP
字号:
//   file DIAGMTRX.CXX
 
#include "diagmtrx.hxx"


void  DiagonalMatrix :: checkBounds (int i,int j)
   // Checks that the receiver possesses a (i,j) coefficient.
{
   if (i>nRows || i<=0 || j!=i) {
      printf ("error : DiagonalMatrix(%d) has no coeff (%d,%d)\n",nRows,i,j);
      exit(0) ;}
}


FloatMatrix*  DiagonalMatrix :: GiveCopy ()
   // Returns a copy of the receiver. For consistency with method giveCopy()
   // of class FloatMatrix, returns the answer as a FloatMatrix.
{
   DiagonalMatrix *answer ;
   double         *P1,*P2 ;
   int            i ;

   answer = new DiagonalMatrix(nRows) ;
   P1     = values ;
   P2     = answer->values ;
   i      = nRows ;
   while (i--)
      *P2++ = *P1++ ;
   return (FloatMatrix*)answer ;
}


void  DiagonalMatrix :: printYourself ()
   // Prints the receiver on screen.
{
   int i ;

   printf ("Diagonal matrix of size %d\n",nRows) ;
   for (i=0 ; i<nRows ; i++)
      printf ("%f ",values[i]) ;
   printf ("\n") ;
}


⌨️ 快捷键说明

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