当前位置: 首页>>代码示例>>C++>>正文


C++ UserData::Sig方法代码示例

本文整理汇总了C++中UserData::Sig方法的典型用法代码示例。如果您正苦于以下问题:C++ UserData::Sig方法的具体用法?C++ UserData::Sig怎么用?C++ UserData::Sig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserData的用法示例。


在下文中一共展示了UserData::Sig方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetTxTest

void SetTxTest (Vec3_t const & Sigf, bVec3_t const & pEps, Vec3_t const & dEpsdt, double theta, double alpha, bool TheStrainCtrl, UserData & UD, DEM::Domain const & D)
{
    // info
    std::cout << "[1;33m\n--- Setting up Triaxial Test -------------------------------------[0m\n";
    double start = std::clock();

    // Store setting up data
    UD.StrainCtrl = TheStrainCtrl;
    UD.Thf = theta;
    UD.Alp = alpha;
    if (TheStrainCtrl) UD.Sig0 = UD.Sig;

    // initialize particles
    for (size_t i=0; i<D.Particles.Size(); i++) D.Particles[i]->Initialize(i);

    // total stress increment
    UD.DSig = Sigf - UD.Sig;

    // assume all strains prescribed by default
    UD.pSig = false, false, false;

    // Eps(0) prescribed ?
    Vec3_t veloc, force;
    if (pEps(0))
    {
        double height = (D.Particles[UD.InitialIndex]->x(0)-D.Particles[UD.InitialIndex+1]->x(0));
        veloc = 0.5*dEpsdt(0)*height, 0.0, 0.0;
        D.Particles[UD.InitialIndex  ]->Ff = 0.0,0.0,0.0;
        D.Particles[UD.InitialIndex  ]->FixVeloc();
        D.Particles[UD.InitialIndex  ]->v  =  veloc;
        D.Particles[UD.InitialIndex+1]->Ff = 0.0,0.0,0.0;
        D.Particles[UD.InitialIndex+1]->FixVeloc();
        D.Particles[UD.InitialIndex+1]->v  = -veloc;
    }
    else // UD.Sig(0) prescribed
    {
        double area = (D.Particles[UD.InitialIndex+2]->x(1)-D.Particles[UD.InitialIndex+3]->x(1))*(D.Particles[UD.InitialIndex+4]->x(2)-D.Particles[UD.InitialIndex+5]->x(2));
        force = UD.Sig(0)*area, 0.0, 0.0;
        D.Particles[UD.InitialIndex  ]->Ff =  force;
        D.Particles[UD.InitialIndex  ]->FixVeloc();
        D.Particles[UD.InitialIndex  ]->vxf = false;
        D.Particles[UD.InitialIndex+1]->Ff = -force;
        D.Particles[UD.InitialIndex+1]->FixVeloc();
        D.Particles[UD.InitialIndex+1]->vxf = false;
        UD.pSig(0) = true;
    }

    // Eps(1) prescribed ?
    if (pEps(1))
    {
        double height = (D.Particles[UD.InitialIndex+2]->x(1)-D.Particles[UD.InitialIndex+3]->x(1));
        veloc = 0.0, 0.5*dEpsdt(1)*height, 0.0;
        D.Particles[UD.InitialIndex+2]->Ff = 0.0,0.0,0.0;
        D.Particles[UD.InitialIndex+2]->FixVeloc();
        D.Particles[UD.InitialIndex+2]->v  =  veloc;
        D.Particles[UD.InitialIndex+3]->Ff = 0.0,0.0,0.0;
        D.Particles[UD.InitialIndex+3]->FixVeloc();
        D.Particles[UD.InitialIndex+3]->v  = -veloc;
    }
    else // UD.Sig(1) presscribed
    {
        double area = (D.Particles[UD.InitialIndex]->x(0)-D.Particles[UD.InitialIndex+1]->x(0))*(D.Particles[UD.InitialIndex+4]->x(2)-D.Particles[UD.InitialIndex+5]->x(2));
        force = 0.0, UD.Sig(1)*area, 0.0;
        D.Particles[UD.InitialIndex+2]->Ff =  force;
        D.Particles[UD.InitialIndex+2]->FixVeloc();
        D.Particles[UD.InitialIndex+2]->vyf = false;
        D.Particles[UD.InitialIndex+3]->Ff = -force;
        D.Particles[UD.InitialIndex+3]->FixVeloc();
        D.Particles[UD.InitialIndex+3]->vyf = false;
        UD.pSig(1) = true;
    }

    // Eps(2) prescribed ?
    if (pEps(2))
    {
        double height = (D.Particles[UD.InitialIndex+4]->x(2)-D.Particles[UD.InitialIndex+5]->x(2));
        veloc = 0.0, 0.0, 0.5*dEpsdt(2)*height;
        D.Particles[UD.InitialIndex+4]->Ff = 0.0,0.0,0.0;
        D.Particles[UD.InitialIndex+4]->FixVeloc();
        D.Particles[UD.InitialIndex+4]->v  =  veloc;
        D.Particles[UD.InitialIndex+5]->Ff = 0.0,0.0,0.0;
        D.Particles[UD.InitialIndex+5]->FixVeloc();
        D.Particles[UD.InitialIndex+5]->v  = -veloc;
    }
    else // UD.Sig(2) presscribed
    {
        double area = (D.Particles[UD.InitialIndex]->x(0)-D.Particles[UD.InitialIndex+1]->x(0))*(D.Particles[UD.InitialIndex+2]->x(1)-D.Particles[UD.InitialIndex+3]->x(1));
        force = 0.0, 0.0, UD.Sig(2)*area;
        D.Particles[UD.InitialIndex+4]->Ff =  force;
        D.Particles[UD.InitialIndex+4]->FixVeloc();
        D.Particles[UD.InitialIndex+4]->vzf = false;
        D.Particles[UD.InitialIndex+5]->Ff = -force;
        D.Particles[UD.InitialIndex+5]->FixVeloc();
        D.Particles[UD.InitialIndex+5]->vzf = false;
        UD.pSig(2) = true;
    }

    // info
    double total = std::clock() - start;
    std::cout << "[1;36m    Time elapsed          = [1;31m" <<static_cast<double>(total)/CLOCKS_PER_SEC<<" seconds[0m\n";
//.........这里部分代码省略.........
开发者ID:Axtal,项目名称:spolytope-dem,代码行数:101,代码来源:shear.cpp


注:本文中的UserData::Sig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。