_cape: Compiled CAPE extension

The _cape module contains methods that were written in C to increase speed and efficiency. The most commonly utilized methods enable Cape, pyCart, etc. to write surface triangulations faster. Because these are simple tasks that may need to be repeated many times, creating a compiled version can save considerable time. However, Python versions of these methods are also included in the main modules.

Extensions for cape module

_cape.CSVFileCountLines()

Read CSV file to count valid data lines

Call:
>>> n = CSVFileCountLines(f)
Inputs:
f: file

Open file interface

Outputs:
n: int

Number of data lines from current position

Versions:
  • 2019-11-27 @ddalle: First version

_cape.CSVFileReadData()

Read data from CSV file

Call:
>>> CSVFileReadData(db, f)
Inputs:
db: cape.attdb.ftypes.csv.CSVFile

CSV data file interface

f: file

Open file interface

Versions:
  • 2019-11-29 @ddalle: First version

_cape.WriteCompID()

Write component ID numbers to Components.pyCart.tri

Call:
>>> _cape.WriteCompID(C)
Inputs:
C: numpy.ndarray (int) (nTri)

Vector of component IDs

Versions:
  • 2014-01-02 @ddalle: First version

_cape.WriteSurf()

Write AFLR3 surface file to Components.pyCart.surf

Call:
>>> cape_WriteSurf(P, blds, bldel, T, CT, BCT, Q, CQ, BCQ)
Inputs:
P: numpy.ndarray (float) (nNode, 3)

Matrix of nodal coordinates

T: numpy.ndarray (int) (nTri, 3)

Matrix of of nodal indices for each triangle

CT: numpy.ndarray (int) (nTri)

Vector of component IDs for each triangle

BCT: numpy.ndarray (int) (nTri)

Vector of AFLR3 boundary condition flags for each triangle

Q: numpy.ndarray (int) (nQuad, 4)

Matrix of of nodal indices for each quadrangle

CQ: numpy.ndarray (int) (nQuad)

Vector of component IDs for each quadrangle

BCQ: numpy.ndarray (int) (nQuad)

Vector of AFLR3 boundary condition flags for each quadrangle

Versions:
  • 2016-04-13 @ddalle: First version

_cape.WriteTri()

Write a Cart3D triangulation to Components.pyCart.tri file

Call:
>>> _cape.WriteTri(P, T)
Inputs:
P: numpy.ndarray (float) (nNode, 3)

Matrix of nodal coordinates

T: numpy.ndarray (int) (nTri, 3)

Matrix of of nodal indices for each triangle

Versions:
  • 2014-01-02 @ddalle: First version

_cape.WriteTriQ()

Write .triq file to Components.pyCart.tri

Call:
>>> _cape.WriteTriQ(P, T, C, Q)
Inputs:
P: numpy.ndarray (float) (nNode, 3)

Matrix of nodal coordinates

T: numpy.ndarray (int) (nTri, 3)

Matrix of of nodal indices for each triangle

C: numpy.ndarray (int) (nTri)

Vector of component IDs

Q: numpy.ndarray (float) (nNode, nq)

Matrix of states at each node

Versions:
  • 2015-09-24 @ddalle: First version

_cape.WriteTriSTL()

Write .stl file to Components.pyCart.stl

Call:
>>> _cape.WriteTriSTL(P, T, N)
Inputs:
P: numpy.ndarray (float) (nNode, 3)

Matrix of nodal coordinates

T: numpy.ndarray (int) (nTri, 3)

Matrix of of nodal indices for each triangle

N: numpy.ndarray (int) (nTri, 3)

Vector of triangle normals

Versions:
  • 2015-11-23 @ddalle: First version

_cape.WriteTri_b4()

Write a single-precision big-endian Fortran-style triangulation file

The file written is Components.pyCart.tri. It is the reverse of whatever the native byte order is. Fortran record markers are included.

Call:
>>> _cape.WriteTri_b4(P, T, C)
Inputs:
P: numpy.ndarray (float) (nNode, 3)

Matrix of nodal coordinates

C: numpy.ndarray (int) (nTri)

Vector of component IDs

T: numpy.ndarray (int) (nTri, 3)

Matrix of of nodal indices for each triangle

Versions:
  • 2016-10-10 @ddalle: First version

_cape.WriteTri_b8()

Write a double-precision big-endian Fortran-style triangulation file

The file written is Components.pyCart.tri. It is the reverse of whatever the native byte order is. Fortran record markers are included.

Call:
>>> _cape.WriteTri_b8(P, T, C)
Inputs:
P: numpy.ndarray (float) (nNode, 3)

Matrix of nodal coordinates

C: numpy.ndarray (int) (nTri)

Vector of component IDs

T: numpy.ndarray (int) (nTri, 3)

Matrix of of nodal indices for each triangle

Versions:
  • 2016-10-10 @ddalle: First version

_cape.WriteTri_lb4()

Write a single-precision little-endian Fortran-style triangulation file

The file written is Components.pyCart.tri. It is the reverse of whatever the native byte order is. Fortran record markers are included.

Call:
>>> _cape.WriteTri_lb4(P, T, C)
Inputs:
P: numpy.ndarray (float) (nNode, 3)

Matrix of nodal coordinates

C: numpy.ndarray (int) (nTri)

Vector of component IDs

T: numpy.ndarray (int) (nTri, 3)

Matrix of of nodal indices for each triangle

Versions:
  • 2016-10-10 @ddalle: First version

_cape.WriteTri_lb8()

Write a double-precision little-endian Fortran-style triangulation file

The file written is Components.pyCart.tri. It is the reverse of whatever the native byte order is. Fortran record markers are included.

Call:
>>> _cape.WriteTri_lb8(P, T, C)
Inputs:
P: numpy.ndarray (float) (nNode, 3)

Matrix of nodal coordinates

C: numpy.ndarray (int) (nTri)

Vector of component IDs

T: numpy.ndarray (int) (nTri, 3)

Matrix of of nodal indices for each triangle

Versions:
  • 2016-10-10 @ddalle: First version