pyCAPS
pyCAPS: A Python Extension Module for CAPS
Public Member Functions | Public Attributes | List of all members
_capsGeometry Class Reference

Functions to interact with a CAPS geometry object. More...

Public Member Functions

def buildGeometry (self)
 Manually force a build of the geometry. More...
 
def saveGeometry (self, filename="myGeometry", directory=os.getcwd(), extension=".egads")
 Save the current geometry to a file. More...
 
def setGeometryVal (self, varname=None, value=None)
 Sets a GEOMETRYIN variable for the geometry object. More...
 
def getGeometryVal (self, varname=None, kwargs)
 Gets a GEOMETRYIN variable for the geometry object. More...
 
def getGeometryOutVal (self, varname=None, kwargs)
 Gets a GEOMETRYOUT variable for the geometry object. More...
 
def viewGeometry (self, kwargs)
 View or take a screen shot of the geometry configuration. More...
 
def getAttributeVal (self, attributeName, kwargs)
 Retrieve a list of attribute values of a given name ("attributeName") for the bodies in the current geometry. More...
 
def getAttributeMap (self, getInternal=False, kwargs)
 Create attribution map (embeded dictionaries) of each body in the current geometry. More...
 
def createTree (self, filename="myGeometry", kwargs)
 Create a HTML dendrogram/tree of the current state of the geometry. More...
 

Public Attributes

 geomName
 Geometry file loaded into problem. More...
 

Detailed Description

Functions to interact with a CAPS geometry object.

Should be created with capsProblem.loadCAPS (not a standalone class).

Member Function Documentation

◆ buildGeometry()

def buildGeometry (   self)

Manually force a build of the geometry.

The geometry will only be rebuilt if a design parameter (see setGeometryVal) has been changed.

◆ createTree()

def 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 getAttributeMap for details.

◆ getAttributeMap()

def getAttributeMap (   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
        • " : ...
      • ...
    • ...
  • ...
Parameters
getInternalGet internal attributes (denoted by starting with an underscore, for example "_AttrName") that exist on the geometry (default - False).
**kwargsSee below.

Valid keywords:

Parameters
reverseMapReverse the attribute map (default - False). See above table for details.
Returns
Dictionary containing attribution map

◆ getAttributeVal()

def getAttributeVal (   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

◆ getGeometryOutVal()

def getGeometryOutVal (   self,
  varname = None,
  kwargs 
)

Gets a GEOMETRYOUT variable for the geometry object.

Parameters
varnameName of geometry (local) parameter to retrieve from the geometry. If no name is provided a dictionary containing all local variables is returned.
**kwargsSee below.

Valid keywords:

Parameters
namesOnlyReturn only a list of parameter names (no values) if creating a dictionary (default - False).
ignoreAtIgnore @ geometry variables when creating a dictionary (default - True).
Returns
Value of "varname" or dictionary of all values.

◆ getGeometryVal()

def getGeometryVal (   self,
  varname = None,
  kwargs 
)

Gets a GEOMETRYIN variable for the geometry object.

Parameters
varnameName of geometry design parameter to retrieve from the geometry. If no name is provided a dictionary containing all design parameters is returned.
**kwargsSee below.

Valid keywords:

Parameters
namesOnlyReturn only a list of parameter names (no values) if creating a dictionary (default - False).
Returns
Value of "varname" or dictionary of all values.

◆ saveGeometry()

def saveGeometry (   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.

◆ setGeometryVal()

def setGeometryVal (   self,
  varname = None,
  value = None 
)

Sets a GEOMETRYIN variable for the geometry object.

Parameters
varnameName of geometry design parameter to set in the geometry.
valueValue of geometry design parameter. Type casting is automatically done based on value indicated by CAPS.

◆ viewGeometry()

def viewGeometry (   self,
  kwargs 
)

View or take a screen shot of the geometry configuration.

The use of this function 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]).

Member Data Documentation

◆ geomName

geomName

Geometry file loaded into problem.

Note that the directory path has been removed.


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