-
Notifications
You must be signed in to change notification settings - Fork 135
Adding database notes and some improvements #1392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3454b2f
Adding better version control checks to database.
germa89 3fc390c
Adding __repr__ method to node and elems classes
germa89 a9d25c1
Moving the definion of __server_version to __init__
germa89 10945f6
Adding/improving unit tests
germa89 8300298
Adding documentation about database module
germa89 5a0208a
Adding string tests and removing 22.2 from CI testing
germa89 2a90c7d
Fixing ON_CI import
germa89 20de261
Apply suggestions from code review
germa89 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,112 @@ | ||
Accessing MAPDL Database | ||
======================== | ||
|
||
.. warning:: This feature is still in Beta stage. Please report any errors or suggestions to [email protected]. | ||
|
||
|
||
From PyMAPDL v0.61.2, you can access elements and nodes data from the MAPDL database using the DB module. | ||
|
||
|
||
Usage | ||
~~~~~ | ||
|
||
Getting elems and nodes objects: | ||
germa89 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
.. code:: py | ||
|
||
>>> from ansys.mapdl.core import launch_mapdl | ||
>>> from ansys.mapdl.core.examples import vmfiles | ||
|
||
>>> mapdl = launch_mapdl() | ||
>>> mapdl.input(vmfiles['vm271'] | ||
|
||
>>> elems = mapdl.db.elems | ||
>>> elems | ||
MAPDL Database Elements | ||
Number of elements: 3459 | ||
Number of selected elements: 3459 | ||
Maximum element number: 3459 | ||
|
||
>>> nodes = mapdl.db.nodes | ||
MAPDL Database Nodes | ||
Number of nodes: 3652 | ||
Number of selected nodes: 3652 | ||
Maximum node number: 3652 | ||
|
||
To obtain the first element: | ||
|
||
.. code:: py | ||
|
||
>>> elems = mapdl.db.elems | ||
>>> elems.first() | ||
1 | ||
|
||
|
||
Check if the element is selected or not: | ||
|
||
.. code:: py | ||
|
||
>>> from ansys.mapdl.core.database import DBDef | ||
>>> elems.info(1, DBDef.DB_SELECTED) | ||
|
||
Return the element information of element 1. | ||
|
||
.. code:: py | ||
|
||
>>> elems = mapdl.db.elems | ||
>>> elem_info = elems.get(1) | ||
>>> elem_info | ||
ielem: 1 | ||
elmdat: 1 | ||
elmdat: 1 | ||
elmdat: 1 | ||
elmdat: 1 | ||
elmdat: 0 | ||
elmdat: 0 | ||
elmdat: 12 | ||
elmdat: 0 | ||
elmdat: 0 | ||
elmdat: 0 | ||
nnod: 2 | ||
nodes: 1 | ||
nodes: 3 | ||
|
||
Return the nodes belonging to the element. | ||
|
||
.. code:: py | ||
|
||
>>> elem_info.nodes | ||
[1, 3] | ||
|
||
Return the element data. | ||
|
||
.. code:: py | ||
|
||
>>> elem_info.elmdat | ||
[1, 1, 1, 1, 0, 0, 12, 0, 0, 0] | ||
|
||
Return the selection status and the coordinates of node 22. | ||
|
||
.. code:: py | ||
|
||
>>> nodes = mapdl.db.nodes | ||
>>> sel, coord = nodes.coord(22) | ||
>>> coord | ||
(-0.0014423144202849985, 0.010955465718673852, 0.0, 0.0, 0.0, 0.0) | ||
|
||
.. note:: The coordenates returned by the method ``coord`` contains the following: X, Y, Z, THXY, THYZ, and THZX. | ||
|
||
|
||
Requirements | ||
~~~~~~~~~~~~ | ||
|
||
To use ``DB`` feature, you need to meet the following requirements: | ||
|
||
* ``ansys.api.mapdl`` package version should be 0.5.1 or higher. | ||
* ANSYS MAPDL version should be 2021R1 or newer. | ||
|
||
.. warning:: This feature does not work in the latest ANSYS2023. | ||
germa89 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
|
||
|
This file contains hidden or 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 |
---|---|---|
|
@@ -22,6 +22,7 @@ PyMAPDL library. | |
mesh_geometry | ||
post | ||
parameters | ||
database | ||
convert | ||
math | ||
pool | ||
|
This file contains hidden or 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 |
---|---|---|
@@ -1,3 +1,8 @@ | ||
"""The mapdl database module, allowing the access to the MAPDL database from Python.""" | ||
|
||
from .database import DBDef, MapdlDb, check_mapdl_db_is_alive # noqa: F401 | ||
from .database import ( # noqa: F401 | ||
VALID_MAPDL_VERSIONS, | ||
DBDef, | ||
MapdlDb, | ||
check_mapdl_db_is_alive, | ||
) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.