private void FillGreen(int i, int j, int sign, QSigns qSigns) { i = TransformI(i); j = TransformJ(j); int lineLength = _greenTensor.Ny; long shift = (i * lineLength + j) * _layoutShiftFactor; { if (CalculateXx) { FillGreen(_qBuffer.Qxx, _greenTensor["xx"], sign * qSigns.XX, shift, _layoutStep); } if (CalculateXy) { FillGreen(_qBuffer.Qxy, _greenTensor["xy"], sign * qSigns.XY, shift, _layoutStep); } if (CalculateXz) { FillGreen(_qBuffer.Qxz, _greenTensor["xz"], sign * qSigns.XZ, shift, _layoutStep); } if (CalculateYx) { FillGreen(_qBuffer.Qyx, _greenTensor["yx"], sign * qSigns.YX, shift, _layoutStep); } if (CalculateYy) { FillGreen(_qBuffer.Qyy, _greenTensor["yy"], sign * qSigns.YY, shift, _layoutStep); } if (CalculateYz) { FillGreen(_qBuffer.Qyz, _greenTensor["yz"], sign * qSigns.YZ, shift, _layoutStep); } if (CalculateZx) { FillGreen(_qBuffer.Qzx, _greenTensor["zx"], sign * qSigns.ZX, shift, _layoutStep); } if (CalculateZy) { FillGreen(_qBuffer.Qzy, _greenTensor["zy"], sign * qSigns.ZY, shift, _layoutStep); } if (CalculateZz) { FillGreen(_qBuffer.Qzz, _greenTensor["zz"], sign * qSigns.ZZ, shift, _layoutStep); } } }
private void FillResultAlongY(int i, int j, int left, int right, QSigns qSigns) { if (i == left) { FillGreen(left, j, -1, qSigns); } else if (i == right) { FillGreen(right - 1, j, 1, qSigns); } else { FillGreen(i - 1, j, 1, qSigns); FillGreen(i, j, -1, qSigns); } }
private void FillResultAlongX(int i, int j, int left, int right, QSigns qSigns) { if (j == left) { FillGreen(i, left, -1, qSigns); } else if (j == right) { FillGreen(i, right - 1, 1, qSigns); } else { FillGreen(i, j - 1, 1, qSigns); FillGreen(i, j, -1, qSigns); } }
private void RunAlongY(int leftX, int rightX, double xShift, int leftY, int rightY, double yShift, Action <IntegralFactors, int> addToBuf, QSigns qSigns, QSigns qSignsSymm) { var dx = (double)Model.LateralDimensions.CellSizeX; var dy = (double)Model.LateralDimensions.CellSizeY; for (int i = leftX; i <= rightX; i++) { var x = dx * (i - 0.5) - xShift; var iIndex = i - leftX; //Iterate(leftY, rightY, j => for (int j = leftY; j <= rightY - 1; j++) { // Console.WriteLine($"{Thread.CurrentThread.ManagedThreadId} {j}"); var y1 = dy * (j - 0.5) - yShift; var y2 = dy * (j + 0.5) - yShift; var jIndex = j - leftY; if (y1 > 0 && y2 > 0) { Integrate(addToBuf, _knots[iIndex, jIndex], _knots[iIndex, jIndex + 1], y1, y2, x); FillResultAlongY(i, j, leftX, rightX, qSigns); } else if (y1 < 0 && y2 < 0) { Integrate(addToBuf, _knots[iIndex, jIndex + 1], _knots[iIndex, jIndex], -y2, -y1, x); FillResultAlongY(i, j, leftX, rightX, qSignsSymm); } else { Integrate(addToBuf, _zeroKnotsY[iIndex], _knots[iIndex, jIndex], 0, -y1, x); FillResultAlongY(i, j, leftX, rightX, qSignsSymm); Integrate(addToBuf, _zeroKnotsY[iIndex], _knots[iIndex, jIndex + 1], 0, y2, x); FillResultAlongY(i, j, leftX, rightX, qSigns); } } //}); } }
private void RunAlongX(int leftX, int rightX, double xShift, int leftY, int rightY, double yShift, Action <IntegralFactors, int> addToBuf, QSigns qSigns, QSigns qSignsSymm) { var dx = (double)Model.LateralDimensions.CellSizeX; var dy = (double)Model.LateralDimensions.CellSizeY; //Iterate(leftY, rightY, j => for (int j = leftY; j <= rightY; j++) { var y = dy * (j - 0.5) - yShift; var jIndex = j - leftY; for (int i = leftX; i <= rightX - 1; i++) { var x1 = dx * (i - 0.5) - xShift; var x2 = dx * (i + 0.5) - xShift; var iIndex = i - leftX; if (x1 > 0 && x2 > 0) { Integrate(addToBuf, _knots[iIndex, jIndex], _knots[iIndex + 1, jIndex], x1, x2, y); FillResultAlongX(i, j, leftY, rightY, qSigns); } else if (x1 < 0 && x2 < 0) { Integrate(addToBuf, _knots[iIndex + 1, jIndex], _knots[iIndex, jIndex], -x2, -x1, y); FillResultAlongX(i, j, leftY, rightY, qSignsSymm); } else { Integrate(addToBuf, _zeroKnotsX[jIndex], _knots[iIndex, jIndex], 0, -x1, y); FillResultAlongX(i, j, leftY, rightY, qSignsSymm); Integrate(addToBuf, _zeroKnotsX[jIndex], _knots[iIndex + 1, jIndex], 0, x2, y); FillResultAlongX(i, j, leftY, rightY, qSigns); } } } //}); }