Skip to content

Conversation

germa89
Copy link
Collaborator

@germa89 germa89 commented Apr 26, 2022

This class provide some MAPDL information in a "dict-like" manner.

It is also the object that is called when you issue "print(mapdl)",
which means it is called by "mapdl.str()".

Notes

You cannot directly modify the values of the keys.

The results are cached for later calls.

Examples

  >>> mapdl.info
  Product:             Ansys Mechanical Enterprise
  MAPDL Version:       21.2
  ansys.mapdl Version: 0.62.dev0

  >>> print(mapdl)
  Product:             Ansys Mechanical Enterprise
  MAPDL Version:       21.2
  ansys.mapdl Version: 0.62.dev0

  >>> mapdl.info['Product']
  'Ansys Mechanical Enterprise'

  >>> info = mapdl.info
  >>> info['MAPDL Version']
  'RELEASE  2021 R2           BUILD 21.2      UPDATE 20210601'

@germa89 germa89 added this to the v0.62.0 milestone Apr 26, 2022
@germa89 germa89 self-assigned this Apr 26, 2022
@codecov
Copy link

codecov bot commented Apr 26, 2022

Codecov Report

Merging #1073 (e4c16cd) into main (be702b5) will increase coverage by 1.12%.
The diff coverage is 96.38%.

@@            Coverage Diff             @@
##             main    #1073      +/-   ##
==========================================
+ Coverage   71.88%   73.01%   +1.12%     
==========================================
  Files          43       43              
  Lines        6147     6381     +234     
==========================================
+ Hits         4419     4659     +240     
+ Misses       1728     1722       -6     

@akaszynski
Copy link
Collaborator

I feel that an attributes or data class would be better here. That allows code inspection via IDEs. We could then move some attributes, like directory, result_filename, to this class. We can also add a simple repr to this class to print out all the information we need.

@germa89
Copy link
Collaborator Author

germa89 commented Apr 27, 2022

Using now class attributes.

There is a lot of work to do with the /STATUS output. For example parsing the units, scratch memory status, etc.

  ***** UNITS *****

 USER UNIT SET SPECIFIED FOR INTERNAL
  LENGTH      =  1.0000     USER UNITS PER METER
  MASS        =  1.0000     USER UNITS PER KILOGRAM
  TIME        =  1.0000     USER UNITS PER SECOND
  TEMPERATURE =  1.0000     USER UNITS PER KELVIN
  TOFFSET     =  0.0000     USER UNITS FROM ABS ZERO
  CHARGE      =  1.0000     USER UNITS PER COULOMB
  FORCE       =  1.0000     USER UNITS PER NEWTON
  HEAT        =  1.0000     USER UNITS PER JOULE
                      ***** SCRATCH MEMORY STATUS *****
 Requested Initial Work Space       =     553648124 Words       2112.000 MB
 Initial Work Space Obtained        =     838860797 Words       3200.000 MB

 ANSYS Scratch Memory Size          =     553648129 Words       2112.000 MB
 ANSYS Scratch Memory Used          =     285484752 Words       1089.038 MB
 Available Scratch Memory           =     268163377 Words       1022.962 MB

 Maximum Scratch Memory Used        =     285484752 Words       1089.038 MB
 Largest Available Contiguous Block =     268160864 Words       1022.953 MB

But I do not have time. If there is interest, I will allocate time.

Copy link
Collaborator

@akaszynski akaszynski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, I agree with the API. Let's add documentation (both docstrings and update the sphinx docs).

@akaszynski
Copy link
Collaborator

But I do not have time. If there is interest, I will allocate time

Honestly, this is begging to a simple dict. We can start with that and automate the API. Better, you can look at the source and auto generate the data"ish" class from that.

Copy link
Collaborator

@akaszynski akaszynski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@akaszynski akaszynski merged commit d123100 into main Apr 28, 2022
@akaszynski akaszynski deleted the feat/mapdl.info branch April 28, 2022 19:39
germa89 added a commit that referenced this pull request May 10, 2022
* Defining 'Information' class

* Implementing 'Information' class

* Adding unit tests

* Improving coverage

* Fixing unit tests.

* Fixing unit tests

* fixing unit tests

* fixing unit tests

* Adding extra field getters

* Adding mapping to /status command, unit tests and documentation.

* Using a pure class instead of a dict.

* removing previous test.

* removing previous test.

* Adding title and stitles method.

Adding code review suggestions

* Adding docs and unit tests

* Adding docs and unit tests

* Fixing unit test.

* Fixing unit tests

* Removing most setters.

* Fixing unit tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants