Skip to content

Commit

Permalink
fix assignment of pre values of Cpp arrays
Browse files Browse the repository at this point in the history
see Modelica.Blocks.Examples.Interaction1
  • Loading branch information
rfranke committed Aug 4, 2015
1 parent c689bad commit 8b6bf38
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Compiler/Template/CodegenCpp.tpl
Expand Up @@ -13445,10 +13445,10 @@ template daeExpCrefRhsArrayBox(ComponentRef cr,DAE.Type ty, Context context, Tex
let &preExp +=
<<
StatArrayDim<%ndims%><<%T%>, <%dimstr%>> <%arr%>_pre;
std::transform(<%arr%>.getDataRefs(),
<%arr%>.getDataRefs() + <%arr%>.getNumElems(),
std::transform(<%arr%>.getData(),
<%arr%>.getData() + <%arr%>.getNumElems(),
<%arr%>_pre.getData(),
PreRefArray2CArray<<%T%>>(_discrete_events));
PreArray2CArray<<%T%>>(_discrete_events));
>>
'<%arr%>_pre'
else
Expand Down
10 changes: 5 additions & 5 deletions SimulationRuntime/cpp/Include/Core/System/DiscreteEvents.h
Expand Up @@ -51,17 +51,17 @@ class BOOST_EXTENSION_EVENTHANDLING_DECL DiscreteEvents
* Operator class to get pre values of an array
*/
template<typename T>
class PreRefArray2CArray
class PreArray2CArray
{
DiscreteEvents *_discrete_events;

public:
PreRefArray2CArray(boost::shared_ptr<DiscreteEvents>& discrete_events) {
PreArray2CArray(boost::shared_ptr<DiscreteEvents>& discrete_events) {
_discrete_events = discrete_events.get();
}

const T operator()(const T* val) const {
return _discrete_events->pre(*val);
const T operator()(const T& val) const {
return _discrete_events->pre(val);
}
};
/** @} */ // end of coreSystem
/** @} */ // end of coreSystem

0 comments on commit 8b6bf38

Please sign in to comment.