diff --git a/doc/changelog.d/4125.miscellaneous.md b/doc/changelog.d/4125.miscellaneous.md new file mode 100644 index 00000000000..bc3d56883ef --- /dev/null +++ b/doc/changelog.d/4125.miscellaneous.md @@ -0,0 +1 @@ +Fix: improve code quality and numpydoc documentation \ No newline at end of file diff --git a/doc/post_process_tex.py b/doc/post_process_tex.py index 0f7d1aebef0..d73f99e05f8 100644 --- a/doc/post_process_tex.py +++ b/doc/post_process_tex.py @@ -1,7 +1,6 @@ """Validate the PNG images in the build/latex/ directory -Removes invalid PNGs (probably GIF) - +Removes invalid PNGs (probably GIF). """ from glob import glob diff --git a/src/ansys/mapdl/core/_commands/apdl/array_parameters.py b/src/ansys/mapdl/core/_commands/apdl/array_parameters.py index fc901da7f31..4de67041d82 100644 --- a/src/ansys/mapdl/core/_commands/apdl/array_parameters.py +++ b/src/ansys/mapdl/core/_commands/apdl/array_parameters.py @@ -1125,7 +1125,6 @@ def starvput( * - ETAB - Lab - Any user-defined element table label ( :ref:`etable` ). - """ command = ( f"*VPUT,{parr},{entity},{entnum},{item1},{it1num},{item2},{it2num},{kloop}" diff --git a/src/ansys/mapdl/core/_commands/apdl/matrix_operations.py b/src/ansys/mapdl/core/_commands/apdl/matrix_operations.py index 7ae8d4768c2..fd4bdd8e55d 100644 --- a/src/ansys/mapdl/core/_commands/apdl/matrix_operations.py +++ b/src/ansys/mapdl/core/_commands/apdl/matrix_operations.py @@ -1265,8 +1265,6 @@ def lsdump(self, enginename: str = "", filename: str = "", **kwargs): :ref:`lsrestore` command. A BCS Sparse Solver can be dumped only if uses the ``INCORE`` memory option (see :ref:`bcsoption` ). - - """ command = f"*LSDUMP,{enginename},{filename}" return self.run(command, **kwargs) @@ -1427,8 +1425,6 @@ def lsrestore(self, enginename: str = "", filename: str = "", **kwargs): Restores a previously dumped Linear Solver (see the :ref:`lsdump` command). This Linear Solver can be used to solve a linear system using the :ref:`lsbac` command. - - """ command = f"*LSRESTORE,{enginename},{filename}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/apdl/parameter_definition.py b/src/ansys/mapdl/core/_commands/apdl/parameter_definition.py index 23b69ddd204..2a8d2cfda41 100644 --- a/src/ansys/mapdl/core/_commands/apdl/parameter_definition.py +++ b/src/ansys/mapdl/core/_commands/apdl/parameter_definition.py @@ -2944,7 +2944,6 @@ def get( * - STAT - ``Element Number`` - Status of the element: 0 = uncracked, 1 = cracked - """ command = f"*GET,{par},{entity},{entnum},{item1},{it1num},{item2},{it2num}" return self.run(command, **kwargs) @@ -4766,7 +4765,6 @@ def starvget( * - EMF - - Electromotive force drop - """ command = ( f"*VGET,{parr},{entity},{entnum},{item1},{it1num},{item2},{it2num},{kloop}" diff --git a/src/ansys/mapdl/core/_commands/database/components.py b/src/ansys/mapdl/core/_commands/database/components.py index 183de0316bf..152afda7d96 100644 --- a/src/ansys/mapdl/core/_commands/database/components.py +++ b/src/ansys/mapdl/core/_commands/database/components.py @@ -511,7 +511,6 @@ def cmwrite(self, fname: str = "", ext: str = "", fmat: str = "", **kwargs): * ``BLOCKED`` - Blocked format. This format allows faster reading of the file. * ``UNBLOCKED`` - Unblocked format. - """ command = f"CMWRITE,{fname},{ext},,,{fmat}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/database/selecting.py b/src/ansys/mapdl/core/_commands/database/selecting.py index 89dc1de2d11..779836c9f0d 100644 --- a/src/ansys/mapdl/core/_commands/database/selecting.py +++ b/src/ansys/mapdl/core/_commands/database/selecting.py @@ -240,7 +240,6 @@ def asel( * - ACCA - - Concatenated areas (selects only areas that were created by area concatenation ( :ref:`accat` )). - """ command = f"ASEL,{type_},{item},{comp},{vmin},{vmax},{vinc},{kswp}" return self.run(command, **kwargs) @@ -652,7 +651,6 @@ def esel( * - ETAB - ``Lab`` - Any user-defined element table label ( :ref:`etable` ). - """ command = f"ESEL,{type_},{item},{comp},{vmin},{vmax},{vinc},{kabs}" return self.run(command, **kwargs) @@ -935,7 +933,6 @@ def ksel( * - ESYS - - Element coordinate system associated with the keypoint. - """ command = f"KSEL,{type_},{item},{comp},{vmin},{vmax},{vinc},{kabs}" return self.run(command, **kwargs) @@ -1166,7 +1163,6 @@ def lsel( * - LCCA - - Concatenated lines (selects only lines that were created by concatenation ( :ref:`lccat` )). - """ command = f"LSEL,{type_},{item},{comp},{vmin},{vmax},{vinc},{kswp}" return self.run(command, **kwargs) @@ -2056,7 +2052,6 @@ def vsel( * - ESYS - - Element coordinate system associated with the volume. - """ command = f"VSEL,{type_},{item},{comp},{vmin},{vmax},{vinc},{kswp}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/graphics/set_up.py b/src/ansys/mapdl/core/_commands/graphics/set_up.py index 4d6e91f1855..bf61947aa0a 100644 --- a/src/ansys/mapdl/core/_commands/graphics/set_up.py +++ b/src/ansys/mapdl/core/_commands/graphics/set_up.py @@ -1000,7 +1000,6 @@ def jpeg(self, kywrd: str = "", opt: str = "", **kwargs): * ``1,0`` - If ``Kywrd`` = TMOD, the values 1 and 0 determine whether bitmap (1) or stroke text (0) fonts will be used - """ command = f"JPEG,{kywrd},{opt}" return self.run(command, **kwargs) @@ -1192,7 +1191,6 @@ def pngr(self, kywrd: str = "", opt: str = "", val: int | str = "", **kwargs): * ``1-9`` - Use this value to specify a specific compression level. 1 is the lowest compression level (fastest) and 9 is the highest compression level (slowest). - """ command = f"PNGR,{kywrd},{opt},{val}" return self.run(command, **kwargs) @@ -1494,7 +1492,6 @@ def tiff(self, kywrd: str = "", opt: str = "", **kwargs): * ``1, 0`` - If ``Kywrd`` = TMOD, the values 1 and 0 determine whether bitmap (1) or stroke text (0) fonts will be used - """ command = f"TIFF,{kywrd},{opt}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/hidden.py b/src/ansys/mapdl/core/_commands/hidden.py index 85a4e45c654..6e41315652c 100644 --- a/src/ansys/mapdl/core/_commands/hidden.py +++ b/src/ansys/mapdl/core/_commands/hidden.py @@ -22,7 +22,6 @@ """These commands may be run by PyMAPDL, but are not supported from a user-context. - """ diff --git a/src/ansys/mapdl/core/_commands/inq_func.py b/src/ansys/mapdl/core/_commands/inq_func.py index a5fc2e08172..abb6ab0304b 100644 --- a/src/ansys/mapdl/core/_commands/inq_func.py +++ b/src/ansys/mapdl/core/_commands/inq_func.py @@ -19,7 +19,6 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. - """Inquire undocumented functions""" @@ -374,7 +373,6 @@ def lsinqr(self, line, key, pname="__tmpvar__", **kwargs): For key not equal to 1 returned data is based on setting of key. - """ return self.run(f"{pname} = lsinqr({line}, {key})", **kwargs) @@ -580,7 +578,6 @@ def rlinqr(self, nreal, key, pname="__tmpvar__", **kwargs): ------- int or str The returned value of ``rlinqr`` is based on setting of key. - """ return self.run(f"{pname} = rlinqr({nreal}, {key})", **kwargs) @@ -762,7 +759,6 @@ def cpinqr(self, ncp, key, pname="__tmpvar__", **kwargs): ------- int or str The returned value of ``cpinqr`` is based on setting of key. - """ return self.run(f"{pname} = cpinqr({ncp}, {key})", **kwargs) @@ -1053,7 +1049,6 @@ def mpinqr(self, mat, iprop, key, pname="__tmpvar__", **kwargs): +----------+-----+----------+-----+----------+-----+----------+-----+----------+-----+----------+-----+ see :meth:`TB ` command for more information. - """ return self.run(f"{pname} = mpinqr({mat}, {iprop}, {key})", **kwargs) @@ -1350,7 +1345,6 @@ def erinqr(self, key, pname="__tmpvar__", **kwargs): ------- int or str Value corresponding to key. - """ return self.run(f"{pname} = erinqr({key})", **kwargs) @@ -1423,6 +1417,5 @@ def wrinqr(self, key, pname="__tmpvar__", **kwargs): ------- int or str The value corresponding to key. - """ return self.run(f"{pname} = wrinqr({key})", **kwargs) diff --git a/src/ansys/mapdl/core/_commands/misc/misc.py b/src/ansys/mapdl/core/_commands/misc/misc.py index fd4c29ab9ad..01baca7ae13 100644 --- a/src/ansys/mapdl/core/_commands/misc/misc.py +++ b/src/ansys/mapdl/core/_commands/misc/misc.py @@ -52,6 +52,5 @@ def verify(self, case="", level="", **kwargs): >>> mapdl.finish() >>> mapdl.verify('VM1') '*** VERIFICATION RUN - CASE VM1 *** OPTION= 4' - """ return self.run(f"/VERIFY,{case},{level}", **kwargs) diff --git a/src/ansys/mapdl/core/_commands/post1/_fatigue.py b/src/ansys/mapdl/core/_commands/post1/_fatigue.py index d1c78c8337e..77669a54cd4 100644 --- a/src/ansys/mapdl/core/_commands/post1/_fatigue.py +++ b/src/ansys/mapdl/core/_commands/post1/_fatigue.py @@ -59,7 +59,6 @@ def fe( .. warning:: This command is archived in the latest version of the software. - """ command = f"FE,{nev},{cycle},{fact},{title}" return self.run(command, **kwargs) @@ -96,7 +95,6 @@ def felist(self, nev1: str = "", nev2: str = "", ninc: str = "", **kwargs): .. warning:: This command is archived in the latest version of the software. - """ command = f"FELIST,{nev1},{nev2},{ninc}" return self.run(command, **kwargs) @@ -165,7 +163,6 @@ def fl( .. warning:: This command is archived in the latest version of the software. - """ command = f"FL,{nloc},{node},{scfx},{scfy},{scfz},{title}" return self.run(command, **kwargs) @@ -202,7 +199,6 @@ def fllist(self, nloc1: str = "", nloc2: str = "", ninc: str = "", **kwargs): .. warning:: This command is archived in the latest version of the software. - """ command = f"FLLIST,{nloc1},{nloc2},{ninc}" return self.run(command, **kwargs) @@ -279,7 +275,6 @@ def fp( .. warning:: This command is archived in the latest version of the software. - """ command = f"FP,{stitm},{c1},{c2},{c3},{c4},{c5},{c6}" return self.run(command, **kwargs) @@ -296,7 +291,6 @@ def fplist(self, **kwargs): .. warning:: This command is archived in the latest version of the software. - """ command = "FPLIST" return self.run(command, **kwargs) @@ -387,7 +381,6 @@ def fs( .. warning:: This command is archived in the latest version of the software. - """ command = f"FS,{node},{nev},{nlod},{stitm},{c1},{c2},{c3},{c4},{c5},{c6}" return self.run(command, **kwargs) @@ -420,7 +413,6 @@ def fsdele(self, nloc: str = "", nev: str = "", nlod: str = "", **kwargs): .. warning:: This command is archived in the latest version of the software. - """ command = f"FSDELE,{nloc},{nev},{nlod}" return self.run(command, **kwargs) @@ -472,7 +464,6 @@ def fslist( .. warning:: This command is archived in the latest version of the software. - """ command = f"FSLIST,{nloc1},{nloc2},{ninc},{nev},{nlod}" return self.run(command, **kwargs) @@ -511,7 +502,6 @@ def fsnode(self, node: str = "", nev: str = "", nlod: str = "", **kwargs): .. warning:: This command is archived in the latest version of the software. - """ command = f"FSNODE,{node},{nev},{nlod}" return self.run(command, **kwargs) @@ -551,7 +541,6 @@ def fsplot(self, nloc: str = "", nev: str = "", item: int | str = "", **kwargs): .. warning:: This command is archived in the latest version of the software. - """ command = f"FSPLOT,{nloc},{nev},{item}" return self.run(command, **kwargs) @@ -579,7 +568,6 @@ def ftcalc(self, nloc: str = "", node: str = "", **kwargs): .. warning:: This command is archived in the latest version of the software. - """ command = f"FTCALC,{nloc},{node}" return self.run(command, **kwargs) @@ -614,7 +602,6 @@ def ftsize(self, mxloc: str = "", mxev: str = "", mxlod: str = "", **kwargs): .. warning:: This command is archived in the latest version of the software. - """ command = f"FTSIZE,{mxloc},{mxev},{mxlod}" return self.run(command, **kwargs) @@ -646,7 +633,6 @@ def ftwrite(self, fname: str = "", ext: str = "", **kwargs): .. warning:: This command is archived in the latest version of the software. - """ command = f"FTWRITE,{fname},{ext}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/post1/_special_purpose.py b/src/ansys/mapdl/core/_commands/post1/_special_purpose.py index 9f75a31c24d..00023ed4c68 100644 --- a/src/ansys/mapdl/core/_commands/post1/_special_purpose.py +++ b/src/ansys/mapdl/core/_commands/post1/_special_purpose.py @@ -91,7 +91,6 @@ def kcalc( .. warning:: This command is archived in the latest version of the software. - """ command = f"KCALC,{kplan},{mat},{kcsym},{klocpr}" return self.run(command, **kwargs) @@ -148,7 +147,6 @@ def plcrack(self, loc: int | str = "", num: int | str = "", **kwargs): .. warning:: This command is archived in the latest version of the software. - """ command = f"PLCRACK,{loc},{num}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/post1/element_table.py b/src/ansys/mapdl/core/_commands/post1/element_table.py index 1530b8ab786..58e6b0e0ade 100644 --- a/src/ansys/mapdl/core/_commands/post1/element_table.py +++ b/src/ansys/mapdl/core/_commands/post1/element_table.py @@ -773,7 +773,6 @@ def etable( - The ``n`` th state variable. * - FLDUF0 ``n`` - The ``n`` th user-defined field variable. - """ command = f"ETABLE,{lab},{item},{comp},{option}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/post1/listing.py b/src/ansys/mapdl/core/_commands/post1/listing.py index 1c8f873321a..9a40b1fe60f 100644 --- a/src/ansys/mapdl/core/_commands/post1/listing.py +++ b/src/ansys/mapdl/core/_commands/post1/listing.py @@ -304,7 +304,6 @@ def prerr(self, **kwargs): consist of one material). * Anisotropic materials ( :ref:`tb`,ANEL) are not considered. - """ command = "PRERR" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/post1/path_operations.py b/src/ansys/mapdl/core/_commands/post1/path_operations.py index e9240eee4b9..b37caf4c547 100644 --- a/src/ansys/mapdl/core/_commands/post1/path_operations.py +++ b/src/ansys/mapdl/core/_commands/post1/path_operations.py @@ -452,7 +452,6 @@ def pcalc( ``LabR`` = FACT2 x ``cos`` -1(FACT1 x Lab1) + CONST ``LabR`` = FACT2 x ``log(FACT1 x Lab1) + CONST`` - """ command = f"PCALC,{oper},{labr},{lab1},{lab2},{fact1},{fact2},{const}" return self.run(command, **kwargs) @@ -995,7 +994,6 @@ def plsect( * - " - INT, EQV - Stress intensity or equivalent stress. - """ command = f"PLSECT,{item},{comp},{rho},{kbr},{kbr3d}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/post1/results.py b/src/ansys/mapdl/core/_commands/post1/results.py index 0a2d24a6a0b..eb380b03528 100644 --- a/src/ansys/mapdl/core/_commands/post1/results.py +++ b/src/ansys/mapdl/core/_commands/post1/results.py @@ -1151,7 +1151,6 @@ def plesol( - The ``n`` th state variable. * - FLDUF0 ``n`` - The ``n`` th user-defined field variable. - """ command = f"PLESOL,{item},{comp},{kund},{fact},{avg}" return self.run(command, **kwargs) @@ -1758,7 +1757,6 @@ def plnsol( - The ``n`` th state variable. * - FLDUF0 ``n`` - The ``n`` th user-defined field variable. - """ command = f"PLNSOL,{item},{comp},{kund},{fact},{fileid},{avg},{datakey}" return self.run(command, **kwargs) @@ -2734,7 +2732,6 @@ def presol(self, item: str = "", comp: str = "", **kwargs): - The ``n`` th state variable. * - FLDUF0 ``n`` - The ``n`` th user-defined field variable. - """ command = f"PRESOL,{item},{comp}" return self.run(command, **kwargs) @@ -3394,7 +3391,6 @@ def prnsol( - The ``n`` th state variable. * - FLDUF0 ``n`` - The ``n`` th user-defined field variable. - """ command = f"PRNSOL,{item},{comp},,,,{avg},{datakey}" return self.run(command, **kwargs) @@ -3703,7 +3699,6 @@ def prvect( * - SNDI - - Sound intensity vector sum and direction cosines. - """ command = f"PRVECT,{item},{lab2},{lab3},{labp}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/post1/set_up.py b/src/ansys/mapdl/core/_commands/post1/set_up.py index da465031c8a..2932eb14f60 100644 --- a/src/ansys/mapdl/core/_commands/post1/set_up.py +++ b/src/ansys/mapdl/core/_commands/post1/set_up.py @@ -315,7 +315,6 @@ def desol( * - RATE - - Diffusion flow rate - """ command = f"DESOL,{elem},{node},{item},{comp},{v1},{v2},{v3},{v4},{v5},{v6}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/post1/special_purpose.py b/src/ansys/mapdl/core/_commands/post1/special_purpose.py index e64ebccfd04..50100b72788 100644 --- a/src/ansys/mapdl/core/_commands/post1/special_purpose.py +++ b/src/ansys/mapdl/core/_commands/post1/special_purpose.py @@ -4029,7 +4029,6 @@ def slashexpand( * :ref:`slashexpand` does not change the database as does the :ref:`expand` command. * You cannot print results displayed via :ref:`slashexpand`. - """ command = f"/EXPAND,{nrepeat1},{type1},{method1},{dx1},{dy1},{dz1},{nrepeat2},{type2},{method2},{dx2},{dy2},{dz2},{nrepeat3},{type3},{method3},{dx3},{dy3},{dz3}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/post1/surface_operations.py b/src/ansys/mapdl/core/_commands/post1/surface_operations.py index 03047189ca8..ef33b997f41 100644 --- a/src/ansys/mapdl/core/_commands/post1/surface_operations.py +++ b/src/ansys/mapdl/core/_commands/post1/surface_operations.py @@ -170,8 +170,6 @@ def sucr( percent to check for inclusion. Excluding facets under such a small tolerance may yield unacceptable (aesthetically) results. Increasing the tolerance by a larger amount (0.1 or 10%) will sometimes yield smother edges along the surface you create. - - """ command = f"SUCR,{surfname},{surftype},{nrefine},{radius},,,{tolout}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/post26/_set_up.py b/src/ansys/mapdl/core/_commands/post26/_set_up.py index c2a10558cca..049fef8a540 100644 --- a/src/ansys/mapdl/core/_commands/post26/_set_up.py +++ b/src/ansys/mapdl/core/_commands/post26/_set_up.py @@ -54,7 +54,6 @@ def gapf(self, nvar: str = "", num: str = "", name: str = "", **kwargs): .. warning:: This command is archived in the latest version of the software. - """ command = f"GAPF,{nvar},{num},{name}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/post26/operations.py b/src/ansys/mapdl/core/_commands/post26/operations.py index faab1cff9d1..099e9ad1241 100644 --- a/src/ansys/mapdl/core/_commands/post26/operations.py +++ b/src/ansys/mapdl/core/_commands/post26/operations.py @@ -127,7 +127,6 @@ def add( Adds variables (up to three at once) according to the operation: ``IR`` = ( ``FACTA`` x ``IA`` ) + ( ``FACTB`` x ``IB`` ) + ( ``FACTC`` x ``IC`` ) - """ command = f"ADD,{ir},{ia},{ib},{ic},{name},,,{facta},{factb},{factc}" return self.run(command, **kwargs) @@ -351,7 +350,6 @@ def exp( Forms the exponential of a variable according to the operation: ``IR`` = ``FACTB`` \*EXP( ``FACTA`` x ``IA`` ) - """ command = f"EXP,{ir},{ia},,,{name},,,{facta},{factb}" return self.run(command, **kwargs) @@ -496,7 +494,6 @@ def int1( Integrates variables according to the operation: ``IR`` = ∫ ( ``FACTA`` x ``IY`` ) d( ``FACTB`` x ``IX`` ) + ``CONST`` - """ command = f"INT1,{ir},{iy},{ix},,{name},,,{facta},{factb},{const}" return self.run(command, **kwargs) @@ -605,7 +602,6 @@ def nlog( Forms the natural log of a variable according to the operation: ``IR`` = ``FACTB`` \*LN( ``FACTA`` x ``IA`` ) - """ command = f"NLOG,{ir},{ia},,,{name},,,{facta},{factb}" return self.run(command, **kwargs) @@ -666,7 +662,6 @@ def prod( Multiplies variables (up to three at once) according to the operation: ``IR`` = ( ``FACTA`` x ``IA`` ) x ( ``FACTB`` x ``IB`` ) x ( ``FACTC`` x ``IC`` ) - """ command = f"PROD,{ir},{ia},{ib},{ic},{name},,,{facta},{factb},{factc}" return self.run(command, **kwargs) @@ -716,7 +711,6 @@ def quot( Divides two variables according to the operation: ``IR`` = ( ``FACTA`` x ``IA`` )/( ``FACTB`` x ``IB`` ) - """ command = f"QUOT,{ir},{ia},{ib},,{name},,,{facta},{factb}" return self.run(command, **kwargs) @@ -819,7 +813,6 @@ def small( Finds the smallest of three variables according to the operation: ``IR`` = smallest of ( ``FACTA`` x ``IA``, ``FACTB`` x ``IB``, ``FACTC`` x ``IC`` ) - """ command = f"SMALL,{ir},{ia},{ib},{ic},{name},,,{facta},{factb},{factc}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/post26/set_up.py b/src/ansys/mapdl/core/_commands/post26/set_up.py index 3b36537532d..d5fd9cc9d88 100644 --- a/src/ansys/mapdl/core/_commands/post26/set_up.py +++ b/src/ansys/mapdl/core/_commands/post26/set_up.py @@ -317,7 +317,6 @@ def ansol( - The ``n`` th state variable. * - FLDUF0 ``n`` - The ``n`` th user-defined field variable. - """ command = ( f"ANSOL,{nvar},{node},{item},{comp},{name},{mat},{real},{ename},{datakey}" @@ -1004,7 +1003,6 @@ def esol( - The ``n`` th state variable. * - FLDUF0 ``n`` - The ``n`` th user-defined field variable. - """ command = f"ESOL,{nvar},{elem},{node},{item},{comp},{name}" return self.run(command, **kwargs) @@ -1136,7 +1134,6 @@ def jsol( * - RM - X, Y, Z - Relative reaction moments in the local x, y, or z direction. - """ command = f"JSOL,{nvar},{elem},{item},{comp},{name}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/preproc/areas.py b/src/ansys/mapdl/core/_commands/preproc/areas.py index 3cb6b2e4832..b126136fc81 100644 --- a/src/ansys/mapdl/core/_commands/preproc/areas.py +++ b/src/ansys/mapdl/core/_commands/preproc/areas.py @@ -86,7 +86,6 @@ def a( >>> a0 = mapdl.a(k0, k1, k2) >>> a0 1 - """ command = f"A,{p1},{p2},{p3},{p4},{p5},{p6},{p7},{p8},{p9},{p10},{p11},{p12},{p13},{p14},{p15},{p16},{p17},{p18}" return parse.parse_a(self.run(command, **kwargs)) @@ -130,7 +129,6 @@ def aatt(self, mat="", real="", type_="", esys="", secn="", **kwargs): secn The section number to be associated with selected unmeshed areas. - """ command = f"AATT,{mat},{real},{type_},{esys},{secn}" return self.run(command, **kwargs) @@ -269,7 +267,6 @@ def adrag( 1, ALONG LINES 2, - """ command = f"ADRAG,{nl1},{nl2},{nl3},{nl4},{nl5},{nl6},{nlp1},{nlp2},{nlp3},{nlp4},{nlp5},{nlp6}" return self.run(command, **kwargs) @@ -296,7 +293,6 @@ def afillt(self, na1="", na2="", rad="", **kwargs): rad Radius of fillet to be generated. - """ command = f"AFILLT,{na1},{na2},{rad}" return self.run(command, **kwargs) @@ -375,7 +371,6 @@ def agen( attached to a volume), they are not moved, and new areas are generated instead. Meshed items corresponding to moved areas are also moved if not needed at their original position. - """ command = ( f"AGEN,{itime},{na1},{na2},{ninc},{dx},{dy},{dz},{kinc},{noelem},{imove}" @@ -444,7 +439,6 @@ def al( >>> anum = mapdl.al(l0, l1, l2, l3) >>> anum 1 - """ command = f"AL,{l1},{l2},{l3},{l4},{l5},{l6},{l7},{l8},{l9},{l10}" return parse.parse_a(self.run(command, **kwargs)) diff --git a/src/ansys/mapdl/core/_commands/preproc/booleans.py b/src/ansys/mapdl/core/_commands/preproc/booleans.py index 62adc3ec3f1..d15cea4f964 100644 --- a/src/ansys/mapdl/core/_commands/preproc/booleans.py +++ b/src/ansys/mapdl/core/_commands/preproc/booleans.py @@ -68,7 +68,6 @@ def aadd( >>> a_comb = mapdl.aadd(a1, a2) >>> a_comb 3 - """ command = f"AADD,{na1},{na2},{na3},{na4},{na5},{na6},{na7},{na8},{na9}" return parse.parse_output_areas(self.run(command, **kwargs)) @@ -396,7 +395,6 @@ def asba(self, na1="", na2="", sepo="", keep1="", keep2="", **kwargs) -> int: >>> aout = mapdl.asba(anum0, anum1) >>> aout 3 - """ command = f"ASBA,{na1},{na2},{sepo},{keep1},{keep2}" return parse.parse_output_volume_area(self.run(command, **kwargs)) diff --git a/src/ansys/mapdl/core/_commands/preproc/database.py b/src/ansys/mapdl/core/_commands/preproc/database.py index 3e5ee5d1b26..84445dd4c60 100644 --- a/src/ansys/mapdl/core/_commands/preproc/database.py +++ b/src/ansys/mapdl/core/_commands/preproc/database.py @@ -19,12 +19,10 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. - """ These PREP7 commands are used to read model data into the database, list out the database, and control the numbering of entities in the database. - """ @@ -342,7 +340,6 @@ def cdwrite( Number of Element Types: 1 Number of Node Components: 0 Number of Element Components: 0 - """ command = f"CDWRITE,{option},'{fname}',{ext},,{fnamei},{exti},{fmat}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/preproc/element_type.py b/src/ansys/mapdl/core/_commands/preproc/element_type.py index d4f3d2ebc42..0bab7846063 100644 --- a/src/ansys/mapdl/core/_commands/preproc/element_type.py +++ b/src/ansys/mapdl/core/_commands/preproc/element_type.py @@ -19,7 +19,6 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. - """ These PREP7 commands define the type of elements to be used in the model. """ @@ -269,7 +268,6 @@ def et( >>> etype_num = mapdl.et(2, 'SOLID186') >>> etype_num 2 - """ command = ( f"ET,{itype},{ename},{kop1},{kop2},{kop3},{kop4},{kop5},{kop6},{inopr}" @@ -387,7 +385,6 @@ def etcontrol( >>> print(output) ELEMENT TECHNOLOGY CONTROL PARAMETER FOR APPLICABLE ELEMENTS = SET. DEGENERATED ELEMENT SHAPE CONTROL PARAMETER FOR APPLICABLE ELEMENTS = ON. - """ return self.run(f"ETCONTROL,{eltech},{eldegene}", **kwargs) @@ -417,7 +414,6 @@ def etdele( >>> mapdl.et(1, 'SOLID186') >>> mapdl.etdele(1) - """ command = f"ETDELE,{ityp1},{ityp2},{inc}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/preproc/elements.py b/src/ansys/mapdl/core/_commands/preproc/elements.py index 034dcb40027..56927e8f9ab 100644 --- a/src/ansys/mapdl/core/_commands/preproc/elements.py +++ b/src/ansys/mapdl/core/_commands/preproc/elements.py @@ -59,7 +59,6 @@ def afsurf(self, sarea="", tline="", **kwargs): tline Component name for the target lines meshed with fluid elements. - """ command = f"AFSURF,{sarea},{tline}" return self.run(command, **kwargs) @@ -138,7 +137,6 @@ def e( >>> mapdl.n(12, 0, 1, 1) >>> mapdl.e(5, 6, 7, 8, 9, 10, 11, 12) 2 - """ command = f"E,{i},{j},{k},{l},{m},{n},{o},{p}" return parse.parse_e(self.run(command, **kwargs)) @@ -210,7 +208,6 @@ def edele( >>> mapdl.edele(10, 25) 'DELETE SELECTED ELEMENTS FROM 10 TO 25 BY 1' - """ return self.run(f"EDELE,{iel1},{iel2},{inc}", **kwargs) @@ -766,7 +763,6 @@ def emodif( >>> mapdl.vmesh('S', 'VOLU', '', 2) >>> mapdl.allsel('BELOW', 'VOLU') >>> mapdl.emodif('ALL', 'MAT', 2) - """ command = f"EMODIF,{iel},{stloc},{i1},{i2},{i3},{i4},{i5},{i6},{i7},{i8}" return self.run(command, **kwargs) @@ -830,7 +826,6 @@ def emore( 'ELEMENT 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 - """ command = f"EMORE,{q},{r},{s},{t},{u},{v},{w},{x}" return self.run(command, **kwargs) @@ -1185,7 +1180,6 @@ def enorm(self, enum: Union[str, int] = "", **kwargs) -> Optional[str]: Examples -------- >>> mapdl.enorm(1) - """ return self.run(f"ENORM,{enum}", **kwargs) @@ -1278,7 +1272,6 @@ def eplot(self, **kwargs): PowerGraphics does not display midside nodes. ``/EFACET`` has no effect on EPLOT for non-midside node elements. This command is valid in any processor. - """ return self.run("EPLOT", **kwargs) @@ -1634,7 +1627,6 @@ def ewrite( Examples -------- >>> mapdl.ewrite('etable.txt', format_='LONG') - """ return self.run(f"EWRITE,{fname},{ext},,{kappnd},{format_}", **kwargs) @@ -1710,7 +1702,6 @@ def gcdef(self, option="", sect1="", sect2="", matid="", realid="", **kwargs): Real constant ID number for general contact interaction properties at the SECT1/SECT2 interface. If zero or blank, the previous setting of REALID for SECT1/SECT2 (if any) is retained. - """ command = f"GCDEF,{option},{sect1},{sect2},{matid},{realid}" return self.run(command, **kwargs) @@ -2104,7 +2095,6 @@ def shsd(self, rid="", action="", **kwargs): For further details, see: https://www.mm.bme.hu/~gyebro/files/ans_help_v182/ans_cmd/Hlp_C_SHSD.html - """ return self.run(f"SHSD,{rid},{action}", **kwargs) diff --git a/src/ansys/mapdl/core/_commands/preproc/keypoints.py b/src/ansys/mapdl/core/_commands/preproc/keypoints.py index 5237d8377a5..d9c8926d4c4 100644 --- a/src/ansys/mapdl/core/_commands/preproc/keypoints.py +++ b/src/ansys/mapdl/core/_commands/preproc/keypoints.py @@ -65,7 +65,6 @@ def k(self, npt="", x="", y="", z="", **kwargs) -> int: >>> knum = mapdl.k(5, 10, 11, 12) >>> knum 5 - """ command = f"K,{npt},{x},{y},{z}" return parse.parse_k(self.run(command, **kwargs)) @@ -130,7 +129,6 @@ def kbetw(self, kp1="", kp2="", kpnew="", type_="", value="", **kwargs) -> int: >>> k2 = mapdl.kbetw(k0, k1) >>> k2 3 - """ command = f"KBETW,{kp1},{kp2},{kpnew},{type_},{value}" return parse.parse_kpoint(self.run(command, **kwargs)) @@ -179,7 +177,6 @@ def kcenter( >>> k3 = mapdl.kcenter('KP', k0, k1, k2) >>> k3 4 - """ command = f"KCENTER,{type_},{val1},{val2},{val3},{val4},{kpnew}" return parse.parse_kpoint(self.run(command, **kwargs)) @@ -201,7 +198,6 @@ def kdele(self, np1="", np2="", ninc="", **kwargs): picking is enabled and all remaining command fields are ignored (valid only in the GUI). A component name may also be substituted for NP1 (NP2 and NINC are ignored). - """ command = f"KDELE,{np1},{np2},{ninc}" return self.run(command, **kwargs) @@ -244,7 +240,6 @@ def kdist(self, kp1="", kp2="", **kwargs) -> list: >>> dist = mapdl.kdist(knum0, knum1) >>> dist [13.96424004376894, 1.0, -5.0, 13.0] - """ return parse.parse_kdist(self.run(f"KDIST,{kp1},{kp2}", **kwargs)) @@ -284,7 +279,6 @@ def kfill(self, np1="", np2="", nfill="", nstrt="", ninc="", space="", **kwargs) Spacing ratio. Ratio of last division size to first division size. If > 1.0, divisions increase. If < 1.0, divisions decrease. Ratio defaults to 1.0 (uniform spacing). - """ command = f"KFILL,{np1},{np2},{nfill},{nstrt},{ninc},{space}" return self.run(command, **kwargs) @@ -405,7 +399,6 @@ def kl(self, nl1="", ratio="", nk1="", **kwargs) -> int: >>> lnum = mapdl.l(knum0, knum1) >>> lnum 1 - """ cmd = f"KL,{nl1},{ratio},{nk1}" return parse.parse_kl(self.run(cmd, **kwargs)) @@ -445,7 +438,6 @@ def klist(self, np1="", np2="", ninc="", lab="", **kwargs): than when displayed with all information). HPT - List only hard point information. - """ command = f"KLIST,{np1},{np2},{ninc},{lab}" return self.run(command, **kwargs) @@ -579,7 +571,6 @@ def knode(self, npt="", node="", **kwargs) -> str: >>> knum1 = mapdl.knode('', nnum) >>> knum1 1 - """ cmd = f"KNODE,{npt},{node}" return parse.parse_knode(self.run(cmd, **kwargs)) diff --git a/src/ansys/mapdl/core/_commands/preproc/lines.py b/src/ansys/mapdl/core/_commands/preproc/lines.py index 52fa9771afb..a0a85facd26 100644 --- a/src/ansys/mapdl/core/_commands/preproc/lines.py +++ b/src/ansys/mapdl/core/_commands/preproc/lines.py @@ -83,7 +83,6 @@ def bsplin( >>> k1 = mapdl.k("", 0, 1, 0) >>> k2 = mapdl.k("", 1, 2, 0) >>> lnum = mapdl.bsplin(k0, k1, k2) - """ command = ( f"BSPLIN,{p1},{p2},{p3},{p4},{p5},{p6},{xv1},{yv1},{zv1},{xv6},{yv6},{zv6}" @@ -156,7 +155,6 @@ def circle( >>> carc0 = mapdl.circle(k0, 1, k1) >>> carc0 [1, 2, 3, 4] - """ command = f"CIRCLE,{pcent},{rad},{paxis},{pzero},{arc},{nseg}" return parse.parse_line_nos(self.run(command, **kwargs)) @@ -225,7 +223,6 @@ def l( >>> lnum = mapdl.l(k0, k1) >>> lnum 1 - """ command = f"L,{p1},{p2},{ndiv},{space},{xv1},{yv1},{zv1},{xv2},{yv2},{zv2}" return parse.parse_line_no(self.run(command, **kwargs)) @@ -294,7 +291,6 @@ def l2ang( >>> lnum = mapdl.l2ang(carc0[0], carc1[0], 90, 90) >>> lnum 9 - """ command = f"L2ANG,{nl1},{nl2},{ang1},{ang2},{phit1},{phit2}" msg = self.run(command, **kwargs) @@ -342,7 +338,6 @@ def l2tan(self, nl1="", nl2="", **kwargs) -> int: Plot these lines >>> mapdl.lplot(cpos='xy') - """ command = f"L2TAN,{nl1},{nl2}" return parse.parse_line_no(self.run(command, **kwargs)) @@ -416,7 +411,6 @@ def lang(self, nl1="", p3="", ang="", phit="", locat="", **kwargs) -> int: >>> lnum = mapdl.lang(lnum, k2, 60) >>> lnum 2 - """ command = f"LANG,{nl1},{p3},{ang},{phit},{locat}" return parse.parse_line_no(self.run(command, **kwargs)) @@ -472,7 +466,6 @@ def larc(self, p1="", p2="", pc="", rad="", **kwargs) -> int: >>> k2 = mapdl.k("", 0, 1, 0) >>> lnum = mapdl.larc(k0, k1, k2, 2) 1 - """ command = f"LARC,{p1},{p2},{pc},{rad}" return parse.parse_line_no(self.run(command, **kwargs)) @@ -517,7 +510,6 @@ def larea(self, p1="", p2="", narea="", **kwargs) -> int: >>> lnum = mapdl.larea(k0, k2, a0) >>> lnum 1 - """ command = f"LAREA,{p1},{p2},{narea}" return parse.parse_line_no(self.run(command, **kwargs)) @@ -572,7 +564,6 @@ def lcomb(self, nl1="", nl2="", keep="", **kwargs) -> int: >>> lout = mapdl.lcomb(l0, l1) >>> lout 1 - """ command = f"LCOMB,{nl1},{nl2},{keep}" return parse.parse_line_no(self.run(command, **kwargs)) @@ -678,7 +669,6 @@ def ldiv(self, nl1="", ratio="", pdiv="", ndiv="", keep="", **kwargs) -> str: >>> k1 = mapdl.k("", 1, 0, 0) >>> l0 = mapdl.l(k0, k1) >>> mapdl.ldiv(l0, ndiv=5) - """ command = f"LDIV,{nl1},{ratio},{pdiv},{ndiv},{keep}" return self.run(command, **kwargs) @@ -785,7 +775,6 @@ def lextnd(self, nl1="", nk1="", dist="", keep="", **kwargs) -> int: >>> lnum = mapdl.lextnd(carcs[0], 3, 1) >>> lnum 1 - """ command = f"LEXTND,{nl1},{nk1},{dist},{keep}" return parse.parse_line_no(self.run(command, **kwargs)) @@ -838,7 +827,6 @@ def lfillt(self, nl1="", nl2="", rad="", pcent="", **kwargs) -> int: >>> l1 = mapdl.l(k0, k2) >>> lnum = mapdl.lfillt(l0, l1, 0.25) 3 - """ command = f"LFILLT,{nl1},{nl2},{rad},{pcent}" return parse.parse_line_no(self.run(command, **kwargs)) @@ -1210,7 +1198,6 @@ def lstr(self, p1="", p2="", **kwargs) -> int: >>> lnum = mapdl.lstr(k0, k1) >>> lnum 1 - """ command = f"LSTR,{p1},{p2}" return parse.parse_line_no(self.run(command, **kwargs)) @@ -1343,7 +1330,6 @@ def ltan(self, nl1="", p3="", xv3="", yv3="", zv3="", **kwargs) -> int: >>> lnum = mapdl.ltan(carc[0], k2) >>> lnum 2 - """ command = f"LTAN,{nl1},{p3},{xv3},{yv3},{zv3}" return parse.parse_line_no(self.run(command, **kwargs)) @@ -1465,7 +1451,6 @@ def spline( >>> lines = mapdl.spline(k0, k1, k2, k3, k4) >>> lines [1, 2, 3, 4] - """ command = ( f"SPLINE,{p1},{p2},{p3},{p4},{p5},{p6},{xv1},{yv1},{zv1},{xv6},{yv6},{zv6}" diff --git a/src/ansys/mapdl/core/_commands/preproc/nodes.py b/src/ansys/mapdl/core/_commands/preproc/nodes.py index 72f0862ab27..c9ff5ff5336 100644 --- a/src/ansys/mapdl/core/_commands/preproc/nodes.py +++ b/src/ansys/mapdl/core/_commands/preproc/nodes.py @@ -244,7 +244,6 @@ def n(self, node="", x="", y="", z="", thxy="", thyz="", thzx="", **kwargs) -> i >>> nnum = mapdl.n(10, 4, 5, 1) >>> nnum 10 - """ command = f"N,{node},{x},{y},{z},{thxy},{thyz},{thzx}" return parse.parse_n(self.run(command, **kwargs)) @@ -436,7 +435,6 @@ def ndist(self, nd1="", nd2="", **kwargs): >>> node_dist = mapdl.ndist(node_num1, node_num2) >>> node_dist [16.673332000533065, 13.0, -3.0, 10.0] - """ return parse.parse_ndist(self.run(f"NDIST,{nd1},{nd2}", **kwargs)) diff --git a/src/ansys/mapdl/core/_commands/preproc/primitives.py b/src/ansys/mapdl/core/_commands/preproc/primitives.py index 5a41f1e46c9..c2ea4a83519 100644 --- a/src/ansys/mapdl/core/_commands/preproc/primitives.py +++ b/src/ansys/mapdl/core/_commands/preproc/primitives.py @@ -75,7 +75,6 @@ def blc4( >>> vnum = mapdl.blc4(1, 1, 1, 2, 10) >>> vnum 1 - """ command = f"BLC4,{xcorner},{ycorner},{width},{height},{depth}" return parse.parse_output_volume_area(self.run(command, **kwargs)) @@ -134,7 +133,6 @@ def blc5( >>> vnum = mapdl.blc5(width=1, height=4, depth=9) >>> vnum 1 - """ command = f"BLC5,{xcenter},{ycenter},{width},{height},{depth}" return parse.parse_output_volume_area(self.run(command, **kwargs)) @@ -177,7 +175,6 @@ def block(self, x1="", x2="", y1="", y2="", z1="", z2="", **kwargs): >>> vnum = mapdl.block(0, 1, 0, 2, 1, 4) >>> vnum 1 - """ command = f"BLOCK,{x1},{x2},{y1},{y2},{z1},{z2}" return parse.parse_output_volume_area(self.run(command, **kwargs)) @@ -229,7 +226,6 @@ def con4(self, xcenter="", ycenter="", rad1="", rad2="", depth="", **kwargs) -> >>> vnum = mapdl.con4(rad1=3, rad2=0, depth=10) >>> vnum 1 - """ command = f"CON4,{xcenter},{ycenter},{rad1},{rad2},{depth}" return parse.parse_output_volume_area(self.run(command, **kwargs)) @@ -289,7 +285,6 @@ def cone( >>> vnum = mapdl.cone(rbot=5, rtop=1, z1=0, z2=10, theta1=180, theta2=90) >>> vnum 1 - """ command = f"CONE,{rbot},{rtop},{z1},{z2},{theta1},{theta2}" return parse.parse_output_volume_area(self.run(command, **kwargs)) @@ -377,7 +372,6 @@ def cyl4( >>> vnum = mapdl.cyl4(0, 0, rad1=1.9, rad2=2.0, depth=10) 2 - """ command = f"CYL4,{xcenter},{ycenter},{rad1},{theta1},{rad2},{theta2},{depth}" return parse.parse_output_volume_area(self.run(command, **kwargs)) @@ -437,7 +431,6 @@ def cyl5( >>> vnum = mapdl.cyl5(xedge1=1, yedge1=1, xedge2=2, yedge2=2, depth=5) >>> vnum 1 - """ command = f"CYL5,{xedge1},{yedge1},{xedge2},{yedge2},{depth}" return parse.parse_output_volume_area(self.run(command, **kwargs)) @@ -497,7 +490,6 @@ def cylind( >>> vnum = mapdl.cylind(0.9, 1, z1=0, z2=5) >>> vnum 1 - """ command = f"CYLIND,{rad1},{rad2},{z1},{z2},{theta1},{theta2}" return parse.parse_output_volume_area(self.run(command, **kwargs)) @@ -543,7 +535,6 @@ def pcirc(self, rad1="", rad2="", theta1="", theta2="", **kwargs) -> int: >>> anum = mapdl.pcirc(0.95, 1) >>> anum 1 - """ command = f"PCIRC,{rad1},{rad2},{theta1},{theta2}" return parse.parse_output_volume_area(self.run(command, **kwargs)) @@ -601,7 +592,6 @@ def prism(self, z1="", z2="", **kwargs): ---------- z1, z2 Working plane Z coordinates of the top and bottom of the prism. - """ command = f"PRISM,{z1},{z2}" return self.run(command, **kwargs) @@ -624,7 +614,6 @@ def ptxy(self, x1="", y1="", x2="", y2="", x3="", y3="", x4="", y4="", **kwargs) ---------- x1, y1, x2, y2, x3, y3, x4, y4 X and Y coordinate pairs on the working plane. - """ command = f"PTXY,{x1},{y1},{x2},{y2},{x3},{y3},{x4},{y4}" return self.run(command, **kwargs) @@ -645,7 +634,6 @@ def rectng(self, x1="", x2="", y1="", y2="", **kwargs): y1, y2 Working plane Y coordinates of the rectangle. - """ command = f"RECTNG,{x1},{x2},{y1},{y2}" return parse.parse_output_volume_area(self.run(command, **kwargs)) @@ -677,7 +665,6 @@ def rpoly(self, nsides="", lside="", majrad="", minrad="", **kwargs): minrad Radius of the minor (or inscribed) circle of the polygon. Not used if LSIDE or MAJRAD is input. - """ command = f"RPOLY,{nsides},{lside},{majrad},{minrad}" return self.run(command, **kwargs) @@ -725,7 +712,6 @@ def rpr4( the working plane Z direction) from the working plane representing the depth of the prism. If DEPTH = 0 (default), a polygonal area is created on the working plane. - """ command = f"RPR4,{nsides},{xcenter},{ycenter},{radius},{theta},{depth}" return self.run(command, **kwargs) @@ -766,7 +752,6 @@ def rprism(self, z1="", z2="", nsides="", lside="", majrad="", minrad="", **kwar Radius of the minor (or inscribed circle) of the polygon defining the top and bottom faces of the prism. Not used if LSIDE or MAJRAD is input. - """ command = f"RPRISM,{z1},{z2},{nsides},{lside},{majrad},{minrad}" return self.run(command, **kwargs) @@ -813,7 +798,6 @@ def sph4(self, xcenter="", ycenter="", rad1="", rad2="", **kwargs) -> int: >>> vnum = mapdl.sph4(0, 0, rad1=0.9, rad2=1.0) >>> vnum 1 - """ command = f"SPH4,{xcenter},{ycenter},{rad1},{rad2}" return parse.parse_output_volume_area(self.run(command, **kwargs)) @@ -854,7 +838,6 @@ def sph5(self, xedge1="", yedge1="", xedge2="", yedge2="", **kwargs) -> int: >>> vnum = mapdl.sph5(xedge1=1, yedge1=1, xedge2=2, yedge2=2) >>> vnum 1 - """ command = f"SPH5,{xedge1},{yedge1},{xedge2},{yedge2}" return parse.parse_output_volume_area(self.run(command, **kwargs)) @@ -905,7 +888,6 @@ def sphere(self, rad1="", rad2="", theta1="", theta2="", **kwargs) -> int: >>> vnum = mapdl.sphere(rad1=0.95, rad2=1.0, theta1=90, theta2=270) >>> vnum 1 - """ command = f"SPHERE,{rad1},{rad2},{theta1},{theta2}" return parse.parse_output_volume_area(self.run(command, **kwargs)) @@ -962,7 +944,6 @@ def torus(self, rad1="", rad2="", rad3="", theta1="", theta2="", **kwargs): >>> vnum = mapdl.torus(rad1=5, rad2=1, rad3=2, theta1=0, theta2=180) >>> vnum 1 - """ command = f"TORUS,{rad1},{rad2},{rad3},{theta1},{theta2}" return parse.parse_output_volume_area(self.run(command, **kwargs)) diff --git a/src/ansys/mapdl/core/_commands/preproc/sections.py b/src/ansys/mapdl/core/_commands/preproc/sections.py index 2f71902f068..a5ca7c7b695 100644 --- a/src/ansys/mapdl/core/_commands/preproc/sections.py +++ b/src/ansys/mapdl/core/_commands/preproc/sections.py @@ -761,8 +761,6 @@ def seclib(self, option="", path="", **kwargs): The current working directory The path specified by the /SECLIB command - - """ command = f"/SECLIB,{option},{path}" return self.run(command, **kwargs) @@ -1166,7 +1164,6 @@ def sectype(self, secid="", type_="", subtype="", name="", refinekey="", **kwarg material IDs). For a tapered pipe section, end sections must have the same number of cells around the circumference and along the pipe wall, and the same shell section ID for a composite pipe wall. - """ command = f"SECTYPE,{secid},{type_},{subtype},{name},{refinekey}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/preproc/status.py b/src/ansys/mapdl/core/_commands/preproc/status.py index 084b2e1047b..010139d8f3f 100644 --- a/src/ansys/mapdl/core/_commands/preproc/status.py +++ b/src/ansys/mapdl/core/_commands/preproc/status.py @@ -151,7 +151,6 @@ def etype(self, **kwargs) -> Optional[str]: KEYOPT( 1- 6)= 0 0 0 0 0 0 KEYOPT( 7-12)= 0 0 0 0 0 0 KEYOPT(13-18)= 0 0 0 0 0 0 - """ return self.run("ETYPE", **kwargs) diff --git a/src/ansys/mapdl/core/_commands/preproc/volumes.py b/src/ansys/mapdl/core/_commands/preproc/volumes.py index d725520d3db..fadf81ce7c3 100644 --- a/src/ansys/mapdl/core/_commands/preproc/volumes.py +++ b/src/ansys/mapdl/core/_commands/preproc/volumes.py @@ -266,7 +266,6 @@ def v( >>> v2 = mapdl.v(k0, k1, k2, k2, k3, k3, k3, k3) >>> v2 3 - """ command = f"V,{p1},{p2},{p3},{p4},{p5},{p6},{p7},{p8}" return parse.parse_v(self.run(command, **kwargs)) @@ -325,7 +324,6 @@ def va( >>> vnum = mapdl.va(a0, a1, a2, a3) >>> vnum 1 - """ command = f"VA,{a1},{a2},{a3},{a4},{a5},{a6},{a7},{a8},{a9},{a10}" return parse.parse_v(self.run(command, **kwargs)) @@ -493,7 +491,6 @@ def vdrag( 3, ALONG LINES 9 - """ command = f"VDRAG,{na1},{na2},{na3},{na4},{na5},{na6},{nlp1},{nlp2},{nlp3},{nlp4},{nlp5},{nlp6}" return self.run(command, **kwargs) @@ -562,7 +559,6 @@ def vext( >>> mapdl.vdele('all') >>> mapdl.vext(a0, dz=4, rx=0.3, ry=0.3, rz=1) - """ command = f"VEXT,{na1},{na2},{ninc},{dx},{dy},{dz},{rx},{ry},{rz}" return self.run(command, **kwargs) @@ -964,7 +960,6 @@ def vrotat( >>> k_axis0 = mapdl.k("", 0, 0, 0) >>> k_axis1 = mapdl.k("", 0, 0, 1) mapdl.vrotat(a0, pax1=k_axis0, pax2=k_axis1) - """ command = ( f"VROTAT,{na1},{na2},{na3},{na4},{na5},{na6},{pax1},{pax2},{arc},{nseg}" @@ -1092,7 +1087,6 @@ def vsymm( >>> print(output) SYMMETRY TRANSFORMATION OF VOLUMES USING COMPONENT Y SET IS ALL SELECTED VOLUMES - """ command = f"VSYMM,{ncomp},{nv1},{nv2},{ninc},{kinc},{noelem},{imove}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/solution/analysis_options.py b/src/ansys/mapdl/core/_commands/solution/analysis_options.py index 90cbbec21a9..cf17f3c3235 100644 --- a/src/ansys/mapdl/core/_commands/solution/analysis_options.py +++ b/src/ansys/mapdl/core/_commands/solution/analysis_options.py @@ -562,7 +562,6 @@ def cgrow(self, action="", par1="", par2="", **kwargs): For additional details on this command, see https://www.mm.bme.hu/~gyebro/files/ans_help_v182/ans_cmd/Hlp_C_CGROW.html - """ command = f"CGROW,{action},{par1},{par2}" return self.run(command, **kwargs) @@ -884,7 +883,6 @@ def cncheck( For additional details, see the notes section at: https://www.mm.bme.hu/~gyebro/files/ans_help_v182/ans_cmd/Hlp_C_CNCHECK.html - """ command = f"CNCHECK,{option},{rid1},{rid2},{rinc},{intertype},{trlevel},{cgap},{cpen},{ioff}" return self.run(command, **kwargs) @@ -2276,7 +2274,6 @@ def lanboption(self, strmck="", **kwargs): By default the sturm sequence check is off for the Block Lanczos eigensolver when it is used in a modal analysis, and on when it is used in a buckling analysis. - """ return self.run(f"LANBOPTION,{strmck}", **kwargs) diff --git a/src/ansys/mapdl/core/_commands/solution/birth_and_death.py b/src/ansys/mapdl/core/_commands/solution/birth_and_death.py index bd311f1a9f9..8f541e853d7 100644 --- a/src/ansys/mapdl/core/_commands/solution/birth_and_death.py +++ b/src/ansys/mapdl/core/_commands/solution/birth_and_death.py @@ -116,7 +116,6 @@ def estif(self, kmult: MapdlFloat = "", **kwargs) -> Optional[str]: >>> mapdl.prep7() >>> mapdl.estif(1E-8) 'DEAD ELEMENT STIFFNESS MULTIPLIER= 0.10000E-07' - """ command = f"ESTIF,{kmult}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/solution/inertia.py b/src/ansys/mapdl/core/_commands/solution/inertia.py index 77fed6f5e70..f79e72af263 100644 --- a/src/ansys/mapdl/core/_commands/solution/inertia.py +++ b/src/ansys/mapdl/core/_commands/solution/inertia.py @@ -589,7 +589,6 @@ def coriolis(self, option="", refframe="", rotdamp="", rotmass="", **kwargs): Alternatively, ``coriolis`` supports bool parameters. >>> mapdl.coriolis(True, refframe=True) - """ # handle bool instead of strings if isinstance(option, bool): diff --git a/src/ansys/mapdl/core/_commands/solution/load_step_operations.py b/src/ansys/mapdl/core/_commands/solution/load_step_operations.py index c1062969dc2..c3420f611c1 100644 --- a/src/ansys/mapdl/core/_commands/solution/load_step_operations.py +++ b/src/ansys/mapdl/core/_commands/solution/load_step_operations.py @@ -165,8 +165,6 @@ def lsread(self, lsnum="", **kwargs): NODE LABEL REAL IMAG 26 FZ -10.0000000 0.00000000 - - """ command = f"LSREAD,{lsnum}" return self.run(command, **kwargs) @@ -209,7 +207,6 @@ def lssolve(self, lsmin="", lsmax="", lsinc="", **kwargs): >>> mapdl.lswrite(2) >>> mapdl.lssolve(1, 2) - """ return self.run(f"LSSOLVE,{lsmin},{lsmax},{lsinc}", **kwargs) diff --git a/src/ansys/mapdl/core/_commands/solution/miscellaneous_loads.py b/src/ansys/mapdl/core/_commands/solution/miscellaneous_loads.py index 914de5c115e..54552319ac4 100644 --- a/src/ansys/mapdl/core/_commands/solution/miscellaneous_loads.py +++ b/src/ansys/mapdl/core/_commands/solution/miscellaneous_loads.py @@ -1401,7 +1401,6 @@ def rescontrol( The program accepts only one occurrence of ``RESCONTROL`` with a negative ``Ldstep`` value (``RESCONTROL,,N`` where ``N`` is a negative number). If you issue ``RESCONTROL`` multiple times with a negative ``Ldstep`` value, the last specification overwrites the previous one. - """ command = f"RESCONTROL, {action}, {ldstep}, {frequency}, {maxfiles}, , {maxtotalfiles}, {filetype}" return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_version.py b/src/ansys/mapdl/core/_version.py index 5a2f6ff4fd4..e63507caca4 100644 --- a/src/ansys/mapdl/core/_version.py +++ b/src/ansys/mapdl/core/_version.py @@ -27,7 +27,6 @@ # major, minor, patch version_info = 0, 58, 'dev0' - """ import importlib.metadata as importlib_metadata from typing import Dict diff --git a/src/ansys/mapdl/core/commands.py b/src/ansys/mapdl/core/commands.py index f9c5e3e1426..54ac3314a10 100644 --- a/src/ansys/mapdl/core/commands.py +++ b/src/ansys/mapdl/core/commands.py @@ -169,7 +169,6 @@ obtain a lower precision than using :class:`Mesh ` methods. |bl| For more information visit :ref:`user_guide_postprocessing`. - """ XSEL_DOCSTRING_INJECTION: str = r""" @@ -180,7 +179,6 @@ Numpy array with the ids of the selected entities. For more information visit :ref:`user_guide_postprocessing`. - """ @@ -539,7 +537,6 @@ class CommandOutput(str): * :attr:`cmd() ` * :attr:`command() ` - """ ## References: @@ -588,7 +585,6 @@ class CommandListingOutput(CommandOutput): * :func:`to_list() ` * :func:`to_array() ` * :func:`to_dataframe() ` - """ _magicwords: list[str] | None @@ -727,7 +723,6 @@ def get_columns(self) -> Optional[List[str]]: Returns ------- List of strings - """ if self._columns_names: return self._columns_names @@ -746,7 +741,6 @@ def _parse_table(self) -> np.ndarray[np.float64, Any]: ------- numpy.ndarray Parsed tabular data from command output. - """ parsed_lines: list[list[str]] = [] for line in self.splitlines(): @@ -842,7 +836,6 @@ class BoundaryConditionsListingOutput(CommandListingOutput): * :func:`to_list() ` * :func:`to_dataframe() ` - """ def bc_colnames(self) -> Optional[List[str]]: @@ -903,7 +896,6 @@ def get_columns(self) -> List[str] | None: Returns ------- List of strings - """ if self._columns_names: return self._columns_names @@ -973,7 +965,6 @@ def to_dataframe( * ``'LABEL'``: str * ``'REAL'``: float * ``'IMAG'``: float - """ df = super().to_dataframe(data=self.to_list()) diff --git a/src/ansys/mapdl/core/common_grpc.py b/src/ansys/mapdl/core/common_grpc.py index c3c93f9e57a..27239d73ff2 100644 --- a/src/ansys/mapdl/core/common_grpc.py +++ b/src/ansys/mapdl/core/common_grpc.py @@ -90,10 +90,23 @@ class GrpcError(MapdlRuntimeError): - """Raised when gRPC fails""" + """Raised when gRPC fails. + + Parameters + ---------- + msg : str, optional + Error message, by default "". + """ def __init__(self, msg: str = "") -> None: - super().__init__(self, msg) + """Initialize GrpcError. + + Parameters + ---------- + msg : str, optional + Error message, by default "". + """ + super().__init__(self, msg=msg) def check_vget_input(entity: str, item: str, itnum: str) -> str: @@ -174,7 +187,7 @@ def check_vget_input(entity: str, item: str, itnum: str) -> str: def parse_chunks( chunks: Iterable[anskernel.Chunk], dtype: Optional[np.typing.DTypeLike] = None ) -> np.ndarray: - """Deserialize gRPC chunks into a numpy array + """Deserialize gRPC chunks into a numpy array. Parameters ---------- @@ -188,7 +201,6 @@ def parse_chunks( ------- np.ndarray Deserialized numpy array. - """ timeout = 3 # seconds time_step = 0.01 diff --git a/src/ansys/mapdl/core/component.py b/src/ansys/mapdl/core/component.py index 4dc0ec38b8d..623efd0da32 100644 --- a/src/ansys/mapdl/core/component.py +++ b/src/ansys/mapdl/core/component.py @@ -459,7 +459,6 @@ def __contains__(self, key: str) -> bool: ------- bool True if the component name exists *and it is selected*, False otherwise. - """ return key.upper() in self._comp.keys() @@ -471,7 +470,6 @@ def __iter__(self) -> Iterator: ------- iterator Return an iterator over the component names. - """ yield from self._comp.keys() @@ -494,7 +492,6 @@ def names(self) -> Tuple[str]: ------- tuple Return a tuple that contains the component names. - """ return tuple(self._comp.keys()) @@ -507,7 +504,6 @@ def types(self) -> Tuple[str]: ------- tuple Return a tuple that contains the types of the components. - """ return tuple(self._comp.values()) @@ -519,7 +515,6 @@ def items(self) -> UNDERLYING_DICT: ------- dict_items Return a view object that contains the name-type pairs for each component. - """ return self._comp.items() @@ -536,7 +531,6 @@ def select( Name(s) of the components mute : bool, optional Whether to mute the `/CMSEL` command output or not, by default False. - """ if isinstance(names, str): names = [names] diff --git a/src/ansys/mapdl/core/convert.py b/src/ansys/mapdl/core/convert.py index 9bd22ec2bb9..def02044c24 100644 --- a/src/ansys/mapdl/core/convert.py +++ b/src/ansys/mapdl/core/convert.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from collections import UserList from logging import Logger, StreamHandler import os import re @@ -167,7 +168,7 @@ def convert_script( ``True``. line_ending : str, optional - When None, automatically is ``\n.`` + When None, automatically is ``\\n``. exec_file : str, optional Specify the location of the ANSYS executable and include @@ -218,13 +219,17 @@ def convert_script( and exit commands are NOT included (``auto_exit=False``). Overrides ``header``, ``add_imports`` and ``auto_exit``. - graphics_backend : bool, optional + graphics_backend : GraphicsBackend, optional It sets the `mapdl.graphics_backend` argument equals True or False depending on this value. clear_at_start : bool, optional Add a `mapdl.clear()` after the Mapdl object initialization. + check_parameter_names : bool, optional + Check if parameter names are valid MAPDL parameter names. + Defaults to ``True``. + Returns ------- list @@ -253,7 +258,6 @@ def convert_script( >>> with open(out_file, 'r') as fid: ... cmds = fid.read() >>> mapdl.input_strings(cmds.splitlines()[2:10]) - """ with open(filename_in, "r") as fid: apdl_strings = fid.readlines() @@ -312,7 +316,7 @@ def convert_apdl_block( Parameters ---------- - apdl_string : str + apdl_strings : str APDL strings or list of strings to convert. loglevel : str, optional @@ -325,6 +329,10 @@ def convert_apdl_block( line_ending : str, optional When None, automatically determined by OS being used. + exec_file : str, optional + Specify the location of the ANSYS executable and include + it in the converter output ``launch_mapdl`` call. + macros_as_functions : bool, optional Attempt to convert MAPDL macros to python functions. @@ -403,7 +411,6 @@ def convert_apdl_block( >>> cmds = cmds.replace('solve', '!solve') >>> mapdl = launch_mapdl() >>> mapdl.input_strings(cmds.splitlines()[2:10]) - """ translator = _convert( @@ -431,10 +438,6 @@ def convert_apdl_block( return translator.lines -from collections import UserList -from typing import Any - - class Lines(UserList[str]): def __init__(self, *args: Any, mute: bool = False, **kwargs: Any) -> None: self._log = Logger("convert_logger") @@ -561,6 +564,10 @@ def format_using_autopep8(self, text: str | None = None) -> str | None: text : str, optional Text to format instead of `self.lines`. For development use. + Returns + ------- + str | None + The formatted text or None if not applicable. """ if self.cleanup_output: try: @@ -581,7 +588,13 @@ def format_using_autopep8(self, text: str | None = None) -> str | None: return autopep8.fix_code(text) def save(self, filename: str) -> None: - """Saves lines to file""" + """Saves lines to file. + + Parameters + ---------- + filename : str + The filename to save the lines to. + """ if os.path.isfile(filename): os.remove(filename) @@ -602,7 +615,15 @@ def save(self, filename: str) -> None: f.write(self.line_ending.join(self.lines)) def initialize_mapdl_object(self, loglevel: str, exec_file: Optional[str]) -> None: - """Initializes ansys object as lines""" + """Initializes ansys object as lines + + Parameters + ---------- + loglevel : str + Logging level for the MAPDL object. + exec_file : str, optional + Path to the ANSYS executable file. + """ core_module = "ansys.mapdl.core" # shouldn't change self.lines.append(f"from {core_module} import launch_mapdl") @@ -639,7 +660,18 @@ def line_ending(self, line_ending: str) -> None: self._line_ending = line_ending def translate_line(self, line: str) -> Optional[str]: - """Converts a single line from an ANSYS APDL script""" + """Converts a single line from an ANSYS APDL script + + Parameters + ---------- + line : str + The APDL line to convert. + + Returns + ------- + str, optional + The converted Python line, or None if no conversion needed. + """ if "$" in line: # these are chained commands. @@ -993,6 +1025,13 @@ def store_under_scored_run_command(self, command: str) -> None: def store_run_command(self, command: str, run_underscored: bool = False) -> None: """Stores pyansys.ANSYS command that cannot be broken down into a function and parameters. + + Parameters + ---------- + command : str + The ANSYS command to store. + run_underscored : bool, optional + Whether to use underscored run method. Default is False. """ if run_underscored: underscore = "_" @@ -1068,7 +1107,15 @@ def _parse_arguments(self, parameters: List[str]) -> str: return ", ".join(parsed_parameters) def store_command(self, function: str, parameters: List[str]) -> None: - """Stores a valid pyansys function with parameters""" + """Stores a valid pyansys function with parameters + + Parameters + ---------- + function : str + The function name to store. + parameters : List[str] + List of parameters to pass to the function. + """ parameter_str = self._parse_arguments(parameters) parameters_dict = { "indentation": self.indent, @@ -1119,7 +1166,18 @@ def end_chained_commands(self) -> None: self.chained_commands = False def output_to_file(self, line: str) -> bool: - """Return if an APDL line is redirecting to a file.""" + """Return if an APDL line is redirecting to a file. + + Parameters + ---------- + line : str + The APDL line to check. + + Returns + ------- + bool + True if redirecting to a file, False otherwise. + """ if line[:4].upper() == "/OUT": # We are redirecting the output to somewhere, probably a file. # Because of the problem with the ansys output, we need to execute @@ -1159,7 +1217,18 @@ def output_to_default(self, line: str) -> bool: return False def _get_items(self, line_: str) -> List[str]: - """Parse the line items (comma separated elements) but ignoring the ones inside parenthesis, or brackets""" + """Parse the line items (comma separated elements) but ignoring the ones inside parenthesis, or brackets. + + Parameters + ---------- + line_ : str + The line to parse. + + Returns + ------- + List[str] + List of parsed items. + """ parenthesis_count = 0 diff --git a/src/ansys/mapdl/core/database/database.py b/src/ansys/mapdl/core/database/database.py index d35bf5c94d2..cf2316bae57 100644 --- a/src/ansys/mapdl/core/database/database.py +++ b/src/ansys/mapdl/core/database/database.py @@ -19,7 +19,6 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. - """Contains the MapdlDb classes, allowing the access to MAPDL DB from Python.""" from enum import Enum from functools import wraps @@ -116,7 +115,6 @@ class MapdlDb: >>> sel, coord = nodes.coord(22) >>> coord (1.0, 0.5, 0.0, 0.0, 0.0, 0.0) - """ def __init__(self, mapdl): @@ -152,7 +150,6 @@ def _start(self, port: Optional[int] = None) -> int: ------- int Port of the database server. - """ # database server must be run from the "BEGIN" level self._mapdl._log.debug("Starting MAPDL server") @@ -449,7 +446,6 @@ def nodes(self): [0., 0., 0.], [0., 0., 0.], [0., 0., 0.]]) - """ if self._nodes is None: from .nodes import DbNodes # here to avoid circular import @@ -494,7 +490,6 @@ def elems(self): >>> elem_info.elmdat [1, 1, 1, 1, 0, 0, 14, 0, 0, 0] - """ if self._elems is None: from .elems import DbElems # here to avoid circular import diff --git a/src/ansys/mapdl/core/database/elems.py b/src/ansys/mapdl/core/database/elems.py index 7680df8e982..c453e280517 100644 --- a/src/ansys/mapdl/core/database/elems.py +++ b/src/ansys/mapdl/core/database/elems.py @@ -19,12 +19,10 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. - """ Contains the element implement of the MAPDL database service. This allows lower level the access to the elements in the MAPDL database. - """ import weakref @@ -66,7 +64,6 @@ class DbElems: >>> elem_info.elmdat [1, 1, 1, 1, 0, 0, 14, 0, 0, 0] - """ def __init__(self, db): @@ -77,12 +74,18 @@ def __init__(self, db): self._itelm = -1 @property - def _db(self): + def _db(self): # numpydoc ignore=RT01 """Return the weakly referenced instance of the database.""" return self._db_weakref() def __str__(self): - """Return the string representation of this class.""" + """Return the string representation of this class. + + Returns + ------- + str + String representation of the class + """ lines = ["MAPDL Database Elements"] lines.append(f" Number of elements: {self.num()}") lines.append(f" Number of selected elements: {self.num(selected=True)}") @@ -121,7 +124,6 @@ def first(self, ielm=0): >>> elems.first(ielm=10) 11 - """ self._itelm = ielm return self.next() @@ -150,7 +152,6 @@ def next(self): >>> elems.next() 2 - """ if self._itelm == -1: raise MapdlRuntimeError( @@ -294,7 +295,6 @@ def num(self, selected=False): >>> elems = mapdl.db.elems >>> elems.num(selected=True) 425 - """ if selected: return self.info(0, DBDef.DB_NUMSELECTED) @@ -305,6 +305,11 @@ def max_num(self) -> int: """ Maximum element number. + Returns + ------- + int + The maximum element number. + Examples -------- Return the maximum element number. @@ -312,7 +317,6 @@ def max_num(self) -> int: >>> elems = mapdl.db.elems >>> elems.max_num 64 - """ return self.info(0, DBDef.DB_MAXDEFINED.value) @@ -363,7 +367,6 @@ def get(self, ielm): >>> elem_info.elmdat [1, 1, 1, 1, 0, 0, 14, 0, 0, 0] - """ request = mapdl_db_pb2.getelmRequest(ielem=ielm) return self._db._stub.getElm(request) @@ -383,7 +386,6 @@ def push(self, ielm, elmdat, nodes): ... [1, 1, 1, 1, 0, 0, 1, 0, 0, 0], ... [1, 2, 3, 4, 5, 6, 7, 8], ... ) - """ if len(elmdat) != 10: raise ValueError("`elmdat` must be length 10") diff --git a/src/ansys/mapdl/core/database/nodes.py b/src/ansys/mapdl/core/database/nodes.py index 938a894558b..d034976e92f 100644 --- a/src/ansys/mapdl/core/database/nodes.py +++ b/src/ansys/mapdl/core/database/nodes.py @@ -19,12 +19,10 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. - """ Contains the Node implementation of the MapdlDb class. This allows access to the Nodes in the MAPDL DB from Python. - """ import weakref @@ -95,7 +93,6 @@ class DbNodes: [0., 0., 0.], [0., 0., 0.], [0., 0., 0.]]) - """ def __init__(self, db): @@ -149,7 +146,6 @@ def first(self, inod=0): >>> nodes.first(inod=10) 11 - """ self._itnod = inod return self.next() @@ -177,7 +173,6 @@ def next(self): >>> nodes.next() 2 - """ if self._itnod == -1: raise MapdlRuntimeError( @@ -289,7 +284,6 @@ def info(self, inod, ikey): >>> nodes = mapdl.db.nodes >>> nodes.info(1, DBDef.DB_SELECTED) 1 - """ if isinstance(ikey, DBDef): ikey = ikey.value @@ -320,7 +314,6 @@ def num(self, selected=False) -> int: >>> nodes = mapdl.db.nodes >>> nodes.num(selected=True) 425 - """ if selected: return self.info(0, DBDef.DB_NUMSELECTED.value) @@ -339,7 +332,6 @@ def max_num(self) -> int: >>> nodes = mapdl.db.nodes >>> nodes.max_num 425 - """ return self.info(0, DBDef.DB_MAXDEFINED.value) @@ -373,7 +365,6 @@ def coord(self, inod): >>> sel, coord = nodes.coord(22) >>> coord (1.0, 0.5, 0.0, 0.0, 0.0, 0.0) - """ request = mapdl_db_pb2.getnodRequest(node=inod) node = self._db._stub.getNod(request) @@ -422,7 +413,6 @@ def all_asarray(self): [0., 0., 0.], [0., 0., 0.], [0., 0., 0.]]) - """ chunk_size = DEFAULT_CHUNKSIZE metadata = [("chunk_size", str(chunk_size))] @@ -508,7 +498,6 @@ def push(self, inod, x, y, z, xang=None, yang=None, zang=None): >>> sel, coord = nodes.coord(1) >>> coord (10.0, 20.0, 30.0, 0.0, 0.0, 0.0) - """ request = mapdl_db_pb2.putnodRequest() request.node = inod diff --git a/src/ansys/mapdl/core/errors.py b/src/ansys/mapdl/core/errors.py index 60ca407ef1e..48abc9f49b5 100644 --- a/src/ansys/mapdl/core/errors.py +++ b/src/ansys/mapdl/core/errors.py @@ -50,7 +50,6 @@ terminated ANSYS run. Disable this check by passing ``override=True`` - """ @@ -382,7 +381,6 @@ def protect_grpc(func: Callable) -> Callable: This works some of the time, but not all the time. For some reason gRPC still captures SIGINT. - """ @wraps(func) diff --git a/src/ansys/mapdl/core/examples/downloads.py b/src/ansys/mapdl/core/examples/downloads.py index f2f2f82eb3a..05fa8f5adbf 100644 --- a/src/ansys/mapdl/core/examples/downloads.py +++ b/src/ansys/mapdl/core/examples/downloads.py @@ -134,7 +134,6 @@ def download_bracket() -> str: >>> filename = examples.download_bracket() >>> filename '/home/user/.local/share/ansys_mapdl_core/examples/bracket.iges' - """ return _download_file("bracket.iges", "geometry") diff --git a/src/ansys/mapdl/core/information.py b/src/ansys/mapdl/core/information.py index 35a6ba792b0..56bf4a39f4d 100644 --- a/src/ansys/mapdl/core/information.py +++ b/src/ansys/mapdl/core/information.py @@ -22,14 +22,17 @@ from functools import wraps import re -from typing import Callable, List, Optional +from typing import TYPE_CHECKING, Callable, Optional import weakref from ansys.mapdl import core as pymapdl from ansys.mapdl.core.errors import MapdlExitedError +if TYPE_CHECKING: + from ansys.mapdl.core import Mapdl -def update_information_first(update: bool = False) -> Callable: + +def update_information_first(update: bool = False) -> Callable[[Callable], Callable]: """ Decorator to wrap :class:`Information ` methods to force update the fields when accessed. @@ -39,6 +42,11 @@ def update_information_first(update: bool = False) -> Callable: update : bool, optional If ``True``, the class information is updated by calling ``/STATUS`` before accessing the methods. By default ``False`` + + Returns + ------- + Callable + The decorator function. """ def decorator(function): @@ -60,6 +68,16 @@ class Information: It is also the object that is called when you issue ``print(mapdl)``, which means ``print`` calls ``mapdl.info.__str__()``. + Parameters + ---------- + mapdl : Mapdl + An instance of the MAPDL class. + + Returns + ------- + Mapdl + An MAPDL instance. + Notes ----- You cannot directly modify the values of this class. @@ -84,11 +102,26 @@ class Information: >>> info = mapdl.info >>> info.mapdl_version 'RELEASE 2021 R2 BUILD 21.2 UPDATE 20210601' - """ def __init__(self, mapdl: "Mapdl") -> None: - """Class Initializer""" + """Class Initializer + + Parameters + ---------- + mapdl : Mapdl + An instance of the MAPDL class. + + Returns + ------- + Mapdl + An MAPDL instance. + + Raises + ------ + TypeError + If the provided `mapdl` object is not an instance of `MapdlBase`. + """ from ansys.mapdl.core.mapdl import MapdlBase # lazy import to avoid circular if not isinstance(mapdl, MapdlBase): # pragma: no cover @@ -104,12 +137,19 @@ def __init__(self, mapdl: "Mapdl") -> None: @property def _mapdl(self) -> "Mapdl": - """Return the weakly referenced MAPDL instance.""" + """Return the weakly referenced MAPDL instance. + + Returns + ------- + Mapdl + A reference to the MAPDL instance. + """ return self._mapdl_weakref() def _update(self) -> None: """We might need to do more calls if we implement properties - that change over the MAPDL session.""" + that change over the MAPDL session. + """ try: if self._mapdl._exited: # pragma: no cover raise MapdlExitedError("Information class: MAPDL exited") @@ -119,8 +159,7 @@ def _update(self) -> None: self._stats = None raise MapdlExitedError("Information class: MAPDL exited") - stats = stats.replace("\n ", "\n") # Bit of formatting - self._stats = stats + self._stats = stats.replace(r"\n ", r"\n") self._mapdl._log.debug("Information class: Updated") def __repr__(self) -> str: @@ -140,82 +179,160 @@ def __repr__(self) -> str: @property @update_information_first(False) def product(self) -> str: - """Retrieve the product from the MAPDL instance.""" + """Retrieve the product from the MAPDL instance. + + Returns + ------- + str + The product name from the MAPDL instance. + """ return self._get_product() @property @update_information_first(False) def mapdl_version(self) -> str: - """Retrieve the MAPDL version from the MAPDL instance.""" + """Retrieve the MAPDL version from the MAPDL instance. + + Returns + ------- + str + The MAPDL version from the MAPDL instance. + """ return self._get_mapdl_version() @property @update_information_first(False) def mapdl_version_release(self) -> str: - """Retrieve the MAPDL version release from the MAPDL instance.""" + """Retrieve the MAPDL version release from the MAPDL instance. + + Returns + ------- + str + The MAPDL version release. + """ st = self._get_mapdl_version() return self._get_between("RELEASE", "BUILD", st).strip() @property @update_information_first(False) def mapdl_version_build(self) -> str: - """Retrieve the MAPDL version build from the MAPDL instance.""" + """Retrieve the MAPDL version build from the MAPDL instance. + + Returns + ------- + str + The MAPDL version build. + """ st = self._get_mapdl_version() return self._get_between("BUILD", "UPDATE", st).strip() @property @update_information_first(False) def mapdl_version_update(self) -> str: - """Retrieve the MAPDL version update from the MAPDL instance.""" + """Retrieve the MAPDL version update from the MAPDL instance. + + Returns + ------- + str + The MAPDL version update. + """ st = self._get_mapdl_version() return self._get_between("UPDATE", "", st).strip() @property @update_information_first(False) def pymapdl_version(self) -> str: - """Retrieve the PyMAPDL version from the MAPDL instance.""" + """Retrieve the PyMAPDL version from the MAPDL instance. + + Returns + ------- + str + Returns the PyMAPDL version. + """ return self._get_pymapdl_version() @property @update_information_first(False) def products(self) -> str: - """Retrieve the products from the MAPDL instance.""" + """Retrieve the products from the MAPDL instance. + + Returns + ------- + str + The products from the MAPDL instance. + """ return self._get_products() @property @update_information_first(False) def preprocessing_capabilities(self) -> str: - """Retrieve the preprocessing capabilities from the MAPDL instance.""" + """Retrieve the preprocessing capabilities from the MAPDL instance. + + Returns + ------- + str + The preprocessing capabilities from the MAPDL instance. + """ return self._get_preprocessing_capabilities() @property @update_information_first(False) def aux_capabilities(self) -> str: - """Retrieve the aux capabilities from the MAPDL instance.""" + """Retrieve the aux capabilities from the MAPDL instance. + + Returns + ------- + str + The aux capabilities from the MAPDL instance. + """ return self._get_aux_capabilities() @property @update_information_first(True) def solution_options(self) -> str: - """Retrieve the solution options from the MAPDL instance.""" + """Retrieve the solution options from the MAPDL instance. + + Returns + ------- + str + The solution options from the MAPDL instance. + """ return self._get_solution_options() @property @update_information_first(False) def post_capabilities(self) -> str: - """Retrieve the post capabilities from the MAPDL instance.""" + """Retrieve the post capabilities from the MAPDL instance. + + Returns + ------- + str + The post capabilities from the MAPDL instance. + """ return self._get_post_capabilities() @property @update_information_first(True) def titles(self) -> str: - """Retrieve the titles from the MAPDL instance.""" + """Retrieve the titles from the MAPDL instance. + + Returns + ------- + str + The titles from the MAPDL instance. + """ return self._get_titles() @property @update_information_first(True) def title(self) -> str: - """Retrieve and set the title from the MAPDL instance.""" + """Retrieve and set the title from the MAPDL instance. + + Returns + ------- + str + The title from the MAPDL instance. + """ return self._mapdl.inquire("", "title") @title.setter @@ -224,9 +341,23 @@ def title(self, title) -> str: @property @update_information_first(True) - def stitles(self, i: int = None) -> str: + def stitles(self, i: int | None = None) -> str: """Retrieve or set the value for the MAPDL stitle (subtitles). + Parameters + ---------- + i + The index of the stitle to retrieve or set. If not provided, + all stitles are returned. If provided, it should be between 0 and 3 + (Python indexing). + + Returns + ------- + str + The stitle(s) from the MAPDL instance. + + Notes + ----- If 'stitle' includes newline characters (`\\n`), then each line is assigned to one STITLE. @@ -242,7 +373,7 @@ def stitles(self, i: int = None) -> str: return self._get_stitles()[i] @stitles.setter - def stitles(self, stitle: str, i: int = None) -> None: + def stitles(self, stitle: str | list[str] | None, i: int | None = None) -> None: if stitle is None: # Case to empty stitle = ["", "", "", ""] @@ -265,72 +396,138 @@ def stitles(self, stitle: str, i: int = None) -> None: for each_index, each_stitle in zip(range(1, 5), stitle): self._mapdl.stitle(each_index, each_stitle) else: - self._mapdl.stitle(i, stitle) + self._mapdl.stitle(str(i), str(stitle)) @property @update_information_first(True) def units(self) -> str: - """Retrieve the units from the MAPDL instance.""" + """Retrieve the units from the MAPDL instance. + + Returns + ------- + str + The units from the MAPDL instance. + """ return self._get_units() @property @update_information_first(True) def scratch_memory_status(self) -> str: - """Retrieve the scratch memory status from the MAPDL instance.""" + """Retrieve the scratch memory status from the MAPDL instance. + + Returns + ------- + str + The scratch memory status from the MAPDL instance. + """ return self._get_scratch_memory_status() @property @update_information_first(True) def database_status(self) -> str: - """Retrieve the database status from the MAPDL instance.""" + """Retrieve the database status from the MAPDL instance. + + Returns + ------- + str + The database status from the MAPDL instance. + """ return self._get_database_status() @property @update_information_first(True) def config_values(self) -> str: - """Retrieve the config values from the MAPDL instance.""" + """Retrieve the config values from the MAPDL instance. + + Returns + ------- + str + The config values from the MAPDL instance. + """ return self._get_config_values() @property @update_information_first(True) def global_status(self) -> str: - """Retrieve the global status from the MAPDL instance.""" + """Retrieve the global status from the MAPDL instance. + + Returns + ------- + str + The global status from the MAPDL instance. + """ return self._get_global_status() @property @update_information_first(True) def job_information(self) -> str: - """Retrieve the job information from the MAPDL instance.""" + """Retrieve the job information from the MAPDL instance. + + Returns + ------- + str + The job information from the MAPDL instance. + """ return self._get_job_information() @property @update_information_first(True) def model_information(self) -> str: - """Retrieve the model information from the MAPDL instance.""" + """Retrieve the model information from the MAPDL instance. + + Returns + ------- + str + The model information from the MAPDL instance. + """ return self._get_model_information() @property @update_information_first(True) def boundary_condition_information(self) -> str: - """Retrieve the boundary condition information from the MAPDL instance.""" + """Retrieve the boundary condition information from the MAPDL instance. + + Returns + ------- + str + The boundary condition information from the MAPDL instance. + """ return self._get_boundary_condition_information() @property @update_information_first(True) def routine_information(self) -> str: - """Retrieve the routine information from the MAPDL instance.""" + """Retrieve the routine information from the MAPDL instance. + + Returns + ------- + str + The routine information from the MAPDL instance. + """ return self._get_routine_information() @property @update_information_first(True) def solution_options_configuration(self) -> str: - """Retrieve the solution options configuration from the MAPDL instance.""" + """Retrieve the solution options configuration from the MAPDL instance. + + Returns + ------- + str + The solution options configuration from the MAPDL instance. + """ return self._get_solution_options_configuration() @property @update_information_first(True) def load_step_options(self) -> str: - """Retrieve the load step options from the MAPDL instance.""" + """Retrieve the load step options from the MAPDL instance. + + Returns + ------- + str + The load step options from the MAPDL instance. + """ return self._get_load_step_options() def _get_between( @@ -341,15 +538,12 @@ def _get_between( ) -> str: if not string: self._update() - string = self._stats + string = self._stats or "" - st = string.find(init_string) + len(init_string) + st: int = string.find(init_string) + len(init_string) + en: int | None = string.find(end_string) if end_string else None - if not end_string: - en = None - else: - en = string.find(end_string) - return "\n".join(string[st:en].splitlines()).strip() + return "\n".join(str(string[st:en]).splitlines()).strip() def _get_product(self) -> str: return self._get_products().splitlines()[0] @@ -366,19 +560,23 @@ def _get_pymapdl_version(self) -> str: def _get_title(self) -> str: match = re.match(r"TITLE=(.*)$", self._get_titles()) if match: - return match.groups(1)[0].strip() - - def _get_stitles(self) -> List[str]: - return [ - ( - re.search(f"SUBTITLE {i}=(.*)", self._get_titles()) - .groups(1)[0] - .strip() - if re.search(f"SUBTITLE {i}=(.*)", self._get_titles()) - else "" + return str(match.groups(1)[0].strip()) # type: ignore + + def _get_stitles(self) -> list[str]: + titles: str = self._get_titles() + + stitles: list[str] = [] + for i in range(1, 5): + match = re.search(f"SUBTITLE {i}=(.*)", titles) + if not match or not match.groups(1): + # If the subtitle is not found, return an empty string + continue + + stitles.append( + str(re.search(f"SUBTITLE {i}=(.*)", titles).groups(1)[0]).strip() # type: ignore ) - for i in range(1, 5) - ] + + return stitles def _get_products(self) -> str: init_ = "*** Products ***" diff --git a/src/ansys/mapdl/core/inline_functions/component_queries.py b/src/ansys/mapdl/core/inline_functions/component_queries.py index 1091e8f47f0..667cb782fcc 100644 --- a/src/ansys/mapdl/core/inline_functions/component_queries.py +++ b/src/ansys/mapdl/core/inline_functions/component_queries.py @@ -600,7 +600,6 @@ def ux(self, n: int) -> float: >>> mapdl.finish() >>> mapdl.queries.ux(7) 1.549155634e-07 - """ return self._run_query(f"UX({n})", integer=False) @@ -646,7 +645,6 @@ def uy(self, n: int) -> float: >>> mapdl.finish() >>> mapdl.queries.uy(7) 5.803680779e-10 - """ return self._run_query(f"UY({n})", integer=False) @@ -692,6 +690,5 @@ def uz(self, n: int) -> float: >>> mapdl.finish() >>> mapdl.queries.uz(7) 3.74530389e-08 - """ return self._run_query(f"UZ({n})", integer=False) diff --git a/src/ansys/mapdl/core/jupyter.py b/src/ansys/mapdl/core/jupyter.py index 72a3818f50e..f174f172ea1 100644 --- a/src/ansys/mapdl/core/jupyter.py +++ b/src/ansys/mapdl/core/jupyter.py @@ -98,7 +98,6 @@ def launch_mapdl_on_cluster( Launch MAPDL and guarantee 16 GB minimum RAM and 8 CPUs. >>> mapdl = launch_mapdl(memory=16, nproc=8) - """ # attempt to connect to the remote scheduler check_manager() diff --git a/src/ansys/mapdl/core/krylov.py b/src/ansys/mapdl/core/krylov.py index 82ea6b430a5..80a87636a99 100644 --- a/src/ansys/mapdl/core/krylov.py +++ b/src/ansys/mapdl/core/krylov.py @@ -77,7 +77,6 @@ class KrylovSolver: >>> Yz = mk.solve(10, 100, freq_steps=1, ramped_load=True) >>> # Expand the reduced solution back to the FE space. >>> res = mk.expand(residual_computation=True, residual_algorithm="l2") - """ def __init__(self, mapdl: Mapdl): diff --git a/src/ansys/mapdl/core/launcher.py b/src/ansys/mapdl/core/launcher.py index 3b280c9218a..32700880d85 100644 --- a/src/ansys/mapdl/core/launcher.py +++ b/src/ansys/mapdl/core/launcher.py @@ -283,7 +283,6 @@ def _is_ubuntu() -> bool: It's a bit complicated because sometimes the distribution is Ubuntu, but the kernel has been recompiled and no longer has the word "ubuntu" in it. - """ # must be running linux for this to be True @@ -327,7 +326,6 @@ def close_all_local_instances(port_range: range | None = None) -> None: >>> import ansys.mapdl.core as pymapdl >>> pymapdl.close_all_local_instances() - """ if port_range is None: port_range = range(50000, 50200) @@ -472,7 +470,6 @@ def generate_mapdl_launch_command( ------- list[str] Command - """ cpu_sw = "-np %d" % nproc @@ -857,7 +854,6 @@ def get_start_instance(start_instance: bool | str | None = None) -> bool: ----- If the environment variable ``PYMAPDL_START_INSTANCE`` is set, hence the argument ``start_instance`` is overwritten. - """ def valid_start_instance(start_instance: str) -> bool: @@ -1035,7 +1031,6 @@ def set_MPI_additional_switches( ------- str Validated additional switches. - """ # Converting additional_switches to lower case to avoid mismatches. add_sw_lower_case = add_sw.lower() @@ -1104,7 +1099,6 @@ def force_smp_in_student(add_sw: str | None, exec_path: str) -> str: ------- str Validated additional switches. - """ # Converting additional_switches to lower case to avoid mismatches. if add_sw is None: diff --git a/src/ansys/mapdl/core/licensing.py b/src/ansys/mapdl/core/licensing.py index da9f158dfbb..2924678b8bd 100644 --- a/src/ansys/mapdl/core/licensing.py +++ b/src/ansys/mapdl/core/licensing.py @@ -29,6 +29,7 @@ # the input is controlled by the library. Excluding bandit check. import subprocess # nosec B404 import time +from typing import Iterator, Literal from ansys.mapdl.core import _HAS_ATP, LOG from ansys.mapdl.core.errors import LicenseServerConnectionError @@ -51,6 +52,7 @@ "preppost": "Mechanical Enterprise PrepPost", } ALLOWABLE_LICENSES = list(LICENSES) +Allowable_licenses = Literal["ansys", "meba", "mech_2", "mech_1", "preppost"] ## Regarding license checking. # The available licenses we can check against are (in order of @@ -76,10 +78,9 @@ class LicenseChecker: ---------- timeout : float, optional Timeout for the licensing log file check. - """ - def __init__(self, timeout=30, verbose=None): + def __init__(self, timeout: int = 30, verbose: bool | None = None): self._license_file_msg = [] self._license_file_success = None @@ -99,21 +100,21 @@ def __init__(self, timeout=30, verbose=None): self._is_connected = False @property - def stop(self): + def stop(self) -> bool: return self._stop @stop.setter - def stop(self, value): + def stop(self, value: bool): if bool(value): LOG.debug("Attempting to stop the license checker.") self._stop = bool(value) @property - def is_connected(self): + def is_connected(self) -> bool: return self._is_connected @is_connected.setter - def is_connected(self, value): + def is_connected(self, value: bool): if bool(value): LOG.debug("PyMAPDL has connected to a MAPDL session.") self._is_connected = bool(value) @@ -129,7 +130,7 @@ def check_license_file(self): self._license_file_success = True @threaded_daemon - def checkout_license(self, host=None): + def checkout_license(self, host: str | None = None): try: self._check_mech_license_available(host) except Exception as error: @@ -138,7 +139,7 @@ def checkout_license(self, host=None): else: self._license_checkout_success = True - def start(self, license_file=True, checkout_license=False): + def start(self, license_file: bool = True, checkout_license: bool = False): """Start monitoring the license file and attempt a license checkout. Parameters @@ -148,7 +149,6 @@ def start(self, license_file=True, checkout_license=False): checkout_license : bool, optional Start the checkout license thread. By default this is disabled. - """ if license_file and _HAS_ATP: self._lic_file_thread = self.check_license_file() @@ -162,7 +162,7 @@ def wait(self): if self._checkout_thread is not None: self._checkout_thread.join() - def check(self): + def check(self) -> bool: """Report if the license checkout or license check was successful. It first checks the output from the license file and later the @@ -181,7 +181,6 @@ def check(self): LicenseServerConnectionError If there were any errors during the license checkout or license file check. - """ if self._license_file_success: return True @@ -195,9 +194,23 @@ def check(self): return False # pragma: no cover - def _check_license_file(self, timeout=30, notify_at_second=5): # pragma: no cover + def _check_license_file( + self, timeout: int = 30, notify_at_second: int = 5 + ): # pragma: no cover """Check the output of the license client log for connection error. + Parameters + ---------- + timeout : int, optional + Time to keep checking the license log file for errors. Default to 10 (seconds). + + Returns + ------- + bool + ``True`` if the license file is valid, ``False`` otherwise. + + Notes + ----- Expect type of errors with 'DENIED' in the header such as: ``` 2021/09/06 22:39:38 DENIED ansys 21.2 (2021.0512) 1/0/0/0 1/1/1/1 10268:FEAT_ANSYS:gayuso@AAPDDqVK5WqNLrt.win.ansys.com:winx64 7368:192.168.18.10 @@ -217,18 +230,12 @@ def _check_license_file(self, timeout=30, notify_at_second=5): # pragma: no cov ``` for `FEAT_ANSYS`. - Parameters - ---------- - timeout : int, optional - Time to keep checking the license log file for errors. Default to 10 (seconds). - Raises ------ LicenseServerConnectionError If there is an error message in the license log file. TimeoutError Exceeded ``timeout`` while waiting for the license log file. - """ licdebug_file = os.path.join( get_ansys_license_debug_file_path(), @@ -241,9 +248,13 @@ def _check_license_file(self, timeout=30, notify_at_second=5): # pragma: no cov ): return True - def _check_license_file_iterator( - self, file_iterator, licdebug_file, timeout=30, notify_at_second=5 - ): + def _check_license_file_iterator( # numpydoc ignore=RT01 + self, + file_iterator: Iterator[str], + licdebug_file: str, + timeout: int = 30, + notify_at_second: int = 5, + ) -> bool: """Loop over iterator""" max_time = time.time() + timeout notification_time = time.time() + notify_at_second @@ -291,7 +302,9 @@ def _check_license_file_iterator( f"Exceeded timeout of {timeout} seconds while examining:\n{licdebug_file}" ) - def _checkout_license(self, lic, host=None, port=2325): + def _checkout_license( + self, lic: Allowable_licenses | str, host: str | None = None, port: int = 2325 + ) -> str: """Check if a license is available using the Ansys license utility. It uses it own process. @@ -311,6 +324,10 @@ def _checkout_license(self, lic, host=None, port=2325): port : int, optional Port on the host to connect to. Only used when ``host`` is set. + Returns + ------- + str + The output from the license checkout command. """ if lic.lower() not in ALLOWABLE_LICENSES: # pragma: no cover raise ValueError(f"Invalid license '{lic}'") @@ -347,8 +364,8 @@ def _checkout_license(self, lic, host=None, port=2325): return output def _check_mech_license_available( - self, host=None, licenses=None - ): # pragma: no cover + self, host: str | None = None, licenses: Allowable_licenses | None = None + ) -> bool: # pragma: no cover """Check if there mechanical license available by running 'ansysli_util'. This uses the default configuration available to MAPDL. @@ -381,7 +398,6 @@ def _check_mech_license_available( ------ LicenseServerConnectionError When errors messages found in the output of the license file. - """ if licenses is None: @@ -399,7 +415,9 @@ def _check_mech_license_available( return True -def get_ansys_license_debug_file_tail(licdebug_file, start_timeout=10, debug=False): +def get_ansys_license_debug_file_tail( + licdebug_file: str, start_timeout: int = 10, debug: bool = False +) -> Iterator[str]: """Get each of the licdebug file messages. This method keeps the ``licdebug`` file open checking for complete messages. @@ -416,7 +434,6 @@ def get_ansys_license_debug_file_tail(licdebug_file, start_timeout=10, debug=Fal ------ msg : str Message formatted as a single string. - """ # wait until file exists max_time = time.time() + start_timeout @@ -437,9 +454,14 @@ def get_ansys_license_debug_file_tail(licdebug_file, start_timeout=10, debug=Fal yield lines -def get_ansys_license_directory(): # pragma: no cover - """Get the path to the Ansys license directory""" +def get_ansys_license_directory() -> str: # pragma: no cover + """Get the path to the Ansys license directory + Returns + ------- + str + The path to the Ansys license directory. + """ # it's possible the user has specified the license as an env var ansyslic_dir = None if LIC_FILE_ENVAR in os.environ: @@ -471,7 +493,7 @@ def get_ansys_license_directory(): # pragma: no cover return ansyslic_dir -def get_ansys_license_debug_file_name(): # pragma: no cover +def get_ansys_license_debug_file_name() -> str: # pragma: no cover """Get license client log file name. This file change the name according to the ANSYS version and the type of license requested (``$appname``). @@ -487,7 +509,6 @@ def get_ansys_license_debug_file_name(): # pragma: no cover ------- str licdebug log file complete name. - """ # Licdebug name convention: # - For version 22.1 and above: `licdebug.$hostname.$appname.$version.out` @@ -508,7 +529,7 @@ def get_ansys_license_debug_file_name(): # pragma: no cover return ".".join([str(each_part) for each_part in parts]) -def get_ansys_license_debug_file_path(): # pragma: no cover +def get_ansys_license_debug_file_path() -> str: # pragma: no cover """Get license client log (``licdebug``) path. This path is obtained from the correspondent env variable (OS @@ -529,8 +550,14 @@ def get_ansys_license_debug_file_path(): # pragma: no cover return os.path.join(folder, ".ansys") -def get_ansys_license_utility_path(): # pragma: no cover - """Return the ansys licencing utilities path.""" +def get_ansys_license_utility_path() -> str: # pragma: no cover + """Return the ansys licencing utilities path. + + Returns + ------- + str + The path to the ANSYS licensing utilities. + """ ansyslic_dir = get_ansys_license_directory() if os.name == "nt": ansysli_util_path = os.path.join(ansyslic_dir, "winx64", "ansysli_util.exe") diff --git a/src/ansys/mapdl/core/logging.py b/src/ansys/mapdl/core/logging.py index d695bcd36df..e617327ff82 100644 --- a/src/ansys/mapdl/core/logging.py +++ b/src/ansys/mapdl/core/logging.py @@ -128,7 +128,6 @@ You can create your own loggers using python ``logging`` library as you would do in any other script. There shall no be conflicts between these loggers. - """ from copy import copy from datetime import datetime @@ -357,7 +356,6 @@ class Logger: >>> from ansys.mapdl.core import LOG >>> file_path = os.path.join(os.getcwd(), 'pymapdl.log') >>> LOG.log_to_file(file_path) - """ file_handler: Optional[logging.FileHandler] = None @@ -438,7 +436,6 @@ def log_to_file( >>> import os >>> file_path = os.path.join(os.getcwd(), 'pymapdl.log') >>> LOG.log_to_file(file_path) - """ addfile_handler(self, filename=filename, level=level, write_headers=True) @@ -587,7 +584,6 @@ def add_instance_logger( ------ Exception You can only input strings as ``name`` to this method. - """ count_ = 0 new_name = name diff --git a/src/ansys/mapdl/core/mapdl.py b/src/ansys/mapdl/core/mapdl.py index 57b0684f8e0..59908e4a513 100644 --- a/src/ansys/mapdl/core/mapdl.py +++ b/src/ansys/mapdl/core/mapdl.py @@ -29,5 +29,4 @@ class MapdlBase(_MapdlExtended): .. warning:: This class should NOT be imported by itself. You should always import a subclass of it like :class:`MapdlGrpc ` - """ diff --git a/src/ansys/mapdl/core/mapdl_console.py b/src/ansys/mapdl/core/mapdl_console.py index ce2207f801c..e9c444852d0 100644 --- a/src/ansys/mapdl/core/mapdl_console.py +++ b/src/ansys/mapdl/core/mapdl_console.py @@ -291,7 +291,6 @@ def mesh(self): Access the geometry as a VTK object >>> mapdl.mesh.grid - """ return self._mesh @@ -301,7 +300,8 @@ def __del__(self): def _exit(self): """Minimal exit command. No logging or cleanup so it does not raise - exceptions""" + exceptions. + """ if self._process is not None: try: self._process.sendline("FINISH") diff --git a/src/ansys/mapdl/core/mapdl_core.py b/src/ansys/mapdl/core/mapdl_core.py index 79cb99234dc..0599f0f8114 100644 --- a/src/ansys/mapdl/core/mapdl_core.py +++ b/src/ansys/mapdl/core/mapdl_core.py @@ -144,7 +144,6 @@ with self.non_interactive: self.vwrite('%s(1)' % parm_name) self.run('(F20.12)') - """ ## Invalid commands in interactive mode. @@ -416,7 +415,6 @@ def allow_ignore(self): *** WARNING *** CP = 0.372 TIME= 21:39:58 K is not a recognized POST1 command, abbreviation, or macro. This command will be ignored. - """ warn( "'allow_ignore' is being deprecated and will be removed in a future release. " @@ -464,7 +462,6 @@ def chain_commands(self): >>> with mapdl.chain_commands: mapdl.prep7() mapdl.k(1, 1, 2, 3) - """ if self._distributed: raise MapdlRuntimeError( @@ -513,14 +510,16 @@ def connection(self): def default_file_type_for_plots(self): """Default file type for plots. - Use when device is not properly set, for instance when the device is closed.""" + Use when device is not properly set, for instance when the device is closed. + """ return self._default_file_type_for_plots @default_file_type_for_plots.setter def default_file_type_for_plots(self, value: VALID_FILE_TYPE_FOR_PLOT_LITERAL): """Set default file type for plots. - Used when device is not properly set, for instance when the device is closed.""" + Used when device is not properly set, for instance when the device is closed. + """ if not isinstance(value, str) or value.upper() not in VALID_FILE_TYPE_FOR_PLOT: raise ValueError(f"'{value}' is not allowed as file output for plots.") return self._default_file_type_for_plots @@ -634,7 +633,6 @@ def force_output(self): and activating text output (``/GOPR``) You can still do changes to those inside this context. - """ return self._force_output(self) @@ -676,7 +674,6 @@ def geometry(self) -> "Geometry": Reselect from the existing selection of lines. >>> mapdl.geometry.line_select([3, 4, 5], sel_type='R') - """ if self._geometry is None: self._geometry = self._create_geometry() @@ -710,7 +707,6 @@ def ignore_errors(self) -> bool: *** WARNING *** CP = 0.372 TIME= 21:39:58 K is not a recognized POST1 command, abbreviation, or macro. This command will be ignored. - """ return self._ignore_errors @@ -843,7 +839,6 @@ def mesh(self): Access the geometry as a VTK object >>> mapdl.mesh.grid - """ return self._mesh @@ -886,7 +881,6 @@ def non_interactive(self): ... mapdl.run("*VWRITE,LABEL(1),VALUE(1,1),VALUE(1,2),VALUE(1,3)") ... mapdl.run("(1X,A8,' ',F10.1,' ',F10.1,' ',1F5.3)") >>> mapdl.last_response - """ return self._non_interactive(self) @@ -901,7 +895,6 @@ def muted(self): -------- >>> with mapdl.muted: ... mapdl.run("/SOLU") # This call is muted - """ return self._muted(self) @@ -934,7 +927,6 @@ def parameters(self) -> "Parameters": >>> mapdl.parameters['ARR'] array([1., 2., 3.]) - """ return self._parameters @@ -968,7 +960,8 @@ def post_processing(self) -> "PostProcessing": @property def print_com(self): """Whether to print or not to the console the - :meth:`mapdl.com ("/COM") ` calls.""" + :meth:`mapdl.com ("/COM") ` calls. + """ return self._print_com @print_com.setter @@ -1048,8 +1041,6 @@ def queries(self): >>> q = mapdl.queries >>> q.nx(1), q.ny(1), q.nz(1) 0.0 20.0 0.0 - - """ if self._query is None: self._query = Query(self) @@ -1062,7 +1053,6 @@ def save_selection(self): Save the current selection (nodes, elements, keypoints, lines, areas, volumes and components) before entering in the context manager, and when exit returns to that selection. - """ if self._save_selection_obj is None: self._save_selection_obj = self._save_selection(self) @@ -1075,6 +1065,8 @@ def solution(self) -> "Solution": Returns ------- :class:`ansys.mapdl.core.solution.Solution` + The solution object contains methods to check the convergence of the + solution, the number of iterations, and the current time step. Examples -------- @@ -1263,7 +1255,8 @@ def _lockfile(self): @supress_logging def _mesh(self) -> "Archive": """Write entire archive to ASCII and read it in as an - ``ansys.mapdl.core.Archive``""" + ``ansys.mapdl.core.Archive`` + """ from ansys.mapdl.reader import Archive if self._archive_cache is None: @@ -1644,7 +1637,6 @@ def run_as_routine(self, routine): ... mapdl.numvar(200) >>> mapdl.parameters.routine 'PREP7' - """ return self._RetainRoutine(self, routine) @@ -2027,7 +2019,6 @@ def add_file_handler(self, filepath, append=False, level="DEBUG"): Start writing the log to a new file named "mapdl.log" >>> mapdl.add_file_handler('mapdl.log') - """ if append: mode = "a" @@ -2056,7 +2047,6 @@ def _flush_stored(self): Used with ``non_interactive``. Overridden by gRPC. - """ if not self._stored_commands: self._log.debug("There is no commands to be flushed.") @@ -2162,7 +2152,6 @@ def run_multiline(self, commands) -> str: KEYOPT( 7-12)= 0 0 0 0 0 0 KEYOPT(13-18)= 0 0 0 0 0 0 output continues... - """ warn( @@ -2216,7 +2205,6 @@ def input_strings(self, commands) -> str: KEYOPT( 1- 6)= 0 0 0 0 0 0 KEYOPT( 7-12)= 0 0 0 0 0 0 KEYOPT(13-18)= 0 0 0 0 0 0 - """ if isinstance(commands, str): commands = commands.splitlines() @@ -2292,7 +2280,6 @@ def run( Equivalent Pythonic method: >>> mapdl.prep7() - """ if self.exited: raise MapdlExitedError( diff --git a/src/ansys/mapdl/core/mapdl_extended.py b/src/ansys/mapdl/core/mapdl_extended.py index 2090ff4c2c9..6389d4af950 100644 --- a/src/ansys/mapdl/core/mapdl_extended.py +++ b/src/ansys/mapdl/core/mapdl_extended.py @@ -86,7 +86,20 @@ def file(self, fname: str = "", ext: str = "", **kwargs) -> str: @wraps(_MapdlCore.lsread) def lsread(self, *args, **kwargs): - """Wraps the ``LSREAD`` which does not work in interactive mode.""" + """Wraps the ``LSREAD`` which does not work in interactive mode. + + Parameters + ---------- + *args : tuple + Positional arguments to pass to the LSREAD command. + **kwargs : dict + Keyword arguments to pass to the LSREAD command. + + Returns + ------- + str + Command output from MAPDL. + """ self._log.debug("Forcing 'LSREAD' to run in non-interactive mode.") with self.non_interactive: super().lsread(*args, **kwargs) @@ -94,7 +107,20 @@ def lsread(self, *args, **kwargs): @wraps(_MapdlCore.use) def use(self, *args, **kwargs): - """Wrap the use command.""" + """Wrap the use command. + + Parameters + ---------- + *args : tuple + Positional arguments to pass to the USE command. + **kwargs : dict + Keyword arguments to pass to the USE command. + + Returns + ------- + str + Command output from MAPDL. + """ # Because of `name` can be a macro file or a macro block on a macro library # file, we are going to test if the file exists locally first, then remote, # and if not, silently assume that it is a macro in a macro library. @@ -153,7 +179,13 @@ def set( order="", **kwargs, ): - """Wraps SET to return a Command listing""" + """Wraps SET to return a Command listing + + Returns + ------- + CommandListingOutput or str + Command listing output when LIST is specified, otherwise MAPDL command output. + """ output = super().set( lstep, sbstep, fact, kimg, time, angle, nset, order, **kwargs ) @@ -183,6 +215,11 @@ def vsel(self, *args, **kwargs) -> str: """Wraps superclassed VSEL to allow to use a list/tuple/array for vmin. It will raise an error in case vmax or vinc are used too. + + Returns + ------- + str + Command output from MAPDL. """ sel_func = ( super().vsel @@ -200,6 +237,11 @@ def nsel(self, *args, **kwargs) -> str: """Wraps previons NSEL to allow to use a list/tuple/array for vmin. It will raise an error in case vmax or vinc are used too. + + Returns + ------- + str + Command output from MAPDL. """ sel_func = ( super().nsel @@ -217,6 +259,11 @@ def esel(self, *args, **kwargs) -> str: """Wraps previons ESEL to allow to use a list/tuple/array for vmin. It will raise an error in case vmax or vinc are used too. + + Returns + ------- + str + Command output from MAPDL. """ sel_func = ( super().esel @@ -234,6 +281,11 @@ def ksel(self, *args, **kwargs) -> str: """Wraps superclassed KSEL to allow to use a list/tuple/array for vmin. It will raise an error in case vmax or vinc are used too. + + Returns + ------- + str + Command output from MAPDL. """ sel_func = ( super().ksel @@ -251,6 +303,11 @@ def lsel(self, *args, **kwargs) -> str: """Wraps superclassed LSEL to allow to use a list/tuple/array for vmin. It will raise an error in case vmax or vinc are used too. + + Returns + ------- + str + Command output from MAPDL. """ sel_func = ( super().lsel @@ -268,6 +325,11 @@ def asel(self, *args, **kwargs) -> str: """Wraps superclassed ASEL to allow to use a list/tuple/array for vmin. It will raise an error in case vmax or vinc are used too. + + Returns + ------- + str + Command output from MAPDL. """ sel_func = ( super().asel @@ -401,7 +463,13 @@ def mpread(self, fname="", ext="", lib="", **kwargs): @wraps(_MapdlCore.cwd) def cwd(self, *args, **kwargs): - """Wraps cwd.""" + """Wraps cwd. + + Returns + ------- + str + Command output from MAPDL. + """ try: output = super().cwd(*args, mute=False, **kwargs) except MapdlCommandIgnoredError as e: @@ -468,6 +536,11 @@ def kplot( + Returns + ------- + object + Plot display object when using PyVista graphics backend, None otherwise. + Notes ----- This command is valid in any processor. @@ -561,6 +634,11 @@ def lplot( This command is valid in any processor. + Returns + ------- + object + Plot display object when using PyVista graphics backend, None otherwise. + Examples -------- >>> mapdl.lplot(graphics_backend=GraphicsBackend.PYVISTA, cpos='xy', line_width=10) @@ -746,6 +824,10 @@ def aplot( >>> pl.add_text('my text') >>> pl.show() + Returns + ------- + object + Plot display object when using PyVista graphics backend, None otherwise. """ if graphics_backend is None: graphics_backend = self._graphics_backend @@ -942,12 +1024,16 @@ def vplot( more keyword arguments applicable when visualizing with ``graphics_backend=GraphicsBackend.PYVISTA``. + Returns + ------- + object + Plot display object when using PyVista graphics backend, None otherwise. + Examples -------- Plot while displaying area numbers. >>> mapdl.vplot(show_area_numbering=True) - """ if graphics_backend is None: graphics_backend = self._graphics_backend @@ -1125,6 +1211,10 @@ def nplot(self, nnum="", *, graphics_backend=None, **kwargs): ... bc_labels="mechanical", ... ) + Returns + ------- + object + Plot display object when using PyVista graphics backend, None otherwise. """ if graphics_backend is None: graphics_backend = self._graphics_backend @@ -1266,6 +1356,10 @@ def eplot(self, show_node_numbering=False, *, graphics_backend=None, **kwargs): window_size=[1920, 1080], savefig='screenshot.png', off_screen=True) + Returns + ------- + object + Plot display object when using PyVista graphics backend, None otherwise. """ if graphics_backend is None: graphics_backend = self._graphics_backend @@ -1384,7 +1478,13 @@ def cmplot(self, label: str = "", entity: str = "", keyword: str = "", **kwargs) @wraps(_MapdlCore.inquire) def inquire(self, strarray="", func="", arg1="", arg2="", **kwargs): - """Wraps original INQUIRE function""" + """Wraps original INQUIRE function + + Returns + ------- + float or bool or str + The inquired value. Type depends on the inquiry function used. + """ func_options = [ "LOGIN", "DOCU", @@ -2154,127 +2254,253 @@ def cmlist(self, *args, **kwargs): @wraps(_MapdlCore.ndinqr) def ndinqr(self, node, key, **kwargs): - """Wrap the ``ndinqr`` method to take advantage of the gRPC methods.""" + """Wrap the ``ndinqr`` method to take advantage of the gRPC methods. + + Returns + ------- + float + Scalar parameter value. + """ super().ndinqr(node, key, pname=TMP_VAR, mute=True, **kwargs) return self.scalar_param(TMP_VAR) @wraps(_MapdlCore.elmiqr) def elmiqr(self, ielem, key, **kwargs): - """Wrap the ``elmiqr`` method to take advantage of the gRPC methods.""" + """Wrap the ``elmiqr`` method to take advantage of the gRPC methods. + + Returns + ------- + float + Scalar parameter value. + """ super().elmiqr(ielem, key, pname=TMP_VAR, mute=True, **kwargs) return self.scalar_param(TMP_VAR) @wraps(_MapdlCore.kpinqr) def kpinqr(self, knmi, key, **kwargs): - """Wrap the ``kpinqr`` method to take advantage of the gRPC methods.""" + """Wrap the ``kpinqr`` method to take advantage of the gRPC methods. + + Returns + ------- + float + Scalar parameter value. + """ super().kpinqr(knmi, key, pname=TMP_VAR, mute=True, **kwargs) return self.scalar_param(TMP_VAR) @wraps(_MapdlCore.lsinqr) def lsinqr(self, line, key, **kwargs): - """Wrap the ``lsinqr`` method to take advantage of the gRPC methods.""" + """Wrap the ``lsinqr`` method to take advantage of the gRPC methods. + + Returns + ------- + float + Scalar parameter value. + """ super().lsinqr(line, key, pname=TMP_VAR, mute=True, **kwargs) return self.scalar_param(TMP_VAR) @wraps(_MapdlCore.arinqr) def arinqr(self, anmi, key, **kwargs): - """Wrap the ``arinqr`` method to take advantage of the gRPC methods.""" + """Wrap the ``arinqr`` method to take advantage of the gRPC methods. + + Returns + ------- + float + Scalar parameter value. + """ super().arinqr(anmi, key, pname=TMP_VAR, mute=True, **kwargs) return self.scalar_param(TMP_VAR) @wraps(_MapdlCore.vlinqr) def vlinqr(self, vnmi, key, **kwargs): - """Wrap the ``vlinqr`` method to take advantage of the gRPC methods.""" + """Wrap the ``vlinqr`` method to take advantage of the gRPC methods. + + Returns + ------- + float + Scalar parameter value. + """ super().vlinqr(vnmi, key, pname=TMP_VAR, mute=True, **kwargs) return self.scalar_param(TMP_VAR) @wraps(_MapdlCore.rlinqr) def rlinqr(self, nreal, key, **kwargs): - """Wrap the ``rlinqr`` method to take advantage of the gRPC methods.""" + """Wrap the ``rlinqr`` method to take advantage of the gRPC methods. + + Returns + ------- + float + Scalar parameter value. + """ super().rlinqr(nreal, key, pname=TMP_VAR, mute=True, **kwargs) return self.scalar_param(TMP_VAR) @wraps(_MapdlCore.gapiqr) def gapiqr(self, ngap, key, **kwargs): - """Wrap the ``gapiqr`` method to take advantage of the gRPC methods.""" + """Wrap the ``gapiqr`` method to take advantage of the gRPC methods. + + Returns + ------- + float + Scalar parameter value. + """ super().gapiqr(ngap, key, pname=TMP_VAR, mute=True, **kwargs) return self.scalar_param(TMP_VAR) @wraps(_MapdlCore.masiqr) def masiqr(self, node, key, **kwargs): - """Wrap the ``masiqr`` method to take advantage of the gRPC methods.""" + """Wrap the ``masiqr`` method to take advantage of the gRPC methods. + + Returns + ------- + float + Scalar parameter value. + """ super().masiqr(node, key, pname=TMP_VAR, mute=True, **kwargs) return self.scalar_param(TMP_VAR) @wraps(_MapdlCore.ceinqr) def ceinqr(self, nce, key, **kwargs): - """Wrap the ``ceinqr`` method to take advantage of the gRPC methods.""" + """Wrap the ``ceinqr`` method to take advantage of the gRPC methods. + + Returns + ------- + float + Scalar parameter value. + """ super().ceinqr(nce, key, pname=TMP_VAR, mute=True, **kwargs) return self.scalar_param(TMP_VAR) @wraps(_MapdlCore.cpinqr) def cpinqr(self, ncp, key, **kwargs): - """Wrap the ``cpinqr`` method to take advantage of the gRPC methods.""" + """Wrap the ``cpinqr`` method to take advantage of the gRPC methods. + + Returns + ------- + float + Scalar parameter value. + """ super().cpinqr(ncp, key, pname=TMP_VAR, mute=True, **kwargs) return self.scalar_param(TMP_VAR) @wraps(_MapdlCore.csyiqr) def csyiqr(self, ncsy, key, **kwargs): - """Wrap the ``csyiqr`` method to take advantage of the gRPC methods.""" + """Wrap the ``csyiqr`` method to take advantage of the gRPC methods. + + Returns + ------- + float + Scalar parameter value. + """ super().csyiqr(ncsy, key, pname=TMP_VAR, mute=True, **kwargs) return self.scalar_param(TMP_VAR) @wraps(_MapdlCore.etyiqr) def etyiqr(self, itype, key, **kwargs): - """Wrap the ``etyiqr`` method to take advantage of the gRPC methods.""" + """Wrap the ``etyiqr`` method to take advantage of the gRPC methods. + + Returns + ------- + float + Scalar parameter value. + """ super().etyiqr(itype, key, pname=TMP_VAR, mute=True, **kwargs) return self.scalar_param(TMP_VAR) @wraps(_MapdlCore.foriqr) def foriqr(self, node, key, **kwargs): - """Wrap the ``foriqr`` method to take advantage of the gRPC methods.""" + """Wrap the ``foriqr`` method to take advantage of the gRPC methods. + + Returns + ------- + float + Scalar parameter value. + """ super().foriqr(node, key, pname=TMP_VAR, mute=True, **kwargs) return self.scalar_param(TMP_VAR) @wraps(_MapdlCore.sectinqr) def sectinqr(self, nsect, key, **kwargs): - """Wrap the ``sectinqr`` method to take advantage of the gRPC methods.""" + """Wrap the ``sectinqr`` method to take advantage of the gRPC methods. + + Returns + ------- + float + Scalar parameter value. + """ super().sectinqr(nsect, key, pname=TMP_VAR, mute=True, **kwargs) return self.scalar_param(TMP_VAR) @wraps(_MapdlCore.mpinqr) def mpinqr(self, mat, iprop, key, **kwargs): - """Wrap the ``mpinqr`` method to take advantage of the gRPC methods.""" + """Wrap the ``mpinqr`` method to take advantage of the gRPC methods. + + Returns + ------- + float + Scalar parameter value. + """ super().mpinqr(mat, iprop, key, pname=TMP_VAR, mute=True, **kwargs) return self.scalar_param(TMP_VAR) @wraps(_MapdlCore.dget) def dget(self, node, idf, kcmplx, **kwargs): - """Wrap the ``dget`` method to take advantage of the gRPC methods.""" + """Wrap the ``dget`` method to take advantage of the gRPC methods. + + Returns + ------- + float + Scalar parameter value. + """ super().dget(node, idf, kcmplx, pname=TMP_VAR, mute=True, **kwargs) return self.scalar_param(TMP_VAR) @wraps(_MapdlCore.fget) def fget(self, node, idf, kcmplx, **kwargs): - """Wrap the ``fget`` method to take advantage of the gRPC methods.""" + """Wrap the ``fget`` method to take advantage of the gRPC methods. + + Returns + ------- + float + Scalar parameter value. + """ super().fget(node, idf, kcmplx, pname=TMP_VAR, mute=True, **kwargs) return self.scalar_param(TMP_VAR) @wraps(_MapdlCore.erinqr) def erinqr(self, key, **kwargs): - """Wrap the ``erinqr`` method to take advantage of the gRPC methods.""" + """Wrap the ``erinqr`` method to take advantage of the gRPC methods. + + Returns + ------- + float + Scalar parameter value. + """ super().erinqr(key, pname=TMP_VAR, mute=True, **kwargs) return self.scalar_param(TMP_VAR) @wraps(_MapdlCore.wrinqr) def wrinqr(self, key, **kwargs): - """Wrap the ``wrinqr`` method to take advantage of the gRPC methods.""" + """Wrap the ``wrinqr`` method to take advantage of the gRPC methods. + + Returns + ------- + float + Scalar parameter value. + """ super().wrinqr(key, pname=TMP_VAR, mute=True, **kwargs) return self.scalar_param(TMP_VAR) @wraps(_MapdlCore.catiain) def catiain(self, name="", extension="", path="", blank="", **kwargs): - """Wrap the ``catiain`` method to take advantage of the gRPC methods.""" + """Wrap the ``catiain`` method to take advantage of the gRPC methods. + + Returns + ------- + str + Command output from MAPDL. + """ if self.platform == "windows": raise OSError( "The command 'catiain' is not supported on Windows. Use the 'mapdl.cat5in' method instead to import Catia v5 files." @@ -2727,6 +2953,11 @@ def get_array( Please reference your Ansys help manual ``*VGET`` command tables for all the available ``*VGET`` values. + Returns + ------- + numpy.ndarray + Array from MAPDL. + Examples -------- List the current selected node numbers @@ -2744,7 +2975,6 @@ def get_array( array([ 0.01605306, -0.01605306, 0.00178402, -0.01605306, ... -0.00178402, -0.01234851, 0.01234851, -0.01234851]) - """ if self._store_commands: raise MapdlRuntimeError( @@ -3040,7 +3270,6 @@ def modal_analysis( Modal analysis using default parameters for the first 6 modes >>> mapdl.modal_analysis(nmode=6) - """ if nrmkey: if nrmkey.upper() != "OFF": diff --git a/src/ansys/mapdl/core/mapdl_geometry.py b/src/ansys/mapdl/core/mapdl_geometry.py index 59b727a9112..7e866676b97 100644 --- a/src/ansys/mapdl/core/mapdl_geometry.py +++ b/src/ansys/mapdl/core/mapdl_geometry.py @@ -107,7 +107,6 @@ class Geometry: Contains advanced methods to extend geometry building and selection within MAPDL. - """ def __init__(self, mapdl: Mapdl): @@ -230,7 +229,6 @@ def keypoints(self) -> "pv.MultiBlock": print(each_point) [ 0. , 0.01778, -0.00318] ... - """ mb = Multiblock(self.get_keypoints(return_as_list=True)) # Setting names @@ -313,7 +311,6 @@ def get_keypoints( 0.00000000e+00], [ 6.00000000e+00, 1.58750000e-02, -7.62000000e-03, ... - """ if return_as_array or return_ids_in_array: if return_ids_in_array: @@ -412,7 +409,6 @@ def lines(self) -> "pv.MultiBlock": Z Bounds: -3.180e-03, -3.180e-03 N Arrays: 1 ... - """ mb = Multiblock(self._lines) # Setting names @@ -460,7 +456,6 @@ def get_lines( >>> lines = mapdl.geometry.get_lines(return_as_list=True) >>> lines [PolyData (0x1492ee7a...rrays: 1, PolyData (0x1491a404...rrays: 1, PolyData (0x1491068c...rrays: 1, PolyData (0x14910662...rrays: 1, PolyData (0x14910632...rrays: 1, PolyData (0x1492eeb0...rrays: 1, PolyData (0x1492eec8...rrays: 1, PolyData (0x1492eee0...rrays: 1, PolyData (0x1492eef8...rrays: 1, PolyData (0x1492ef10...rrays: 1, PolyData (0x1492ef28...rrays: 1, PolyData (0x1492ef40...rrays: 1, PolyData (0x1492ef58...rrays: 1, PolyData (0x1492ef70...rrays: 1, ...] - """ if return_as_list: return self._lines @@ -529,7 +524,6 @@ def areas(self) -> "pv.MultiBlock": Z Bounds: -3.180e-03, -3.180e-03 N Arrays: 3 ... - """ mb = Multiblock(self.get_areas(return_as_list=True)) # Setting names @@ -592,7 +586,6 @@ def get_areas( Z Bounds: 5.500e-01, 5.500e-01 N Arrays: 4, ... - """ if not isinstance(quality, int) or (quality > 10 or quality < 1): raise ValueError( @@ -642,7 +635,6 @@ def generate_surface( ninc : int, optional Steps to between amin and amax. - """ with self._mapdl.save_selection: orig_anum = self.anum @@ -975,7 +967,6 @@ def keypoint_select( Select all keypoints >>> mapdl.geometry.keypoint_select('ALL') - """ if isinstance(items, str): items = items.upper() @@ -1057,7 +1048,6 @@ def line_select( Select all lines >>> mapdl.geometry.line_select('ALL') - """ if isinstance(items, str): items = items.upper() @@ -1139,7 +1129,6 @@ def area_select( Select all areas >>> mapdl.geometry.area_select('ALL') - """ if isinstance(items, str): items = items.upper() @@ -1222,7 +1211,6 @@ def volumes(self) -> "pv.MultiBlock": Z Bounds: -3.180e-03, 0.000e+00 N Arrays: 3 ... - """ mb = Multiblock(self.get_volumes(return_as_list=True)) # Setting names @@ -1288,7 +1276,6 @@ def get_volumes( Z Bounds: 5.500e-01, 5.500e-01 N Arrays: 4, ... - """ quality = int(quality) if quality > 10: @@ -1374,7 +1361,6 @@ def volume_select( Select all volumes >>> mapdl.geometry.volume_select('ALL') - """ if isinstance(items, str): items = items.upper() @@ -1427,7 +1413,6 @@ def _select_items( * ``'R'``: Reselect a set from the current set. * ``'A'``: Additionally select a set and extend the current set. * ``'U'``: Unselect a set from the current set. - """ if item_type not in FLST_LOOKUP: raise KeyError(f'Invalid ``item_type`` "{item_type}"') @@ -1469,7 +1454,6 @@ def get_elements_per_area(self) -> NDArray[np.int32]: np.ndarray An array with the area id for the first column, and the number of elements per each area on the second column. - """ anum = self.anum.ravel() diff --git a/src/ansys/mapdl/core/mapdl_grpc.py b/src/ansys/mapdl/core/mapdl_grpc.py index 50c8ee0165c..d8d557cfad3 100644 --- a/src/ansys/mapdl/core/mapdl_grpc.py +++ b/src/ansys/mapdl/core/mapdl_grpc.py @@ -19,7 +19,6 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. - """A gRPC specific class and methods for the MAPDL gRPC client""" import fnmatch @@ -135,8 +134,8 @@ } -def get_start_instance(*args, **kwargs) -> bool: - """Wraps get_start_instance to avoid circular imports""" +def get_start_instance(*args, **kwargs) -> bool: # numpydoc ignore=RT01 + """Wraps get_start_instance to avoid circular imports.""" from ansys.mapdl.core.launcher import get_start_instance return get_start_instance(*args, **kwargs) @@ -324,7 +323,6 @@ class MapdlGrpc(MapdlBase): ... ], ... ) >>> mapdl = pymapdl.Mapdl(channel=channel) - """ # Required by `_name` method to be defined before __init__ be @@ -547,8 +545,21 @@ def _create_process_stds_queue(self, process=None): self._stderr_queue, self._stderr_thread = _create_queue_for_std(process.stderr) def _create_channel(self, ip: str, port: int) -> grpc.Channel: - """Create an insecured grpc channel.""" + """Create an insecured grpc channel. + + Parameters + ---------- + ip : str + The IP address of the gRPC server. + port : int + The port number of the gRPC server. + + Returns + ------- + grpc.Channel + The created gRPC channel. + """ # open the channel channel_str = f"{ip}:{port}" self._log.debug("Opening insecure channel at %s", channel_str) @@ -575,6 +586,8 @@ def connectivity_callback(connectivity): def channel_state(self) -> str: """Returns the gRPC channel state. + Notes + ----- The possible values are: - 0 - 'IDLE' @@ -582,6 +595,11 @@ def channel_state(self) -> str: - 2 - 'READY' - 3 - 'TRANSIENT_FAILURE' - 4 - 'SHUTDOWN' + + Returns + ------- + str + The current state of the gRPC channel as a string. """ return self._channel_state.name @@ -594,7 +612,6 @@ def _multi_connect(self, n_attempts=5, timeout=15): Number of connection attempts. timeout : float, optional Total timeout. - """ # This prevents a single failed connection from blocking other attempts connected = False @@ -636,7 +653,7 @@ def _multi_connect(self, n_attempts=5, timeout=15): self._exited = False - def _is_alive_subprocess(self): + def _is_alive_subprocess(self): # numpydoc ignore=RT01 """Returns: * True if the PID is alive. * False if it is not. @@ -647,7 +664,13 @@ def _is_alive_subprocess(self): @property def process_is_alive(self): - """Check if the MAPDL process is alive""" + """Check if the MAPDL process is alive. + + Returns + ------- + bool + True if the MAPDL process is alive, False otherwise. + """ return self._is_alive_subprocess() def _post_mortem_checks(self, process=None): @@ -760,11 +783,17 @@ def _raise_custom_stds_errors(self, errs_message): raise MapdlConnectionError(errs_message) @property - def _channel_str(self): - """Return the target string. + def _channel_str(self) -> str: + """Returns the target string. + Notes + ----- Generally of the form of "ip:port", like "127.0.0.1:50052". + Returns + ------- + str + The target string. """ channel = self._channel while channel is not None: @@ -820,7 +849,6 @@ def mute(self): >>> mapdl.k('', 1, 1, 1, mute=False) 1 - """ return self._mute @@ -833,13 +861,18 @@ def __repr__(self): info = super().__repr__() return info - def _connect(self, timeout=5): + def _connect(self, timeout: int = 5) -> bool: """Establish a gRPC channel to a remote or local MAPDL instance. Parameters ---------- timeout : float - Time in seconds to wait until the connection has been established + Time in seconds to wait until the connection has been established. + + Returns + ------- + bool + True if the connection was established successfully, False otherwise. """ self._state = grpc.channel_ready_future(self._channel) self._stub = mapdl_grpc.MapdlServiceStub(self._channel) @@ -869,9 +902,14 @@ def _connect(self, timeout=5): return True @property - def _server_version(self): + def _server_version(self) -> tuple[int, int, int]: """Return the server version. + Returns + ------- + tuple + The server version as a tuple of (major, minor, patch). + Examples -------- >>> mapdl._server_version @@ -884,9 +922,11 @@ def _server_version(self): self.__server_version = self._get_server_version() return self.__server_version - def _get_server_version(self): + def _get_server_version(self) -> tuple[int, int, int]: """Request version from gRPC server. + Notes + ----- Generally tied to the release version unless on a development release. 2020R2 --> 0.0.0 (or any unknown version) @@ -894,6 +934,10 @@ def _get_server_version(self): 2021R2 --> 0.4.0 2022R1 --> 0.X.X + Returns + ------- + tuple + The server version as a tuple of (major, minor, patch). """ sver = (0, 0, 0) verstr = self._ctrl("VERSION") @@ -985,7 +1029,7 @@ def _mesh(self): return self._mesh_rep def _run(self, cmd: str, verbose: bool = False, mute: Optional[bool] = None) -> str: - """Sens a command and return the response as a string. + """Send a command and return the response as a string. Parameters ---------- @@ -1000,6 +1044,11 @@ def _run(self, cmd: str, verbose: bool = False, mute: Optional[bool] = None) -> is ``None``, in which case the global setting specified by ``mapdl.mute = `` is used, which is ``False`` by default. + Returns + ------- + str + The response from the MAPDL server. + Examples -------- Run a basic command. @@ -1013,7 +1062,6 @@ def _run(self, cmd: str, verbose: bool = False, mute: Optional[bool] = None) -> Run a command and stream its output while it is being run. >>> mapdl.run('/PREP7', verbose=True) - """ if mute is None: mute = self._mute @@ -1041,43 +1089,87 @@ def _run(self, cmd: str, verbose: bool = False, mute: Optional[bool] = None) -> @property def busy(self) -> bool: - """True when MAPDL gRPC server is executing a command.""" + """Check if the MAPDL gRPC server is busy executing a command. + + Returns + ------- + bool + Returns true if the MAPDL gRPC server is busy executing a command. + """ return self._busy @property def exiting(self) -> bool: - """Returns true if the MAPDL instance is exiting.""" + """Check if the MAPDL instance is exiting. + + Returns + ------- + bool + Returns true if the MAPDL instance is exiting.""" return self._exiting @property def port(self) -> int: - """Returns the MAPDL gRPC instance port.""" + """Returns the MAPDL gRPC instance port. + + Returns + ------- + int + Port number of the MAPDL gRPC instance. + """ return self._port @property def ip(self) -> str: - """Return the MAPDL gRPC instance IP.""" + """Return the MAPDL gRPC instance IP. + + Returns + ------- + str + IP address of the MAPDL gRPC instance. + """ return self._ip @property def hostname(self) -> str: - """Return the hostname of the machine MAPDL is running in.""" + """Return the hostname of the machine MAPDL is running in. + + Returns + ------- + str + Hostname of the machine MAPDL is running in + """ return self._hostname @property def jobid(self) -> int: """Returns the job id where the MAPDL is running in. - This is only applicable if MAPDL is running on an HPC cluster.""" + + This is only applicable if MAPDL is running on an HPC cluster. + + Returns + ------- + int + Returns the job id where the MAPDL is running in. + """ return self._jobid @property def mapdl_on_hpc(self) -> bool: - """Returns :class:`True` if the MAPDL instance has been launched using - an scheduler.""" + """Check if MAPDL is running on an HPC cluster. + + Returns + ------- + bool + Returns :class:`True` if the MAPDL instance has been launched using + an scheduler. + """ return self._mapdl_on_hpc @protect_grpc - def _send_command(self, cmd: str, mute: bool = False) -> Optional[str]: + def _send_command( + self, cmd: str, mute: bool = False + ) -> Optional[str]: # numpydoc ignore=RT01 """Send a MAPDL command and return the response as a string""" opt = "" if mute: @@ -1093,7 +1185,7 @@ def _send_command(self, cmd: str, mute: bool = False) -> Optional[str]: return None @protect_grpc - def _send_command_stream(self, cmd, verbose=False) -> str: + def _send_command_stream(self, cmd, verbose=False) -> str: # numpydoc ignore=RT01 """Send a command and expect a streaming response""" request = pb_types.CmdRequest(command=cmd) time_step = self._get_time_step_stream() @@ -1227,7 +1319,6 @@ def _remove_temp_dir_on_exit(self, path=None): This only runs if the current working directory of MAPDL is within the user temporary directory. - """ if self.remove_temp_dir_on_exit and self._local: from pathlib import Path @@ -1254,7 +1345,6 @@ def _exit_mapdl_server(self): This only shuts down the mapdl server process and leaves the other processes orphaned. This is useful for killing a remote process but not a local process. - """ if self._exited: return @@ -1321,7 +1411,6 @@ def _close_process(self, timeout=2): # pragma: no cover This is effectively the only way to completely close down MAPDL locally on linux. Just killing the server with ``_exit_mapdl_server`` leaves orphaned processes making this method ineffective for a local instance of MAPDL. - """ self._log.debug("Closing processes") if self._local: @@ -1343,7 +1432,6 @@ def _cache_pids(self): These PIDs are stored in a "cleanup.sh/bat" file and are the PIDs of the MAPDL process. Killing these kills all dependent MAPDL processes. - """ self._log.debug("Caching PIDs") self._pids = [] @@ -1436,7 +1524,6 @@ def sys(self, cmd: str, **kwargs) -> str: Examples -------- >>> mapdl.sys('ls') - """ # always redirect system output to a temporary file tmp_file = f"__tmp_sys_out_{random_string()}__" @@ -1454,25 +1541,30 @@ def sys(self, cmd: str, **kwargs) -> str: def download_result( self, - path: Optional[Union[str, pathlib.Path]] = None, + path: str | pathlib.Path | None = None, progress_bar: bool = False, - preference: Optional[Literal["rst", "rth"]] = None, + preference: Literal["rst", "rth"] | None = None, ) -> str: """Download remote result files to a local directory Parameters ---------- - path : str, Path, optional - Path where the files are downloaded, by default the current - python path (``os.getcwd()``) + path + Path where the files are downloaded, by default the current + python path (``os.getcwd()``) - progress_bar : bool, optional - Show the progress bar or not, default to False. + progress_bar + Show the progress bar or not, default to False. - preference : str - Preferred type for the result file, which is either ``rst`` or ``rth``. - This parameter is only required when both files are present. The default is ```None``, - in which case ``"rst"`` is used. + preference + Preferred type for the result file, which is either ``rst`` or ``rth``. + This parameter is only required when both files are present. The default is ```None``, + in which case ``"rst"`` is used. + + Returns + ------- + list[str] + List of downloaded files. Examples -------- @@ -1480,7 +1572,6 @@ def download_result( >>> import os >>> mapdl.download_result(os.getcwd()) - """ if path is None: # if not path seems to not work in same cases. path = os.getcwd() @@ -1561,7 +1652,7 @@ def _download(targets: List[str]) -> None: return os.path.join(path, jobname + "0." + preference) @protect_grpc - def _ctrl(self, cmd: str, opt1: str = ""): + def _ctrl(self, cmd: str, opt1: str = ""): # numpydoc ignore=RT01 """Issue control command to the MAPDL server. Available commands: @@ -1590,7 +1681,6 @@ def _ctrl(self, cmd: str, opt1: str = ""): - ``mem-stats`` To be added - """ self._log.debug(f'Issuing CtrlRequest "{cmd}" with option "{opt1}".') request = anskernel.CtrlRequest(ctrl=str(cmd), opt1=str(opt1)) @@ -1614,7 +1704,9 @@ def _ctrl(self, cmd: str, opt1: str = ""): return resp.response @wraps(MapdlBase.cdread) - def cdread(self, option="", fname="", ext="", fnamei="", exti="", **kwargs): + def cdread( + self, option="", fname="", ext="", fnamei="", exti="", **kwargs + ): # numpydoc ignore=RT01 """Wraps CDREAD""" option = option.strip().upper() @@ -1642,7 +1734,7 @@ def cdread(self, option="", fname="", ext="", fnamei="", exti="", **kwargs): self.input(fname, **kwargs) @wraps(MapdlBase.tbft) - def tbft( + def tbft( # numpydoc ignore=RT01 self, oper="", id_="", @@ -1819,7 +1911,6 @@ def input( >>> from ansys.mapdl.core import mapdl_grpc >>> mapdl_grpc.DEFAULT_TIME_STEP_STREAM=100 # in milliseconds - """ # Checking compatibility # Checking the user is not reusing old api: @@ -1994,7 +2085,7 @@ def input( return output - def _get_time_step_stream( + def _get_time_step_stream( # numpydoc ignore=RT01 self, time_step: Optional[Union[int, float]] = None ) -> str: """Return the time step for checking if MAPDL is done writing the @@ -2081,7 +2172,7 @@ def build_rand_tmp(): self._log.warning("Unable to remove temporary file %s", tmp_filename) @protect_grpc - def _get( + def _get( # numpydoc ignore=RT01 self, entity: str = "", entnum: str = "", @@ -2209,20 +2300,20 @@ def download_project( def download( self, - files: Union[str, List[str], Tuple[str, ...]], - target_dir: Optional[str] = None, - extension: Optional[str] = None, - chunk_size: Optional[int] = None, - progress_bar: Optional[bool] = None, + files: str | list[str] | tuple[str, ...], + target_dir: str | None = None, + extension: str | None = None, + chunk_size: int | None = None, + progress_bar: bool | None = None, recursive: bool = False, - ) -> List[str]: + ) -> list[str]: """Download files from the gRPC instance working directory .. warning:: This feature is only available for MAPDL 2021R1 or newer. Parameters ---------- - files : str or List[str] or tuple(str) + files Name of the file on the server. File must be in the same directory as the mapdl instance. A list of string names or tuples of string names can also be used. @@ -2232,23 +2323,28 @@ def download( match file names. For example: `'file*'` to match every file whose name starts with `'file'`. - target_dir : str, optional + target_dir Path where the downloaded files will be located. The default is the current working directory. - extension : str, optional + extension Filename with this extension will be considered. The default is None. - chunk_size : int, optional + chunk_size Chunk size in bytes. Must be less than 4MB. The default is 256 kB. - progress_bar : bool, optional + progress_bar Display a progress bar using ``tqdm`` when ``True``. Helpful for showing download progress. - recursive : bool, optional + recursive Whether to use recursion when using glob pattern. The default is ``False``. + Returns + ------- + list[str] + List of downloaded files. + Notes ----- There are some considerations to keep in mind when using this command: @@ -2278,7 +2374,6 @@ def download( :func:`Mapdl.download_project ` (recommended): >>> mapdl.download_project() - """ if chunk_size is None: chunk_size = DEFAULT_CHUNKSIZE @@ -2315,7 +2410,7 @@ def download( progress_bar=progress_bar, ) - def _download_on_local( + def _download_on_local( # numpydoc ignore=RT01 self, files: Union[str, List[str], Tuple[str, ...]], target_dir: str, @@ -2383,7 +2478,7 @@ def _download_on_local( return return_list_files - def _download_from_remote( + def _download_from_remote( # numpydoc ignore=RT01 self, files: Union[str, List[str], Tuple[str, ...]], target_dir: str, @@ -2592,7 +2687,7 @@ def _get_array( self._vget_lock = False return values - def _screenshot_path(self): + def _screenshot_path(self): # numpydoc ignore=RT01 """Returns the local path of the MAPDL generated screenshot. If necessary, downloads the remotely rendered file. @@ -2614,7 +2709,7 @@ def _screenshot_path(self): return save_name @protect_grpc - def _download_as_raw(self, target_name: str) -> str: + def _download_as_raw(self, target_name: str) -> str: # numpydoc ignore=RT01 """Download a file from the gRPC instance as a binary string without saving it to disk. """ @@ -2624,7 +2719,13 @@ def _download_as_raw(self, target_name: str) -> str: @property def is_alive(self) -> bool: - """True when there is an active connect to the gRPC server""" + """True when there is an active connect to the gRPC server. + + Returns + ------- + bool + True if the MAPDL instance is alive, False otherwise. + """ if self.channel_state not in ["IDLE", "READY", None]: self._log.debug( "MAPDL instance is not alive because the channel is not 'IDLE' o 'READY'." @@ -2671,6 +2772,11 @@ def xpl(self) -> "ansXpl": Iteratively navigate through MAPDL files. + Returns + ------- + :class:`ansXpl ` + An instance of :class:`ansXpl `. + Examples -------- Read the MASS record from the "file.full" file @@ -2696,6 +2802,11 @@ def scalar_param(self, pname: str) -> float: If parameter does not exist, returns ``None``. + Returns + ------- + float or None + The value of the parameter as a float or ``None`` if the + parameter does not exist. """ request = pb_types.ParameterRequest(name=pname, array=False) presponse = self._stub.GetParameter(request) @@ -2729,6 +2840,7 @@ def math(self): Returns ------- :class:`MapdlMath ` + MAPDL Math interface. Examples -------- @@ -2756,10 +2868,13 @@ def math(self): @property def krylov(self): """APDL krylov interface. + For more information, see the :class:`KrylovSolver ` + Returns ------- :class:`Krylov class ` + An instance of :class:`Krylov class ` """ if self._krylov is None: from ansys.mapdl.core.krylov import KrylovSolver @@ -2776,6 +2891,7 @@ def db(self): Returns ------- :class:`MapdlDb ` + MAPDL database interface. Examples -------- @@ -2804,7 +2920,6 @@ def db(self): >>> sel, coord = nodes.coord(22) >>> coord (1.0, 0.5, 0.0, 0.0, 0.0, 0.0) - """ from ansys.mapdl.core.database import MapdlDb @@ -2815,7 +2930,7 @@ def db(self): return self._db @protect_grpc - def _data_info(self, pname): + def _data_info(self, pname): # numpydoc ignore=RT01 """Returns the data type of a parameter APDLMATH vectors only. @@ -2824,7 +2939,7 @@ def _data_info(self, pname): return self._stub.GetDataInfo(request) @protect_grpc - def _vec_data(self, pname): + def _vec_data(self, pname): # numpydoc ignore=RT01 """Downloads vector data from a MAPDL MATH parameter""" dtype = ANSYS_VALUE_TYPE[self._data_info(pname).stype] request = pb_types.ParameterRequest(name=pname) @@ -2832,7 +2947,7 @@ def _vec_data(self, pname): return parse_chunks(chunks, dtype) @protect_grpc - def _mat_data(self, pname, raw=False): + def _mat_data(self, pname, raw=False): # numpydoc ignore=RT01 """Downloads matrix data from a parameter and returns a scipy sparse array""" try: from scipy import sparse @@ -2863,12 +2978,18 @@ def _mat_data(self, pname, raw=False): raise ValueError(f'Invalid matrix type "{mtype}"') @property - def locked(self): - """Instance is in use within a pool.""" + def locked(self) -> bool: + """Instance is in use within a pool. + + Returns + ------- + bool + True if the instance is distributed, False otherwise. + """ return self._locked @locked.setter - def locked(self, new_value): + def locked(self, new_value: bool): self._locked = new_value @supress_logging @@ -2897,7 +3018,13 @@ def __str__(self): @supress_logging @run_as("PREP7") def _generate_iges(self): - """Save IGES geometry representation to disk""" + """Save IGES geometry representation to disk. + + Returns + ------- + str + The filename of the saved IGES representation. + """ basename = "_tmp.iges" if self._local: filename = self.directory / basename @@ -2909,7 +3036,7 @@ def _generate_iges(self): return filename @property - def _distributed_result_file(self): + def _distributed_result_file(self): # numpydoc ignore=RT01 """Path of the distributed result file.""" if not self._distributed: return @@ -2945,14 +3072,26 @@ def _distributed_result_file(self): @property def thermal_result(self): - """The thermal result object.""" + """The thermal result object. + + Returns + ------- + :class:`MapdlResult ` + The thermal result object. + """ self._prioritize_thermal = True result = self.result self._prioritize_thermal = False return result - def list_error_file(self): - """Listing of errors written in JOBNAME.err""" + def list_error_file(self) -> str | None: + """Listing of errors written in JOBNAME.err + + Returns + ------- + str + Contents of the error file or None if not found. + """ files = self.list_files() jobname = self.jobname error_file = None @@ -2974,7 +3113,7 @@ def list_error_file(self): return self._download_as_raw(error_file).decode("latin-1") @wraps(MapdlBase.cmatrix) - def cmatrix( + def cmatrix( # numpydoc ignore=RT01 self, symfac="", condname="", @@ -2998,7 +3137,14 @@ def cmatrix( @MapdlBase.name.getter def name(self) -> str: - """Instance unique identifier.""" + """Instance unique identifier. + + Returns + ------- + str + Unique identifier for the instance. If not set, it will be + generated based on the IP and port of the gRPC server. + """ if not self._name: if self._ip or self._port: self._name = f"GRPC_{self._ip}:{self._port}" @@ -3007,14 +3153,14 @@ def name(self) -> str: return self._name @property - def _distributed(self) -> bool: + def _distributed(self) -> bool: # numpydoc ignore=RT01 """MAPDL is running in distributed mode.""" if self.__distributed is None: self.__distributed = self.parameters.numcpu > 1 return self.__distributed @wraps(MapdlBase.vget) - def vget( + def vget( # numpydoc ignore=RT01 self, par: str = "", ir: MapdlInt = "", @@ -3064,7 +3210,7 @@ def get_variable( return variable @wraps(MapdlBase.nsol) - def nsol( + def nsol( # numpydoc ignore=RT01 self, nvar: MapdlInt = VAR_IR, node: MapdlInt = "", @@ -3087,7 +3233,7 @@ def nsol( return self.vget("_temp", nvar) @wraps(MapdlBase.esol) - def esol( + def esol( # numpydoc ignore=RT01 self, nvar: MapdlInt = VAR_IR, elem: MapdlInt = "", @@ -3110,7 +3256,7 @@ def esol( return self.vget("_temp", nvar) @wraps(MapdlBase.rpsd) - def rpsd( + def rpsd( # numpydoc ignore=RT01 self, ir: str = "", ia: str = "", @@ -3191,7 +3337,6 @@ def get_nsol( For SHELL131 and SHELL132 elements with KEYOPT(3) = 0 or 1, use the labels TBOT, TE2, TE3, . . ., TTOP instead of TEMP. - """ return self.nsol( VAR_IR, diff --git a/src/ansys/mapdl/core/mesh/mesh.py b/src/ansys/mapdl/core/mesh/mesh.py index f143eb139cd..a2edea4c767 100644 --- a/src/ansys/mapdl/core/mesh/mesh.py +++ b/src/ansys/mapdl/core/mesh/mesh.py @@ -108,7 +108,6 @@ def _parse_vtk( Adds additional midside nodes when ``True``. When ``False``, missing ANSYS cells will simply point to the first node. - """ if not mesh._has_nodes or not mesh._has_elements: # warnings.warn('Missing nodes or elements. Unable to parse to vtk') diff --git a/src/ansys/mapdl/core/mesh_grpc.py b/src/ansys/mapdl/core/mesh_grpc.py index e64065343af..cd4d73d1923 100644 --- a/src/ansys/mapdl/core/mesh_grpc.py +++ b/src/ansys/mapdl/core/mesh_grpc.py @@ -19,7 +19,6 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. - """Module to manage downloading and parsing the FEM from the MAPDL gRPC server.""" from functools import wraps import os @@ -343,7 +342,6 @@ def elem(self): - FIELD 8 : element number - FIELD 9 : base element number (applicable to reinforcing elements only) - FIELDS 10 - 30 : The nodes belonging to the element in ANSYS numbering. - """ if self._cached_elements is None: self._cached_elements = np.split(self._elem, self._elem_off[1:-1]) @@ -388,7 +386,6 @@ def ekey(self): Array containing element type numbers in the first column and the element types (like SURF154) in the second column. - """ return self._ekey @@ -667,7 +664,6 @@ def _load_elements_offset(self, chunk_size=None): offset : np.ndarray Array of indices indicating the start of each element. - """ if not chunk_size: chunk_size = self._chunk_size or DEFAULT_CHUNKSIZE @@ -761,7 +757,6 @@ def grid(self): >>> import pyvista >>> pyvista.read('grid.vtk') - """ return self._grid diff --git a/src/ansys/mapdl/core/misc.py b/src/ansys/mapdl/core/misc.py index 77aa291fb89..f25b7636b15 100644 --- a/src/ansys/mapdl/core/misc.py +++ b/src/ansys/mapdl/core/misc.py @@ -91,7 +91,6 @@ def check_valid_routine(routine: ROUTINES) -> bool: ------ ValueError Raised when a routine is invalid. - """ if routine.lower().startswith("/"): routine = routine[1:] @@ -376,7 +375,6 @@ def load_file(mapdl: "Mapdl", fname: str, priority_mapdl_file: bool = None) -> s Check if the file exists locally or in the working directory, if not, it will raise a ``FileNotFound`` exception. If the file is local, it will be uploaded. - """ base_fname = os.path.basename(fname) diff --git a/src/ansys/mapdl/core/parameters.py b/src/ansys/mapdl/core/parameters.py index 5995b48f966..8a67f82d61d 100644 --- a/src/ansys/mapdl/core/parameters.py +++ b/src/ansys/mapdl/core/parameters.py @@ -97,7 +97,6 @@ class Parameters: >>> mapdl.parameters['ARR'] array([1., 2., 3.]) - """ def __init__(self, mapdl: MapdlBase): @@ -142,7 +141,6 @@ def numcpu(self) -> int: -------- >>> mapdl.parameters.numcpu 2 - """ return int(self._mapdl.get_value("ACTIVE", item1="NUMCPU")) @@ -422,7 +420,6 @@ def __contains__(self, key): ------- bool True if the key is in the dictionary, False otherwise. - """ return key.upper() in self._parm.keys() @@ -434,7 +431,6 @@ def __iter__(self): ------- iterator An iterator over the keys in the dictionary. - """ yield from self._parm.keys() @@ -446,7 +442,6 @@ def keys(self): ------- dict_keys A view object that contains the keys in the dictionary. - """ return self._parm.keys() @@ -458,7 +453,6 @@ def values(self): ------- dict_values A view object that contains the values in the dictionary. - """ return self._parm.values() @@ -470,7 +464,6 @@ def copy(self): ------- dict A shallow copy of the dictionary. - """ return self._parm.copy() @@ -482,7 +475,6 @@ def items(self): ------- dict_items A view object that contains the key-value pairs in the dictionary. - """ return self._parm.items() @@ -498,7 +490,6 @@ def _set_parameter(self, name, value): :attr:`ansys.mapdl.core.mapdl_core.MAX_PARAM_CHARS`, beginning with a letter and containing only letters, numbers, and underscores. Examples: ``"ABC" "A3X" "TOP_END"``. - """ if not isinstance(value, (str, int, float, np.integer, np.floating)): raise TypeError("``Parameter`` must be either a float, int, or string") @@ -612,7 +603,6 @@ def _set_parameter_array(self, name, arr): >>> parm, mapdl_arrays = mapdl.load_parameters() >>> mapdl_arrays['MYARR'] array([10., -1., 8., 4., 10.]) - """ # type checks arr = np.array(arr) diff --git a/src/ansys/mapdl/core/plotting/theme.py b/src/ansys/mapdl/core/plotting/theme.py index 890331a78fe..5a2b85b6f2c 100644 --- a/src/ansys/mapdl/core/plotting/theme.py +++ b/src/ansys/mapdl/core/plotting/theme.py @@ -219,7 +219,6 @@ class MapdlTheme(Theme): # type: ignore Apply this theme to area plotting. >>> mapdl.aplot(theme=theme) - """ def __init__(self) -> None: # type: ignore diff --git a/src/ansys/mapdl/core/pool.py b/src/ansys/mapdl/core/pool.py index 199540b2e69..f57db0d60f6 100755 --- a/src/ansys/mapdl/core/pool.py +++ b/src/ansys/mapdl/core/pool.py @@ -191,7 +191,6 @@ class MapdlPool: >>> pool = MapdlPool(ip=["123.0.0.1", "123.0.0.2", "123.0.0.3", "123.0.0.4"], port=[50052, 50053, 50055, 50060]) Creating Pool: 100%|########| 4/4 [00:01<00:00, 1.23it/s] - """ def __init__( diff --git a/src/ansys/mapdl/core/post.py b/src/ansys/mapdl/core/post.py index 5d6b2f9f0ad..6efb0a0090a 100644 --- a/src/ansys/mapdl/core/post.py +++ b/src/ansys/mapdl/core/post.py @@ -19,7 +19,6 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. - """Post-processing module using MAPDL interface""" import weakref @@ -116,7 +115,6 @@ class PostProcessing: >>> mapdl.mesh.nnum_all array([ 1, 2, 3, ..., 7215, 7216, 7217], dtype=int32) - """ def __init__(self, mapdl): @@ -339,7 +337,6 @@ def nodal_values(self, item, comp="") -> np.ndarray: ----- Please reference your Ansys help manual ``*VGET`` command tables for all the available ``*VGET`` values. - """ # using _ndof_rst instead of get_array because it is wrapped to check the rst. values = self._ndof_rst(item=item, it1num=comp) @@ -479,7 +476,6 @@ def element_values(self, item, comp="", option="AVG") -> np.ndarray: >>> arr = mapdl.post_processing.element_values("EPTH", "EQV", "min") >>> arr array([0., 0., 0., ..., 0., 0., 0.]) - """ tmp_table = "__ETABLE__" self._mapdl.etable(tmp_table, item, comp, option, mute=True) @@ -608,7 +604,6 @@ def plot_element_values( >>> mapdl.post_processing.plot_element_values( ... "CONT", "STAT", scalar_bar_args={"title": "Contact status"} ... ) - """ kwargs.setdefault( "scalar_bar_args", {"title": f"item: {item}\nComponent: {comp}"} @@ -778,7 +773,6 @@ def _nsel(self): -1 for unselected 0 for undefined 1 for selected - """ return self._ndof_rst("NSEL").astype(np.int8) @@ -797,7 +791,6 @@ def selected_nodes(self) -> np.ndarray: >>> mapdl.post_processing.selected_nodes.nonzero()[0] + 1 array([1, 2, 3, 4, 5, 6, 7, 8, 9]) - """ return self._nsel == 1 @@ -808,7 +801,6 @@ def _esel(self): -1 for unselected 0 for undefined 1 for selected - """ return self._edof_rst("ESEL").astype(np.int8) @@ -825,7 +817,6 @@ def selected_elements(self) -> np.ndarray: >>> mapdl.post_processing.selected_elements.nonzero()[0] + 1 array([1, 2, 3, 4, 5, 6, 7, 8, 9]) - """ return self._esel == 1 @@ -842,7 +833,6 @@ def _ndof_rst(self, item, it1num="", item2=""): results. * ``ESOL`` - Use element-based results only. * ``NAR`` - Use nodal-averaged results only. - """ values = self._mapdl.get_array("NODE", item1=item, it1num=it1num, item2=item2) if values.size == 0: # pragma: no cover @@ -879,7 +869,6 @@ def nodal_temperature(self) -> np.ndarray: -------- >>> mapdl.post_processing.temperature array([0., 0., 0., ..., 0., 0., 0.]) - """ return self.nodal_values("TEMP") @@ -983,7 +972,6 @@ def nodal_displacement(self, component="NORM") -> np.ndarray: >>> mapdl.mesh.nnum_all array([ 1, 2, 3, ..., 7215, 7216, 7217], dtype=int32) - """ component = check_comp(component, DISP_TYPE) @@ -1103,7 +1091,6 @@ def nodal_rotation(self, component="ALL") -> np.ndarray: >>> mapdl.mesh.nnum_all array([ 1, 2, 3, ..., 7215, 7216, 7217], dtype=int32) - """ component = check_comp(component, ROT_TYPE) @@ -1217,7 +1204,6 @@ def element_displacement(self, component="ALL", option="AVG") -> np.ndarray: [ 5.41204700e-06, -4.80335719e-05, 7.75819589e-11], [ 3.33649806e-06, -2.96109417e-05, 1.44947535e-10], [ 1.13836132e-06, -1.01038096e-05, 6.95566641e-11]]) - """ check_elem_option(option) component = component.upper() @@ -1297,7 +1283,6 @@ def plot_element_displacement( ... "NORM", ... option="AVG" ... ) - """ if component.upper() == "ALL": raise ValueError( @@ -1370,7 +1355,6 @@ def element_stress(self, component, option="AVG") -> np.ndarray: >>> arr array([-0.29351357, -0.37027832, -0.37340827, ..., 0. , 0. , 0. ]) - """ if not isinstance(component, str): component = str(component) @@ -1437,7 +1421,6 @@ def plot_element_stress( Plot the average element component stress in the X direction. >>> mapdl.post_processing.plot_element_stress("X") - """ component = str(component).upper() stress = self.element_stress(component, option=option) @@ -1494,7 +1477,6 @@ def element_temperature(self, option="AVG") -> np.ndarray: (2080, 3) >>> arr array([20., 20., 20., ..., 20., 20., 20.]) - """ return self.element_values("TEMP", option=option) @@ -1547,7 +1529,6 @@ def plot_element_temperature( Plot the average element temperature. >>> arr = mapdl.post_processing.plot_element_temperature() - """ scalars = self.element_temperature(option) @@ -1575,7 +1556,6 @@ def nodal_pressure(self) -> np.ndarray: -------- >>> mapdl.post_processing.pressure() array([0., 0., 0., ..., 0., 0., 0.]) - """ return self.nodal_values("PRES") @@ -1761,7 +1741,6 @@ def nodal_component_stress(self, component) -> np.ndarray: >>> mapdl.mesh.nnum_all array([ 1, 2, 3, ..., 7215, 7216, 7217], dtype=int32) - """ component = check_comp(component, COMPONENT_STRESS_TYPE) return self.nodal_values("S", component) @@ -1851,7 +1830,6 @@ def nodal_principal_stress(self, component) -> np.ndarray: >>> mapdl.mesh.nnum_all array([ 1, 2, 3, ..., 7215, 7216, 7217], dtype=int32) - """ if isinstance(component, int): component = str(component) @@ -1935,7 +1913,6 @@ def nodal_stress_intensity(self) -> np.ndarray: >>> mapdl.post_processing.nodal_stress_intensity() array([15488.84357602, 16434.95432337, 15683.2334295 , ..., 0. , 0. , 0. ]) - """ return self.nodal_values("S", "INT") @@ -1989,7 +1966,6 @@ def plot_nodal_stress_intensity(self, show_node_numbering=False, **kwargs): >>> mapdl.esel('S', 'TYPE', vmin=1) >>> mapdl.post_processing.plot_nodal_stress_intensity(smooth_shading=True) - """ scalars = self.nodal_stress_intensity() kwargs.setdefault("scalar_bar_args", {"title": "Nodal Stress\nIntensity"}) @@ -2031,7 +2007,6 @@ def nodal_eqv_stress(self) -> np.ndarray: >>> mapdl.post_processing.nodal_eqv_stress() array([15488.84357602, 16434.95432337, 15683.2334295 , ..., 0. , 0. , 0. ]) - """ return self.nodal_values("S", "EQV") @@ -2085,7 +2060,6 @@ def plot_nodal_eqv_stress(self, show_node_numbering=False, **kwargs): >>> mapdl.esel('S', 'TYPE', vmin=1) >>> mapdl.post_processing.plot_nodal_eqv_stress(smooth_shading=True) - """ scalars = self.nodal_eqv_stress() kwargs.setdefault("scalar_bar_args", {"title": "Nodal Equivalent\nStress"}) @@ -2127,7 +2101,6 @@ def nodal_total_component_strain(self, component) -> np.ndarray: >>> mapdl.mesh.nnum_all array([ 1, 2, 3, ..., 7215, 7216, 7217], dtype=int32) - """ component = check_comp(component, COMPONENT_STRESS_TYPE) return self.nodal_values("EPTO", component) @@ -2224,7 +2197,6 @@ def nodal_total_principal_strain(self, component) -> np.ndarray: >>> mapdl.mesh.nnum_all array([ 1, 2, 3, ..., 7215, 7216, 7217], dtype=int32) - """ if isinstance(component, int): component = str(component) @@ -2316,7 +2288,6 @@ def nodal_total_strain_intensity(self) -> np.ndarray: >>> mapdl.post_processing.nodal_total_strain_intensity() array([15488.84357602, 16434.95432337, 15683.2334295 , ..., 0. , 0. , 0. ]) - """ return self.nodal_values("EPEL", "INT") @@ -2372,7 +2343,6 @@ def plot_nodal_total_strain_intensity(self, show_node_numbering=False, **kwargs) >>> mapdl.esel('S', 'TYPE', vmin=1) >>> mapdl.post_processing.plot_nodal_total_strain_intensity() - """ scalars = self.nodal_total_strain_intensity() kwargs.setdefault("scalar_bar_args", {"title": "Total Nodal\nStrain Intensity"}) @@ -2412,7 +2382,6 @@ def nodal_total_eqv_strain(self) -> np.ndarray: >>> mapdl.post_processing.nodal_total_eqv_strain() array([15488.84357602, 16434.95432337, 15683.2334295 , ..., 0. , 0. , 0. ]) - """ return self.nodal_values("EPTO", "EQV") @@ -2466,7 +2435,6 @@ def plot_nodal_total_eqv_strain(self, show_node_numbering=False, **kwargs): >>> mapdl.esel('S', 'TYPE', vmin=1) >>> mapdl.post_processing.plot_nodal_total_eqv_strain(smooth_shading=True) - """ scalars = self.nodal_total_eqv_strain() kwargs.setdefault( @@ -2503,7 +2471,6 @@ def nodal_elastic_component_strain(self, component) -> np.ndarray: >>> mapdl.mesh.nnum_all array([ 1, 2, 3, ..., 7215, 7216, 7217], dtype=int32) - """ component = check_comp(component, COMPONENT_STRESS_TYPE) return self.nodal_values("EPEL", component) @@ -2597,7 +2564,6 @@ def nodal_elastic_principal_strain(self, component) -> np.ndarray: >>> mapdl.mesh.nnum_all array([ 1, 2, 3, ..., 7215, 7216, 7217], dtype=int32) - """ if isinstance(component, int): component = str(component) @@ -2691,7 +2657,6 @@ def nodal_elastic_strain_intensity(self) -> np.ndarray: >>> mapdl.post_processing.nodal_elastic_strain_intensity() array([15488.84357602, 16434.95432337, 15683.2334295 , ..., 0. , 0. , 0. ]) - """ return self.nodal_values("EPEL", "INT") @@ -2745,7 +2710,6 @@ def plot_nodal_elastic_strain_intensity(self, show_node_numbering=False, **kwarg >>> mapdl.esel('S', 'TYPE', vmin=1) >>> mapdl.post_processing.plot_nodal_elastic_strain_intensity() - """ scalars = self.nodal_elastic_strain_intensity() kwargs.setdefault( @@ -2786,7 +2750,6 @@ def nodal_elastic_eqv_strain(self) -> np.ndarray: >>> mapdl.post_processing.nodal_elastic_eqv_strain() array([15488.84357602, 16434.95432337, 15683.2334295 , ..., 0. , 0. , 0. ]) - """ return self.nodal_values("EPEL", "EQV") @@ -2840,7 +2803,6 @@ def plot_nodal_elastic_eqv_strain(self, show_node_numbering=False, **kwargs): >>> mapdl.esel('S', 'TYPE', vmin=1) >>> mapdl.post_processing.plot_nodal_elastic_eqv_strain(smooth_shading=True) - """ scalars = self.nodal_elastic_eqv_strain() kwargs.setdefault( @@ -2882,7 +2844,6 @@ def nodal_plastic_component_strain(self, component) -> np.ndarray: >>> mapdl.mesh.nnum_all array([ 1, 2, 3, ..., 7215, 7216, 7217], dtype=int32) - """ component = check_comp(component, COMPONENT_STRESS_TYPE) return self.nodal_values("EPPL", component) @@ -2970,7 +2931,6 @@ def nodal_plastic_principal_strain(self, component) -> np.ndarray: >>> mapdl.mesh.nnum_all array([ 1, 2, 3, ..., 7215, 7216, 7217], dtype=int32) - """ if isinstance(component, int): component = str(component) @@ -3065,7 +3025,6 @@ def nodal_plastic_strain_intensity(self) -> np.ndarray: >>> mapdl.post_processing.nodal_plastic_strain_intensity() array([15488.84357602, 16434.95432337, 15683.2334295 , ..., 0. , 0. , 0. ]) - """ return self.nodal_values("EPPL", "INT") @@ -3119,7 +3078,6 @@ def plot_nodal_plastic_strain_intensity(self, show_node_numbering=False, **kwarg >>> mapdl.esel('S', 'TYPE', vmin=1) >>> mapdl.post_processing.plot_nodal_plastic_strain_intensity() - """ scalars = self.nodal_plastic_strain_intensity() kwargs.setdefault( @@ -3167,7 +3125,6 @@ def nodal_plastic_eqv_strain(self) -> np.ndarray: >>> mapdl.post_processing.nodal_plastic_eqv_strain() array([15488.84357602, 16434.95432337, 15683.2334295 , ..., 0. , 0. , 0. ]) - """ return self.nodal_values("EPPL", "EQV") @@ -3221,7 +3178,6 @@ def plot_nodal_plastic_eqv_strain(self, show_node_numbering=False, **kwargs): >>> mapdl.esel('S', 'TYPE', vmin=1) >>> mapdl.post_processing.plot_nodal_plastic_eqv_strain(smooth_shading=True) - """ scalars = self.nodal_plastic_eqv_strain() kwargs.setdefault( @@ -3264,7 +3220,6 @@ def nodal_thermal_component_strain(self, component) -> np.ndarray: >>> mapdl.mesh.nnum_all array([ 1, 2, 3, ..., 7215, 7216, 7217], dtype=int32) - """ component = check_comp(component, COMPONENT_STRESS_TYPE) return self.nodal_values("EPTH", component) @@ -3358,7 +3313,6 @@ def nodal_thermal_principal_strain(self, component) -> np.ndarray: >>> mapdl.mesh.nnum_all array([ 1, 2, 3, ..., 7215, 7216, 7217], dtype=int32) - """ if isinstance(component, int): component = str(component) @@ -3453,7 +3407,6 @@ def nodal_thermal_strain_intensity(self) -> np.ndarray: >>> mapdl.post_processing.nodal_thermal_strain_intensity() array([15488.84357602, 16434.95432337, 15683.2334295 , ..., 0. , 0. , 0. ]) - """ return self.nodal_values("EPTH", "INT") @@ -3507,7 +3460,6 @@ def plot_nodal_thermal_strain_intensity(self, show_node_numbering=False, **kwarg >>> mapdl.esel('S', 'TYPE', vmin=1) >>> mapdl.post_processing.plot_nodal_thermal_strain_intensity() - """ scalars = self.nodal_thermal_strain_intensity() kwargs.setdefault( @@ -3555,7 +3507,6 @@ def nodal_thermal_eqv_strain(self) -> np.ndarray: >>> mapdl.post_processing.nodal_thermal_eqv_strain() array([15488.84357602, 16434.95432337, 15683.2334295 , ..., 0. , 0. , 0. ]) - """ return self.nodal_values("EPTH", "EQV") @@ -3609,7 +3560,6 @@ def plot_nodal_thermal_eqv_strain(self, show_node_numbering=False, **kwargs): >>> mapdl.esel('S', 'TYPE', vmin=1) >>> mapdl.post_processing.plot_nodal_thermal_eqv_strain(smooth_shading=True) - """ scalars = self.nodal_thermal_eqv_strain() kwargs.setdefault( @@ -3647,7 +3597,6 @@ def nodal_contact_friction_stress(self) -> np.ndarray: >>> mapdl.post_processing.nodal_contact_friction_stress() array([15488.84357602, 16434.95432337, 15683.2334295 , ..., 0. , 0. , 0. ]) - """ return self.nodal_values("CONT", "SFRIC") @@ -3701,7 +3650,6 @@ def plot_nodal_contact_friction_stress(self, show_node_numbering=False, **kwargs >>> mapdl.esel('S', 'TYPE', vmin=1) >>> mapdl.post_processing.plot_nodal_contact_friction_stress(smooth_shading=True) - """ kwargs.setdefault( "scalar_bar_args", {"title": "Nodal Contact\nFriction Stress"} diff --git a/src/ansys/mapdl/core/report.py b/src/ansys/mapdl/core/report.py index 0cc3a6d3dcf..48230f2972e 100644 --- a/src/ansys/mapdl/core/report.py +++ b/src/ansys/mapdl/core/report.py @@ -238,7 +238,6 @@ def __init__( Dictionary containing the Ansys libraries and versions to be reported. (e.g. {"MyLib" : "v1.2", ...}). Defaults to ``None``. Only used for the `pyansys-tools-report` package. - """ # Mandatory packages core = [ diff --git a/src/ansys/mapdl/core/solution.py b/src/ansys/mapdl/core/solution.py index 4b7534827fa..70333cd2a23 100644 --- a/src/ansys/mapdl/core/solution.py +++ b/src/ansys/mapdl/core/solution.py @@ -343,7 +343,6 @@ def pressure_conv(self): Examples -------- >>> mapdl.solution.pressure_conv - """ return self._mapdl.get_value("ACTIVE", 0, "SOLU", "PRCV") @@ -354,7 +353,6 @@ def velocity_conv(self): Examples -------- >>> mapdl.solution.velocity_conv - """ return self._mapdl.get_value("ACTIVE", 0, "SOLU", "VECV") diff --git a/src/ansys/mapdl/core/xpl.py b/src/ansys/mapdl/core/xpl.py index 539fa9d804d..c621a776d94 100644 --- a/src/ansys/mapdl/core/xpl.py +++ b/src/ansys/mapdl/core/xpl.py @@ -19,7 +19,6 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. - """Contains the ansXpl class.""" import json import pathlib @@ -59,7 +58,6 @@ class ansXpl: >>> vec.asarray() array([ 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58, 1], dtype=int32) - """ def __init__(self, mapdl): @@ -100,7 +98,6 @@ def open(self, filename, option=""): =============================================== Opening the file.mode ANSYS File - """ self._filename = filename out = self._mapdl.run(f"*XPL,OPEN,{filename},,{option}") @@ -166,7 +163,6 @@ def list(self, nlev=1): ::FULL::MASS::HEADER Size = 50.801 KB ::FULL::DIAGM Size = 1.910 KB ::FULL::NGPH Size = 336 B - """ response = self._mapdl.run(f"*XPL,LIST,{nlev}") self._check_ignored(response) @@ -268,7 +264,6 @@ def print(self, recname): DOFSBYNOD : Size : 3 1 2 3 - """ return self._mapdl.run(f"*XPL,PRINT,{recname}") @@ -435,7 +430,6 @@ def extract(self, recordname, sets="ALL", asarray=False): 1.08619340e-02, -1.72211102e-02, 2.52199472e-03], [ 2.29726170e-02, 3.54392176e-03, -1.87020162e-03, ..., 1.20642736e-02, 2.58299321e-11, 9.14504940e-04]]) - """ from ansys.math.core.math import AnsMath diff --git a/tests/test_information.py b/tests/test_information.py index d09a67f4206..065e43b27d4 100644 --- a/tests/test_information.py +++ b/tests/test_information.py @@ -67,3 +67,14 @@ def test_info_stitle(mapdl, cleared): info.stitles = None assert all([not each for each in info.stitles]) + + +def test_title(mapdl, cleared): + """Test the title property of the MapdlInfo class.""" + title = "This is a test title" + mapdl.info.title = title + assert mapdl.info.title == title + + stitles = ["Subtitle 1", "Subtitle 2", "Subtitle 3", "Subtitle 4"] + mapdl.info.stitles = stitles + assert mapdl.info.stitles == stitles