pyCAPS
pyCAPS: A Python Extension Module for CAPS
Loading...
Searching...
No Matches
ProblemGeometry Class Reference

Defines Problem Geometry Object. More...

Inherits object.

Inherited by capsGeometry.

Public Member Functions

 build (self)
 Exlicitly build geometry.
 
 save (self, filename="myGeometry", directory=os.getcwd(), extension=".egads")
 Save the current geometry to a file.
 
 view (self, **kwargs)
 View or take a screen shot of the geometry configuration.
 
 attrList (self, attributeName, **kwargs)
 Retrieve a list of attribute values of a given name ("attributeName") for the bodies in the current geometry.
 
 attrMap (self, getInternal=False, **kwargs)
 Create attribution map (embeded dictionaries) of each body in the current geometry.
 
 createTree (self, filename="myGeometry", **kwargs)
 Create a HTML dendrogram/tree of the current state of the geometry.
 
 bodies (self)
 Get dict of geometric bodies.
 
 lengthUnit (self)
 Get the lenght Unit of geometric bodies.
 
 writeParameters (self, filename)
 Write an OpenCSM Design Parameter file to disk.
 
 readParameters (self, filename)
 Read an OpenCSM Design Parameter file from disk and and overwrites (makes dirty) the current state of the geometry.
 

Detailed Description

Defines Problem Geometry Object.

Parameters
ProblemGeometry.despmtrValueInSequence of ValueIn CSM design parameters
ProblemGeometry.cfgpmtrValueInSequence of ValueIn CSM configuration parameters
ProblemGeometry.conpmtrValueInSequence of ValueIn CSM constant parameters
ProblemGeometry.outpmtrValueOutSequence of ValueOut CSM outputs

Member Function Documentation

◆ attrList()

attrList (   self,
  attributeName,
**  kwargs 
)

Retrieve a list of attribute values of a given name ("attributeName") for the bodies in the current geometry.

Level in which to search the bodies is determined by the attrLevel keyword argument.

Parameters
attributeNameName of attribute to retrieve values for.
**kwargsSee below.
Returns
A list of attribute values.

Valid keywords:

Parameters
bodyIndexSpecific body in which to retrieve attribute information from.
attrLevelLevel to which to search the body(ies). Options:
0 (or "Body") - search just body attributes
1 (or "Face") - search the body and all the faces [default]
2 (or "Edge") - search the body, faces, and all the edges
3 (or "Node") - search the body, faces, edges, and all the nodes

◆ attrMap()

attrMap (   self,
  getInternal = False,
**  kwargs 
)

Create attribution map (embeded dictionaries) of each body in the current geometry.

Dictionary layout:

  • Body 1
    • Body : Body level attributes
    • Faces
      • 1 : Attributes on the first face of the body
      • 2 : Attributes on the second face of the body
      • " : ... - Edges - 1 : Attributes on the first edge of the body - 2 : Attributes on the second edge of the body - " : ...
    • Nodes :
      • 1 : Attributes on the first node of the body
      • 2 : Attributes on the second node of the body
      • " : ... - Body 2 - Body : Body level attributes - Faces - 1 : Attributes on the first face of the body - " : ...
    • ...
  • ...

Dictionary layout (reverseMap = True):

  • Body 1
    • Attribute : Attribute name
      • Value : Value of attribute
        • Body : True if value exist at body level, None if not
        • Faces : Face numbers at which the attribute exist
        • Edges : Edge numbers at which the attribute exist
        • Nodes : Node numbers at which the attribute exist
      • Value : Next value of attribute with the same name
        • Body : True if value exist at body level, None if not
        • " : ... - ... - Atribute : Attribute name - Value : Value of attribute - " : ...
      • ...
  • Body 2
    • Attribute : Attribute name
      • Value : Value of attribute
        • Body : True if value exist at body level, None if not
        • " : ... - ... - ... - ... @param getInternal Get internal attributes (denoted by starting with an underscore, for example "_AttrName") that exist on the geometry (default - False).
          Parameters
          **kwargsSee below.
          Valid keywords:
          Parameters
          reverseMapReverse the attribute map (default - False). See above table for details.
          Returns
          Dictionary containing attribution map

