Skip to content

Commit

Permalink
changed prefix of variable names in cpp runtime
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@11186 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
niklwors committed Feb 23, 2012
1 parent 920b75c commit bdb511f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
20 changes: 10 additions & 10 deletions Compiler/susan_codegen/SimCode/CodegenCpp.tpl
Expand Up @@ -2762,7 +2762,7 @@ template cref(ComponentRef cr)
match cr
case CREF_IDENT(ident = "time") then "time"
case WILD(__) then ''
else "$"+crefToCStr(cr)
else "_"+crefToCStr(cr)
end cref;
template cref2(ComponentRef cr)
Expand All @@ -2772,15 +2772,15 @@ template cref2(ComponentRef cr)
case CREF_IDENT(ident = "xloc") then '<%crefStr(cr)%>'
case CREF_IDENT(ident = "time") then "time"
case WILD(__) then ''
else "$"+crefToCStr(cr)
else "_"+crefToCStr(cr)
end cref2;
template crefToCStr(ComponentRef cr)
"Helper function to cref."
::=
match cr
case CREF_IDENT(__) then '<%ident%><%subscriptsToCStr(subscriptLst)%>'
case CREF_QUAL(__) then '<%ident%><%subscriptsToCStr(subscriptLst)%>$P<%crefToCStr(componentRef)%>'
case CREF_QUAL(__) then '<%ident%><%subscriptsToCStr(subscriptLst)%>_P_<%crefToCStr(componentRef)%>'
case WILD(__) then ''
else "CREF_NOT_IDENT_OR_QUAL"
end crefToCStr;
Expand All @@ -2806,14 +2806,14 @@ template arraycref(ComponentRef cr)
case CREF_IDENT(ident = "xloc") then crefStr(cr)
case CREF_IDENT(ident = "time") then "time"
case WILD(__) then ''
else "$"+crefToCStr1(cr)
else "_"+crefToCStr1(cr)
end arraycref;
template crefToCStr1(ComponentRef cr)
::=
match cr
case CREF_IDENT(__) then '<%ident%>'
case CREF_QUAL(__) then '<%ident%><%subscriptsToCStr(subscriptLst)%>$P<%crefToCStr1(componentRef)%>'
case CREF_QUAL(__) then '<%ident%><%subscriptsToCStr(subscriptLst)%>_P_<%crefToCStr1(componentRef)%>'
case WILD(__) then ''
else "CREF_NOT_IDENT_OR_QUAL"
end crefToCStr1;
Expand Down Expand Up @@ -3376,14 +3376,14 @@ template dimension(Dimension d)
end dimension;
template arrayCrefCStr(ComponentRef cr)
::= '$<%arrayCrefCStr2(cr)%>'
::= '_<%arrayCrefCStr2(cr)%>'
end arrayCrefCStr;
template arrayCrefCStr2(ComponentRef cr)
::=
match cr
case CREF_IDENT(__) then '<%unquoteIdentifier(ident)%>'
case CREF_QUAL(__) then '<%unquoteIdentifier(ident)%>$P<%arrayCrefCStr2(componentRef)%>'
case CREF_QUAL(__) then '<%unquoteIdentifier(ident)%>_P_<%arrayCrefCStr2(componentRef)%>'
else "CREF_NOT_IDENT_OR_QUAL"
end arrayCrefCStr2;
Expand Down Expand Up @@ -6184,9 +6184,9 @@ IHistory* <%lastIdentOfPath(modelInfo.name)%>::getHistory()

label_list_type <%lastIdentOfPath(modelInfo.name)%>::getLabels()
{
label_list_type $labels = tuple_list_of
<%(labels |> label hasindex index0 => '(&$<%label%>_1,<%index0%>,&$<%label%>_2)') ;separator=" "%>;
return $labels;
label_list_type labels = tuple_list_of
<%(labels |> label hasindex index0 => '(&<%label%>_1,<%index0%>,&<%label%>_2)') ;separator=" "%>;
return labels;
}

void <%lastIdentOfPath(modelInfo.name)%>::setVariables(const ublas::vector<double>& variables,const ublas::vector<double>& variables2)
Expand Down
Expand Up @@ -75,7 +75,14 @@ int Modelica::getDimVars(const INDEX index) const
{
return(SystemDefaultImplementation::getDimVars(index));
}

void Modelica::giveConditions(bool* c)
{
memcpy(c,_conditions0,_dimZeroFunc*sizeof(bool));
}
void Modelica::setConditions(bool* c)
{
memcpy(_conditions0,c,_dimZeroFunc*sizeof(bool));
}
// Provide number (dimension) of right hand sides (equations and/or residuals) according to the index
int Modelica::getDimRHS(const INDEX index ) const
{
Expand Down
Expand Up @@ -84,7 +84,8 @@ class Modelica: public IDAESystem ,public IContinous ,public IEvent ,public ISys

// Provides current values of root/zero functions
virtual void giveZeroFunc(double* f,const double& eps);

virtual void giveConditions(bool* c);
virtual void setConditions(bool* c);
//Called to handle all events occured at same time
virtual void handleSystemEvents(const bool* events,update_events_type update_event);

Expand Down

0 comments on commit bdb511f

Please sign in to comment.