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


C++ SiconosVector::size方法代码示例

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


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

示例1: assert

void FirstOrderType1R::computeh(double time, SiconosVector& x, SiconosVector& z, SiconosVector& y)
{
  assert(_pluginh && "FirstOrderType1R::computeOutput() is not linked to a plugin function");

  ((Type1Ptr)(_pluginh->fPtr))(x.size(), &(x)(0), y.size(), &(y)(0), z.size(), &(z)(0));

}
开发者ID:radarsat1,项目名称:siconos,代码行数:7,代码来源:FirstOrderType1R.cpp

示例2: toBlock

void SiconosVector::toBlock(SiconosVector& vOut, unsigned int sizeB, unsigned int startIn, unsigned int startOut) const
{
  // To copy a subBlock of the vector (from position startIn to startIn+sizeB) into vOut (from pos. startOut to startOut+sizeB).
  // Check dim ...
  assert(startIn < size() && "vector toBlock(v1,v2,...): start position in input vector is out of range.");

  assert(startOut < vOut.size() && "vector toBlock(v1,v2,...): start position in output vector is out of range.");

  assert(startIn + sizeB <= size() && "vector toBlock(v1,v2,...): end position in input vector is out of range.");
  assert(startOut + sizeB <= vOut.size() && "vector toBlock(v1,v2,...): end position in output vector is out of range.");

  unsigned int endOut = startOut + sizeB;
  unsigned int numIn = num();
  unsigned int numOut = vOut.num();

  if (numIn == numOut)
  {
    if (numIn == 1) // vIn / vOut are Dense
      noalias(ublas::subrange(*vOut.dense(), startOut, endOut)) = ublas::subrange(*vect.Dense, startIn, startIn + sizeB);
    else // if(numIn == 4)// vIn / vOut are Sparse
      noalias(ublas::subrange(*vOut.sparse(), startOut, endOut)) = ublas::subrange(*vect.Sparse, startIn, startIn + sizeB);
  }
  else // vIn and vout of different types ...
  {
    if (numIn == 1) // vIn Dense
      noalias(ublas::subrange(*vOut.sparse(), startOut, endOut)) = ublas::subrange(*vect.Dense, startIn, startIn + sizeB);
    else // if(numIn == 4)// vIn Sparse
      noalias(ublas::subrange(*vOut.dense(), startOut, endOut)) = ublas::subrange(*vect.Sparse, startIn, startIn + sizeB);
  }
}
开发者ID:siconos,项目名称:siconos,代码行数:30,代码来源:SiconosVector.cpp

示例3: computee

void FirstOrderLinearR::computee(double time, SiconosVector& z, SiconosVector& e)
{

  if (_plugine->fPtr)
  {
    ((FOVecPtr) _plugine->fPtr)(time, e.size(), &(e)(0), z.size(), &(z)(0));
  }
}
开发者ID:siconos,项目名称:siconos,代码行数:8,代码来源:FirstOrderLinearR.cpp

示例4: computeJachlambda

void LagrangianCompliantR::computeJachlambda(double time, SiconosVector& q0, SiconosVector& lambda, SiconosVector& z)
{

  if (_pluginJachlambda->fPtr)
  {
    // get vector lambda of the current interaction
    ((FPtr2)_pluginJachlambda->fPtr)(q0.size(), &(q0)(0), lambda.size(), &(lambda)(0), &(*_jachlambda)(0, 0), z.size(), &(z)(0));
    // Copy data that might have been changed in the plug-in call.
  }
}
开发者ID:radarsat1,项目名称:siconos,代码行数:10,代码来源:LagrangianCompliantR.cpp

示例5: computeh

void LagrangianCompliantR::computeh(double time, SiconosVector& q0, SiconosVector& lambda, SiconosVector& z, SiconosVector& y)
{
  if (_pluginh->fPtr)
  {
    // get vector y of the current interaction

    // Warning: temporary method to have contiguous values in memory, copy of block to simple.
    ((FPtr2)(_pluginh->fPtr))(q0.size(), &(q0)(0), y.size(), &(lambda)(0), &(y)(0), z.size(), &(z)(0));

  }
}
开发者ID:radarsat1,项目名称:siconos,代码行数:11,代码来源:LagrangianCompliantR.cpp

示例6: computeJachq

void LagrangianCompliantR::computeJachq(double time, SiconosVector& q0, SiconosVector& lambda, SiconosVector& z)
{

  if (_pluginJachq->fPtr)
  {
    // Warning: temporary method to have contiguous values in memory, copy of block to simple.
    // get vector lambda of the current interaction
    ((FPtr2)(_pluginJachq->fPtr))(q0.size(), &(q0)(0), lambda.size(), &(lambda)(0), &(*_jachq)(0, 0), z.size(), &(z)(0));
    // Copy data that might have been changed in the plug-in call.
  }
}
开发者ID:radarsat1,项目名称:siconos,代码行数:11,代码来源:LagrangianCompliantR.cpp

示例7: computeh

void LagrangianRheonomousR::computeh(double time, SiconosVector& q, SiconosVector& z, SiconosVector& y)
{
  DEBUG_PRINT(" LagrangianRheonomousR::computeh(double time,Interaction& inter, SP::BlockVector q, SP::BlockVector z)");
  if (_pluginh)
  {
    // arg= time. Unused in this function but required for interface.
    if (_pluginh->fPtr)
    {
      ((FPtr4)(_pluginh->fPtr))(q.size(), &(q)(0), time, y.size(),  &(y)(0), z.size(), &(z)(0));

    }
  }
}
开发者ID:radarsat1,项目名称:siconos,代码行数:13,代码来源:LagrangianRheonomousR.cpp

示例8: computehDot

