78. plugins.isopar
— Isoparametric transformations¶
78.1. Classes defined in module plugins.isopar¶
- class plugins.isopar.Isopar(eltype, coords, oldcoords)[source]¶
A class representing an isoparametric transformation
eltype is one of the keys in Isopar.isodata coords and oldcoords can be either arrays, Coords or Formex instances, but should be of equal shape, and match the number of atoms in the specified transformation type
The following three formulations are equivalent
trf = Isopar(eltype,coords,oldcoords) G = F.isopar(trf) trf = Isopar(eltype,coords,oldcoords) G = trf.transform(F) G = isopar(F,eltype,coords,oldcoords)
78.2. Functions defined in module plugins.isopar¶
- plugins.isopar.exponents(n, layout='lag')[source]¶
Create tuples of polynomial exponents.
Create the exponents of polynomials in 1 to 3 dimensions which can be used to construct interpolation function over lagrangian, triangular or serendipity grids.
- Parameters:
n (tuple of int) – A tuple of 1 to 3 integers, specifying the degree of the polynomials in the x up to z directions. For a lagrangian layout, this is one less than the number of points in each direction.
layout (str) – A string specifying the layout of the grid and the selection of monomials to be used. Should be one of ‘lagrangian’, ‘triangular’, ‘serendipity’ or ‘border’. The string can be abbreviated to its first 3 characters.
- Returns:
int array – An integer array with shape (ndim,npoints), where ndim = len(n) and npoints depends on the layout:
lagrangian: npoints = prod(n). The point layout is a rectangular lagrangian grid form by n[i] points in direction i. As an example, specifying n=(3,2) uses a grid of 3 points in x-direction and 2 points in y-direction.
triangular: requires that all values in n are equal. For ndim=2, the number of points is n*(n+1)//2.
border: this is like the lagrangian grid with all internal points removed. For ndim=2, we have npoints = 2 * sum(n) - 4. For ndim=3 we have npoints = 2 * sum(nx*ny+ny*nz+nz*nx) - 4 * sum(n) + 8. Thus n=(3,3,3) will yield 2*3*3*3 - 4*(3+3+3) + 8 = 26
serendipity: tries to use only the corner and edge nodes, but uses a convex domain of the monomials. This may require some nodes inside the faces or the volume. Currently works up to (4,4) in 2D or (3,3,3) in 3D.
See also
interpoly
Returns the corresponding interpolation polynomial
Examples
Quadratic in x, linear in y:
>>> exponents((2,1)) array([[0, 0], [1, 0], [2, 0], [0, 1], [1, 1], [2, 1]])
Linear in x,y,x:
>>> exponents((1,1,1)) array([[0, 0, 0], [1, 0, 0], [0, 1, 0], [1, 1, 0], [0, 0, 1], [1, 0, 1], [0, 1, 1], [1, 1, 1]])
Quadratic serendipity in x,y:
>>> exponents((2,2), 'ser') array([[0, 0], [1, 0], [2, 0], [0, 1], [1, 1], [2, 1], [0, 2], [1, 2]])
- plugins.isopar.interpoly(n, layout='lag')[source]¶
Create an interpolation polynomial.
This is syntactical sugar for:
Polynomial(exponents(n, layout))
Parameters: see
exponents()
.- Returns:
Polynomial – The
Polynomial
constructed from theexponents()
.