本文整理汇总了C++中sp::DynamicalSystem类的典型用法代码示例。如果您正苦于以下问题:C++ DynamicalSystem类的具体用法?C++ DynamicalSystem怎么用?C++ DynamicalSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DynamicalSystem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initOSIs
void EventDriven::initOSIs()
{
for (OSIIterator itosi = _allOSI->begin(); itosi != _allOSI->end(); ++itosi)
{
// Initialize the acceleration like for NewMarkAlphaScheme
if ((*itosi)->getType() == OSI::NEWMARKALPHAOSI)
{
SP::NewMarkAlphaOSI osi_NewMark = std11::static_pointer_cast<NewMarkAlphaOSI>(*itosi);
DynamicalSystemsGraph::VIterator dsi, dsend;
SP::DynamicalSystemsGraph osiDSGraph = (*itosi)->dynamicalSystemsGraph();
for (std11::tie(dsi, dsend) = osiDSGraph->vertices(); dsi != dsend; ++dsi)
{
if (!(*itosi)->checkOSI(dsi)) continue;
SP::DynamicalSystem ds = osiDSGraph->bundle(*dsi);
if ((Type::value(*ds) == Type::LagrangianDS) || (Type::value(*ds) == Type::LagrangianLinearTIDS))
{
SP::LagrangianDS d = std11::static_pointer_cast<LagrangianDS>(ds);
*(d->workspace(DynamicalSystem::acce_like)) = *(d->acceleration()); // set a0 = ddotq0
// Allocate the memory to stock coefficients of the polynomial for the dense output
d->allocateWorkMatrix(LagrangianDS::coeffs_denseoutput, ds->dimension(), (osi_NewMark->getOrderDenseOutput() + 1));
}
}
}
}
}
示例2: setW
void EulerMoreauOSI::setW(const SiconosMatrix& newValue, SP::DynamicalSystem ds)
{
// Check if ds is in the OSI
if (!OSIDynamicalSystems->isIn(ds))
RuntimeException::selfThrow("EulerMoreauOSI::setW(newVal,ds) - ds does not belong to this Integrator ...");
// Check dimensions consistency
unsigned int line = newValue.size(0);
unsigned int col = newValue.size(1);
if (line != col) // Check that newValue is square
RuntimeException::selfThrow("EulerMoreauOSI::setW(newVal,ds) - newVal is not square! ");
if (!ds)
RuntimeException::selfThrow("EulerMoreauOSI::setW(newVal,ds) - ds == NULL.");
unsigned int sizeW = ds->getDim(); // n for first order systems, ndof for lagrangian.
unsigned int dsN = ds->number();
if (line != sizeW) // check consistency between newValue and dynamical system size
RuntimeException::selfThrow("EulerMoreauOSI::setW(newVal,ds) - unconsistent dimension between newVal and dynamical system to be integrated ");
// Memory allocation for W, if required
if (!WMap[dsN]) // allocate a new W if required
{
WMap[dsN].reset(new SimpleMatrix(newValue));
}
else // or fill-in an existing one if dimensions are consistent.
{
if (line == WMap[dsN]->size(0) && col == WMap[dsN]->size(1))
*(WMap[dsN]) = newValue;
else
RuntimeException::selfThrow("EulerMoreauOSI - setW: inconsistent dimensions with problem size for given input matrix W");
}
}
示例3: getWBoundaryConditions
const SimpleMatrix SchatzmanPaoliOSI::getWBoundaryConditions(SP::DynamicalSystem ds)
{
assert(ds &&
"SchatzmanPaoliOSI::getWBoundaryConditions(ds): ds == NULL.");
// return *(WBoundaryConditionsMap[0]);
assert(_WBoundaryConditionsMap[ds->number()] &&
"SchatzmanPaoliOSI::getWBoundaryConditions(ds): WBoundaryConditions[ds] == NULL.");
return *(_WBoundaryConditionsMap[ds->number()]); // Copy !!
}
示例4:
void Hem5OSI::computeJacobianRhs(double t)
{
DynamicalSystemsGraph::VIterator dsi, dsend;
for (std11::tie(dsi, dsend) = _dynamicalSystemsGraph->vertices(); dsi != dsend; ++dsi)
{
if (!checkOSI(dsi)) continue;
SP::DynamicalSystem ds = _dynamicalSystemsGraph->bundle(*dsi);
ds->computeJacobianRhsx(t);
}
}
示例5: initializeWorkVectorsForDS
void SchatzmanPaoliOSI::initializeWorkVectorsForDS( double t, SP::DynamicalSystem ds)
{
DEBUG_BEGIN("SchatzmanPaoliOSI::initializeWorkVectorsForDS( double t, SP::DynamicalSystem ds)\n");
// Get work buffers from the graph
VectorOfVectors& ds_work_vectors = *_initializeDSWorkVectors(ds);
// Check dynamical system type
Type::Siconos dsType = Type::value(*ds);
assert(dsType == Type::LagrangianLinearTIDS);
if(dsType == Type::LagrangianLinearTIDS)
{
SP::LagrangianLinearTIDS lltids = std11::static_pointer_cast<LagrangianLinearTIDS> (ds);
// buffers allocation (inside the graph)
ds_work_vectors.resize(SchatzmanPaoliOSI::WORK_LENGTH);
ds_work_vectors[SchatzmanPaoliOSI::RESIDU_FREE].reset(new SiconosVector(lltids->dimension()));
ds_work_vectors[SchatzmanPaoliOSI::FREE].reset(new SiconosVector(lltids->dimension()));
ds_work_vectors[SchatzmanPaoliOSI::LOCAL_BUFFER].reset(new SiconosVector(lltids->dimension()));
SP::SiconosVector q0 = lltids->q0();
SP::SiconosVector q = lltids->q();
SP::SiconosVector v0 = lltids->velocity0();
SP::SiconosVector velocity = lltids->velocity();
// We first swap the initial value contained in q and v after initialization.
lltids->swapInMemory();
// we compute the new state values
double h = _simulation->timeStep();
*q = *q0 + h* * v0;
//*velocity=*velocity; we do nothing for the velocity
lltids->swapInMemory();
}
// W initialization
initializeIterationMatrixW(t, ds);
for (unsigned int k = _levelMinForInput ; k < _levelMaxForInput + 1; k++)
{
ds->initializeNonSmoothInput(k);
}
// if ((*itDS)->getType() == Type::LagrangianDS || (*itDS)->getType() == Type::FirstOrderNonLinearDS)
DEBUG_EXPR(ds->display());
DEBUG_END("SchatzmanPaoliOSI::initializeWorkVectorsForDS( double t, SP::DynamicalSystem ds)\n");
}
示例6: insertDynamicalSystem
void Topology::insertDynamicalSystem(SP::DynamicalSystem ds)
{
DynamicalSystemsGraph::VDescriptor dsgv = _DSG[0]->add_vertex(ds);
_DSG[0]->properties(dsgv).workVectors.reset(new VectorOfVectors());
_DSG[0]->properties(dsgv).workMatrices.reset(new VectorOfMatrices());
ds->initWorkSpace(*_DSG[0]->properties(dsgv).workVectors, *_DSG[0]->properties(dsgv).workMatrices);
}
示例7: initializeWorkVectorsForDS
void MoreauJeanDirectProjectionOSI::initializeWorkVectorsForDS( double t, SP::DynamicalSystem ds)
{
DEBUG_BEGIN("MoreauJeanDirectProjectionOSI::initializeWorkVectorsForDS( double t, SP::DynamicalSystem ds) \n");
MoreauJeanOSI::initializeWorkVectorsForDS(t, ds);
const DynamicalSystemsGraph::VDescriptor& dsv = _dynamicalSystemsGraph->descriptor(ds);
VectorOfVectors& workVectors = *_dynamicalSystemsGraph->properties(dsv).workVectors;
Type::Siconos dsType = Type::value(*ds);
if(dsType == Type::LagrangianDS || dsType == Type::LagrangianLinearTIDS)
{
SP::LagrangianDS d = std11::static_pointer_cast<LagrangianDS> (ds);
workVectors[MoreauJeanOSI::QTMP].reset(new SiconosVector(d->dimension()));
}
else if(dsType == Type::NewtonEulerDS)
{
SP::NewtonEulerDS d = std11::static_pointer_cast<NewtonEulerDS>(ds);
workVectors[MoreauJeanOSI::QTMP].reset(new SiconosVector(d->getqDim()));
}
else
{
RuntimeException::selfThrow("MoreauJeanDirectProjectionOSI::initialize() - DS not of the right type");
}
for (unsigned int k = _levelMinForInput ; k < _levelMaxForInput + 1; k++)
{
DEBUG_PRINTF("ds->initializeNonSmoothInput(%i)\n", k);
ds->initializeNonSmoothInput(k);
DEBUG_EXPR_WE(
SP::LagrangianDS d = std11::static_pointer_cast<LagrangianDS> (ds);
if (d->p(k))
std::cout << "d->p(" << k <<" ) exists" << std::endl;
);
}
示例8: setWPtr
void EulerMoreauOSI::setWPtr(SP::SimpleMatrix newPtr, SP::DynamicalSystem ds)
{
unsigned int line = newPtr->size(0);
unsigned int col = newPtr->size(1);
if (line != col) // Check that newPtr is square
RuntimeException::selfThrow("EulerMoreauOSI::setWPtr(newVal) - newVal is not square! ");
if (!ds)
RuntimeException::selfThrow("EulerMoreauOSI::setWPtr(newVal,ds) - ds == NULL.");
unsigned int sizeW = ds->getDim(); // n for first order systems, ndof for lagrangian.
if (line != sizeW) // check consistency between newValue and dynamical system size
RuntimeException::selfThrow("EulerMoreauOSI::setW(newVal) - unconsistent dimension between newVal and dynamical system to be integrated ");
WMap[ds->number()] = newPtr; // link with new pointer
}
示例9: WBoundaryConditions
SP::SiconosMatrix EulerMoreauOSI::WBoundaryConditions(SP::DynamicalSystem ds)
{
assert(ds && "EulerMoreauOSI::WBoundaryConditions(ds): ds == NULL.");
// return WBoundaryConditionsMap[0];
// if(WBoundaryConditionsMap[ds]==NULL)
// RuntimeException::selfThrow("EulerMoreauOSI::WBoundaryConditions(ds): W[ds] == NULL.");
return _WBoundaryConditionsMap[ds->number()];
}
示例10: W
SP::SimpleMatrix EulerMoreauOSI::W(SP::DynamicalSystem ds)
{
assert(ds && "EulerMoreauOSI::W(ds): ds == NULL.");
// return WMap[0];
// if(WMap[ds]==NULL)
// RuntimeException::selfThrow("EulerMoreauOSI::W(ds): W[ds] == NULL.");
return WMap[ds->number()];
}
示例11: getDynamicalSystem
SP::DynamicalSystem Topology::getDynamicalSystem(unsigned int requiredNumber)
{
DynamicalSystemsGraph::VIterator vi, vdend;
SP::DynamicalSystem ds;
unsigned int currentNumber;
for (std11::tie(vi, vdend) = _DSG[0]->vertices(); vi != vdend; ++vi)
{
ds = _DSG[0]->bundle(*vi);
currentNumber = ds->number();
if (currentNumber == requiredNumber)
return ds;
}
RuntimeException::selfThrow("Topology::getDynamicalSystem(n) ds not found.");
return ds;
}
示例12: getW
const SimpleMatrix SchatzmanPaoliOSI::getW(SP::DynamicalSystem ds)
{
assert(ds &&
"SchatzmanPaoliOSI::getW(ds): ds == NULL.");
// return *(WMap[0]);
unsigned int dsN = ds->number();
assert(WMap[dsN] &&
"SchatzmanPaoliOSI::getW(ds): W[ds] == NULL.");
return *(WMap[dsN]); // Copy !!
}
示例13: display
void SchatzmanPaoliOSI::display()
{
OneStepIntegrator::display();
std::cout << "====== SchatzmanPaoliOSI OSI display ======" <<std::endl;
DynamicalSystemsGraph::VIterator dsi, dsend;
for (std11::tie(dsi, dsend) = _dynamicalSystemsGraph->vertices(); dsi != dsend; ++dsi)
{
if (!checkOSI(dsi)) continue;
SP::DynamicalSystem ds = _dynamicalSystemsGraph->bundle(*dsi);
std::cout << "--------------------------------" <<std::endl;
std::cout << "--> W of dynamical system number " << ds->number() << ": " <<std::endl;
if (_dynamicalSystemsGraph->properties(*dsi).W) _dynamicalSystemsGraph->properties(*dsi).W->display();
else std::cout << "-> NULL" <<std::endl;
std::cout << "--> and corresponding theta is: " << _theta <<std::endl;
}
std::cout << "================================" <<std::endl;
}
示例14: getWBoundaryConditions
const SimpleMatrix EulerMoreauOSI::getWBoundaryConditions(SP::DynamicalSystem ds)
{
assert(ds &&
"EulerMoreauOSI::getWBoundaryConditions(ds): ds == NULL.");
// return *(WBoundaryConditionsMap[0]);
unsigned int dsN = ds->number();
assert(_WBoundaryConditionsMap[dsN] &&
"EulerMoreauOSI::getWBoundaryConditions(ds): WBoundaryConditions[ds] == NULL.");
return *(_WBoundaryConditionsMap[dsN]); // Copy !!
}
示例15: getW
const SimpleMatrix EulerMoreauOSI::getW(SP::DynamicalSystem ds)
{
int dsN = ds->number();
assert(ds &&
"EulerMoreauOSI::getW(ds): ds == NULL.");
// return *(WMap[0]);
assert(WMap[dsN] &&
"EulerMoreauOSI::getW(ds): W[ds] == NULL.");
return *(WMap[dsN]); // Copy !!
}