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

📄 testproblem7.h

📁 Dolfin provide a high-performance linear algebra library
💻 H
字号:
// Copyright (C) 2003-2006 Anders Logg.// Licensed under the GNU LGPL Version 2.1.//// First added:  2003// Last changed: 2006-08-21#include <dolfin.h>using namespace dolfin;class TestProblem7 : public ODE{public:    TestProblem7() : ODE(101, 1.0)  {    h = 1.0 / (static_cast<real>(N) - 1);    message("The heat equation on [0,1] with h = %f", h);  }    void u0(uBlasVector& u)  {    u = 0.0;  }  void f(const uBlasVector& u, real t, uBlasVector& y)  {    // Boundary values    y(0)   = 0.0;    y(N-1) = 0.0;    // Interior values    for (unsigned int i = 1; i < N - 1; i++)    {      // Heat source      real source = 0.0;      if ( i == N/2 )	source = 100.0;            y[i] = (u[i-1] - 2.0*u[i] + u[i+1]) / (h*h) + source;    }  }  private:    real h;};

⌨️ 快捷键说明

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