void LagrangianRheonomousR::computehDot(double time, SiconosVector& q, SiconosVector& z)
{
  if (_pluginhDot && _pluginhDot->fPtr)
  {
    ((FPtr4)(_pluginhDot->fPtr))(q.size(), &(q)(0), time, _hDot->size(),  &(*_hDot)(0), z.size(), &(z)(0));
  }
}
开发者ID:radarsat1,项目名称:siconos,代码行数:7,代码来源:LagrangianRheonomousR.cpp

示例9: computeB

void FirstOrderLinearR::computeB(double time, SiconosVector& z, SimpleMatrix& B)
{
  if (_pluginJacglambda->fPtr)
  {
    ((FOMatPtr1) _pluginJacglambda->fPtr)(time, B.size(0), B.size(1), &(B)(0, 0), z.size(), &(z)(0));
  }
}
开发者ID:siconos,项目名称:siconos,代码行数:7,代码来源:FirstOrderLinearR.cpp

示例10: setVector

void SiconosVector::setVector(unsigned int , const SiconosVector& newV)
{
  if (newV.size() != size())
    SiconosVectorException::selfThrow("SiconosVector::setVector(num,v), unconsistent sizes.");

  *this = newV ;
}
开发者ID:siconos,项目名称:siconos,代码行数:7,代码来源:SiconosVector.cpp

示例11: computeD

void FirstOrderLinearR::computeD(double time, SiconosVector& z, SimpleMatrix& D)
{
  if (_pluginJachlambda->fPtr)
  {
    ((FOMatPtr1)(_pluginJachlambda->fPtr))(time, D.size(0), D.size(1), &(D)(0, 0), z.size(), &(z)(0));
  }
}
开发者ID:siconos,项目名称:siconos,代码行数:7,代码来源:FirstOrderLinearR.cpp

示例12: computeC

void FirstOrderLinearR::computeC(double time, SiconosVector& z, SimpleMatrix& C)
{
  if (_pluginJachx->fPtr)
  {
    ((FOMatPtr1)(_pluginJachx->fPtr))(time, C.size(0), C.size(1), &(C)(0, 0), z.size(), &(z)(0));
  }
}
开发者ID:siconos,项目名称:siconos,代码行数:7,代码来源:FirstOrderLinearR.cpp

示例13: addSmoothTerms

void ControlLinearAdditionalTermsED::addSmoothTerms(DynamicalSystemsGraph& DSG0, const DynamicalSystemsGraph::VDescriptor& dsgVD, const double t, SiconosVector& xdot)
{
    // check whether we have a system with a control input
    if (DSG0.u.hasKey(dsgVD))
    {
        if (DSG0.B.hasKey(dsgVD))
        {
            prod(DSG0.B.getRef(dsgVD), DSG0.u.getRef(dsgVD), xdot, false); // xdot += B*u
        }
        else if (DSG0.pluginU.hasKey(dsgVD))
        {
            DynamicalSystem& ds = *DSG0.bundle(dsgVD);
            SiconosVector& u = DSG0.u.getRef(dsgVD);
            SiconosVector& tmpXdot = DSG0.tmpXdot.getRef(dsgVD);
            ((AdditionalTermsEDfctU)DSG0.pluginU.getRef(dsgVD).fPtr)(t, xdot.size(), ds.getx().getArray(), u.size(), u.getArray(), tmpXdot.getArray(), ds.getz().size(), ds.getz().getArray());
            xdot += tmpXdot; // xdot += g(x, u)
        }
        else
        {
            RuntimeException::selfThrow("ControlLinearAdditionalTermsED :: input u but no B nor pluginU");
        }
    }
    // check whether the DynamicalSystem is an Observer
    if (DSG0.e.hasKey(dsgVD))
    {
        assert(DSG0.L.hasKey(dsgVD));
        prod(*DSG0.L[dsgVD], *DSG0.e[dsgVD], xdot, false); // xdot += -L*e
    }
}
开发者ID:bremond,项目名称:siconos,代码行数:29,代码来源:ControlLinearAdditionalTermsED.cpp

示例14: SolveByLeastSquares

void SimpleMatrix::SolveByLeastSquares(SiconosVector &B)
{
  if (B.isBlock())
    SiconosMatrixException::selfThrow("SimpleMatrix::SolveByLeastSquares(SiconosVector &B) failed. Not yet implemented for V being a BlockVector.");

  DenseMat tmpB(B.size(), 1);
  ublas::column(tmpB, 0) = *(B.dense()); // Conversion of vector to matrix. Temporary solution.
  int info = 0;

#ifdef USE_OPTIMAL_WORKSPACE
  info += lapack::gels(*mat.Dense, tmpB, lapack::optimal_workspace());
#endif
#ifdef USE_MINIMAL_WORKSPACE
  info += lapack::gels(*mat.Dense, tmpB, lapack::minimal_workspace());
#endif
  if (info != 0)
  {
    std::cout << "info = " << info << std::endl;
    SiconosMatrixException::selfThrow("SimpleMatrix::SolveByLeastSquares failed.");
  }
  else
  {
    noalias(*(B.dense())) = ublas::column(tmpB, 0);
  }

}
开发者ID:siconos,项目名称:siconos,代码行数:26,代码来源:SimpleMatrixSolvers.cpp

示例15: computeF

void FirstOrderLinearR::computeF(double time, SiconosVector& z, SimpleMatrix& F)
{
  if (_pluginf->fPtr)
  {
    ((FOMatPtr1)(_pluginf->fPtr))(time, F.size(0), F.size(1), &(F)(0, 0), z.size(), &(z)(0));
  }
}
开发者ID:siconos,项目名称:siconos,代码行数:7,代码来源:FirstOrderLinearR.cpp


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