pyCAPS
pyCAPS: A Python Extension Module for CAPS
analysis3.py

Example use case of the pyCAPS._capsAnalysis.getAttributeVal() function

1 # Use: Retrieve attributes from the geometry loaded into an analysis object
2 
3 # Make print statement Python 2-3 agnostic
4 from __future__ import print_function
5 
6 # Import pyCAPS module (Linux and OSx = pyCAPS.so file; Windows = pyCAPS.pyd file)
7 import pyCAPS
8 
9 # Instantiate our CAPS problem "myProblem"
10 myProblem = pyCAPS.capsProblem()
11 
12 # Load a *.csm file "./csmData/cfdMultiBody.csm" into our newly created problem.
13 myGeometry = myProblem.loadCAPS("./csmData/cfdMultiBody.csm")
14 
15 # Load FUN3D aim
16 fun3d = myProblem.loadAIM(aim = "fun3dAIM",
17  altName = "fun3d",
18  analysisDir = "FUN3DAnalysisTest",
19  capsIntent = "CFD")
20 
21 # Retrieve "capsGroup" attributes for geometry loaded into fun3dAIM.
22 # Only search down to the body level
23 attributeList = fun3d.getAttributeVal("capsGroup", attrLevel = "Body")
24 print(attributeList)
25 
26 # Provide a wrong attribute level - issue warning and default to "Face"
27 attributeList = fun3d.getAttributeVal("capsGroup", attrLevel = 5)
28 print(attributeList)
29 
30 # Retrieve "capsGroup" attributes for geometry loaded into fun3dAIM.
31 # Only search down to the node level
32 attributeList = fun3d.getAttributeVal("capsGroup", attrLevel = "Node")
33 print(attributeList)
34 
35 # Close our problem
36 myProblem.closeCAPS()