I have the following LINQ query
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();
The from
until into meshPlan
will select a list of meshPlan
s. And this is some part that I believe parallelization can take advantage of.
Any idea on how to use PLINQ to parallelize the above operation?
I've tried the following operation:
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();
but sadly it cannot compile.