◆ bodies()

bodies (   self)

Get dict of geometric bodies.

Returns
Returns a dictionary of the bodies and the capsLength unit. Keys use the body "_name" attribute or "Body_#".

◆ createTree()

createTree (   self,
  filename = "myGeometry",
**  kwargs 
)

Create a HTML dendrogram/tree of the current state of the geometry.

The HTML file relies on the open-source JavaScript library, D3, to visualize the data. This library is freely available from https://d3js.org/ and is dynamically loaded within the HTML file. If running on a machine without internet access a (miniaturized) copy of the library may be written to a file alongside the generated HTML file by setting the internetAccess keyword to False. If set to True, internet access will be necessary to view the tree.

Parameters
filenameFilename to use when saving the tree (default - "myGeometry"). Note an ".html" is automatically appended to the name (same with ".json" if embedJSON = False).
**kwargsSee below.

Valid keywords:

Parameters
embedJSONEmbed the JSON tree data in the HTML file itself (default - True). If set to False a seperate file is generated for the JSON tree data.
internetAccessIs internet access available (default - True)? If set to True internet access will be necessary to view the tree.
internalGeomAttrShow the internal attributes (denoted by starting with an underscore, for example "_AttrName") that exist on the geometry (default - False).
reverseMapReverse the attribute map (default - False). See attrMap for details.

◆ lengthUnit()

lengthUnit (   self)

Get the lenght Unit of geometric bodies.

Returns
Returns the length unit defined by capsLength attribute.

◆ readParameters()

readParameters (   self,
  filename 
)

Read an OpenCSM Design Parameter file from disk and and overwrites (makes dirty) the current state of the geometry.

Parameters
filenameFilename of the OpenCSM Design Parameter file

◆ save()

save (   self,
  filename = "myGeometry",
  directory = os.getcwd(),
  extension = ".egads" 
)

Save the current geometry to a file.

Parameters
filenameFile name to use when saving geometry file.
directoryDirectory where to save file. Default current working directory.
extensionExtension type for file if filename does not contain an extension.

◆ view()

view (   self,
**  kwargs 
)

View or take a screen shot of the geometry configuration.

The use of this function to save geometry requires the matplotlib module. Important: If both showImage = True and filename is not None, any manual view changes made by the user in the displayed image will be reflected in the saved image.

Parameters
**kwargsSee below.

Valid keywords:

Parameters
viewerTypeWhat viewer should be used (default - "capsViewer"). Options: "capsViewer" or "matplotlib" (options are case insensitive). Important: if $filename is not None, the viewer is changed to matplotlib.
portNumberPort number to start the server listening on (default - 7681).
titleTitle to add to each figure (default - None).
filenameSave image(s) to file specified (default - None). Note filename should not contain '.' other than to indicate file type extension (default type = *.png). 'file' - OK, 'file2.0Test' - BAD, 'file2_0Test.png' - OK, 'file2.0Test.jpg' - BAD.
directoryDirectory path were to save file. If the directory doesn't exist it will be made. (default - current directory).
viewTypeType of view for the image(s). Options: "isometric" (default), "fourview", "top" (or "-zaxis"), "bottom" (or "+zaxis"), "right" (or "+yaxis"), "left" (or "-yaxis"), "front" (or "+xaxis"), "back" (or "-xaxis").
combineBodiesCombine all bodies into a single image (default - False).
ignoreBndBoxIgnore the largest body (default - False).
showImageShow image(s) (default - False).
showAxesShow the xyz axes in the image(s) (default - False).
showTessShow the edges of the tessellation (default - False).
dpiResolution in dots-per-inch for the figure (default - None).
tessParamCustom tessellation paremeters, see EGADS documentation for makeTessBody function. values will be scaled by the norm of the bounding box for the body (default - [0.0250, 0.0010, 15.0]).

◆ writeParameters()

writeParameters (   self,
  filename 
)

Write an OpenCSM Design Parameter file to disk.

Parameters
filenameFilename of the OpenCSM Design Parameter file

The documentation for this class was generated from the following file: