本文整理汇总了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));
}
示例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);
}
}
示例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));
}
}
示例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.
}
}
示例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));
}
}
示例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.
}
}
示例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));
}
}
}
示例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));
}
}
示例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));
}
}
示例10: setVector
void SiconosVector::setVector(unsigned int , const SiconosVector& newV)
{
if (newV.size() != size())
SiconosVectorException::selfThrow("SiconosVector::setVector(num,v), unconsistent sizes.");
*this = newV ;
}
示例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));
}
}
示例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));
}
}
示例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
}
}
示例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);
}
}
示例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));
}
}