Example #1
0
GolemMaterialBase::GolemMaterialBase(const InputParameters & parameters)
  : Material(parameters),
    _has_scaled_properties(isParamValid("scaling_uo")),
    _rho0_f(getParam<Real>("fluid_density_initial")),
    _rho0_s(getParam<Real>("solid_density_initial")),
    _phi0(getParam<Real>("porosity_initial")),
    _has_gravity(getParam<bool>("has_gravity")),
    _g(getParam<Real>("gravity_acceleration")),
    _scaling_factor0(getParam<Real>("scaling_factor_initial")),
    _function_scaling(isParamValid("function_scaling") ? &getFunction("function_scaling") : NULL),
    _alpha_T_f(getParam<Real>("fluid_thermal_expansion")),
    _alpha_T_s(getParam<Real>("solid_thermal_expansion")),
    _fluid_density_uo(NULL),
    _fluid_viscosity_uo(NULL),
    _permeability_uo(NULL),
    _porosity_uo(&getUserObject<GolemPorosity>("porosity_uo")),
    _scaling_uo(_has_scaled_properties ? &getUserObject<GolemScaling>("scaling_uo") : NULL),
    _material_type(getParam<MooseEnum>("material_type")),
    _scaling_factor(declareProperty<Real>("scaling_factor")),
    _porosity(declareProperty<Real>("porosity")),
    _fluid_density(declareProperty<Real>("fluid_density")),
    _fluid_viscosity(declareProperty<Real>("fluid_viscosity"))
{
  if (_has_scaled_properties)
  {
    _g /= _scaling_uo->_s_acceleration;
    _rho0_s /= _scaling_uo->_s_density;
    _rho0_f /= _scaling_uo->_s_density;
    _alpha_T_s /= _scaling_uo->_s_expansivity;
    _alpha_T_f /= _scaling_uo->_s_expansivity;
    _scaling_factor0 /= _scaling_uo->_s_length;
  }
  computeGravity();
}
Example #2
0
 void Model::
 updateDynamics()
 {
   computeGravity();
   computeCoriolisCentrifugal();
   computeMassInertia();
   computeInverseMassInertia();
 }
Example #3
0
//What's in doStuff right now is only for testing purpose. Lot of stuff to do here.
void Elodie::doStuff(const EventHandler& event, const std::vector< std::vector<TileSprite*> >& tiles,
                     EntityMap& entities, sf::Time animate)
{
    //Compute the gravity
    computeGravity(animate);

    //Check the collisions, set the new distances and do the move
    Collide collideTiles = collideWithTiles(tiles, animate.asSeconds());
    setDistance(collideTiles);
    move(animate.asSeconds()*(speed.x), animate.asSeconds()*speed.y);
    spriteCast->update(animate);

    //Change the sprite in accord with the speed
    changeAnimation(collideTiles);
    handleEvent(event, entities, collideTiles);

    if (0 == speed.x && !collideTiles.right["surface"])
    {
        speed.x = moveSpeed;
    }

    float dist = cameraPos.x - spriteCast->getPosition().x;

    if (dist > 0 && !collideTiles.right["surface"] && !buffed)
    {
        buffed = true;
        speed.x = moveSpeed + dist;
    }

    buffed = !collideTiles.right["surface"];

    if (buffed && dist <= 0)
    {
        buffed = false;
        speed.x = moveSpeed;
    }

    //Other stuff to do
    attackTimer += animate.asSeconds();
    pvTimer += animate.asSeconds();
    if (pvTimer > interRecoveryTime)
    {
        pvTimer = 0;
        immersionLevel = immersionLevel == 100 ? 100 : immersionLevel + 1;
    }
    if (damageCD)
    {
        --damageCD;
    }
    cameraPos.x += (moveSpeed)*animate.asSeconds();
    cameraPos.y = spriteCast->getPosition().y;
}
Example #4
0
void Sheep::doStuff(const EventHandler&, const std::vector< std::vector<TileSprite*> >& tiles,
                    std::map< std::string, Entity* >& entities, sf::Time animate)
{
    //Compute the gravity
    computeGravity(animate);

    //Check the collisions, set the new distances and do the move
    Collide collideTiles = collideWithTiles(tiles, animate.asSeconds());
    setDistance(collideTiles);
    move(animate.asSeconds()*(speed.x), animate.asSeconds()*speed.y);
    sprite->update(animate);

    doAttack(entities);

    if (damageCD)
    {
        --damageCD;
    }
}
Example #5
0
void Poro::doStuff(const EventHandler&, std::vector< std::vector<TileSprite*> > const& tiles, std::map< std::string, Entity* >& entities, sf::Time animate)
{
    checkArea(entities);

    //Compute the gravity
    computeGravity(animate);

    //Check the collisions, set the new distances and do the move
    Collide collideTiles = collideWithTiles(tiles, animate.asSeconds());
    setDistance(collideTiles);
    move(animate.asSeconds()*(speed.x), animate.asSeconds()*speed.y);
    sprite->update(animate);

    if (speed.y == 0 && ((speed.x > 0 && collideTiles.right["surface"]) || (speed.x < 0 && collideTiles.left["surface"])))
    {
        speed.y = -SPEED_Y;
    }

    if (damageCD)
        --damageCD;
}