Skip to content
  • 最新
  • 版块
  • 东岳流体
  • 随机看[请狂点我]
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(不使用皮肤)
  • 不使用皮肤
折叠
CFD中文网

CFD中文网

  1. CFD中文网
  2. OpenFOAM
  3. OpenFOAM中有关类模板使用的一些疑问

OpenFOAM中有关类模板使用的一些疑问

已定时 已固定 已锁定 已移动 OpenFOAM
1 帖子 1 发布者 1.3k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
回复
  • 在新帖中回复
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • 小 离线
    小 离线
    小考拉
    写于 最后由 编辑
    #1

    各位朋友们好!

    我最近在看lagrangian库中的solidParticle库代码,对于里面的 类模板的使用 不太懂,solidParticleCloud.C部分代码如下:

    void Foam::solidParticleCloud::move(const dimensionedVector& g)  //在solidParticleCloud类中定义一个move函数
    {
        const volScalarField& rho = mesh_.lookupObject<const volScalarField>("rho");
        const volVectorField& U = mesh_.lookupObject<const volVectorField>("U");
        const volScalarField& nu = mesh_.lookupObject<const volScalarField>("nu");
    
        interpolationCellPoint<scalar> rhoInterp(rho);
        interpolationCellPoint<vector> UInterp(U);
        interpolationCellPoint<scalar> nuInterp(nu);
    
        solidParticle::trackingData
            td(*this, rhoInterp, UInterp, nuInterp, g.value());   //在solidParticleCloud类下面定义了一个trackingData类的对象td??
        Cloud<solidParticle>::move(td, mesh_.time().deltaTValue());
    }
    

    代码中的这句话:

    solidParticle::trackingData
            td(*this, rhoInterp, UInterp, nuInterp, g.value());  
    

    目前自己很困惑,为什么在solidParticleCloud类的函数move中可以 定义一个 solidParticle类中的 trackingData类的 对象td呢?

    自己查找了solidParticleCloud.H文件发现 solidParticleCloud的基类是 Cloud<solidParticle>类,这个Cloud<solidParticle>类 中solidParticle是实参,对Cloud <ParticleType> 类模板进行了实例化.

    我怀疑难道是因为Cloud<solidParticle>类中的 实参是solidParticle,所以其子类solidParticleCloud中函数 就可以调用/定义 solidParticle类中的trackingData类?

    请哪位高手能够指点一下呢?感激不尽:xinxin:

    1 条回复 最后回复

  • 登录

  • 登录或注册以进行搜索。
  • 第一个帖子
    最后一个帖子
0
  • 最新
  • 版块
  • 东岳流体
  • 随机看[请狂点我]