Пример #1
0
void
MultiscaleCoupling::interpolateCouplingVariables ( const Real& t, multiscaleVector_Type& interpolatedCouplingVariables ) const
{
    // Coupling variables size
    UInt couplingVariablesSize ( M_localCouplingVariables.size() );

    // Time container for interpolation
    timeContainer_Type timeContainer ( couplingVariablesSize, 0 );
    for ( UInt i (0) ; i < couplingVariablesSize ; ++i )
    {
        timeContainer[i] = M_globalData->dataTime()->time() - i * M_globalData->dataTime()->timeStep();
    }

    // Lagrange interpolation
    interpolatedCouplingVariables *= 0;
    Real base (1);

    for ( UInt i (0) ; i < M_localCouplingVariables.size() ; ++i )
    {
        base = 1;
        for ( UInt j (0) ; j < M_localCouplingVariables.size() ; ++j )
            if ( j != i )
            {
                base *= (t - timeContainer[j]) / (timeContainer[i] - timeContainer[j]);
            }

        interpolatedCouplingVariables += base * localCouplingVariables ( i );
    }
}
Пример #2
0
Node::InsertionNotificationRequest SVGSVGElement::insertedInto(
    ContainerNode* rootParent) {
  if (rootParent->isConnected()) {
    UseCounter::count(document(), UseCounter::SVGSVGElementInDocument);
    if (rootParent->document().isXMLDocument())
      UseCounter::count(document(), UseCounter::SVGSVGElementInXMLDocument);

    if (RuntimeEnabledFeatures::smilEnabled()) {
      document().accessSVGExtensions().addTimeContainer(this);

      // Animations are started at the end of document parsing and after firing
      // the load event, but if we miss that train (deferred programmatic
      // element insertion for example) we need to initialize the time container
      // here.
      if (!document().parsing() && !document().processingLoadEvent() &&
          document().loadEventFinished() && !timeContainer()->isStarted())
        timeContainer()->start();
    }
  }
  return SVGGraphicsElement::insertedInto(rootParent);
}
Пример #3
0
Node::InsertionNotificationRequest SVGSVGElement::insertedInto(ContainerNode* rootParent)
{
    if (rootParent->inDocument()) {
        document()->accessSVGExtensions()->addTimeContainer(this);

        // Animations are started at the end of document parsing and after firing the load event,
        // but if we miss that train (deferred programmatic element insertion for example) we need
        // to initialize the time container here.
        if (!document()->parsing() && !document()->processingLoadEvent() && document()->loadEventFinished() && !timeContainer()->isStarted())
            timeContainer()->begin();
    }
    return SVGStyledLocatableElement::insertedInto(rootParent);
}
Пример #4
0
Real
MultiscaleModelFSI1D::bcFunctionDelta ( const Real& t )
{
    // Previous bc size
    UInt bcPreviousSize ( M_bcPreviousTimeSteps.size() );

    // Time container for interpolation
    std::vector< Real > timeContainer ( bcPreviousSize, 0 );
    for ( UInt i (0) ; i < bcPreviousSize ; ++i )
    {
        timeContainer[i] = M_globalData->dataTime()->time() - i * M_globalData->dataTime()->timeStep();
    }

    // Lagrange interpolation
    Real bcValue (0);
    Real base (1);

    for ( UInt i (0) ; i < M_bcPreviousTimeSteps.size() ; ++i )
    {
        base = 1;
        for ( UInt j (0) ; j < M_bcPreviousTimeSteps.size() ; ++j )
            if ( j != i )
            {
                base *= (t - timeContainer[j]) / (timeContainer[i] - timeContainer[j]);
            }

        if ( i == 0 )
        {
            bcValue += base * ( M_bcPreviousTimeSteps[i][M_bcDeltaSide][M_bcDeltaType] + M_bcDelta );
        }
        else
        {
            bcValue += base * M_bcPreviousTimeSteps[i][M_bcDeltaSide][M_bcDeltaType];
        }
    }

    return bcValue;
}