Skip to content

Commit

Permalink
Do not create local copies for scalar symbolic parameters
Browse files Browse the repository at this point in the history
ref #202
  • Loading branch information
ddemidov committed Apr 29, 2016
1 parent 274c797 commit e3a6960
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions vexcl/generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,19 +446,9 @@ class symbolic
std::string init() const {
std::ostringstream s;

if (scope != LocalVar) {
s << "\t\t" << type_name<T>() << " " << *this << " = p_" << *this;

switch (scope) {
case VectorParameter:
s << "[idx];\n";
break;
case ScalarParameter:
s << ";\n";
break;
case LocalVar:
break;
}
if (scope == VectorParameter) {
s << "\t\t" << type_name<T>() << " " << *this
<< " = p_" << *this << "[idx];\n";
}

return s.str();
Expand All @@ -482,11 +472,11 @@ class symbolic
s << "const ";

if (scope == VectorParameter)
s << type_name< global_ptr<T> >();
s << type_name< global_ptr<T> >() << " p_";
else
s << type_name< T >();
s << type_name< T >() << " ";

s << " p_" << *this;
s << *this;

return s.str();
}
Expand Down

0 comments on commit e3a6960

Please sign in to comment.