#### Previous topic

32. toolbar — Toolbars for the pyFormex GUI.

#### Next topic

34. cameratools — Camera tools

# 33. calpy_itf — Calpy interface for pyFormex.¶

Currently this is only used to detect the installation of calpy and add the path of the calpy module to sys.path.

Importing this module will automatically check the availabilty of calpy and set the sys.path accordingly.

Classes defined in module calpy_itf

A class to interface with calpy’s Quad class.

We want to use the calpy interpolation facilities without having to set up a full model for calpy processing. This class just sets the necessary data to make the interpolation methods (GP2NOdes, NodalAcc, NodalAvg) work.

Parameters:

• nelems: number of elements
• nplex: plexitude of the elements (supported is 4 to 9)
• gprule: gauss integration rule

Add elements to group and store interpolation matrices

InterpolationMatrix(elnod, xyz, gpx, gpw)

Form interpolation matrix for QUAD/4-9 element

The input gives a node set with either 4, 8 or 9 nodes. The 8 and 9 node versions may contain zeros to suppress higher order nodes. xyz[nnod,2] contains the coordinates of the actually existing nodes! gpx and gpw are the coordinates and weights of the Gauss integration points (gpx has 2 rows) The procedure returns two matrices: hall[3,nnod,ng] holds the values at all gauss points, of the interpolation function and its natural derivatives corresponding with each node. w[ng] holds the 2D weight of the gauss points.

Assemble(s, emat, model)

Assemble all elements of this group

StressGP(v, emat)

Compute stress at GP for all elements of this group

GP2Nodes(data)

Extrapolate a set of data at GP to 9 nodal points

data has shape (ndata,ngp,nelems) result has shape (ndata,nnodel,nelems)

NodalAcc(nodes, endata, nnod=0, nodata=None, nodn=None)

Store element data in nodes and compute averages

If matching nodal arrays nodata and nodn are specified, data are added to it. If not, nnod should be specified. By default, new nodata and nodn arrays are created and zeroed.

NodalAvg(*args)

Return the nodal average from the accumulated data.

BoundaryInterpolationMatrix(elnod, xyz, gpx, gpw, localnodes)

Form interpolation matrix for QUAD/4-9 boundary

The input gives a node set with either 2 or 3 nodes. The 3 node version may contain a zero to suppress the higher order node. xyz[nnod,2] contains the coordinates of the actually existing nodes! gpx, gpw are the (2D)-coordinates and weights of the GPs The procedure returns two matrices: hall[3,nnod,ng] holds the values at all gauss points, of the interpolation function and its natural derivatives corresponding with each node. w[ng] holds the 2D weight of the gauss points.

Functions defined in module calpy_itf

calpy_itf.detect(trypaths=None)

Check if we have calpy and if so, add its path to sys.path.

calpy_itf.check(trypaths=None)