Kaydet (Commit) 27a5bafe authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Test-drive grouped formula calculation.

But of course since we haven't yet implemented the real vectorized
calculation backend, we calculate the cells individually...

Change-Id: I27e0a3e846f62a7fcda86a79e9455c81e3737ddf
üst 20d4db0f
...@@ -3037,34 +3037,52 @@ bool ScFormulaCell::InterpretFormulaGroup() ...@@ -3037,34 +3037,52 @@ bool ScFormulaCell::InterpretFormulaGroup()
} }
} }
// scan the formula ... #if 0
// have a document method: "Get2DRangeAsDoublesArray" that does the // TODO: Calculate the formula group via vectorization.
// column-based heavy lifting call it for each absolute range from the #else
// first cell pos in the formula group. // Until we implement group calculation for real, decompose the group into
// // individual formula token arrays for individual calculation.
// Project single references to ranges by adding their vector * xGroup->mnLength ScAddress aTmpPos = aPos;
// for (sal_Int32 i = 0; i < xGroup->mnLength; ++i)
// TODO: {
// elide multiple dimensional movement in vectors eg. =SUM(A1<1,1>) aTmpPos.SetRow(xGroup->mnStart + i);
// produces a diagonal 'column' that serves no useful purpose for us. ScTokenArray aCode2;
// these should be very rare. Should elide in GetDeltas anyway and for (const formula::FormulaToken* p = aCode.First(); p; p = aCode.Next())
// assert here. {
// switch (p->GetType())
// Having built our input data ... {
// Throw it, and the formula over to some 'OpenCLCalculage' hook case svSingleVectorRef:
// {
// on return - release references on these double buffers const formula::SingleVectorRefToken* p2 = static_cast<const formula::SingleVectorRefToken*>(p);
// const formula::VectorArray& rArray = p2->GetArray();
// transfer the result to the formula cells (as above) aCode2.AddDouble(rArray.mpArray[i]);
// store the doubles in the columns' maDoubles array for }
// dependent formulae break;
// case svDoubleVectorRef:
// TODO: return false;
// need to abort/fail when we get errors returned and fallback to break;
// stock interpreting [ I guess ], unless we can use NaN etc. to default:
// signal errors. aCode2.AddToken(*p);
}
}
return false; ScFormulaCell* pDest = pDocument->GetFormulaCell(aTmpPos);
if (!pDest)
return false;
ScCompiler aComp(pDocument, aPos, aCode2);
aComp.SetGrammar(pDocument->GetGrammar());
OUStringBuffer aBuf;
aComp.CreateStringFromTokenArray(aBuf);
aComp.CompileTokenArray(); // Create RPN token array.
ScInterpreter aInterpreter(pDest, pDocument, aTmpPos, aCode2);
aInterpreter.Interpret();
pDest->aResult.SetToken(aInterpreter.GetResultToken().get());
}
return true;
#endif
} }
bool ScFormulaCell::InterpretInvariantFormulaGroup() bool ScFormulaCell::InterpretInvariantFormulaGroup()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment