本文整理汇总了C++中Intersection::modelicaValue方法的典型用法代码示例。如果您正苦于以下问题:C++ Intersection::modelicaValue方法的具体用法?C++ Intersection::modelicaValue怎么用?C++ Intersection::modelicaValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Intersection
的用法示例。
在下文中一共展示了Intersection::modelicaValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
MMO_Expression_::_traverseAlgebraics (Dependencies deps, Index derivativeIndex,
Dependencies derivativeDeps,
map<Index, Index> *states,
map<Index, Index> *discretes,
Index variableChange, DEP_Type type,
int value)
{
for (Index *idx = deps->begin (type); !deps->end (type);
idx = deps->next (type))
{
list<MMO_Equation> algEqs = _data->algebraics ()->equation (*idx);
list<MMO_Equation>::iterator algEq;
if (type == DEP_ALGEBRAIC_VECTOR_DEF)
{
derivativeDeps->insert (*idx, DEP_ALGEBRAIC_VECTOR);
}
int algValue = -1;
for (algEq = algEqs.begin (); algEq != algEqs.end (); algEq++)
{
Index algebraicIdx = *idx;
if (value >= 0 && idx->hasRange ())
{
algebraicIdx = idx->indexValue (value);
}
if (!(*algEq)->exp()->deps()->autonomous())
{
_deps->setAutonomous(false);
}
Index variableCh;
int f = (*algEq)->lhs ().factor ();
int c = (*algEq)->lhs ().operConstant ();
if (f != 0 && type == DEP_ALGEBRAIC_DEF)
{
if (f != 1 || c != 0)
{
variableCh.setFactor (f);
variableCh.setConstant (-c);
variableCh.setLow ((*algEq)->lhs ().low () * f + c);
variableCh.setHi ((*algEq)->lhs ().hi () * f + c);
}
}
Index algebraicIndex = (*algEq)->lhs ();
if (variableChange.isSet ())
{
algebraicIndex = (*algEq)->lhs ().applyVariableChange (
variableChange);
algebraicIdx = idx->applyVariableChange (variableChange);
algebraicIdx.setLow (variableChange.low ());
algebraicIdx.setHi (variableChange.hi ());
}
Intersection is = algebraicIndex.intersection (algebraicIdx);
if (is.type () != IDX_DISJOINT)
{
Index algKey = algebraicIdx;
Index equationIndex;
equationIndex.setOffset (_equationIndex++);
if (is.hasRange ())
{
equationIndex.setRange ();
equationIndex.setLow (is.low ());
equationIndex.setHi (is.hi ());
algKey.setRange ();
algKey.setHi (equationIndex.hi ());
algKey.setLow (equationIndex.low ());
}
else
{
equationIndex.setConstant (is.modelicaValue ());
if (is.type () == IDX_CONSTANT_BA)
{
algKey.setConstant (is.modelicaValue () + is.begin ());
algValue = is.modelicaValue ();
}
else if (is.type () == IDX_CONSTANT_AB)
{
algKey.setConstant (is.modelicaValue () + is.begin ());
algValue = is.modelicaValue ();
}
else
{
algKey.setConstant (is.modelicaValue ());
}
algKey.setLow (1);
algKey.setHi (1);
algKey.setFactor (0);
}
if (type == DEP_ALGEBRAIC_DEF)
{
derivativeDeps->insert (algKey, DEP_ALGEBRAIC);
}
_addAlgebriacDeps (algKey, (*algEq), equationIndex,
derivativeIndex, derivativeDeps, states,
discretes, variableCh, algValue);
}
}
}
}