我有以下 LINQ 查询
var meshesList= (
from element in elementCoord.Elements
let coordinateList = elementCoord.Coordinates
select new Plane3D
{
Pt1 = coordinateList[element.NodeList[0]], Pt2 = coordinateList[element.NodeList[1]], Pt3 = coordinateList[element.NodeList[2]]
}
into meshPlan
let algo = new AlgoProvider()
where WellBehaveMesh(meshPlan)
select algo.ComputeVolume(meshPlan, platformPlan)).ToList();
from
until将into meshPlan
选择一个meshPlan
s 列表。这是我相信并行化可以利用的部分。
关于如何使用 PLINQ 并行化上述操作的任何想法?
我尝试了以下操作:
var meshesList= (
(from element in elementCoord.Elements
let coordinateList = elementCoord.Coordinates
select new Plane3D
{
Pt1 = coordinateList[element.NodeList[0]], Pt2 = coordinateList[element.NodeList[1]], Pt3 = coordinateList[element.NodeList[2]]
}
into meshPlan).AsParallel() //cannot compile
let algo = new AlgoProvider()
where WellBehaveMesh(meshPlan)
select algo.ComputeVolume(meshPlan, platformPlan)).ToList();
但遗憾的是它无法编译。