summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/core/opencl/formulagroupcl.cxx4
-rw-r--r--sc/source/core/opencl/op_math.cxx27
-rw-r--r--sc/source/core/opencl/op_math.hxx7
3 files changed, 38 insertions, 0 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 0fccd9d94062..96ba7329d8ff 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1196,6 +1196,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
mvSubArguments.push_back(SoPHelper(ts,
ft->Children[i],new OpLn));
break;
+ case ocRound:
+ mvSubArguments.push_back(SoPHelper(ts,
+ ft->Children[i],new OpRound));
+ break;
case ocExternal:
if ( !(pChild->GetExternal().compareTo(OUString(
"com.sun.star.sheet.addin.Analysis.getEffect"))))
diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx
index 569a7173c013..7e76952502cd 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -629,6 +629,33 @@ void OpLn::GenSlidingWindowFunction(
ss << " return tmp;\n";
ss << "}";
}
+
+void OpRound::GenSlidingWindowFunction(std::stringstream &ss,
+ const std::string sSymName, SubArguments &vSubArguments)
+{
+ ss << "\ndouble " << sSymName;
+ ss << "_"<< BinFuncName() <<"(";
+ for (unsigned i = 0; i < vSubArguments.size(); i++)
+ {
+ if (i)
+ ss << ",";
+ vSubArguments[i]->GenSlidingWindowDecl(ss);
+ }
+ ss << ")\n{\n";
+ ss << " int gid0=get_global_id(0);\n";
+ ss << " int singleIndex = gid0;\n";
+ GenTmpVariables(ss,vSubArguments);
+ CheckAllSubArgumentIsNan(ss,vSubArguments);
+ ss << " for(int i=0;i<tmp1;i++)\n";
+ ss << " tmp0 = tmp0 * 10;\n";
+ ss << " double tmp=round(tmp0);\n";
+ ss << " for(int i=0;i<tmp1;i++)\n";
+ ss << " tmp = tmp / 10;\n";
+ ss << " return tmp;\n";
+ ss << "}";
+}
+
+
}}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/opencl/op_math.hxx b/sc/source/core/opencl/op_math.hxx
index 2167ce52760e..8a151a8f6cfa 100644
--- a/sc/source/core/opencl/op_math.hxx
+++ b/sc/source/core/opencl/op_math.hxx
@@ -160,6 +160,13 @@ public:
const std::string sSymName, SubArguments &vSubArguments);
virtual std::string BinFuncName(void) const { return "Ln"; }
};
+class OpRound: public CheckVariables
+{
+public:
+ virtual void GenSlidingWindowFunction(std::stringstream &ss,
+ const std::string sSymName, SubArguments &vSubArguments);
+ virtual std::string BinFuncName(void) const { return "Round"; }
+};
}}
#endif