-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into release/0.59
- Loading branch information
Showing
19 changed files
with
702 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,6 @@ jobs: | |
- name: Deploy | ||
uses: JamesIves/[email protected] | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
repository-name: pyansys/pymapdl-dev-docs | ||
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
|
||
class _EntityNearestEntityQueries: | ||
_mapdl = None | ||
|
||
def nnear(self, n: int) -> int: | ||
"""Returns the selected node nearest node `n`. | ||
Parameters | ||
---------- | ||
n : int | ||
Node number | ||
Returns | ||
------- | ||
int | ||
Node number | ||
Examples | ||
-------- | ||
In this example we construct a solid box and mesh it. Then we | ||
use the ``Query`` method ``node`` to find the node closest to | ||
the centre of the block and finally use ``nnear`` to find the | ||
node nearest to that. | ||
>>> from ansys.mapdl.core import launch_mapdl | ||
>>> mapdl = launch_mapdl() | ||
>>> mapdl.prep7() | ||
>>> mapdl.et(1, 'SOLID5') | ||
>>> mapdl.block(0, 10, 0, 10, 0, 10) | ||
>>> mapdl.esize(3) | ||
>>> mapdl.vmesh('ALL') | ||
>>> q = mapdl.query() | ||
>>> node_number = q.node(5., 5., 5.) | ||
>>> nearest_node = q.nnear(node_number) | ||
>>> node_number, nearest_node | ||
(112, 103) | ||
""" | ||
response = self._mapdl.run(f'_=NNEAR({n})') | ||
integer = self._parse_parameter_integer_response(response) | ||
return integer | ||
|
||
def knear(self, k: int) -> int: | ||
"""Returns the selected keypoint nearest keypoint `k`. | ||
Parameters | ||
---------- | ||
k : int | ||
Keypoint number | ||
Returns | ||
------- | ||
int | ||
Keypoint number | ||
Examples | ||
-------- | ||
In this example we construct two keypoints and then verify that | ||
the nearest keypoint to one is the other. | ||
>>> from ansys.mapdl.core import launch_mapdl | ||
>>> mapdl = launch_mapdl() | ||
>>> mapdl.prep7() | ||
>>> k1 = mapdl.k(1, 0, 0, 0) | ||
>>> k2 = mapdl.k(2, 1, 1, 1) | ||
>>> q = mapdl.query() | ||
>>> q.knear(k1) | ||
1 | ||
>>> q.knear(k1) == k2 | ||
True | ||
""" | ||
response = self._mapdl.run(f'_=KNEAR({k})') | ||
integer = self._parse_parameter_integer_response(response) | ||
return integer | ||
|
||
def enearn(self, n: int) -> int: | ||
"""Returns the selected element nearest node `n`. | ||
The element position is calculated from the selected nodes. | ||
Parameters | ||
---------- | ||
n : int | ||
Node number | ||
Returns | ||
------- | ||
int | ||
Element number | ||
Examples | ||
-------- | ||
In this example we construct a solid box and mesh it. Then we | ||
use the ``Query`` method ``node`` to find the node closest to | ||
the centre of the block and finally use ``enearn`` to find the | ||
element nearest to that node. | ||
>>> from ansys.mapdl.core import launch_mapdl | ||
>>> mapdl = launch_mapdl() | ||
>>> mapdl.prep7() | ||
>>> mapdl.et(1, 'SOLID5') | ||
>>> mapdl.block(0, 10, 0, 10, 0, 10) | ||
>>> mapdl.esize(3) | ||
>>> mapdl.vmesh('ALL') | ||
>>> q = mapdl.query() | ||
>>> node_number = q.node(5., 5., 5.) | ||
>>> nearest_element = q.enearn(node_number) | ||
>>> node_number, nearest_element | ||
(112, 22) | ||
""" | ||
response = self._mapdl.run(f'_=ENEARN({n})') | ||
integer = self._parse_parameter_integer_response(response) | ||
return integer | ||
|
Oops, something went wrong.