Tag Info

New answers tagged

5

This seems to be a problem with the "Continuation" boundary mesh generator. The "RegionPlot" generator does not have this problem: Table[Timing@ ToElementMesh[Disk[{0, 0}, r], "BoundaryMeshGenerator" -> "RegionPlot"], {r, 10^Range[3]}] {{0.254000,ElementMesh[{{-10.,10.},{-10.,10.}},{TriangleElement[<518>]}]}, ...


5

I would suggest not going through the Plot functions for this. They're designed to produce a good visual representation of the region, which is not necessarily the same as a good representation for doing numerical computation on. Besides, the plot already discretizes the region into a polygon, so the mesh refinement options of DiscretizeRegion or ...


6

fn = {-Cos[u] (1.2 - Cos[(u - Pi)/2]^6) (0.2 + Cos[10 u]^10), Sin[u] (1.2 - Cos[(u - Pi)/2]^6) (0.2 + Cos[10 u]^10)}; plot = ParametricPlot[fn, {u, 0, 2 Pi}, PlotPoints -> Round[2 Pi (Sqrt@MaxValue[#.# &@D[fn, u], u])/0.2], PlotRange -> All]; Cases[plot, Line[p_] :> Polygon[p], Infinity] // First // DiscretizeRegion ...


2

Building on the trick of kguler and on the @user21 recommendations I ends up with the following approach. For many reason my actual interest is on first-order meshes and on a MeshRegion-type output. However, I used the some services of FEM toolbox and particularly of NumericalRegion. Its "BoundaryFunction" property with FindRoot is useful to "improve" ...


4

That's an bug in the 1D case. A somewhat cumbersome way to work around that is to generate the mesh and then generate the mesh a second time where markers are computed and inserted into the mesh elements: Needs["NDSolve`FEM`"] bmesh = ToBoundaryMesh["Coordinates" -> {{0}, {5}, {10}}, "BoundaryElements" -> {PointElement[List /@ Range@3]}]; mesh = ...


0

What if you used the orientation of the triangle as a clue to choosing sides? TriangleOrientation[{x1_, y1_}, {x2_, y2_}, {x3_, y3_}] := Sign[x3 (y1 - y2) + x1 (y2 - y3) + x2 (-y1 + y3)] Any triangle in your mesh has three sides, say vertices U to V, V to W, and W back to U. Say your current midpoint is in side $k$, where $k=1$, $2$, or $3$. If the ...



Top 50 recent answers are included