public static double[,,] Generate(LabelPoint[,,] finiteElement) { double[,,] result = new double[3, 3, 27]; _3DPoint[,,] matrix = new SquareGenerator(-1 * Math.Sqrt(0.6), 0, Math.Sqrt(0.6)).getMatrix(); Dictionary <int, _3DPoint> magicDictionary = Globals.magicDictionary; //// to delete //double[] oksana = new double[] { -1 * Math.Sqrt(0.6), 0, Math.Sqrt(0.6) }; //// to delete //for (int i = 0; i < 3; i++) //{ // for (int j = 0; j < 3; j++) // { // for (int k = 0; k < 3; k++) // { // lst.Add(new _3DPoint(oksana[i], oksana[j], oksana[k])); // } // } //} List <_3DPoint> lst = new List <_3DPoint>(); for (int z = 0; z < 3; z++) { for (int y = 0; y < 3; y++) { for (int x = 0; x < 3; x++) { lst.Add(matrix[x, y, z]); } } } _3DPoint p = null; double globalCoordinate = 0; double diFi = 0; double sum = 0; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { for (int k = 0; k < 27; k++) { sum = 0; for (int l = 1; l <= 20; l++) { p = magicDictionary[l]; globalCoordinate = finiteElement[(int)p.X, (int)p.Y, (int)p.Z].value[i]; diFi = FI.getDiFi(j + 1, l, lst[k].X, lst[k].Y, lst[k].Z); sum += globalCoordinate * diFi; } result[i, j, k] = sum; } } } return(result); }
public static double diGammaFirst(int i, double alpha, double beta, double gamma) { double result; _3DPoint point = magicDictionary[i]; _3DPoint coord = ALPHA_BETA_GAMMA_VALUE[(int)point.X, (int)point.Y, (int)point.Z]; result = ONE_EIGHT * (1 + alpha * coord.X) * (1 + beta * coord.Y) * coord.Z * (alpha * coord.X + beta * coord.Y + 2 * gamma * coord.Z - 1); return(result); }
private static double secondFi(int i, double alpha, double beta, double gamma) { double result; _3DPoint point = magicDictionary[i]; _3DPoint coord = ALPHA_BETA_GAMMA_VALUE[(int)point.X, (int)point.Y, (int)point.Z]; result = ONE_FOURTH * (1 + alpha * coord.X) * (1 + beta * coord.Y) * (1 + gamma * coord.Z) * (1 - Math.Pow((alpha * coord.Y * coord.Z), 2) - Math.Pow((beta * coord.X * coord.Z), 2) - Math.Pow((gamma * coord.X * coord.Y), 2)); return(result); }
private static double firstFi(int i, double alpha, double beta, double gamma) { double result; _3DPoint point = magicDictionary[i]; _3DPoint coord = ALPHA_BETA_GAMMA_VALUE[(int)point.X, (int)point.Y, (int)point.Z]; result = ONE_EIGHT * (1 + alpha * coord.X) * (1 + beta * coord.Y) * (1 + gamma * coord.Z) * (alpha * coord.X + beta * coord.Y + gamma * coord.Z - 2); return(result); }
private void setLocalNumeration() { Dictionary <int, _3DPoint> magicDictionary = Globals.magicDictionary; _3DPoint p = null; foreach (FiniteElement item in finiteElement) { for (int i = 1; i <= 20; i++) { p = magicDictionary[i]; item.matrix[(int)p.X, (int)p.Y, (int)p.Z].local = i; } } }
public _3DPoint[, , ] getMatrix() { _3DPoint[,,] matrix = new _3DPoint[3, 3, 3]; for (int z = 0; z < 3; z++) { for (int y = 0; y < 3; y++) { for (int x = 0; x < 3; x++) { matrix[x, y, z] = new _3DPoint(value[x], value[2 - y], value[z]); //Console.WriteLine($"{value[k]}, {value[2 - j]}, {value[i]}"); } } } return(matrix); }