/// <summary> /// Projection of a 3D-function <paramref name="f"/> onto a DG-Field /// </summary> public static void ProjectField(this DGField u, _3D f) { if (u.Basis.GridDat.SpatialDimension != 3) { throw new ArgumentException("mismatch in spatial dimension"); } u.ProjectField(f.Vectorize()); }
/// <summary> /// L2Error w.r.t. a 3D-function <paramref name="f"/> of a DG-Field /// </summary> public static double L2Error(this DGField u, _3D f) { if (u.Basis.GridDat.SpatialDimension != 3) { throw new ArgumentException("mismatch in spatial dimension"); } return(u.L2Error(f.Vectorize())); }
private void button3D_Click(object sender, EventArgs e) { if (form3D.IsDisposed || form3D == null) { form3D = new _3D(); } form3D.Show(); }
/// <summary> /// Vectorized 2D function (<see cref="ScalarFunction"/>) from a scalar implementation, with fixed time /// </summary> /// <param name="f">calling sequence: f(<paramref name="time"/>,x,y)</param> /// <param name="time">fixed time</param> /// <returns></returns> public static ScalarFunction Vectorize(this _3D f, double time) { return(delegate(MultidimensionalArray inp, MultidimensionalArray res) { int D = inp.GetLength(1); if (D != 2) { throw new ArgumentException("wrong spatial dimension."); } for (int i = 0; i < inp.GetLength(0); i++) { double x = inp[i, 0]; double y = inp[i, 1]; res[i] = f(time, x, y); } }); }
/// <summary> /// Scalar function conversion. /// </summary> public static Func <double[], double, double> Convert_txy2Xt(this _3D f) { return((double[] X, double t) => f(t, X[0], X[1])); }
/// <summary> /// Scalar function conversion. /// </summary> public static Func <double[], double> Convert_xyz2X(this _3D f) { return((double[] X) => f(X[0], X[1], X[2])); }