Skip to main content
Tweeted twitter.com/StackMma/status/1561186599093895168
added 12 characters in body
Source Link
Ulrich Neumann
  • 61.8k
  • 2
  • 30
  • 66

modified

For an, examplary simple, ElementMesh

p = {{0, 0}, {1, 0}, {1, 1}, {0, 1}, {1/2, 1/2}}; mesh = ToElementMesh["Coordinates" -> p,"MeshElements" -> {TriangleElement[{{1, 2, 5 }, {2, 3, 5 }, {5,3, 4 }, { 1, 5,4 } }]}]; Show[mesh["Wireframe"], Axes -> True, AxesLabel -> {x, y}] 

enter image description here

I would like to select part of the mesh {x,y}which fullfills condition y>=x

Is there a simple solution?

Thanks!

addendum

Based on the @DanielHuber's helpful answer I tried to preserve the meshnumbering

dreiecke = mesh["MeshElements"][[1]][[1]] dreiecke1 = Select[dreiecke,Apply[And,RegionMember[ImplicitRegion[r >= z, {z, r}], p[[#]]]] &] ToElementMesh["Coordinates" -> p,"MeshElements" ->{TriangleElement[dreiecke1]}] 

but Mathematica gives an error message "ToElementMesh::fememins: The mesh elements are not valid. A set of valid mesh element incidents needs to be positive integers and be able to form a complete sequence starting from 1 to the largest incident present. There are missing incidents; a complete sequence cannot be formed."

Obviously because there are unused meshpoints in "Coordinates".

Any idea how to solve this probelemproblem? Thanks!

For an, examplary simple, ElementMesh

p = {{0, 0}, {1, 0}, {1, 1}, {0, 1}, {1/2, 1/2}}; mesh = ToElementMesh["Coordinates" -> p,"MeshElements" -> {TriangleElement[{{1, 2, 5 }, {2, 3, 5 }, {5,3, 4 }, { 1, 5,4 } }]}]; Show[mesh["Wireframe"], Axes -> True, AxesLabel -> {x, y}] 

enter image description here

I would like to select part of the mesh {x,y}which fullfills condition y>=x

Is there a simple solution?

Thanks!

addendum

Based on the @DanielHuber's helpful answer I tried to preserve the meshnumbering

dreiecke = mesh["MeshElements"][[1]][[1]] dreiecke1 = Select[dreiecke,Apply[And,RegionMember[ImplicitRegion[r >= z, {z, r}], p[[#]]]] &] ToElementMesh["Coordinates" -> p,"MeshElements" ->{TriangleElement[dreiecke1]}] 

but Mathematica gives an error message "ToElementMesh::fememins: The mesh elements are not valid. A set of valid mesh element incidents needs to be positive integers and be able to form a complete sequence starting from 1 to the largest incident present. There are missing incidents; a complete sequence cannot be formed."

Obviously because there are unused meshpoints in "Coordinates".

Any idea how to solve this probelem? Thanks!

modified

For an, examplary simple, ElementMesh

p = {{0, 0}, {1, 0}, {1, 1}, {0, 1}, {1/2, 1/2}}; mesh = ToElementMesh["Coordinates" -> p,"MeshElements" -> {TriangleElement[{{1, 2, 5 }, {2, 3, 5 }, {5,3, 4 }, { 1, 5,4 } }]}]; Show[mesh["Wireframe"], Axes -> True, AxesLabel -> {x, y}] 

enter image description here

I would like to select part of the mesh {x,y}which fullfills condition y>=x

Is there a simple solution?

Thanks!

addendum

Based on @DanielHuber's helpful answer I tried to preserve the meshnumbering

dreiecke = mesh["MeshElements"][[1]][[1]] dreiecke1 = Select[dreiecke,Apply[And,RegionMember[ImplicitRegion[r >= z, {z, r}], p[[#]]]] &] ToElementMesh["Coordinates" -> p,"MeshElements" ->{TriangleElement[dreiecke1]}] 

but Mathematica gives an error message "ToElementMesh::fememins: The mesh elements are not valid. A set of valid mesh element incidents needs to be positive integers and be able to form a complete sequence starting from 1 to the largest incident present. There are missing incidents; a complete sequence cannot be formed."

Obviously because there are unused meshpoints in "Coordinates".

Any idea how to solve this problem? Thanks!

added 777 characters in body
Source Link
Ulrich Neumann
  • 61.8k
  • 2
  • 30
  • 66

For an, examplary simple, ElementMesh

p = {{0, 0}, {1, 0}, {1, 1}, {0, 1}, {1/2, 1/2}}; mesh = ToElementMesh["Coordinates" -> p,"MeshElements" -> {TriangleElement[{{1, 2, 5 }, {2, 3, 5 }, {5,3, 4 }, { 1, 5,4 } }]}]; Show[mesh["Wireframe"], Axes -> True, AxesLabel -> {x, y}] 

enter image description here

I would like to select part of the mesh {x,y}which fullfills condition y>=x

Is there a simple solution?

Thanks!

addendum

Based on the @DanielHuber's helpful answer I tried to preserve the meshnumbering

dreiecke = mesh["MeshElements"][[1]][[1]] dreiecke1 = Select[dreiecke,Apply[And,RegionMember[ImplicitRegion[r >= z, {z, r}], p[[#]]]] &] ToElementMesh["Coordinates" -> p,"MeshElements" ->{TriangleElement[dreiecke1]}] 

but Mathematica gives an error message "ToElementMesh::fememins: The mesh elements are not valid. A set of valid mesh element incidents needs to be positive integers and be able to form a complete sequence starting from 1 to the largest incident present. There are missing incidents; a complete sequence cannot be formed."

Obviously because there are unused meshpoints in "Coordinates".

Any idea how to solve this probelem? Thanks!

For an, examplary simple, ElementMesh

p = {{0, 0}, {1, 0}, {1, 1}, {0, 1}, {1/2, 1/2}}; mesh = ToElementMesh["Coordinates" -> p,"MeshElements" -> {TriangleElement[{{1, 2, 5 }, {2, 3, 5 }, {5,3, 4 }, { 1, 5,4 } }]}]; Show[mesh["Wireframe"], Axes -> True, AxesLabel -> {x, y}] 

enter image description here

I would like to select part of the mesh {x,y}which fullfills condition y>=x

Is there a simple solution?

Thanks!

For an, examplary simple, ElementMesh

p = {{0, 0}, {1, 0}, {1, 1}, {0, 1}, {1/2, 1/2}}; mesh = ToElementMesh["Coordinates" -> p,"MeshElements" -> {TriangleElement[{{1, 2, 5 }, {2, 3, 5 }, {5,3, 4 }, { 1, 5,4 } }]}]; Show[mesh["Wireframe"], Axes -> True, AxesLabel -> {x, y}] 

enter image description here

I would like to select part of the mesh {x,y}which fullfills condition y>=x

Is there a simple solution?

Thanks!

addendum

Based on the @DanielHuber's helpful answer I tried to preserve the meshnumbering

dreiecke = mesh["MeshElements"][[1]][[1]] dreiecke1 = Select[dreiecke,Apply[And,RegionMember[ImplicitRegion[r >= z, {z, r}], p[[#]]]] &] ToElementMesh["Coordinates" -> p,"MeshElements" ->{TriangleElement[dreiecke1]}] 

but Mathematica gives an error message "ToElementMesh::fememins: The mesh elements are not valid. A set of valid mesh element incidents needs to be positive integers and be able to form a complete sequence starting from 1 to the largest incident present. There are missing incidents; a complete sequence cannot be formed."

Obviously because there are unused meshpoints in "Coordinates".

Any idea how to solve this probelem? Thanks!

edited tags
Link
user21
  • 42.2k
  • 8
  • 116
  • 176
Source Link
Ulrich Neumann
  • 61.8k
  • 2
  • 30
  • 66
Loading