Skip to main content
added 92 characters in body
Source Link
Henrik Schumacher
  • 109.5k
  • 7
  • 186
  • 323

I observed that you included a timing before the plot, you missed a timing after the plot. Moreover, it appeared to me that TimeObject has quite an overhead, so Iin order to get "purer" timings, I replaced it by AbsoluteTime[]. This is what I used for timings:

I observed that you included a timing before the plot, you missed a timing after the plot. Moreover, it appeared to me that TimeObject has quite an overhead, so I order to get "purer" timings, I replaced it by AbsoluteTime[]. This is what I used for timings:

I observed that you included a timing before the plot, you missed a timing after the plot. Moreover, it appeared to me that TimeObject has quite an overhead, so in order to get "purer" timings, I replaced it by AbsoluteTime[]. This is what I used for timings:

Commonmark migration
Source Link

#Addendum

Addendum

#Addendum

Addendum

added 510 characters in body
Source Link
Henrik Schumacher
  • 109.5k
  • 7
  • 186
  • 323
points = 100;
mesh = {15, 15};
f = {x, y} \[Function] x y;
νf = {x, y} \[Function] Evaluate[-Cross @@ Transpose[D[{x, y, f[x, y]}, {{x, y}, 1}]]];

cfsurface = 
  With[{code = {Compile`GetElement[X, 1], Compile`GetElement[X, 2], 
      f[Compile`GetElement[X, 1], Compile`GetElement[X, 2]]}},
   Compile[{{X, _Real, 1}}, code, RuntimeAttributes -> {Listable}, Parallelization -> True]
   ];
cνf = 
  With[{code = νf[Compile`GetElement[X, 1], Compile`GetElement[X, 2]]},
   Compile[{{X, _Real, 1}}, code, RuntimeAttributes -> {Listable}, 
    Parallelization -> True]
   ];
getQuads = Compile[{{m, _Integer}, {n, _Integer}},
   Flatten[Table[
     {m (j - 1) + i, m (j - 1) + i + 1, m j + i + 1, m j + i},
     {j, 1, n - 1}, {i, 1, m - 1}], 1],
   CompilationTarget -> "C",
   RuntimeOptions -> "Speed"
   ]; 

points = 100;
pts2D = Tuples[{Subdivide[-2., 2., points - 1], Subdivide[-2., 2., points - 1]}];
lines = cfsurface@Outer[List, Subdivide[-2., 2., mesh[[1]] - 1], Subdivide[-2., 2., mesh[[2]] - 1]];
Graphics3D[{
  GraphicsComplex[
   cfsurface[pts2D], {EdgeForm[], Orange, Specularity[White, 30], 
    Polygon[getQuads[points, points]]}, 
   VertexNormals -> c\[Nu]f[pts2D]],
  Line@lines,
  Line@Transpose[lines]
  },
 Lighting -> "Neutral"
 ]
points = 100;
mesh = {15, 15};
f = {x, y} \[Function] x y;
νf = {x, y} \[Function] Evaluate[-Cross @@ Transpose[D[{x, y, f[x, y]}, {{x, y}, 1}]]];

cfsurface = 
  With[{code = {Compile`GetElement[X, 1], Compile`GetElement[X, 2], 
      f[Compile`GetElement[X, 1], Compile`GetElement[X, 2]]}},
   Compile[{{X, _Real, 1}}, code, RuntimeAttributes -> {Listable}, Parallelization -> True]
   ];
cνf = 
  With[{code = νf[Compile`GetElement[X, 1], Compile`GetElement[X, 2]]},
   Compile[{{X, _Real, 1}}, code, RuntimeAttributes -> {Listable}, 
    Parallelization -> True]
   ];
getQuads = Compile[{{m, _Integer}, {n, _Integer}},
   Flatten[Table[
     {m (j - 1) + i, m (j - 1) + i + 1, m j + i + 1, m j + i},
     {j, 1, n - 1}, {i, 1, m - 1}], 1],
   CompilationTarget -> "C",
   RuntimeOptions -> "Speed"
   ];
points = 100;
mesh = {15, 15};
f = {x, y} \[Function] x y;
νf = {x, y} \[Function] Evaluate[-Cross @@ Transpose[D[{x, y, f[x, y]}, {{x, y}, 1}]]];

cfsurface = 
  With[{code = {Compile`GetElement[X, 1], Compile`GetElement[X, 2], 
      f[Compile`GetElement[X, 1], Compile`GetElement[X, 2]]}},
   Compile[{{X, _Real, 1}}, code, RuntimeAttributes -> {Listable}, Parallelization -> True]
   ];
cνf = 
  With[{code = νf[Compile`GetElement[X, 1], Compile`GetElement[X, 2]]},
   Compile[{{X, _Real, 1}}, code, RuntimeAttributes -> {Listable}, 
    Parallelization -> True]
   ];
getQuads = Compile[{{m, _Integer}, {n, _Integer}},
   Flatten[Table[
     {m (j - 1) + i, m (j - 1) + i + 1, m j + i + 1, m j + i},
     {j, 1, n - 1}, {i, 1, m - 1}], 1],
   CompilationTarget -> "C",
   RuntimeOptions -> "Speed"
   ]; 

points = 100;
pts2D = Tuples[{Subdivide[-2., 2., points - 1], Subdivide[-2., 2., points - 1]}];
lines = cfsurface@Outer[List, Subdivide[-2., 2., mesh[[1]] - 1], Subdivide[-2., 2., mesh[[2]] - 1]];
Graphics3D[{
  GraphicsComplex[
   cfsurface[pts2D], {EdgeForm[], Orange, Specularity[White, 30], 
    Polygon[getQuads[points, points]]}, 
   VertexNormals -> c\[Nu]f[pts2D]],
  Line@lines,
  Line@Transpose[lines]
  },
 Lighting -> "Neutral"
 ]
added 1474 characters in body
Source Link
Henrik Schumacher
  • 109.5k
  • 7
  • 186
  • 323
Loading
added 1474 characters in body
Source Link
Henrik Schumacher
  • 109.5k
  • 7
  • 186
  • 323
Loading
added 723 characters in body
Source Link
Henrik Schumacher
  • 109.5k
  • 7
  • 186
  • 323
Loading
Source Link
Henrik Schumacher
  • 109.5k
  • 7
  • 186
  • 323
Loading