getfem_python_reference (version 1.3.0)
index
/home/wilk/GetFem/getfem-4.0.0/interface/src/python/getfem_python_reference.py

Getfem-interface classes.
Provides access to the pseudo-objects exported by the python-getfem interface.

 
Modules
       
numpy.add_newdocs
numpy.core.defchararray
numpy.ctypeslib
numpy.lib.scimath
numpy.fft
numpy.linalg
numpy.ma
math
numpy.random
numpy.core.records
sys

 
Classes
       
CvStruct
Eltm
Fem
GeoTrans
Integ
LevelSet
MdBrick
MdState
Mesh
MeshFem
MeshIm
Model
Poly
Precond
Slice
Spmat

 
class CvStruct
    Descriptor for a convex structure.
 
The convex structures are internal structures of getfem++. They do
not contain points positions. These structures are recursive, since
the faces of a convex structures are convex structures.
 
  Methods defined here:
__del__(self)
__init__(self, *args)
__repr__(self)
basic_structure(self)
Get the simplest convex structure.
 
Synopsis: cs = CvStruct.basic_structure()
 
For example, the 'basic structure' of the 6-node triangle, is the canonical
3-noded triangle.
dim(self)
Get the dimension of the convex structure.
face(self, F)
Return the convex structure of the face `F`.
facepts(self, F)
Return the list of point indices for the face `F`.
get(self, *args)
nbpts(self)
Get the number of points of the convex structure.

 
class Eltm
    Descriptor for an elementary matrix type.
 
If you have very particular assembling needs, or if you just want to 
check the content of an elementary matrix, this function might be
useful. But the generic assembly abilities of getfem.asm_* should 
suit most needs.
 
  Methods defined here:
__del__(self)
__init__(self, *args)
Generates a descriptor for an elementary matrix type.
 
Eltm = Eltm(...)
 
Eltm('base', Fem FEM)
  return a descriptor for the integration of shape functions on
  elements, using the Fem `FEM`.
Eltm('grad', Fem FEM)
  return a descriptor for the integration of the gradient of shape
  functions on elements, using the Fem `FEM`.
Eltm('hessian', Fem FEM)
  return a descriptor for the integration of the hessian of shape
  functions on elements, using the Fem `FEM`.
Eltm('normal')
  return a descriptor for the unit normal of convex faces.
Eltm('grad_geotrans')
  return a descriptor to the gradient matrix of the geometric
  transformation.
Eltm('grad_geotrans_inv')
  return a descriptor to the inverse of the gradient matrix of the
  geometric transformation (this is rarely used).
Eltm('product', Eltm A, Eltm B)
  return a descriptor for the integration of the tensorial product
  of elementary matrices `A` and `B`.
 
In order to obtain a numerical value of theses matrices, see MeshIm.eltm().

 
class Fem
    FEM (Finite Element Method) objects.
 
  Methods defined here:
__del__(self)
__init__(self, fem_name)
Build a FEM object from a string description.
 
Fem = Fem(string fem_name)
 
The `fem_name` should contain a description of the finite element method.
Please refer to the getfem++ manual (especially the description of finite
element and integration methods) for a complete reference. Here is a list
of some of them:
 
* FEM_PK(n,k)
  classical Lagrange element Pk on a simplex of dimension `n`.
* FEM_PK_DISCONTINUOUS(N,K[,alpha])
  discontinuous Lagrange element Pk on a simplex of dimension `n`.
* FEM_QK(n,k)
  classical Lagrange element Qk on quadrangles, hexahedrons etc.
* FEM_QK_DISCONTINUOUS(n,k[,alpha])
  discontinuous Lagrange element Qk on quadrangles, hexahedrons etc.
* FEM_Q2_INCOMPLETE
  incomplete 2D Q2 element with 8 dof (serendipity Quad 8 element).
* FEM_PK_PRISM(n,k)
  classical Lagrange element Pk on a prism.
* FEM_PK_PRISM_DISCONTINUOUS(n,k[,alpha])
  classical discontinuous Lagrange element Pk on a prism.
* FEM_PK_WITH_CUBIC_BUBBLE(n,k)
  classical Lagrange element Pk on a simplex with an additional volumic
  bubble function.
* FEM_P1_NONCONFORMING
  non-conforming P1 method on a triangle.
* FEM_P1_BUBBLE_FACE(n)
  P1 method on a simplex with an additional bubble function on face 0.
* FEM_P1_BUBBLE_FACE_LAG
  P1 method on a simplex with an additional lagrange dof on face 0.
* FEM_PK_HIERARCHICAL(n,k)
  PK element with a hierarchical basis.
* FEM_QK_HIERARCHICAL(n,k)
  QK element with a hierarchical basis
* FEM_PK_PRISM_HIERARCHICAL(n,k)
  PK element on a prism with a hierarchical basis.
* FEM_STRUCTURED_COMPOSITE(FEM,k)
  Composite fem on a grid with `k` divisions.
* FEM_PK_HIERARCHICAL_COMPOSITE(n,k,s)
  Pk composite element on a grid with `s` subdivisions and with a
  hierarchical basis.
* FEM_PK_FULL_HIERARCHICAL_COMPOSITE(n,k,s)
  Pk composite element with `s` subdivisions and a hierarchical basis
  on both degree and subdivision.
* FEM_PRODUCT(FEM1,FEM2)
  tensorial product of two polynomial elements.
* FEM_HERMITE(n)
  Hermite element P3 on a simplex of dimension `n = 1, 2, 3`.
* FEM_ARGYRIS
  Argyris element P5 on the triangle.
* FEM_HCT_TRIANGLE
  Hsieh-Clough-Tocher element on the triangle (composite P3
  element which is C^1), should be used with IM_HCT_COMPOSITE()
  integration method.
* FEM_QUADC1_COMPOSITE
  Quadrilateral element, composite P3 element and C^1 (16 dof).
* FEM_REDUCED_QUADC1_COMPOSITE
  Quadrilateral element, composite P3 element and C^1 (12 dof).
* FEM_RT0(n)
  Raviart-Thomas element of order 0 on a simplex of dimension `n`.
* FEM_NEDELEC(n)
  Nedelec edge element of order 0 on a simplex of dimension `n`.
 
Of course, you have to ensure that the selected fem is compatible with
the geometric transformation: a Pk fem has no meaning on a quadrangle.
 
**SPECIAL FEM:**
 
Fem = Fem('interpolated_fem', MeshFem mf, MeshIm mim, [ivec blocked_dof])
  Build a special Fem which is interpolated from another MeshFem.
 
  Using this special finite element, it is possible to interpolate a given
  MeshFem `mf` on another mesh, given the integration method `mim` that will
  be used on this mesh.
 
  Note that this finite element may be quite slow, and eats much memory.
__repr__(self)
__str__(self)
base_value(self, p)
Evaluate all basis functions of the FEM at point `p`.
 
Synopsis: E = Fem.base_value(mat p)
 
`p` is supposed to be in the reference convex!
char(self)
Ouput a (unique) string representation of the Fem.
 
Synopsis: string = Fem.char()
 
This can be used to perform comparisons between two different Fem objects.
dim(self)
Return the dimension (dimension of the reference convex) of the Fem.
estimated_degree(self)
Return an estimation of the polynomial degree of the Fem.
 
Synopsis: d = Fem.estimated_degree()
 
This is an estimation for fem which are not polynomials.
get(self, *args)
grad_base_value(self, p)
Evaluate the gradient of all base functions of the Fem at point `p`.
 
Synopsis: ED = Fem.grad_base_value(mat p)
 
`p` is supposed to be in the reference convex!
hess_base_value(self, p)
Evaluate the Hessian of all base functions of the Fem at point `p`.
 
Synopsis: EH = Fem.hess_base_value(mat p)
 
`p` is supposed to be in the reference convex!.
is_equivalent(self)
Return 0 if the Fem is not equivalent.
 
Synopsis: b = Fem.is_equivalent()
 
Equivalent Fem are evaluated on the reference convex. This is the case of most
classical Fem's.
is_lagrange(self)
Return 0 if the Fem is not of Lagrange type.
is_polynomial(self)
Return 0 if the basis functions are not polynomials.
nbdof(self, cv=None)
Return the number of dof for the Fem.
 
Synopsis: n = Fem.nbdof([, int cv])
 
Some specific Fem (for example 'interpolated_fem') may require a convex number
`cv` to give their result. In most of the case, you can omit this convex
number.
poly_str(self)
Return the polynomial expressions of its basis functions in the reference
convex.
 
Synopsis: Fem.poly_str()
 
The result is expressed as a tuple of strings. Of course this will fail on
non-polynomial Fem's.
pts(self, cv=None)
Get the location of the dof on the reference element.
 
Synopsis: P = Fem.pts([, int cv])
 
Some specific Fem may require a convex number `cv` to give their result (for
example 'interpolated_fem'). In most of the case, you can omit this convex
number.
target_dim(self)
Return the dimension of the target space.
 
Synopsis: td = Fem.target_dim()
 
The target space dimension is usually 1, except for vector Fem (none of them
has been implemented in getfem++ for now).

 
class GeoTrans
    General function for building descriptors to geometric transformations.
 
The geometric transformation must be used when you are building
a custom mesh convex by convex (see the add_convex() function of 
getfem.Mesh): it also defines the kind of convex (triangle,
hexahedron, prism, etc..)
 
  Methods defined here:
__del__(self)
__init__(self, *args)
Build a GeoTrans object from a string description.
 
GeoTrans = GeoTrans(string name)
 
The name argument contains the specification of the geometric
transformation as a string, which may be:
 
* GT_PK(n,k)
  Transformation on simplexes, dim `n`, degree `k`.
* GT_QK(n,k)
  Transformation on parallelepipeds, dim `n`, degree `k`.
* GT_PRISM(n,k)
  Transformation on prisms, dim `n`, degree `k`.
* GT_PRODUCT(A,B)
  Tensorial product of two transformations.
* GT_LINEAR_PRODUCT(A,B)
  Linear tensorial product of two transformations
__repr__(self)
__str__(self)
char(self)
Output a (unique) string representation of the GeoTrans.
 
Synopsis: s = GeoTrans.char()
 
This can be used to perform comparisons between two different GeoTrans
objects.
dim(self)
Get the dimension of the GeoTrans.
 
Synopsis: d = GeoTrans.dim()
 
This is the dimension of the source space, i.e. the dimension of the reference
convex.
get(self, *args)
is_linear(self)
Return 0 if the GeoTrans is not linear.
nbpts(self)
Return the number of points of the GeoTrans.
normals(self)
Get the normals for each face of the reference convex of the GeoTrans.
 
Synopsis: N = GeoTrans.normals()
 
The normals are stored in the columns of the output matrix.
pts(self)
Return the reference convex points of the GeoTrans.
 
Synopsis: P = GeoTrans.pts()
 
The points are stored in the columns of the output matrix.
transform(self, G, Pr)
Apply the GeoTrans to a set of points.
 
Synopsis: Pt = GeoTrans.transform(mat G, mat Pr)
 
`G` is the set of vertices of the real convex, `Pr` is the set of points (in
the reference convex) that are to be transformed. The corresponding set of
points in the real convex is returned.

 
class Integ
    Integration Method Objects.
 
General object for obtaining handles to various integrations
methods on convexes (used when the elementary matrices are built).
 
  Methods defined here:
__del__(self)
__init__(self, *args)
Return a FEM Integration Method from a string description.
 
Integ = Integ(string method)
 
Here is a list of some integration methods defined in getfem++
(see the description of finite element and integration methods
for a complete reference):
 
* IM_EXACT_SIMPLEX(n)
  Exact integration on simplices (works only with linear geometric
  transformations and PK Fem's).
* IM_PRODUCT(A,B)
  Product of two integration methods.
* IM_EXACT_PARALLELEPIPED(n)
  Exact integration on parallelepipeds.
* IM_EXACT_PRISM(n)
  Exact integration on prisms.
* IM_GAUSS1D(k)
  Gauss method on the segment, order `k=1,3,...99`.
* IM_NC(n,k)
  Newton-Cotes approximative integration on simplexes, order `k`.
* IM_NC_PARALLELEPIPED(n,k)
  Product of Newton-Cotes integration on parallelepipeds.
* IM_NC_PRISM(n,k)
  Product of Newton-Cotes integration on prisms.
* IM_GAUSS_PARALLELEPIPED(n,k)
  Product of Gauss1D integration on parallelepipeds.
* IM_TRIANGLE(k)
  Gauss methods on triangles `k=1,3,5,6,7,8,9,10,13,17,19`.
* IM_QUAD(k)
  Gauss methods on quadrilaterons `k=2, 3, 5, .. 17`. Note that
  IM_GAUSS_PARALLELEPIPED should be prefered for QK Fem's.
* IM_TETRAHEDRON(k)
  Gauss methods on tetrahedrons `k=1, 2, 3, 5, 6 or 8`.
* IM_SIMPLEX4D(3)
  Gauss method on a 4-dimensional simplex.
* IM_STRUCTURED_COMPOSITE(im,k)
  Composite method on a grid with `k` divisions.
* IM_HCT_COMPOSITE(im)
  Composite integration suited to the HCT composite finite element.
 
Example:
Integ('IM_PRODUCT(IM_GAUSS1D(5),IM_GAUSS1D(5))')
is the same as:
Integ('IM_GAUSS_PARALLELEPIPED(2,5)')
 
Note that 'exact integration' should be avoided in general, since they
only apply to linear geometric transformations, are quite slow, and
subject to numerical stability problems for high degree Fem's.
__repr__(self)
__str__(self)
char(self)
Ouput a (unique) string representation of the integration method.
 
Synopsis: s = Integ.char()
 
This can be used to comparisons between two different Integ objects.
coeffs(self)
Returns the coefficients associated to each integration point.
 
Synopsis: Cp = Integ.coeffs()
 
Only for approximate methods, this has no meaning for exact integration
methods!
dim(self)
Return the dimension of the reference convex of the method.
face_coeffs(self, F)
Returns the coefficients associated to each integration of a face.
 
Synopsis: Cf = Integ.face_coeffs(F)
 
Only for approximate methods, this has no meaning for exact integration
methods!
face_pts(self, F)
Return the list of integration points for a face.
 
Synopsis: Pf = Integ.face_pts(F)
 
Only for approximate methods, this has no meaning for exact integration
methods!
get(self, *args)
is_exact(self)
Return 0 if the integration is an approximate one.
nbpts(self)
Return the total number of integration points.
 
Synopsis: n = Integ.nbpts()
 
Count the points for the volume integration, and points for surface
integration on each face of the reference convex.
 
Only for approximate methods, this has no meaning for exact integration
methods!
pts(self)
Return the list of integration points
 
Synopsis: Pp = Integ.pts()
 
Only for approximate methods, this has no meaning for exact integration
methods!

 
class LevelSet
    Getfem Level-Set Object.
 
getfem++ deals with level-set definied by piecewise polynomial
function on a mesh. It will be defined as the zero of this function.
The level-set is represented by a function defined on a lagrange fem
of a certain degree on a mesh.
 
**IMPORTANT:**
 
All tools listed below needs the package qhull installed on your
system. This package is widely available. It computes convex hull
and delaunay triangulations in arbitrary dimension. Everything
here is considered *work in progress*, it is still subject to
major changes if needed.
 
  Methods defined here:
__del__(self)
__init__(self, *args)
General constructor for LevelSet objects.
 
LevelSet = LevelSet(...)
 
The level-set object is represented by a primary level-set and optionally
a secondary level-set used to represent fractures (if p(x) is the primary
level-set function and s(x) is the secondary level-set, the crack is defined
by p(x)=0 and s(x)<=0: the role of the secondary is stop the crack).
 
LevelSet(Mesh m, int d)
  Create a LevelSet object on a Mesh m represented by a primary function
  defined on a lagrange Fem of degree d.
LevelSet(Mesh m, int d, string poly1)
  Create a LevelSet object on a Mesh m represented by a primary function
  defined by the polynomial expression poly1 on a lagrange Fem of
  degree d.
LevelSet(Mesh m, int d, 'with_secondary' [, string poly2])
  Create a LevelSet object on a Mesh m represented by a primary function
  defined by the polynomial expression poly1 and a secondary function,
  both on a lagrange Fem of degree d.
LevelSet(Mesh m, int d, string poly1, string poly2)
  Create a LevelSet object on a Mesh m represented by a primary function
  defined by the polynomial expression poly1 and a secondary function
  defined by the polynomial expression poly2, both on a lagrange Fem
  of degree d.
degree(self)
Return the degree of lagrange representation.
get(self, *args)
memsize(self)
Return the amount of memory (in bytes) used by the level-set.
mf(self)
Return a reference on the MeshFem object.
set(self, *args)
set_values(self, *args)
Set values of the vector of dof for the level-set functions.
 
Synopsis: LevelSet.set_values({mat v1|string poly1}[, {mat v2|string poly2}])
 
Set the primary function with the vector of dof `v1` (or the polynomial
expression `poly1`) and the secondary function (if any) with the vector of
dof `v2` (or the polynomial expression `poly2`)
simplify(self, eps=0.01)
Simplify dof of level-set optionally with the parameter `eps`.
values(self, nls)
Return the vector of dof for `nls` funtion.
 
Synopsis: V = LevelSet.values(int nls)
 
If `nls` is 0, the method return the vector of dof for the primary level-set
funtion. If `nls` is 1, the method return the vector of dof for the secondary
level-set function (if any).

 
class MdBrick
    Getfem MdBrick Object.
 
A model brick is basically an object which modifies a global tangent
matrix and its associated right hand side. Typical modifications are
insertion of the stiffness matrix for the problem considered (linear
elasticity, laplacian, ...), handling of a set of contraints, Dirichlet
condition, addition of a source term to the right hand side, etc. The
global tangent matrix and its right hand side are stored in a MdState
object.
 
  Methods defined here:
__del__(self)
__init__(self, *args)
General constructor for MdBrick objects.
 
* B = MdBrick('constraint', MdBrick pb, string CTYPE[, int nfem])
  Build a generic constraint brick. It may be useful in some situations,
  such as the Stokes problem where the pressure is defined modulo a constant.
  In such a situation, this brick can be used to add an additional constraint
  on the pressure value.
  `CTYPE` has to be chosen among 'augmented', 'penalized', and 'eliminated'.
  The constraint can be specified with MdBrick.set_constraints(). Note that
  Dirichlet bricks (except the 'generalized Dirichlet' one) are also
  specializations of the 'constraint' brick.
* B = MdBrick('dirichlet', MdBrick pb, int bnum, MeshFem mf_m, string CTYPE[, int nfem])
  Build a Dirichlet condition brick which impose the value of a field along a
  mesh boundary. The `bnum` parameter selects on which mesh region the
  Dirichlet condition is imposed. `CTYPE` has to be chosen among 'augmented',
  'penalized', and 'eliminated'. The `mf_m` may generally be taken as the
  MeshFem of the unknown, but for 'augmented' Dirichlet conditions, you may
  have to respect the Inf-Sup condition and choose an adequate MeshFem.
* B = MdBrick('dirichlet_on_normal_component', MdBrick pb, int bnum, MeshFem mf_m, string CTYPE[, int nfem])
  Build a Dirichlet condition brick which imposes the value of the normal
  component of a vector field.
* B = MdBrick('dirichlet_on_normal_derivative', MdBrick pb, int bnum, MeshFem mf_m, string CTYPE[, int nfem])
  Build a Dirichlet condition brick which imposes the value of the normal
  derivative of the unknown.
* B = MdBrick('generalized_dirichlet', MdBrick pb, int bnum[, int nfem])
  This is the "old" Dirichlet brick of getfem. This brick can be used to
  impose general Dirichlet conditions `h(x)u(x) = r(x)`, however it may have
  some issues with elaborated Fem's (such as Argyris, etc). It should be
  avoided when possible.
* B = MdBrick('source_term', MdBrick pb[, int bnum=-1[, int nfem]])
  Add a boundary or volumic source term ( \int B.v ). If `bnum` is omitted
  (or set to -1) , the brick adds a volumic source term on the whole mesh.
  For `bnum` >= 0, the source term is imposed on the mesh region `bnum`. Use
  MdBrick.set_param('source term',mf,B) to set the source term field. The
  source term is expected as a vector field of size Q (with Q = qdim).
* B = MdBrick('normal_source_term', MdBrick pb, int bnum[, int nfem])
  Add a boundary source term ( \int (Bn).v ). The source term is imposed on
  the mesh region `bnum` (which of course is not allowed to be a volumic
  region, only boundary regions are allowed). Use MdBrick.set_param('source
  term',mf,B) to set the source term field. The source term B is expected as
  tensor field of size QxN (with Q = qdim, N = mesh dim). For example, if you
  consider an elasticity problem, this brick may be used to impose a force on
  the boundary with B as the stress tensor.
* B = MdBrick('normal_derivative_source_term', MdBrick parent, int bnum[, int nfem])
  Add a boundary source term ( \int (\partial_n B).v ). The source term is
  imposed on the mesh region `bnum`. Use MdBrick.set_param('source
  term',mf,B) to set the source term field, which is expected as a vector
  field of size Q (with Q = qdim).
* B = MdBrick('neumann KirchhoffLove source term', MdBrick pb, int bnum[, int nfem])
  Add a boundary source term for neumann Kirchhoff-Love plate problems.
  Should be used with the Kirchhoff-Love flavour of the bilaplacian brick.
* B = MdBrick('qu_term', MdBrick pb[, int bnum[, int nfem]])
  Update the tangent matrix with a \int (Qu).v term. The Q(x) parameter is a
  matrix field of size qdim x qdim. An example of use is for the "iku" part
  of Robin boundary conditions \partial_n u + iku = ...
* B = MdBrick('mass_matrix', MeshIm mim, MeshFem mf_u[, 'real'|'complex'])
  Build a mass-matrix brick.
* B = MdBrick('generic_elliptic', MeshIm mim, MeshFem mfu[, 'scalar'|'matrix'|'tensor'][, 'real'|'complex'])
  Setup a generic elliptic problem. a(x)*grad(U).grad(V)
 
  The brick parameter `a` may be a scalar field, a matrix field, or a tensor
  field (default is scalar).
* B = MdBrick('helmholtz', MeshIm mim, MeshFem mfu[, 'real'|'complex'])
  Setup a Helmholtz problem. The brick has one parameter, 'wave_number'.
* B = MdBrick('isotropic_linearized_elasticity', MeshIm mim, MeshFem mfu)
  Setup a linear elasticity problem. The brick has two scalar parameter,
  'lambda' and 'mu' (the Lame coefficients).
* B = MdBrick('linear_incompressibility_term', MdBrick pb, MeshFem mfp[, int nfem])
  Add an incompressibily constraint (div u = 0).
* B = MdBrick('nonlinear_elasticity', MeshIm mim, MeshFem mfu, string law)
  Setup a nonlinear elasticity (large deformations) problem.
 
  The material `law` can be chosen among:
  - 'SaintVenant Kirchhoff'
  Linearized material law.
  - 'Mooney Rivlin'
  To be used with the nonlinear incompressibily term.
  - 'Ciarlet Geymonat'
* B = MdBrick('nonlinear_elasticity_incompressibility_term', MdBrick pb, MeshFem mfp[, int nfem])
  Add an incompressibily constraint to a large strain elasticity problem.
* B = MdBrick('small_deformations_plasticity', MeshIm mim, MeshFem mfu, scalar THRESHOLD)
  Setup a plasticity problem (with small deformations). The `THRESHOLD`
  parameter is the maximum value of the Von Mises stress before
  'plastification' of the material.
* B = MdBrick('dynamic', MdBrick pb, scalar rho[, int numfem])
  Dynamic brick. This brick is not ready.
* B = MdBrick('bilaplacian', MeshIm mim, MeshFem mfu[, 'Kirchhoff-Love'])
  Setup a bilaplacian problem. If the 'Kirchhoff-Love' option is specified,
  the Kirchhoff-Love plate model is used.
* B = MdBrick('navier_stokes', MeshIm mim, MeshFem mfu, MeshFem mfp)
  Setup a Navier-Stokes problem (this brick is not ready, do not use it).
* B = MdBrick('isotropic_linearized_plate', MeshIm mim, MeshIm mims, MeshFem mfut, MeshFem mfu3, MeshFem mftheta, scalar eps)
  Setup a linear plate model brick. For moderately thick plates, using the
  Reissner-Mindlin model. `eps` is the plate thinkness, the MeshFem `mfut`
  and `mfu3` are used respectively for the membrane displacement and the
  transverse displacement of the plate. The MeshFem `mftheta` is the rotation
  of the normal ("section rotations"). The second integration method `mims`
  can be chosen equal to `mim`, or different if you want to perform sub-
  integration on the transverse shear term (mitc4 projection). This brick
  has two parameters "lambda" and "mu" (the Lame coefficients)
* B = MdBrick('mixed_isotropic_linearized_plate', MeshIm mim, MeshFem mfut, MeshFem mfu3, MeshFem mftheta, scalar eps)
  Setup a mixed linear plate model brick. For thin plates, using Kirchhoff-
  Love model. For a non-mixed version, use the bilaplacian brick.
* B = MdBrick('plate_source_term', MdBrick pb[, int bnum=-1[, int nfem]])
  Add a boundary or a volumic source term to a plate problem. This brick has
  two parameters: "B" is the displacement (ut and u3) source term, "M" is the
  moment source term (i.e. the source term on the rotation of the normal).
* B = MdBrick('plate_simple_support', MdBrick pb, int bnum, string CTYPE[, int nfem])
  Add a "simple support" boundary condition to a plate problem. Homogeneous
  Dirichlet condition on the displacement, free rotation. `CTYPE` specifies
  how the constraint is enforced ('penalized', 'augmented' or 'eliminated').
* B = MdBrick('plate_clamped_support', MdBrick pb, int bnum, string CTYPE[, int nfem])
  Add a "clamped support" boundary condition to a plate problem. Homogeneous
  Dirichlet condition on the displacement and on the rotation. `CTYPE`
  specifies how the constraint is enforced ('penalized', 'augmented' or
  'eliminated').
* B = MdBrick('plate_closing', MdBrick pb[, int nfem])
  Add a free edges condition for the mixed plate model brick. This brick is
  required when the mixed linearized plate brick is used. It must be inserted
  after all other boundary conditions (the reason is that the brick has to
  inspect all other boundary conditions to determine the number of
  disconnected boundary parts which are free edges).
__repr__(self)
__str__(self)
dim(self)
Get the dimension of the main mesh (2 for a 2D mesh, etc).
get(self, *args)
is_coercive(self)
Return true if the problem is coercive.
is_complex(self)
Return true if the problem uses complex numbers.
is_linear(self)
Return true if the problem is linear.
is_symmetric(self)
Return true if the problem is symmetric.
memsize(self)
Return the amount of memory (in bytes) used by the model brick.
mixed_variables(self)
Identify the indices of mixed variables (typically the pressure, etc.) in the
tangent matrix.
nb_constraints(self)
Get the total number of dof constraints of the current problem.
 
Synopsis: n = MdBrick.nb_constraints()
 
This is the sum of the brick specific dof constraints plus the dof constraints
of the parent bricks.
nbdof(self)
Get the total number of dof of the current problem.
 
Synopsis: n = MdBrick.nbdof()
 
This is the sum of the brick specific dof plus the dof of the parent bricks.
param(self, parameter_name)
Get the parameter value.
 
Synopsis: MdBrick.param(string parameter_name)
 
When the parameter has been assigned a specific MeshFem, it is returned as a
large array (the last dimension being the MeshFem dof). When no MeshFem has
been assigned, the parameter is considered to be constant over the mesh.
param_list(self)
Get the list of parameters names.
 
Synopsis: MdBrick.param_list()
 
Each brick embeds a number of parameters (the Lame coefficients for the
linearized elasticity brick, the wave number for the Helmholtz brick,...),
described as a (scalar, or vector, tensor etc) field on a mesh_fem. You can
read/change the parameter values with MdBrick.param() and MdBrick.set_param().
penalization_epsilon(self, eps)
Change the penalization coefficient of a constraint brick.
 
Synopsis: MdBrick.penalization_epsilon(scalar eps)
 
This is only applicable to the bricks which inherit from the constraint brick,
such as the Dirichlet ones. And of course it is not effective when the
constraint is enforced via direct elimination or via Lagrange multipliers. The
default value of `eps` is 1e-9.
set(self, *args)
set_constraints(self, H, R)
Set the constraints imposed by a constraint brick.
 
Synopsis: MdBrick.set_constraints(mat H, vec R)
 
This is only applicable to the bricks which inherit from the constraint brick,
such as the Dirichlet ones. Imposes `H.U=R`.
set_constraints_rhs(self, H, R)
Set the right hand side of the constraints imposed by a constraint brick.
 
Synopsis: MdBrick.set_constraints_rhs(mat H, vec R)
 
This is only applicable to the bricks which inherit from the constraint brick,
such as the Dirichlet ones.
set_param(self, name, *args)
Change the value of a brick parameter.
 
Synopsis: MdBrick.set_param(string name,{MeshFem mf,V | V})
 
`name` is the name of the parameter. `V` should contain the new parameter
value (vector or float). If a MeshFem is given, `V` should hold the field
values over that MeshFem (i.e. its last dimension should be MeshFem.nbdof() or
1 for constant field).
solve(self, mds, *args)
Run the standard getfem solver.
 
Synopsis: MdBrick.solve(MdState mds[,...])
 
Note that you should be able to use your own solver if you want (it is
possible to obtain the tangent matrix and its right hand side with the
MdState.tangent_matrix() etc.).
 
Various options can be specified:
 
- 'noisy' or 'very noisy'
  the solver will display some information showing the progress
  (residual values etc.).
- 'max_iter', NIT
  set the maximum iterations numbers.
- 'max_res', RES
  set the target residual value.
- 'lsolver', SOLVERNAME
  select explicitely the solver used for the linear systems (the
  default value is 'auto', which lets getfem choose itself).
  Possible values are 'superlu', 'mumps' (if supported),
  'cg/ildlt', 'gmres/ilu' and 'gmres/ilut'.
subclass(self)
Get the typename of the brick.
tresca(self, mds, mft)
Compute the Tresca stress criterion on the MeshFem `mft`.
 
Synopsis: T = MdBrick.tresca(MdState mds, MeshFem mft)
 
Only available on bricks where it has a meaning: linearized elasticity,
plasticity, nonlinear elasticity.
von_mises(self, mds, mfvm)
Compute the Von Mises stress on the MeshFem `mfvm`.
 
Synopsis: VM = MdBrick.von_mises(MdState mds, MeshFem mfvm)
 
Only available on bricks where it has a meaning: linearized elasticity,
plasticity, nonlinear elasticity. Note that in 2D it is not the "real" Von
Mises (which should take into account the 'plane stress' or 'plane strain'
aspect), but a pure 2D Von Mises.

 
class MdState
    Getfem MdState Object.
 
A model state is an object which store the state data for a chain of
model bricks. This includes the global tangent matrix, the right hand
side and the constraints.
 
  Methods defined here:
__del__(self)
__init__(self, *args)
General constructor for MdState objects.
There are two sorts of model states, the 'real' and the 'complex'
model states.
 
* MDS = MdState(MdBrick B)
  Build a modelstate for the brick `B`. Selects the real or complex state
  from the complexity of `B`.
* MDS = MdState('real')
  Build a model state for real unknowns.
* MDS = MdState('complex')
  Build a model state for complex unknowns.
__repr__(self)
__str__(self)
clear(self)
Clear the model state.
compute_reduced_residual(self)
Compute the reduced residual from the residual and constraints.
compute_reduced_system(self)
Compute the reduced system from the tangent matrix and constraints.
compute_residual(self, B)
Compute the residual for the brick `B`.
compute_tangent_matrix(self, B)
Update the tangent matrix from the brick `B`.
constraints_matrix(self)
Return the constraints matrix stored in the model state.
constraints_nullspace(self)
Return the nullspace of the constraints matrix.
get(self, *args)
is_complex(self)
Return 0 is the model state is real, 1 if it is complex.
memsize(self)
Return the amount of memory (in bytes) used by the model state.
reduced_residual(self)
Return the residual on the reduced system.
reduced_tangent_matrix(self)
Return the reduced tangent matrix (i.e. the tangent matrix after elimination
of the constraints).
residual(self)
Return the residual.
set(self, *args)
set_state(self, U)
Update the internal state with the vector `U`.
state(self)
Return the vector of unknowns, which contains the solution after
MdBrick.solve().
tangent_matrix(self)
Return the tangent matrix stored in the model state.
unreduce(self, U)
Reinsert the constraint eliminated from the system.

 
class Mesh
    Getfem Mesh Object.
 
Thos object is able to store any element in any dimension even 
if you mix elements with different dimensions.
 
  Methods defined here:
__del__(self)
__init__(self, *args)
General constructor for Mesh objects.
 
* M = Mesh('empty', int dim)
  Create a new empty mesh.
* M = Mesh('cartesian', vec X[, vec Y[, vec Z,..]])
  Build quickly a regular mesh of quadrangles, cubes, etc.
* M = Mesh('triangles_grid', vec X, vec Y)
  Build quickly a regular mesh of triangles. This is a very limited and
  somehow deprecated function (See also ``Mesh('ptND')``,
  ``Mesh('regular_simplices')`` and ``Mesh('cartesian')``).
* M = Mesh('regular_simplices', vec X[, vec Y[, vec Z,...]]['degree', int k]['noised'])
  Mesh a n-dimensionnal parallelepipeded with simplices (triangles,
  tetrahedrons etc) . The optional degree may be used to build meshes with
  non linear geometric transformations.
* M = Mesh('curved', Mesh m0, vec F)
  Build a curved (n+1)-dimensions mesh from a n-dimensions mesh `m0`. The
  points of the new mesh have one additional coordinate, given by the vector
  `F`. This can be used to obtain meshes for shells. `m0` may be a MeshFem
  object, in that case its linked mesh will be used.
* M = Mesh('prismatic', Mesh m0, int NLAY)
  Extrude a prismatic Mesh `M` from a Mesh `m0`. In the additional dimension
  there are `NLAY` layers of elements built from ``0`` to ``1``.
* M = Mesh('pt2D', mat P, ivec T[, int n])
  Build a mesh from a 2D triangulation. Each column of `P` contains a point
  coordinate, and each column of `T` contains the point indices of a
  triangle. `n` is optional and is a zone number. If `n` is specified then
  only the zone number `n` is converted (in that case, `T` is expected to
  have 4 rows, the fourth containing these zone numbers).
* M = Mesh('ptND', mat P, imat T)
  Build a mesh from a N-dimensional "triangulation". Similar function to
  'pt2D', for building simplexes meshes from a triangulation given in `T`,
  and a list of points given in `P`. The dimension of the mesh will be the
  number of rows of `P`, and the dimension of the simplexes will be the
  number of rows of `T`.
* M = Mesh('load', string filename)
  Load a mesh from a GETFEM++ ascii mesh file. See also Mesh.save(filename).
* M = Mesh('from_string', string s)
  Load a mesh from a string description.
 
  For example, a string returned by ``Mesh.char()``.
* M = Mesh('import', string format, string filename)
  Import a mesh. `format` may be: - 'gmsh' for a mesh created with `gmsh
  <http://www.geuz.org/gmsh>`_
  - 'gid' for a mesh created with `GiD <http://gid.cimne.upc.es>`_
  - 'am_fmt' for a mesh created with `emc2
  <http://pauillac.inria.fr/cdrom/www/emc2/fra.htm>`_
* M = Mesh('clone', Mesh m2)
  Create a copy of a mesh.
__repr__(self)
__str__(self)
add_convex(self, GT, PTS)
Add a new convex into the mesh.
 
Synopsis: CVIDs = Mesh.add_convex(GeoTrans GT, mat PTS)
 
The convex structure (triangle, prism,...) is given by `GT` (obtained with
GeoTrans('...')), and its points are given by the columns of `PTS`. On return,
`CVIDs` contains the convex #ids. `PTS` might be a 3-dimensional array in
order to insert more than one convex (or a two dimensional array correctly
shaped according to Fortran ordering).
add_point(self, PTS)
Insert new points in the mesh and return their #ids.
 
Synopsis: PIDs = Mesh.add_point(mat PTS)
 
`PTS` should be an ``nxm`` matrix , where ``n`` is the mesh dimension, and
``m`` is the number of points that will be added to the mesh. On output,
`PIDs` contains the point #ids of these new points.
 
Remark: if some points are already part of the mesh (with a small tolerance of
approximately ``1e-8``), they won't be inserted again, and `PIDs` will contain
the previously assigned #ids of these points.
char(self)
Output a string description of the mesh.
convex_area(self, CVIDs=None)
Return an estimation of the area of each convex.
curved_edges(self, N, CVLST=None)
[OBSOLETE FUNCTION! will be removed in a future release]
 
Synopsis: [E,C] = Mesh.curved_edges(int N [, CVLST])
 
More sophisticated version of Mesh.edges() designed for curved elements. This
one will return N (N>=2) points of the (curved) edges. With N==2, this is
equivalent to Mesh.edges(). Since the points are no more always part of the
mesh, their coordinates are returned instead of points number, in the array E
which is a [ mesh_dim x 2 x nb_edges ] array. If the optional output argument
C is specified, it will contain the convex number associated with each edge.
cvid(self)
Return the list of all convex #id.
 
Synopsis: CVid = Mesh.cvid()
 
Note that their numbering is not supposed to be contiguous from 0 to
Mesh.nbcvs()-1, especially if some points have been removed from the mesh. You
can use Mesh.optimize_structure() to enforce a contiguous numbering.
cvid_from_pid(self, PIDs, share=False)
Search convex #ids related with the point #ids given in `PIDs`.
 
Synopsis: CVIDs = Mesh.cvid_from_pid(ivec PIDs[, bool share=False])
 
If `share=False`, search convex whose vertex #ids are in `PIDs`. If
`share=True`, search convex #ids that share the point #ids given in `PIDs`.
`CVIDs` is a vector (possibly empty).
cvstruct(self, CVIDs=None)
Return an array of the convex structures.
 
Synopsis: (S, CV2S) = Mesh.cvstruct([, ivec CVIDs])
 
If `CVIDs` is not given, all convexes are considered. Each convex structure is
listed once in `S`, and `CV2S` maps the convexes indice in `CVIDs` to the
indice of its structure in `S`.
del_convex(self, CVIDs)
Remove one or more convexes from the mesh.
 
Synopsis: Mesh.del_convex(mat CVIDs)
 
`CVIDs` should contain the convexes #ids, such as the ones returned by the
'add convex' command.
del_convex_of_dim(self, DIMs)
Remove all convexes of dimension listed in `DIMs`.
 
Synopsis: Mesh.del_convex_of_dim(ivec DIMs)
 
For example; ``Mesh.del_convex_of_dim( [1,2])`` remove all line segments,
triangles and quadrangles.
del_point(self, PIDs)
Removes one or more points from the mesh.
 
Synopsis: Mesh.del_point(ivec PIDs)
 
`PIDs` should contain the point #ids, such as the one returned by the 'add
point' command.
delete_region(self, RIDs)
Remove the regions whose #ids are listed in `RIDs`
dim(self)
Get the dimension of the mesh (2 for a 2D mesh, etc).
edges(self, CVLST=None, *args)
[OBSOLETE FUNCTION! will be removed in a future release]
 
Synopsis: [E,C] = Mesh.edges([, CVLST][,'merge'])
 
Return the list of edges of mesh M for the convexes listed in the row vector
CVLST. E is a 2 x nb_edges matrix containing point indices. If CVLST is
omitted, then the edges of all convexes are returned. If CVLST has two rows
then the first row is supposed to contain convex numbers, and the second face
numbers, of which the edges will be returned. If 'merge' is indicated, all
common edges of convexes are merged in a single edge. If the optional output
argument C is specified, it will contain the convex number associated with
each edge.
export_to_dx(self, filename, *args)
Exports a mesh to an OpenDX file.
 
Synopsis: Mesh.export_to_dx(string filename, ...
[,'ascii'][,'append'][,'as',string name,[,'serie',string
serie_name]][,'edges'])
 
See also MeshFem.export_to_dx(), Slice.export_to_dx().
export_to_pos(self, filename)
Exports a mesh to a POS file .
 
Synopsis: Mesh.export_to_pos(string filename)
 
See also MeshFem.export_to_pos(), Slice.export_to_pos().
export_to_vtk(self, filename, *args)
Exports a mesh to a VTK file .
 
Synopsis: Mesh.export_to_vtk(string filename, ... [,'ascii'][,'quality'])
 
If 'quality' is specified, an estimation of the quality of each convex will be
written to the file. See also MeshFem.export_to_vtk(), Slice.export_to_vtk().
faces_from_cvid(self, CVIDs=None, *args)
Return a list of convexes faces from a list of convex #id.
 
Synopsis: CVFIDs = Mesh.faces_from_cvid([, ivec CVIDs][, 'merge'])
 
`CVFIDs` is a two-rows matrix, the first row lists convex #ids, and the second
lists face numbers. If `CVIDs` is not given, all convexes are considered. The
optional argument 'merge' merges faces shared by the convex of `CVIDs`.
faces_from_pid(self, PIDs)
Return the convex faces whose vertex #ids are in `PIDs`.
 
Synopsis: CVFIDs = Mesh.faces_from_pid(ivec PIDs)
 
For a convex face to be returned, EACH of its points have to be listed in
`PIDs`. On output, the first row of `CVf` contains the convex number, and the
second row contains the face number (local number in the convex).
geotrans(self, CVIDs=None)
Returns an array of the geometric transformations.
 
Synopsis: (GT, CV2GT) = Mesh.geotrans([, ivec CVIDs])
 
See also Mesh.cvstruct().
get(self, *args)
max_cvid(self)
Return the maximum #id of all convexes in the mesh (see 'max pid').
max_pid(self)
Return the maximum #id of all points in the mesh (see 'max cvid').
memsize(self)
Return the amount of memory (in bytes) used by the mesh.
merge(self, m2)
Merge with the Mesh `m2`.
 
Synopsis: Mesh.merge(Mesh m2)
 
Overlapping points won't be duplicated. If `m2` is a MeshFem object, its
linked mesh will be used.
nbcvs(self)
Get the number of convexes of the mesh.
nbpts(self)
Get the number of points of the mesh.
normal_of_face(self, cv, f, nfpt=None)
Evaluates the normal of convex `cv`, face `f` at the `nfpt` point of the face.
 
Synopsis: N = Mesh.normal_of_face(int cv, int f[, int nfpt])
 
If `nfpt` is not specified, then the normal is evaluated at each geometrical
node of the face.
normal_of_faces(self, CVFIDs)
Evaluates (at face centers) the normals of convexes.
 
Synopsis: N = Mesh.normal_of_faces(imat CVFIDs)
 
`CVFIDs` is supposed to contain convex numbers in its first row and convex
face number in its second row.
optimize_structure(self)
Reset point and convex numbering.
 
Synopsis: Mesh.optimize_structure()
 
After optimisation, the points (resp. convexes) will be consecutively numbered
from ``0`` to ``Mesh.max_pid()-1`` (resp. ``Mesh.max_cvid()-1``).
orphaned_pid(self)
Search point #id which are not linked to a convex.
outer_faces(self, CVIDs=None)
Return the faces which are not shared by two convexes.
 
Synopsis: CVFIDs = Mesh.outer_faces([, CVIDs])
 
If `CVIDs` is not given, it basically returns the mesh boundary. If `CVIDs` is
given, it returns the boundary of the convex set whose #ids are listed in
`CVIDs`.
pid(self)
Return the list of points #id of the mesh.
 
Synopsis: Pid = Mesh.pid()
 
Note that their numbering is not supposed to be contiguous from 0 to
Mesh.nbpts()-1, especially if some points have been removed from the mesh. You
can use Mesh.optimize_structure() to enforce a contiguous numbering.
pid_from_coords(self, PTS, radius=0)
Search point #id whose coordinates are listed in `PTS`.
 
Synopsis: PIDs = Mesh.pid_from_coords(mat PTS[, scalar radius=0])
 
`PTS` is an array containing a list of point coordinates. On return, `PIDs` is
a vector containing points #id for each point found in `eps` range, and -1 for
those which where not found in the mesh.
pid_from_cvid(self, CVIDs=None)
Return the points attached to each convex of the mesh.
 
Synopsis: (Pid, IDx) = Mesh.pid_from_cvid([,imat CVIDs])
 
If `CVIDs` is omitted, all the convexes will be considered (equivalent to
`CVIDs = Mesh.max_cvid()`). `IDx` is a vector, length(IDx) = length(CVIDs)+1.
`Pid` is a vector containing the concatenated list of #id of points of each
convex in `CVIDs`. Each entry of `IDx` is the position of the corresponding
convex point list in `Pid`. Hence, for example, the list of #id of points of
the second convex is Pid[IDx(2):IDx(3)].
 
If `CVIDs` contains convex #id which do not exist in the mesh, their point
list will be empty.
pid_in_cvids(self, CVIDs)
Search point #id listed in `CVIDs`.
 
Synopsis: PIDs = Mesh.pid_in_cvids(imat CVIDs)
 
`PIDs` is a vector containing points #id.
pid_in_faces(self, CVFIDs)
Search point #id listed in `CVFIDs`.
 
Synopsis: PIDs = Mesh.pid_in_faces(imat CVFIDs)
 
`CVFIDs` is a two-rows matrix, the first row lists convex #ids, and the second
lists face numbers. On return, `PIDs` is a vector containing points #id.
pid_in_regions(self, RIDs)
Search point #id listed in `RIDs`.
 
Synopsis: PIDs = Mesh.pid_in_regions(imat RIDs)
 
`PIDs` is a vector containing points #id.
pts(self, PIDs=None)
Return the list of point coordinates of the mesh.
 
Synopsis: P = Mesh.pts([, ivec PIDs])
 
Each column of the returned matrix contains the coordinates of one point. If
the optional argument `PIDs` was given, only the points whose #id is listed in
this vector are returned. Otherwise, the returned matrix will have
Mesh.max_pid() columns, which might be greater than Mesh.nbpts() (if some
points of the mesh have been destroyed and no call to
Mesh.optimize_structure() have been issued). The columns corresponding to
deleted points will be filled with NaN. You can use Mesh.pid() to filter such
invalid points.
quality(self, CVIDs=None)
Return an estimation of the quality of each convex (0 <= Q <= 1).
refine(self, CVIDs=None)
Use a Bank strategy for mesh refinement.
 
Synopsis: Mesh.refine([, ivec CVIDs])
 
If `CVIDs` is not given, the whole mesh is refined. Note that the regions, and
the finite element methods and integration methods of the MeshFem and MeshIm
objects linked to this mesh will be automagically refined.
region(self, RIDs)
Return the list of convexes/faces on the regions `RIDs`.
 
Synopsis: CVFIDs = Mesh.region(ivec RIDs)
 
On output, the first row of `CVFIDs` contains the convex numbers, and the
second row contains the face numbers (and -1 when the whole convex is in the
regions).
region_intersect(self, r1, r2)
Replace the region number `r1` with its intersection with region number `r2`.
region_merge(self, r1, r2)
Merge region number `r2` into region number `r1`.
region_substract(self, r1, r2)
Replace the region number `r1` with its difference with region number `r2`.
regions(self)
Return the list of valid regions stored in the mesh.
save(self, filename)
Save the mesh object to an ascii file.
 
Synopsis: Mesh.save(string filename)
 
This mesh can be restored with Mesh('load', filename).
set(self, *args)
set_pts(self, PTS)
Replace the coordinates of the mesh points with those given in `PTS`.
set_region(self, rnum, CVFIDs)
Assigns the region number `rnum` to the convex faces stored in each column of
the matrix `CVFIDs`. The first row of `CVFIDs` contains a convex #ids, and
the second row contains a face number in the convex (or ``-1`` for the whole
convex (regions are usually used to store a list of convex faces, but you may
also use them to store a list of convexes).
transform(self, T)
Applies the matrix `T` to each point of the mesh.
 
Synopsis: Mesh.transform(mat T)
 
Note that `T` is not required to be a ``NxN`` matrix (with ``N =
Mesh.dim()``). Hence it is possible to transform a 2D mesh into a 3D one (and
reciprocally).
translate(self, V)
Translates each point of the mesh from `V`.
triangulated_surface(self, Nrefine, CVLIST=None)
[OBSOLETE FUNCTION! will be removed in a future release]
 
Synopsis: [mat T] = Mesh.triangulated_surface(int Nrefine [,CVLIST])
 
Similar function to Mesh.curved_edges() : split (if necessary, i.e. if the
geometric transformation if non-linear) each face into sub-triangles and
return their coordinates in T (see also compute_eval on P1 tri mesh(mf, U, ))

 
class MeshFem
     Methods defined here:
__del__(self)
__init__(self, *args)
General constructor for MeshFem objects.
 
MeshFem('load', string fname[, Mesh m])
  Load a MeshFem from a file. If the mesh `m` is not supplied (this kind of
  file does not store the mesh), then it is read from the file `fname` and
  its descriptor is returned as the second output argument.
MeshFem('from_string', string [, mesh M])
  Create a MeshFem object from its string description. See also
  MeshFem.char()
MeshFem('clone', MeshFem mf2)
  Create a copy of a MeshFem.
MeshFem('sum', MeshFem mf1, MeshFem mf2[, MeshFem mf3[, ...]])
  Create a MeshFem that combines two (or more) MeshFem's. All MeshFem must
  share the same mesh (see Fem('interpolated_fem') to map a MeshFem onto
  another). After that, you should not modify the FEM of `mf1`, `mf2` etc.
MeshFem('levelset', MeshFem mf, LevelSet ls)
  Create a MeshFem that is conformal to implicit surfaces defined by
  LevelSet's.
MeshFem('partial', MeshFem mf, ivec DOFs[,ivec RCVs])
  Build a restricted MeshFem by keeping only a subset of the degrees of
  freedom of `mf`. If `RCVs` is given, no FEM will be put on the convexes
  listed in `RCVs`.
MeshFemMesh m[, int Qdim=1])
  Build a new MeshFem object. The `Qdim` parameter is optional.
__repr__(self)
__str__(self)
basic_dof_from_cv(self, CVids)
Return the dof of the convexes listed in `CVids`.
 
Synopsis: DOF = MeshFem.basic_dof_from_cv(mat CVids)
 
WARNING: the Degree of Freedom might be returned in ANY order, do not use this
function in your assembly routines. Use 'basic dof from cvid' instead, if you
want to be able to map a convex number with its associated degrees of freedom.
One can also get the list of basic dof on a set on convex faces, by indicating
on the second row of `CVids` the faces numbers (with respect to the convex
number on the first row).
basic_dof_from_cvid(self, CVids=None)
Return the degrees of freedom attached to each convex of the mesh.
 
Synopsis: (DOFs, IDx) = MeshFem.basic_dof_from_cvid([, mat CVids])
 
If `CVids` is omitted, all the convexes will be considered (equivalent to
`CVids = 1 ... Mesh.max_cvid()`). `IDx` is a vector, `length(IDx) =
length(CVids)+1`. `DOFs` is a vector containing the concatenated list of dof
of each convex in `CVids`. Each entry of `IDx` is the position of the
corresponding convex point list in `DOFs`. Hence, for example, the list of
points of the second convex is DOFs[IDx(2):IDx(3)]. If `CVids` contains
convex #id which do not exist in the mesh, their point list will be empty.
basic_dof_nodes(self, DOFids=None)
Get location of basic degrees of freedom.
 
Synopsis: DOFpts = MeshFem.basic_dof_nodes([, mat DOFids])
 
Return the list of interpolation points for the specified dof #IDs in `DOFids`
(if `DOFids` is omitted, all basic dof are considered).
basic_dof_on_region(self, Rs)
Return the list of basic dof (before the optional reduction) lying on one of
the mesh regions listed in `Rs`. More precisely, this function returns the
basic dof whose support is non-null on one of regions whose #ids are listed in
`Rs` (note that for boundary regions, some dof nodes may not lie exactly on
the boundary, for example the dof of Pk(n,0) lies on the center of the convex,
but the base function in not null on the convex border).
char(self, opt=None)
Output a string description of the MeshFem.
 
Synopsis: MeshFem.char([, string opt])
 
By default, it does not include the description of the linked mesh object,
except if `opt` is 'with_mesh'.
convex_index(self)
Return the list of convexes who have a FEM.
dof_from_cv(self, CVids)
Deprecated function. Use MeshFem.basic_dof_from_cv() instead.
dof_from_cvid(self, CVids=None)
Deprecated function. Use MeshFem.basic_dof_from_cvid() instead.
dof_from_im(self, mim, p=None)
Return a selection of dof who contribute significantly to the mass-matrix that
would be computed with `mf` and the integration method `mim`. `p` represents
the dimension on what the integration method operates (default `p = mesh
dimension`). IMPORTANT: you still have to set a valid integration method on
the convexes which are not crosses by the levelset!
dof_nodes(self, DOFids=None)
Deprecated function. Use MeshFem.basic_dof_nodes() instead.
dof_on_region(self, Rs)
Return the list of dof (after the optional reduction) lying on one of the mesh
regions listed in `Rs`. More precisely, this function returns the basic dof
whose support is non-null on one of regions whose #ids are listed in `Rs`
(note that for boundary regions, some dof nodes may not lie exactly on the
boundary, for example the dof of Pk(n,0) lies on the center of the convex, but
the base function in not null on the convex border). For a reduced mesh_fem
a dof is lying on a region if its potential corresponding shape function is
nonzero on this region. The extension matrix is used to make the
correspondance between basic and reduced dofs.
dof_partition(self, DOFP)
Change the 'dof_partition' array.
 
Synopsis: MeshFem.dof_partition(ivec DOFP)
 
`DOFP` is a vector holding a integer value for each convex of the MeshFem. See
MeshFem.dof_partition() for a description of "dof partition".
eval(self, expression)
interpolate an expression on the (lagrangian) MeshFem.
 
Examples:
 
mf.eval('x[0]*x[1]') interpolates the function 'x*y'
mf.eval('[x[0],x[1]]') interpolates the vector field '[x,y]'
export_to_dx(self, filename, *args)
Export a MeshFem and some fields to an OpenDX file.
 
Synopsis: MeshFem.export_to_dx(string filename, ...['as', string
mesh_name][,'edges']['serie',string serie_name][,'ascii'][,'append'], U,
'name'...)
 
This function will fail if the MeshFem mixes different convex types (i.e.
quads and triangles), or if OpenDX does not handle a specific element type
(i.e. prism connections are not known by OpenDX). The FEM will be mapped to
order 1 Pk (or Qk) FEMs. If you need to represent high-order FEMs or high-
order geometric transformations, you should consider Slice.export_to_dx().
export_to_pos(self, filename, U1=None, nameU1=None, *args)
Export a MeshFem and some fields to a pos file.
 
Synopsis: MeshFem.export_to_pos(string filename[, mat U1, string nameU1[, mat
U2, string nameU2,...])
 
The FEM and geometric transformations will be mapped to order 1 isoparametric
Pk (or Qk) FEMs (as GMSH does not handle higher order elements).
export_to_vtk(self, filename, *args)
Export a MeshFem and some fields to a vtk file.
 
Synopsis: MeshFem.export_to_vtk(string filename, ... ['ascii'], U, 'name'...)
 
The FEM and geometric transformations will be mapped to order 1 or 2
isoparametric Pk (or Qk) FEMs (as VTK does not handle higher order elements).
If you need to represent high-order FEMs or high-order geometric
transformations, you should consider Slice.export_to_vtk().
extension_matrix(self)
Return the optional extension matrix.
fem(self, CVids=None)
Return a list of FEM used by the MeshFem.
 
Synopsis: (FEMs, CV2F) = MeshFem.fem([, mat CVids])
 
`FEMs` is an array of all Fem objects found in the convexes given in `CVids`.
If `CV2F` was supplied as an output argument, it contains, for each convex
listed in `CVids`, the index of its correspounding FEM in `FEMs`. Convexes
which are not part of the mesh, or convexes which do not have any FEM have
their correspounding entry in `CV2F` set to -1.
get(self, *args)
has_linked_mesh_levelset(self)
???.
interpolate_convex_data(self, Ucv)
Interpolate data given on each convex of the mesh to the MeshFem dof. The
MeshFem has to be lagrangian, and should be discontinuous (typically a
FEM_PK(N,0) or FEM_QK(N,0) should be used). The last dimension of the input
vector Ucv should have Mesh.max_cvid() elements. Example of use:
MeshFem.interpolate_convex_dataMesh.quality())
is_equivalent(self, CVids=None)
Test if the MeshFem is equivalent.
 
Synopsis: bB = MeshFem.is_equivalent([, mat CVids])
 
See MeshFem.is_lagrangian()
is_lagrangian(self, CVids=None)
Test if the MeshFem is Lagrangian.
 
Synopsis: bB = MeshFem.is_lagrangian([, mat CVids])
 
Lagrangian means that each base function Phi[i] is such that Phi[i](P[j]) =
delta(i,j), where P[j] is the dof location of the jth base function, and
delta(i,j) = 1 if i==j, else 0.
 
If `CVids` is omitted, it returns 1 if all convexes in the mesh are
Lagrangian. If `CVids` is used, it returns the convex indices (with respect to
`CVids`) which are Lagrangian.
is_polynomial(self, CVids=None)
Test if all base functions are polynomials.
 
Synopsis: bB = MeshFem.is_polynomial([, mat CVids])
 
See MeshFem.is_lagrangian()
is_reduced(self)
Return 1 if the optional reduction matrix is applied to the dofs.
linked_mesh(self)
Return a reference to the Mesh object linked to `mf`.
linked_mesh_levelset(self)
???
memsize(self)
Return the amount of memory (in bytes) used by the mesh_fem object.
 
Synopsis: z = MeshFem.memsize()
 
The result does not take into account the linked mesh object.
nb_basic_dof(self)
Return the number of basic degrees of freedom (dof) of the MeshFem.
nbdof(self)
Return the number of degrees of freedom (dof) of the MeshFem.
non_conformal_basic_dof(self, CVids=None)
Return partially linked degrees of freedom.
 
Synopsis: MeshFem.non_conformal_basic_dof([, mat CVids])
 
Return the basic dof located on the border of a convex and which belong to
only one convex, except the ones which are located on the border of the mesh.
For example, if the convex 'a' and 'b' share a common face, 'a' has a P1 FEM,
and 'b' has a P2 FEM, then the basic dof on the middle of the face will be
returned by this function (this can be useful when searching the interfaces
between classical FEM and hierarchical FEM).
non_conformal_dof(self, CVids=None)
Deprecated function. Use MeshFem.non_conformal_basic_dof() instead.
qdim(self)
Return the dimension Q of the field interpolated by the MeshFem.
 
Synopsis: MeshFem.qdim()
 
By default, Q=1 (scalar field). This has an impact on the dof numbering.
reduction(self, s)
Set or unset the use of the reduction/extension matrices.
reduction_matrices(self, R, E)
Set the reduction and extension matrices and valid their use.
reduction_matrix(self)
Return the optional reduction matrix.
save(self, filename, opt=None)
Save a MeshFem in a text file (and optionaly its linked mesh object if `opt`
is the string 'with_mesh').
set(self, *args)
set_classical_discontinuous_fem(self, K, IM_DEGREE=None, *args)
Assigns a classical (Lagrange polynomial) discontinuous fem or order K.
 
Synopsis: MeshFem.set_classical_discontinuous_fem(int K, [int IM_DEGREE [,ivec
CVIDX]])
 
Similar to MeshFem.set_classical_fem() except that FEM_PK_DISCONTINUOUS is
used.
set_classical_fem(self, k, CVids=None)
Assign a classical (Lagrange polynomial) fem of order `k` to the MeshFem.
 
Synopsis: MeshFem.set_classical_fem(int k[, ivec CVids])
 
Uses FEM_PK for simplexes, FEM_QK for parallelepipeds etc.
set_fem(self, f, CVids=None)
Set the Finite Element Method.
 
Synopsis: MeshFem.set_fem(Fem f[, ivec CVids])
 
Assign a FEM `f` to all convexes whose #ids are listed in `CVids`. If `CVids`
is not given, the integration is assigned to all convexes. See the help of
Fem to obtain a list of available FEM methods.
set_qdim(self, Q)
Change the `Q` dimension of the field that is interpolated by the MeshFem.
 
Synopsis: MeshFem.set_qdim(int Q)
 
`Q = 1` means that the MeshFem describes a scalar field, `Q = N` means that
the MeshFem describes a vector field of dimension N.

 
class MeshIm
     Methods defined here:
__del__(self)
__init__(self, *args)
General constructor for MeshIm objects.
 
MeshIm('load', string fname[, Mesh m])
  Load a MeshIm from a file. If the mesh `m` is not supplied (this kind of
  file does not store the mesh), then it is read from the file and its
  descriptor is returned as the second output argument.
MeshIm('from_string', string s[, mesh M])
  Create a MeshIm object from its string description. See also MeshIm.char()
MeshIm('clone', MeshIm mim2)
  Create a copy of a MeshIm.
MeshIm('levelset', LevelSet ls, string where, Integ im[, Integ im_tip])
  Build an integration method conformal to a partition defined implicitely by
  a levelset. The `where` argument define the domain of integration with
  respect to the levelset, it has to be chosen among 'ALL', 'INSIDE',
  'OUTSIDE' and 'BOUNDARY'.
MeshIm(Mesh m, [{Integ im|int im_degree}])
  Build a new MeshIm object. For convenience, optional arguments (`im` or
  `im_degree`) can be provided, in that case a call to MeshIm.integ() is
  issued with these arguments.
__repr__(self)
__str__(self)
char(self)
Output a string description of the MeshIm.
 
Synopsis: MeshIm.char([,'with mesh'])
 
By default, it does not include the description of the linked Mesh object.
convex_index(self)
Return the list of convexes who have a FEM.
eltm(self, em, cv, f=None)
Return the elementary matrix (or tensor) integrated on the convex `cv`.
 
Synopsis: M = MeshIm.eltm(Eltm em, int cv [int f])
 
**WARNING** Be sure that the fem used for the construction of `em` is
compatible with the fem assigned to element `cv` ! This is not checked by the
function ! If the argument `f` is given, then the elementary tensor is
integrated on the face `f` of `cv` instead of the whole convex.
get(self, *args)
im_nodes(self, CVids=None)
Return the coordinates of the integration points, with their weights.
 
Synopsis: Ip = MeshIm.im_nodes([, mat CVids])
 
`CVids` may be a list of convexes, or a list of convex faces, such as returned
by Mesh.region()
integ(self, CVids=None)
Return a list of integration methods used by the MeshIm.
 
Synopsis: (I, CV2I) = MeshIm.integ([, mat CVids])
 
`I` is an array of all Integ objects found in the convexes given in `CVids`.
If `CV2I` was supplied as an output argument, it contains, for each convex
listed in `CVids`, the index of its correspounding integration method in `I`.
Convexes which are not part of the mesh, or convexes which do not have any
integration method have their correspounding entry in `CV2I` set to -1.
linked_mesh(self)
Returns a reference to the Mesh object linked to `mim`.
memsize(self)
Return the amount of memory (in bytes) used by the MeshIm object.
 
Synopsis: z = MeshIm.memsize()
 
The result does not take into account the linked Mesh object.
save(self, filename)
Saves a MeshIm in a text file (and optionaly its linked mesh object).
set(self, *args)
set_integ(self, *args)
Set the integration method.
 
Synopsis: MeshIm.set_integ({Integ im|int im_degree}[, ivec CVids])
 
Assign an integration method to all convexes whose #ids are listed in `CVids`.
If `CVids` is not given, the integration is assigned to all convexes. It is
possible to assign a specific integration method with an integration method
handle `im` obtained via Integ('IM_SOMETHING'), or to let getfem choose a
suitable integration method with `im_degree` (choosen such that polynomials of
`degree <= im_degree` are exactly integrated. If `im_degree=-1`, then the
dummy integration method IM_NONE will be used.)

 
class Model
    Getfem Model Object.
 
A model is an object which store all the state variable and the data of a
model and a list of bricks. A brick is a component of the model, i.e. a
term wich link some state variables. The model object  includes the global
tangent matrix, the right hand side and the constraints.
 
  Methods defined here:
__del__(self)
__init__(self, *args)
General constructor for Model objects.
There are two sorts of model states, the 'real' and the 'complex'
model states.
 
* MDS = Model('real')
  Build a model for real unknowns.
* MDS = Model('complex')
  Build a model for complex unknowns.
__repr__(self)
__str__(self)
add_Dirichlet_condition_with_multipliers(self, mim, varname, mult_description, region, dataname=None)
Add a Dirichlet condition on the variable `varname` and the mesh region
`region`. This region should be a boundary. The Dirichlet condition is
prescribed with a multiplier variable described by `mult_description`. If
`mult_description` is a string this is assumed to be the variable name
correpsonding to the multiplier (which should be first declared as a
multiplier variable on the mesh region in the model). If it is a finite
element method (mesh_fem object) then a multiplier variable will be added to
the model and build on this finite element method (it will be restricted to
the mesh region `region` and eventually some conflicting dofs with some other
multiplier variables will be suppressed). If it is an integer, then a
multiplier variable will be added to the model and build on a classical finite
element of degree that integer. `dataname` is the optional right hand side of
the Dirichlet condition. It could be constant or described on a fem; scalar or
vector valued, depending on the variable on which the Dirichlet condition is
prescribed. Return the brick index in the model.
add_Dirichlet_condition_with_penalization(self, mim, varname, coeff, region, dataname=None)
Add a Dirichlet condition on the variable `varname` and the mesh region
`region`. This region should be a boundary. The Dirichlet condition is
prescribed with penalization. The penalization coefficient is intially `coeff`
and will be added to the data of the model. `dataname` is the optional right
hand side of the Dirichlet condition. It could be constant or described on a
fem; scalar or vector valued, depending on the variable on which the Dirichlet
condition is prescribed. Return the brick index in the model.
add_Fourier_Robin_brick(self, mim, varname, dataname, region)
add a Fourier-Robin term to the model relatively to the variable `varname`.
this corresponds to a weak term of the form $\int (qu).v$. `dataname` should
contain the parameter $q$ of the Fourier-Robin condition. `region` is the mesh
region on which the term is added.
add_Helmholtz_brick(self, mim, varname, dataname, region=None)
add a Helmholtz term to the model relatively to the variable `varname`.
`dataname` should contain the wave number. `region` is an optional mesh region
on which the term is added. If it is not specified, it is added on the whole
mesh.
add_Laplacian_brick(self, mim, varname, region=None)
add a Laplacian term to the model relatively to the variable `varname`. If
this is a vector valued variable, the Laplacian term is added componentwise.
`region` is an optional mesh region on which the term is added. If it is not
specified, it is added on the whole mesh.
add_basic_d2_on_dt2_brick(self, mim, varnameU, datanameV, dataname_dt, dataname_alpha, dataname_rho=None, *args)
Add the standard discretization of a second order time derivative on
`varnameU`. `datanameV` is a data represented on the same finite element
method as U which represents the time derivative of U. The parameter $rho$ is
the density which could be omitted (the defaul value is 1). This brick should
be used in addition to a time dispatcher for the other terms. The time
derivative $v$ of the variable $u$ is preferably computed as a post-traitement
which depends on each scheme. The parameter `dataname_alpha` depends on the
time integration scheme.
add_basic_d_on_dt_brick(self, mim, varnameU, dataname_dt, dataname_rho=None, *args)
Add the standard discretization of a first order time derivative on
`varnameU`. The parameter $rho$ is the density which could be omitted (the
defaul value is 1). This brick should be used in addition to a time dispatcher
for the other terms.
add_constraint_with_multipliers(self, varname, multname, B, L)
Add an additional explicit constraint on the variable `varname` thank to a
multiplier `multname` peviously added to the model (should be a fixed size
variable). The constraint is $BU=L$ with `B` being a rectangular sparse
matrix. It is possible to change the constraint at any time whith the methods
Model.set_private_matrix() and Model.set_private_rhs()
add_constraint_with_penalization(self, varname, coeff, B, L)
Add an additional explicit penalized constraint on the variable `varname`. The
constraint is $BU=L$ with `B` being a rectangular sparse matrix. Be aware that
`B` should not contain a palin row, otherwise the whole tangent matrix will be
plain. It is possible to change the constraint at any time whith the methods
Model.set_private_matrix() and Model.set_private_rhs(). The method
Model.change_penalization_coeff() can be used.
add_data(self, name, size, niter=None)
Add a data to the model of constant size. `name` is the data name and `niter`
is the optional number of copy of the data for time integration schemes.
add_explicit_matrix(self, varname1, varname2, B, issymmetric=None, *args)
Add a brick reprenting an explicit matrix to be added to the tangent linear
system relatively to the variables 'varname1' and 'varname2'. The given matrix
should have has many rows as the dimension of 'varname1' and as many columns
as the dimension of 'varname2'. If the two variables are different and if
`issymmetric' is set to 1 then the transpose of the matrix is also added to
the tangent system (default is 0). set `iscoercive` to 1 if the term does not
affect the coercivity of the tangent system (default is 0). The matrix can be
changed by the command Model.set_private_matrix().
add_explicit_rhs(self, varname, L)
Add a brick reprenting an explicit right hand side to be added to the right
hand side of the tangent linear system relatively to the variable 'varname'.
The given rhs should have the same size than the dimension of 'varname'. The
rhs can be changed by the command Model.set_private_rhs().
add_fem_data(self, name, mf, qdim=None, niter=None)
Add a data to the model linked to a MeshFem. `name` is the data name, `qdim`
is the optional dimension of the data over the MeshFem and `niter` is the
optional number of copy of the data for time integration schemes.
add_fem_variable(self, name, mf, niter=None)
Add a variable to the model linked to a MeshFem. `name` is the variable name
and `niter` is the optional number of copy of the variable for time
integration schemes.
add_generic_elliptic_brick(self, mim, varname, dataname, region=None)
add a generic elliptic term to the model relatively to the variable `varname`.
The shape of the elliptic term depends both on the variable and the data. This
corresponds to a term $-        ext{div}(a
abla u)$ where $a$ is the data and $u$
the variable. The data can be a scalar, a matrix or an order four tensor. The
variable can be vector valued or not. If the data is a scalar or a matrix and
the variable is vector valued then the term is added componentwise. An order
four tensor data is allowed for vector valued variable only. The data can be
constant or describbed on a fem. Of course, when the data is a tensor describe
on a finite element method (a tensor field) the data can be a huge vector. The
components of the matrix/tensor have to be stored with the fortran order
(columnwise) in the data vector (compatibility with blas). The symmetry of the
given matrix/tensor is not verified (but assumed). If this is a vector valued
variable, the Laplacian term is added componentwise. `region` is an optional
mesh region on which the term is added. If it is not specified, it is added
on the whole mesh.
add_initialized_data(self, name, V)
Add a fixed size data to the model linked to a MeshFem. `name` is the data
name, `V` is the value of the data.
add_initialized_fem_data(self, name, mf, V)
Add a data to the model linked to a MeshFem. `name` is the data name. The data
is initiakized with `V`. The data can be a scalar or vector field.
add_isotropic_linearized_elasticity_brick(self, mim, varname, dataname_lambda, dataname_mu, region=None)
add an isotropic linearized elasticity term to the model relatively to the
variable `varname`. `dataname_lambda` and `dataname_mu` should contain the
Lam'e coefficients. `region` is an optional mesh region on which the term is
added. If it is not specified, it is added on the whole mesh.
add_linear_incompressibility_brick(self, mim, varname, multname_pressure, region=None, *args)
add an linear incompressibility condition on `variable`. `multname_pressure`
is a variable which represent the pressure. Be aware that an inf-sup condition
between the finite element method describing the rpressure and the primal
variable has to be satisfied. `region` is an optional mesh region on which the
term is added. If it is not specified, it is added on the whole mesh.
`dataname_coeff` is an optional penalization coefficient for nearly
incompressible elasticity for instance. In this case, it is the inverse of the
Lam'e coefficient $\lambda$.
add_mass_brick(self, mim, varname, dataname_rho=None, *args)
add mass term to the model relatively to the variable `varname`. If specified,
the data `dataname_rho` should contain the density (1 if omitted). `region` is
an optional mesh region on which the term is added. If it is not specified, it
is added on the whole mesh.
add_midpoint_dispatcher(self, bricks_indices)
Add a midpoint time dispatcher to a list of bricks. For instance, a nonlinear
term $K(U)$ will be replaced by $K((U^{n+1} + U^{n})/2)$.
add_multiplier(self, name, mf, primalname, niter=None)
Add a particular variable linked to a fem being a multiplier with respect to a
primal variable. The dof will be filtered with the gmm::range_basis function
applied on the terms of the model which link the multiplier and the primal
variable. This in order to retain only linearly independant constraints on the
primal variable. Optimized for boundary multipliers. niter is the number of
version of the data stored, for time integration schemes.
add_normal_source_term_brick(self, mim, varname, dataname, region=None)
add a source term on the variable `varname` on a boundary `region`. The source
term is represented by the data `dataname` which could be constant or
described on a fem. A scalar product with the outward normal unit vector to
the boundary is performed. The main aim of this brick is to represent a
Neumann condition with a vector data without performing the scalar product
with the normal as a pre-processing.
add_source_term_brick(self, mim, varname, dataname, region=None)
add a source term to the model relatively to the variable `varname`. The
source term is represented by the data `dataname` which could be constant or
described on a fem. `region` is an optional mesh region on which the term is
added. An additional optional data `directdataname` can be provided. The
corresponding data vector will be directly added to the right hand side
without assembly.
add_theta_method_dispatcher(self, bricks_indices, theta)
Add a theta-method time dispatcher to a list of bricks. For instance, a matrix
term $K$ will be replaced by $  heta K U^{n+1} + (1-    heta) K U^{n}$.
add_variable(self, name, size, niter=None)
Add a variable to the model of constant size. `name` is the variable name and
`niter` is the optional number of copy of the variable for time integration
schemes.
assembly(self, option=None)
Assembly of the tangent system taking into account the terms from all bricks.
`option`, if specified, should be 'build all', 'build rhs' or 'build matrix'.
The default is to build the whole tangent linear system (matrix and rhs). This
function is usefull to solve your problem with you own solver.
change_penalization_coeff(self, ind_brick, coeff)
Change the penalization coefficient of a Dirichlet condition with penalization
brick. If the brick is not of this kind, this function has an undefined
behavior.
clear(self)
Clear the model.
compute_isotropic_linearized_Von_Mises_or_Tresca(self, varname, dataname_lambda, dataname_mu, mf_vm, version=None)
Compute the Von-Mises stress or the Tresca stress of a field (only valid for
isotropic linearized elasticity in 3D). `version` should be 'Von Mises' or
'Tresca' ('Von Mises' is the default).
disable_bricks(self, bricks_indices)
Disable a brick (the brick will no longer participate to the building of the
tangent linear system).
first_iter(self)
To be executed before the first iteration of a time integration scheme.
from_variables(self)
Return the vector of all the degrees of freedom of the model consisting of the
concatenation of the variables of the model (usefull to solve your problem
with you own solver).
get(self, *args)
is_complex(self)
Return 0 is the model is real, 1 if it is complex.
listbricks(self)
print to the output the list of bricks of the model.
listvar(self)
print to the output the list of variables and constants of the model.
memsize(self)
Return a rough approximation of the amount of memory (in bytes) used by the
model.
mult_varname_Dirichlet(self, ind_brick)
Gives the name of the multiplier variable for a Dirichlet brick. If the brick
is not a Dirichlet condition with multiplier brick, this function has an
undefined behavior
next_iter(self)
To be executed at the end of each iteration of a time integration scheme.
rhs(self)
Return the right hand side of the tangent problem.
set(self, *args)
set_private_matrix(self, indbrick, B)
For some specific bricks having an internal sparse matrix (explicit bricks:
'constraint brick' and 'explicit matrix brick'), set this matrix.
set_private_rhs(self, indbrick, B)
For some specific bricks having an internal right hand side vector (explicit
bricks: 'constraint brick' and 'explicit rhs brick'), set this rhs.
set_variable(self, name, V, niter=None)
Set the value of a variable or data.
solve(self, *args)
Run the standard getfem solver.
 
Synopsis: Model.solve([,...])
 
Note that you should be able to use your own solver if you want (it is
possible to obtain the tangent matrix and its right hand side with the
Model.tangent_matrix() etc.).
 
Various options can be specified:
 
- 'noisy' or 'very noisy'
  the solver will display some information showing the progress
  (residual values etc.).
- 'max_iter', NIT
  set the maximum iterations numbers.
- 'max_res', RES
  set the target residual value.
- 'lsolver', SOLVERNAME
  select explicitely the solver used for the linear systems (the
  default value is 'auto', which lets getfem choose itself).
  Possible values are 'superlu', 'mumps' (if supported),
  'cg/ildlt', 'gmres/ilu' and 'gmres/ilut'.
tangent_matrix(self)
Return the tangent matrix stored in the model .
to_variables(self, V)
Set the value of the variables of the model with the vector `V`. Typically,
the vector `V` results of the solve of the tangent linear system (usefull to
solve your problem with you own solver).
unable_bricks(self, bricks_indices)
Unable a disabled brick.
variable(self, name, niter=None)
Gives the value of a variable or data.
velocity_update_for_Newmark_scheme(self, id2dt2_brick, varnameU, datanameV, dataname_dt, dataname_twobeta, dataname_alpha)
Function which udpate the velocity $v^{n+1}$ after the computation of the
displacement $u^{n+1}$ and before the next iteration. Specific for Newmark
scheme and when the velocity is included in the data of the model. This
version inverts the mass matrix by a conjugate gradient.
velocity_update_for_order_two_theta_method(self, varnameU, datanameV, dataname_dt, dataname_theta)
Function which udpate the velocity $v^{n+1}$ after the computation of the
displacement $u^{n+1}$ and before the next iteration. Specific for theta-
method and when the velocity is included in the data of the model.

 
class Poly
    

 
class Precond
    Getfem preconditioner.
 
  Methods defined here:
__del__(self)
__init__(self, *args)
General constructor for getfem preconditioners.
 
The preconditioners may store REAL or COMPLEX values. They accept
getfem sparse matrices and Matlab sparse matrices.
 
Precond('identity')
  Create a REAL identity precondioner.
Precond('cidentity')
  Create a COMPLEX identity precondioner.
Precond('diagonal', vec D)
  Create a diagonal precondioner.
Precond('ildlt', Spmat m)
  Create an ILDLT (Cholesky) preconditioner for the (symmetric)
  sparse matrix `m`. This preconditioner has the same sparsity
  pattern than `m` (no fill-in).
Precond('ilu', Spmat m)
  Create an ILU (Incomplete LU) preconditioner for the sparse
  matrix `m`. This preconditioner has the same sparsity pattern
  than `m` (no fill-in).
Precond('ildltt', Spmat m[, int fillin[, scalar threshold]])
  Create an ILDLT (Cholesky with filling) preconditioner for the
  (symmetric) sparse matrix `m`. The preconditioner may add at most
  `fillin` additional non-zero entries on each line. The default
  value for `fillin` is 10, and the default threshold is1e-7.
Precond('ilut', Spmat m[, int fillin[, scalar threshold]])
  Create an ILUT (Incomplete LU with filling) preconditioner for the
  sparse matrix `m`. The preconditioner may add at most `fillin`
  additional non-zero entries on each line. The default value for
  `fillin` is 10, and the default threshold is 1e-7.
Precond('superlu', Spmat m)
  Uses SuperLU to build an exact factorization of the sparse matrix
  `m`. This preconditioner is only available if the getfem-interface
  was built with SuperLU support. Note that LU factorization is likely
  to eat all your memory for 3D problems. * Precond('spmat', Spmat M)
  ???
get(self, *args)
info(self)
Return a short informative string about the preconditioner.
is_complex(self)
Return 1 if the preconditioner stores complex values.
mult(self, V)
Apply the preconditioner to the supplied vector.
set(self, *args)
size(self)
Return the dimensions of the preconditioner.
tmult(self, V)
Apply the transposed preconditioner to the supplied vector.
type(self)
Return a string describing the type of the preconditioner ('ilu', 'ildlt',..).

 
class Slice
    Mesh slices.
 
The slices may be considered as a (non-conformal) mesh of simplexes
which provides fast interpolation on a P1-discontinuous MeshFem.
    
It is used mainly for post-processing purposes.
 
  Methods defined here:
__del__(self)
__init__(self, *args)
General constructor for Slice objects.
 
Slice(sliceop, Mesh m, int refine[, mat CVfids])
Slice(sliceop, MeshFem mf, vec U, int refine[, mat CVfids])
Slice(sliceop, Slice sl)
Slice('streamlines', MeshFem mf, vec U, mat SEEDS)
Slice('points', Mesh m, mat PTS)
Slice('load', Mesh m)
 
Creation of a mesh slice. Mesh slices are very similar to a
P1-discontinuous MeshFem on which interpolation is very fast. The
slice is built from a mesh object, and a description of the
slicing operation, for example:
 
sl = Slice(('planar',+1,array([[0],[0]]),array([[0],[1]])), m, 5);
 
cuts the original mesh with the half space {y>0}. Each convex of the
original mesh `m` is simplexified (for example a quadrangle is
splitted into 2 triangles), and each simplex is refined 5 times.
 
Slicing operations can be:
 
- cutting with a plane, a sphere or a cylinder
- intersection or union of slices
- isovalues surfaces/volumes
- "points", "streamlines" (see below)
 
If the first argument is a MeshFem mf instead of a mesh, and if it
is followed by a field `U`, then the deformation U will be applied
to the mesh before the slicing operation.
 
The first argument can also be a slice.
 
**Slicing operations:**
 
They are specified with TUPLES, do not forget the extra parentheses!.
The first element is the name of the operation, followed the slicing
options.
 
* ('none')
  Does not cut the mesh.
* ('planar', int orient, vec p, vec n)
  Planar cut. `p` and `n` define a half-space, `p` being a point belong to
  the boundary of the half-space, and `n` being its normal. If `orient` is
  equal to -1 (resp. 0, +1), then the slicing operation will cut the mesh
  with the "interior" (resp. "boundary", "exterior") of the half-space.
  `orient` may also be set to +2 which means that the mesh will be sliced,
  but both the outer and inner parts will be kept.
* ('ball', int orient, vec c, scalar r)
  Cut with a ball of center `c` and radius `r`.
* ('cylinder', int orient, vec p1, vec p2, scalar r)
  Cut with a cylinder whose axis is the line `(p1,p2)` and whose radius is
  `r`.
* ('isovalues', int orient, MeshFem mf, vec U, scalar V)
  Cut using the isosurface of the field `U` (defined on the MeshFem `mf`).
  The result is the set `{x such that U(x) <= V}` or `{x such that
  U(x)=V}` or `{x such that U(x) >= V}` depending on the value of
  `orient`.
* ('boundary'[, SLICEOP])
  Return the boundary of the result of SLICEOP, where SLICEOP is any
  slicing operation. If SLICEOP is not specified, then the whole mesh is
  considered (i.e. it is equivalent to ('boundary',{'none'})).
* ('explode', mat Coef)
  Build an 'exploded' view of the mesh: each convex is shrinked (0 < Coef
  <= 1). In the case of 3D convexes, only their faces are kept.
* ('union', SLICEOP1, SLICEOP2)
* ('intersection', SLICEOP1, SLICEOP2)
* ('diff', SLICEOP1, SLICEOP2)
* ('comp', SLICEOP)
  Boolean operations: returns the union,intersection, difference or
  complementary of slicing operations.
* ('mesh', Mesh m)
  Build a slice which is the intersection of the sliced mesh with another
  mesh. The slice is such that all of its simplexes are stricly contained
  into a convex of each mesh.
 
  EXAMPLE:
 
  sl = Slice(('intersection',('planar',+1,[0;0;0],[0;0;1]),
  ...,('isovalues',-1,mf2,U2,0)),mf,U,5);
 
**SPECIAL SLICES**:
 
There are also some special calls to Slice(...)
 
Slice('streamlines',MeshFem mf, mat U, mat Seeds)
  compute streamlines of the (vector) field `U`, with seed points given by
  the columns of `Seeds`.
Slice('points', Mesh m, mat Pts)
  return the "slice" composed of points given by the columns of `Pts`
  (useful for interpolation on a given set of sparse points, see
  compute_interpolate_on(mf, U, sl).
Slice('load', string filename[, Mesh m])
  load the slice (and its linked mesh if it is not given as an argument)
  from a text file.
area(self)
Return the area of the slice.
cvs(self)
Return the list of convexes of the original mesh contained in the slice.
dim(self)
Return the dimension of the slice (2 for a 2D mesh, etc..).
edges(self)
Return the edges of the linked mesh contained in the slice.
 
Synopsis: (P, E1, E2) = Slice.edges()
 
`P` contains the list of all edge vertices, `E1` contains the indices of each
mesh edge in `P`, and `E2` contains the indices of each "edges" which is on
the border of the slice. This function is useless except for post-processing
purposes.
export_to_dx(self, filename, *args)
Export a slice to OpenDX.
 
Synopsis: Slice.export_to_dx(string filename, ...)
 
Following the file name, you may use any of the following options:
 
- if 'ascii' is not used, the file will contain binary data
  (non portable, but fast).
- if 'edges' is used, the edges of the original mesh will be
  written instead of the slice content.
- if 'append' is used, the opendx file will not be overwritten,
  and the new data will be added at the end of the file.
 
More than one dataset may be written, just list them. Each dataset consists of
either:
 
- a field interpolated on the slice (scalar, vector or tensor),
  followed by an optional name.
- a mesh_fem and a field, followed by an optional name.
export_to_pov(self, filename, *args)
Export a the triangles of the slice to POV-RAY.
export_to_vtk(self, filename, *args)
Export a slice to VTK.
 
Synopsis: Slice.export_to_vtk(string filename ... [, 'ascii'][, 'edges'] ...)
 
Following the `filename`, you may use any of the following options:
 
- if 'ascii' is not used, the file will contain binary data
  (non portable, but fast).
- if 'edges' is used, the edges of the original mesh will be
  written instead of the slice content.
 
More than one dataset may be written, just list them. Each dataset consists of
either:
 
- a field interpolated on the slice (scalar, vector or tensor),
  followed by an optional name.
- a mesh_fem and a field, followed by an optional name.
 
Examples:
 
Slice.export_to_vtk('test.vtk',Usl,'first_dataset', mf,
  U2, 'second_dataset')
Slice.export_to_vtk('test.vtk','ascii',mf,U2)
Slice.export_to_vtk('test.vtk','edges','ascii',Uslice)
get(self, *args)
interpolate_convex_data(self, Ucv)
Interpolate data given on each convex of the mesh to the slice nodes.
 
Synopsis: Usl = Slice.interpolate_convex_data(mat Ucv)
 
The input array `Ucv` may have any number of dimensions, but its last
dimension should be equal to Mesh.max_cvid().
 
Example of use: Slice.interpolate_convex_dataMesh.quality()).
linked_mesh(self)
Return the mesh on which the slice was taken.
memsize(self)
Return the amount of memory (in bytes) used by the slice object.
mesh(self)
nbpts(self)
Return the number of points in the slice.
nbsplxs(self, dim=None)
Return the number of simplexes in the slice.
 
Synopsis: ns = Slice.nbsplxs([, int dim])
 
Since the slice may contain points (simplexes of dim 0), segments (simplexes
of dimension 1), triangles etc., the result is a vector of size Slice.dim()+1
, except if the optional argument `dim` is used.
pts(self)
Return the list of point coordinates.
set(self, *args)
set_pts(self, P)
Replace the points of the slice.
 
Synopsis: Slice.set_pts(mat P)
 
The new points `P` are stored in the columns the matrix. Note that you can use
the function to apply a deformation to a slice, or to change the dimension of
the slice (the number of rows of `P` is not required to be equal to
Slice.dim()).
splxs(self, dim)
Return the list of simplexes of dimension `dim`.
 
Synopsis: (S, CV2S) = Slice.splxs(int dim)
 
On output, S has 'dim+1' rows, each column contains the point numbers of a
simplex. The vector `CV2S` can be used to find the list of simplexes for any
convex stored in the slice. For example 'S[:,CV2S[4]:CV2S[5]]' gives the list
of simplexes for the fourth convex.

 
class Spmat
    Getfem sparse matrix.
 
  Methods defined here:
__add__(self, other)
__del__(self)
__getitem__(self, key)
__init__(self, *args)
General constructor for getfem sparse matrices.
 
These sparse matrix can be stored as CSC (compressed column sparse), which
is the format used by Matlab, or they can be stored as WSC (internal format
to getfem). The CSC matrices are not writable (it would be very inefficient),
but they are optimized for multiplication with vectors, and memory usage.
The WSC are writable, they are very fast with respect to random read/write
operation. However their memory overhead is higher than CSC matrices, and
they are a little bit slower for matrix-vector multiplications.
 
By default, all newly created matrices are build as WSC matrices. This can
be changed later with Spmat.to_csc(...), or may be changed automatically
by getfem (for example ::LINSOLVE() converts the matrices to CSC).
 
The matrices may store REAL or COMPLEX values.
 
Spmat('empty', int m [, int n])
  Create a new empty (i.e. full of zeros) sparse matrix, of dimensions `m
  x n`. If `n` is omitted, the matrix dimension is `m x m`.
Spmat('copy', mat K [, list I [, list J]])
  Duplicate a matrix K (which might be a Spmat). If (index) `I` and/or `J`
  are given, the matrix will be a submatrix of `K`. For example:
 
  M = Spmat('copy', Spmat('empty',50,50), range(40), [6, 7, 8, 3, 10])
 
  will return a 40x5 matrix.
Spmat('identity', int n)
  Create a `n x n` identity matrix.
Spmat('mult', @spmat A, @spmat B)
  Create a sparse matrix as the product of the sparse matrices `A` and
  `B`. It requires that `A` and `B` be both real or both complex, you may
  have to use Spmat.to_complex()
Spmat('add', @spmat A, @spmat B)
  Create a sparse matrix as the sum of the sparse matrices `A` and `B`.
  Adding a real matrix with a complex matrix is possible.
Spmat.diag( mat D [, ivec E [, int n [,int m]]])
  Create a diagonal matrix. If `E` is given, `D` might be a matrix and
  each column of `E` will contain the sub-diagonal number that will be
  filled with the corresponding column of `D`.
Spmat('load','hb'|'harwell-boeing', string filename)
  Read a sparse matrix from an Harwell-Boeing file.
Spmat('load','mm'|'matrix-market', filename)
  Read a sparse matrix from a Matrix-Market file.
__mul__(self, other)
Multiplication of a Spmat with another Spmat or a vector or a scalar.
 
The result is another Spmat object.
__neg__(self)
__repr__(self)
__rmul__(self, other)
__setitem__(self, key, keyval)
__str__(self)
__sub__(self, other)
add(self, I, J, V)
Add `V` to the sub-matrix 'M(I,J)'.
 
Synopsis: Spmat.add(ivec I, ivec J, mat V)
 
`V` might be a sparse matrix or a full matrix.
assign(self, I, J, V)
Copy V into the sub-matrix 'M(I,J)'.
 
Synopsis: Spmat.assign(ivec I, ivec J, mat V)
 
`V` might be a sparse matrix or a full matrix.
clear(self, I=None, *args)
Erase the non-zero entries of the matrix.
 
Synopsis: Spmat.clear([, list I[, list J]])
 
The optional arguments `I` and `J` may be specified to clear a sub-matrix
instead of the entire matrix.
conjugate(self)
Conjugate each element of the matrix.
csc_ind(self)
Return the two usual index arrays of CSC storage.
 
Synopsis: (JC, IR) = Spmat.csc_ind()
 
If `M` is not stored as a CSC matrix, it is converted into CSC.
csc_val(self)
Return the array of values of all non-zero entries of `M`.
 
Synopsis: V = Spmat.csc_val()
 
If `M` is not stored as a CSC matrix, it is converted into CSC.
diag(self, D, E=None)
Change the diagonal (or sub-diagonals) of the matrix.
 
Synopsis: Spmat.diag(mat D [, ivec E])
 
If `E` is given, `D` might be a matrix and each column of `E` will contain the
sub-diagonal number that will be filled with the corresponding column of `D`.
dirichlet_nullspace(self, R)
Solve the dirichlet conditions `M.U=R`.
 
Synopsis: (N, U0) = Spmat.dirichlet_nullspace(vec R)
 
A solution `U0` which has a minimum L2-norm is returned, with a sparse matrix
`N` containing an orthogonal basis of the kernel of the (assembled)
constraints matrix `M` (hence, the PDE linear system should be solved on this
subspace): the initial problem
 
`K.U = B` with constraints `M.U = R`
 
is replaced by
 
`(N'.K.N).UU = N'.B` with `U = N.UU + U0`
full(self, I=None, *args)
Return a full (sub-)matrix.
 
Synopsis: Sm = Spmat.full([, list I[, list J]])
 
The optional arguments `I` and `J`, are the sub-intervals for the rows and
columns that are to be extracted.
get(self, *args)
info(self)
Return a string contains a short summary on the sparse matrix (dimensions,
filling, ...).
is_complex(self)
Return 1 if the matrix contains complex values.
mult(self, V)
Product of the sparse matrix `M` with a vector `V`.
 
Synopsis: MV = Spmat.mult(vec V)
 
For matrix-matrix multiplications, see Spmat('mult').
nnz(self)
Return the number of non-null values stored in the sparse matrix.
save(self, format, filename)
Export the sparse matrix.
 
Synopsis: Spmat.save(string format, string filename)
 
the format of the file may be 'hb' for Harwell-Boeing, or 'mm' for Matrix-
Market.
scale(self, v)
Multiplies the matrix by a scalar value `v`.
set(self, *args)
size(self)
Return a vector where `ni` and `nj` are the dimensions of the matrix.
storage(self)
Return the storage type currently used for the matrix.
 
Synopsis: s = Spmat.storage()
 
The storage is returned as a string, either 'CSC' or 'WSC'.
tmult(self, V)
Product of `M` transposed (conjugated if `M` is complex) with the vector `V`.
to_complex(self)
Store complex numbers.
to_csc(self)
Convert the matrix to CSC storage.
 
Synopsis: Spmat.to_csc()
 
CSC storage is recommended for matrix-vector multiplications.
to_wsc(self)
Convert the matrix to WSC storage.
 
Synopsis: Spmat.to_wsc()
 
Read and write operation are quite fast with WSC storage.
transconj(self)
Transpose and conjugate the matrix.
transpose(self)
Transpose the matrix.

 
Functions
       
add_docstring(...)
docstring(obj, docstring)
 
Add a docstring to a built-in obj if possible.
If the obj already has a docstring raise a RuntimeError
If this routine does not know how to add a docstring to the object
raise a TypeError
alterdot(...)
Change `dot`, `vdot`, and `innerproduct` to use accelerated BLAS functions.
 
Typically, as a user of Numpy, you do not explicitly call this function. If
Numpy is built with an accelerated BLAS, this function is automatically
called when Numpy is imported.
 
When Numpy is built with an accelerated BLAS like ATLAS, these functions
are replaced to make use of the faster implementations.  The faster
implementations only affect float32, float64, complex64, and complex128
arrays. Furthermore, the BLAS API only includes matrix-matrix,
matrix-vector, and vector-vector products. Products of arrays with larger
dimensionalities use the built in functions and are not accelerated.
 
See Also
--------
restoredot : `restoredot` undoes the effects of `alterdot`.
arange(...)
arange([start,] stop[, step,], dtype=None)
 
Return evenly spaced values within a given interval.
 
Values are generated within the half-open interval ``[start, stop)``
(in other words, the interval including `start` but excluding `stop`).
For integer arguments the function is equivalent to the Python built-in
`range <http://docs.python.org/lib/built-in-funcs.html>`_ function,
but returns a ndarray rather than a list.
 
Parameters
----------
start : number, optional
    Start of interval.  The interval includes this value.  The default
    start value is 0.
stop : number
    End of interval.  The interval does not include this value.
step : number, optional
    Spacing between values.  For any output `out`, this is the distance
    between two adjacent values, ``out[i+1] - out[i]``.  The default
    step size is 1.  If `step` is specified, `start` must also be given.
dtype : dtype
    The type of the output array.  If `dtype` is not given, infer the data
    type from the other input arguments.
 
Returns
-------
out : ndarray
    Array of evenly spaced values.
 
    For floating point arguments, the length of the result is
    ``ceil((stop - start)/step)``.  Because of floating point overflow,
    this rule may result in the last element of `out` being greater
    than `stop`.
 
See Also
--------
linspace : Evenly spaced numbers with careful handling of endpoints.
ogrid: Arrays of evenly spaced numbers in N-dimensions
mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions
 
Examples
--------
>>> np.arange(3)
array([0, 1, 2])
>>> np.arange(3.0)
array([ 0.,  1.,  2.])
>>> np.arange(3,7)
array([3, 4, 5, 6])
>>> np.arange(3,7,2)
array([3, 5])
array(...)
array(object, dtype=None, copy=True, order=None, subok=False, ndmin=True)
 
Create an array.
 
Parameters
----------
object : array_like
    An array, any object exposing the array interface, an
    object whose __array__ method returns an array, or any
    (nested) sequence.
dtype : data-type, optional
    The desired data-type for the array.  If not given, then
    the type will be determined as the minimum type required
    to hold the objects in the sequence.  This argument can only
    be used to 'upcast' the array.  For downcasting, use the
    .astype(t) method.
copy : bool, optional
    If true (default), then the object is copied.  Otherwise, a copy
    will only be made if __array__ returns a copy, if obj is a
    nested sequence, or if a copy is needed to satisfy any of the other
    requirements (`dtype`, `order`, etc.).
order : {'C', 'F', 'A'}, optional
    Specify the order of the array.  If order is 'C' (default), then the
    array will be in C-contiguous order (last-index varies the
    fastest).  If order is 'F', then the returned array
    will be in Fortran-contiguous order (first-index varies the
    fastest).  If order is 'A', then the returned array may
    be in any order (either C-, Fortran-contiguous, or even
    discontiguous).
subok : bool, optional
    If True, then sub-classes will be passed-through, otherwise
    the returned array will be forced to be a base-class array (default).
ndmin : int, optional
    Specifies the minimum number of dimensions that the resulting
    array should have.  Ones will be pre-pended to the shape as
    needed to meet this requirement.
 
Examples
--------
>>> np.array([1, 2, 3])
array([1, 2, 3])
 
Upcasting:
 
>>> np.array([1, 2, 3.0])
array([ 1.,  2.,  3.])
 
More than one dimension:
 
>>> np.array([[1, 2], [3, 4]])
array([[1, 2],
       [3, 4]])
 
Minimum dimensions 2:
 
>>> np.array([1, 2, 3], ndmin=2)
array([[1, 2, 3]])
 
Type provided:
 
>>> np.array([1, 2, 3], dtype=complex)
array([ 1.+0.j,  2.+0.j,  3.+0.j])
 
Data-type consisting of more than one element:
 
>>> x = np.array([(1,2),(3,4)],dtype=[('a','<i4'),('b','<i4')])
>>> x['a']
array([1, 3])
 
Creating an array from sub-classes:
 
>>> np.array(np.mat('1 2; 3 4'))
array([[1, 2],
       [3, 4]])
 
>>> np.array(np.mat('1 2; 3 4'), subok=True)
matrix([[1, 2],
        [3, 4]])
asm(what, *args)
asm_bilaplacian(mim, mf_u, mf_d, a)
Assembly of the matrix for the Bilaplacian problem.
 
Synopsis: A = asm_bilaplacian(MeshIm mim, MeshFem mf_u, MeshFem mf_d, vec a)
 
:math:`\Delta(a(x)\Delta u) = 0` with `a` scalar.
 
Return a Spmat object.
asm_boundary(bnum, expr, mim=None, mf=None, data=None, *args)
Generic boundary assembly.
 
Synopsis: (...) = asm_boundary(int bnum, string expr [, MeshIm mim, MeshFem
mf, data...])
 
See the help for asm_volumic().
asm_boundary_qu_term(boundary_num, mim, mf_u, mf_d, q)
Assembly of a boundary qu term.
 
Synopsis: Q = asm_boundary_qu_term(int boundary_num, MeshIm mim, MeshFem mf_u,
MeshFem mf_d, mat q)
 
`q` should be be a [Qdim x Qdim x N] array, where N is the number of dof of
`mf_d`, and Qdim is the dimension of the unkown u (that is set when creating
the MeshFem).
 
Return a Spmat object.
asm_boundary_source(bnum, mim, mf_u, mf_d, G)
Assembly of a boundary source term.
 
Synopsis: B = asm_boundary_source(int bnum, MeshIm mim, MeshFem mf_u, MeshFem
mf_d, vec G)
 
`G` should be a [Qdim x N] matrix, where N is the number of dof of `mf_d`, and
Qdim is the dimension of the unkown u (that is set when creating the MeshFem).
 
Return a vec object.
asm_dirichlet(bnum, mim, mf_u, mf_d, H, R, threshold=None)
Assembly of Dirichlet conditions of type `h.u = r`.
 
Synopsis: (HH, RR) = asm_dirichlet(int bnum, MeshIm mim, MeshFem mf_u, MeshFem
mf_d, mat H, vec R [, threshold])
 
Handle `h.u = r` where h is a square matrix (of any rank) whose size is equal
to the dimension of the unkown u. This matrix is stored in `H`, one column per
dof in `mf_d`, each column containing the values of the matrix h stored in
fortran order:
 
`H(:,j) = [h11(x_j) h21(x_j) h12(x_j) h22(x_j)]`
 
if u is a 2D vector field.
 
Of course, if the unknown is a scalar field, you just have to set `H = ones(1,
N)`, where N is the number of dof of `mf_d`.
 
This is basically the same than calling asm_boundary_qu_term() for `H` and
calling asm_neumann() for `R`, except that this function tries to produce a
'better' (more diagonal) constraints matrix (when possible).
 
See also Spmat.Dirichlet_nullspace().
asm_extrapolation_matrix(mf, mfe)
Build the extrapolation matrix from a MeshFem onto another MeshFem.
 
Synopsis: Me = asm_extrapolation_matrix(MeshFem mf, MeshFem mfe)
 
Return a matrix `Me`, such that `V = Me.U` is equal to
compute_extrapolate_on(mf, U, mfe). Useful for repeated extrapolations. `Me`
is a Spmat object.
asm_helmholtz(mim, mf_u, mf_d, k)
Assembly of the matrix for the Helmholtz problem.
 
Synopsis: A = asm_helmholtz(MeshIm mim, MeshFem mf_u, MeshFem mf_d, vec k)
 
:math:`\Delta u + k^2 u` = 0 with `k` complex scalar.
 
Return a Spmat object.
asm_interpolation_matrix(mf, mfi)
Build the interpolation matrix from a MeshFem onto another MeshFem.
 
Synopsis: Mi = asm_interpolation_matrix(MeshFem mf, MeshFem mfi)
 
Return a matrix `Mi`, such that `V = Mi.U` is equal to
compute_interpolate_on(mf, U, mfi). Useful for repeated interpolations. Note
that this is just interpolation, no elementary integrations are involved here,
and `mfi` has to be lagrangian. In the more general case, you would have to do
a L2 projection via the mass matrix.
 
`Mi` is a Spmat object.
asm_laplacian(mim, mf_u, mf_d, a)
Assembly of the matrix for the Laplacian problem.
 
Synopsis: L = asm_laplacian(MeshIm mim, MeshFem mf_u, MeshFem mf_d, vec a)
 
:math:`\nabla\cdot(a(x)\nabla u)` with `a` scalar.
 
Return a Spmat object.
asm_linear_elasticity(mim, mf_u, mf_d, lambda_d, mu_d)
Assembles of the matrix for the linear (isotropic) elasticity problem.
 
Synopsis: Le = asm_linear_elasticity(MeshIm mim, MeshFem mf_u, MeshFem mf_d,
vec lambda_d, vec mu_d)
 
:math:`\nabla\cdot(C(x):\nabla u)` with :math:`C` defined via `lambda_d`
and `mu_d`.
 
Return a Spmat object.
asm_mass_matrix(mim, mf1, mf2=None)
Assembly of a mass matrix.
 
Synopsis: M = asm_mass_matrix(MeshIm mim, MeshFem mf1[, MeshFem mf2])
 
Return a Spmat object.
asm_nonlinear_elasticity(mim, mf_u, U, law, mf_d, params, *args)
Assembles terms (tangent matrix and right hand side) for nonlinear elasticity.
 
Synopsis: TRHS = asm_nonlinear_elasticity(MeshIm mim, MeshFem mf_u, vec U,
string law, MeshFem mf_d, mat params, {'tangent matrix'|'rhs'|'incompressible
tangent matrix', MeshFem mf_p, vec P|'incompressible rhs', MeshFem mf_p, vec
P})
 
The solution `U` is required at the current time-step. The `law` may be
choosen among:
 
- 'SaintVenant Kirchhoff':
  Linearized law, should be avoided). This law has the two usual
  Lame coefficients as parameters, called lambda and mu.
- 'Mooney Rivlin':
  Only for incompressibility. This law has two parameters,
  called C1 and C2.
- 'Ciarlet Geymonat':
  This law has 3 parameters, called lambda, mu and gamma, with
  gamma chosen such that gamma is in ]-lambda/2-mu, -mu[.
 
The parameters of the material law are described on the MeshFem `mf_d`. The
matrix `params` should have `nbdof(mf_d)` columns, each row correspounds to a
parameter.
 
The last argument selects what is to be built: either the tangent matrix, or
the right hand side. If the incompressibility is considered, it should be
followed by a MeshFem `mf_p`, for the pression.
 
Return a Spmat object (tangent matrix), vec object (right hand side), tuple of
Spmat objects (incompressible tangent matrix), or tuple of vec objects
(incompressible right hand side).
asm_stokes(mim, mf_u, mf_p, mf_d, nu)
Assembly of matrices for the Stokes problem.
 
Synopsis: (K, B) = asm_stokes(MeshIm mim, MeshFem mf_u, MeshFem mf_p, MeshFem
mf_d, vec nu)
 
:math:`-\nu(x)\Delta u + \nabla p = 0`
 
:math:`\nabla\cdot u = 0`
 
with :math:`\nu` (`nu`), the fluid's dynamic viscosity.
 
On output, `K` is the usual linear elasticity stiffness matrix with
:math:`\lambda = 0` and :math:`2\mu = \nu`. `B` is a matrix corresponding
to :math:`\int p\nabla\cdot\phi`.
 
`K` and `B` are Spmat object's.
asm_volumic(CVLST=None, *args)
Generic assembly procedure for volumic assembly.
 
Synopsis: (...) = asm_volumic([,CVLST], expr [, mesh_ims, mesh_fems, data...])
 
The expression `expr` is evaluated over the MeshFem's listed in the arguments
(with optional data) and assigned to the output arguments. For details about
the syntax of assembly expressions, please refer to the getfem user manual (or
look at the file getfem_assembling.h in the getfem++ sources).
 
For example, the L2 norm of a field can be computed with
 
compute_L2 norm(mf, U, ) or with:
 
asm_volumic('u=data(#1);
V()+=u(i).u(j).comp(Base(#1).Base(#1))(i,j)',mim,mf,U)
 
The Laplacian stiffness matrix can be evaluated with
 
asm_laplacian(mim, mf, A) or equivalently with:
 
asm_volumic('a=data(#2);M(#1,#1)+=sym(comp(Grad(#1).Grad(#1).Base(#2))(:,i,:,i
,j).a(j))', mim,mf, A);
asm_volumic_source(mim, mf_u, mf_d, fd)
Assembly of a volumic source term.
 
Synopsis: V = asm_volumic_source(MeshIm mim, MeshFem mf_u, MeshFem mf_d, vec
fd)
 
Output a vector `V`, assembled on the MeshFem `mf_u`, using the data vector
`fd` defined on the data MeshFem `mf_d`. `fd` may be real or complex-valued.
 
Return a vec object.
bincount(...)
bincount(x, weights=None)
 
Return the number of occurrences of each value in array of nonnegative
integers.
 
The output, b[i], represents the number of times that i is found in `x`.
If `weights` is specified, every occurrence of i at a position p
contributes `weights` [p] instead of 1.
 
Parameters
----------
x : array_like, 1 dimension, nonnegative integers
    Input array.
weights : array_like, same shape as `x`, optional
    Weights.
 
See Also
--------
histogram, digitize, unique
can_cast(...)
can_cast(from=d1, to=d2)
 
Returns True if cast between data types can occur without losing precision.
 
Parameters
----------
from: data type code
    Data type code to cast from.
to: data type code
    Data type code to cast to.
 
Returns
-------
out : bool
    True if cast can occur without losing precision.
compare_chararrays(...)
compute(mf, U, what, *args)
compute_H1_norm(mf, U, mim, CVids=None)
Compute the H1 norm of `U`.
 
Synopsis: n = compute_H1 norm(mf, U, MeshIm mim[, mat CVids])
 
If `CVids` is given, the norm will be computed only on the listed convexes.
compute_H1_semi_norm(mf, U, mim, CVids=None)
Compute the L2 norm of grad(`U`).
 
Synopsis: n = compute_H1 semi norm(mf, U, MeshIm mim[, mat CVids])
 
If `CVids` is given, the norm will be computed only on the listed convexes.
compute_H2_norm(mf, U, mim, CVids=None)
Compute the H2 norm of `U`.
 
Synopsis: n = compute_H2 norm(mf, U, MeshIm mim[, mat CVids])
 
If `CVids` is given, the norm will be computed only on the listed convexes.
compute_H2_semi_norm(mf, U, mim, CVids=None)
Compute the L2 norm of D^2(`U`).
 
Synopsis: n = compute_H2 semi norm(mf, U, MeshIm mim[, mat CVids])
 
If `CVids` is given, the norm will be computed only on the listed convexes.
compute_L2_norm(mf, U, mim, CVids=None)
Compute the L2 norm of the (real or complex) field `U`.
 
Synopsis: n = compute_L2 norm(mf, U, MeshIm mim[, mat CVids])
 
If `CVids` is given, the norm will be computed only on the listed convexes.
compute_error_estimate(mf, U, mim)
Compute an a posteriori error estimation.
 
Synopsis: E = compute_error_estimate(mf, U, MeshIm mim)
 
Currently there is only one which is available: for each convex, the jump of
the normal derivative is integrated on its faces.
compute_extrapolate_on(mf, U, mfe)
Extrapolate a field on another MeshFem.
 
Synopsis: Ue = compute_extrapolate_on(mf, U, MeshFem mfe)
 
If the mesh of `mfe` is stricly included in the mesh of `mf`, this function
does stricly the same job as compute_interpolate_on(mf, U, ). However, if the
mesh of `mfe` is not exactly included in `mf` (imagine interpolation between a
curved refined mesh and a coarse mesh), then values which are slightly outside
`mf` will be extrapolated.
 
See also asm_extrapolation_matrix()
compute_gradient(mf, U, mf_du)
Compute the gradient of the field `U` defined on MeshFem `mf_du`.
 
Synopsis: DU = compute_gradient(mf, U, MeshFem mf_du)
 
The gradient is interpolated on the MeshFem `mf_du`, and returned in `DU`. For
example, if `U` is defined on a P2 MeshFem, `DU` should be evaluated on a
P1-discontinuous MeshFem. `mf` and `mf_du` should share the same mesh.
 
`U` may have any number of dimensions (i.e. this function is not restricted to
the gradient of scalar fields, but may also be used for tensor fields).
However the last dimension of `U` has to be equal to the number of dof of
`mf`. For example, if `U` is a [3x3xNmf] array (where Nmf is the number of dof
of `mf`), `DU` will be a [Nx3x3[xQ]xNmf_du] array, where N is the dimension of
the mesh, Nmf_du is the number of dof of `mf_du`, and the optional Q dimension
is inserted if `Qdim_mf != Qdim_mf_du`, where Qdim_mf is the Qdim of `mf` and
Qdim_mf_du is the Qdim of `mf_du`.
compute_hessian(mf, U, mf_h)
Compute the hessian of the field `U` defined on MeshFem `mf_h`.
 
Synopsis: HU = compute_hessian(mf, U, MeshFem mf_h)
 
See also compute_gradient(mf, U, MeshFem mf_du).
compute_interpolate_on(mf, U, *args)
Interpolate a field on another MeshFem or a Slice.
 
Synopsis: Ui = compute_interpolate_on(mf, U, {MeshFem mfi | Slice sli})
 
- Interpolation on another MeshFem `mfi`:
  `mfi` has to be Lagrangian. If `mf` and `mfi` share the same
  mesh object, the interpolation will be much faster.
- Interpolation on a Slice `sli`:
  this is similar to interpolation on a refined P1-discontinuous
  mesh, but it is much faster. This can also be used with
  Slice('points') to obtain field values at a given set of
  points.
 
See also asm_interpolation_matrix()
concatenate(...)
concatenate((a1, a2, ...), axis=0)
 
Join a sequence of arrays together.
 
Parameters
----------
a1, a2, ... : sequence of ndarrays
    The arrays must have the same shape, except in the dimension
    corresponding to `axis` (the first, by default).
axis : int, optional
    The axis along which the arrays will be joined.  Default is 0.
 
Returns
-------
res : ndarray
    The concatenated array.
 
See Also
--------
array_split : Split an array into multiple sub-arrays of equal or
              near-equal size.
split : Split array into a list of multiple sub-arrays of equal size.
hsplit : Split array into multiple sub-arrays horizontally (column wise)
vsplit : Split array into multiple sub-arrays vertically (row wise)
dsplit : Split array into multiple sub-arrays along the 3rd axis (depth).
hstack : Stack arrays in sequence horizontally (column wise)
vstack : Stack arrays in sequence vertically (row wise)
dstack : Stack arrays in sequence depth wise (along third dimension)
 
Examples
--------
>>> a = np.array([[1, 2], [3, 4]])
>>> b = np.array([[5, 6]])
>>> np.concatenate((a, b), axis=0)
array([[1, 2],
       [3, 4],
       [5, 6]])
>>> np.concatenate((a, b.T), axis=1)
array([[1, 2, 5],
       [3, 4, 6]])
digitize(...)
digitize(x, bins)
 
Return the indices of the bins to which each value in input array belongs.
 
Each index returned is such that `bins[i-1]` <= `x` < `bins[i]` if `bins`
is monotonically increasing, or `bins[i-1]` > `x` >= `bins[i]` if `bins`
is monotonically decreasing. Beyond the bounds of `bins`, 0 or len(`bins`)
is returned as appropriate.
 
Parameters
----------
x : array_like
    Input array to be binned.
bins : array_like
    Array of bins.
 
Returns
-------
out : ndarray
    Output array of indices of same shape as `x`.
 
Examples
--------
>>> x = np.array([0.2, 6.4, 3.0, 1.6])
>>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0])
>>> d = np.digitize(x,bins)
>>> d
array([1, 4, 3, 2])
>>> for n in range(len(x)):
...   print bins[d[n]-1], "<=", x[n], "<", bins[d[n]]
...
0.0 <= 0.2 < 1.0
4.0 <= 6.4 < 10.0
2.5 <= 3.0 < 4.0
1.0 <= 1.6 < 2.5
dot(...)
dot(a, b)
 
Dot product of two arrays.
 
For 2-D arrays it is equivalent to matrix multiplication, and for 1-D
arrays to inner product of vectors (without complex conjugation). For
N dimensions it is a sum product over the last axis of `a` and
the second-to-last of `b`::
 
    dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m])
 
Parameters
----------
a : array_like
    First argument.
b : array_like
    Second argument.
 
Returns
-------
output : ndarray
    Returns the dot product of `a` and `b`.  If `a` and `b` are both
    scalars or both 1-D arrays then a scalar is returned; otherwise
    an array is returned.
 
Raises
------
ValueError
    If the last dimension of `a` is not the same size as
    the second-to-last dimension of `b`.
 
See Also
--------
vdot : Complex-conjugating dot product.
tensordot : Sum products over arbitrary axes.
 
Examples
--------
>>> np.dot(3, 4)
12
 
Neither argument is complex-conjugated:
 
>>> np.dot([2j, 3j], [2j, 3j])
(-13+0j)
 
For 2-D arrays it's the matrix product:
 
>>> a = [[1, 0], [0, 1]]
>>> b = [[4, 1], [2, 2]]
>>> np.dot(a, b)
array([[4, 1],
       [2, 2]])
 
>>> a = np.arange(3*4*5*6).reshape((3,4,5,6))
>>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3))
>>> np.dot(a, b)[2,3,2,1,2,2]
499128
>>> sum(a[2,3,2,:] * b[1,2,:,2])
499128
empty(...)
empty(shape, dtype=float, order='C')
 
Return a new array of given shape and type, without initialising entries.
 
Parameters
----------
shape : {tuple of int, int}
    Shape of the empty array
dtype : data-type, optional
    Desired output data-type.
order : {'C', 'F'}, optional
    Whether to store multi-dimensional data in C (row-major) or
    Fortran (column-major) order in memory.
 
See Also
--------
empty_like, zeros
 
Notes
-----
`empty`, unlike `zeros`, does not set the array values to zero,
and may therefore be marginally faster.  On the other hand, it requires
the user to manually set all the values in the array, and should be
used with caution.
 
Examples
--------
>>> np.empty([2, 2])
array([[ -9.74499359e+001,   6.69583040e-309],  #random data
       [  2.13182611e-314,   3.06959433e-309]])
 
>>> np.empty([2, 2], dtype=int)
array([[-1073741821, -1067949133],  #random data
       [  496041986,    19249760]])
factory(id)
fastCopyAndTranspose = _fastCopyAndTranspose(...)
_fastCopyAndTranspose(a)
frombuffer(...)
frombuffer(buffer, dtype=float, count=-1, offset=0)
 
Interpret a buffer as a 1-dimensional array.
 
Parameters
----------
buffer
    An object that exposes the buffer interface.
dtype : data-type, optional
    Data type of the returned array.
count : int, optional
    Number of items to read. ``-1`` means all data in the buffer.
offset : int, optional
    Start reading the buffer from this offset.
 
Notes
-----
If the buffer has data that is not in machine byte-order, this
should be specified as part of the data-type, e.g.::
 
  >>> dt = np.dtype(int)
  >>> dt = dt.newbyteorder('>')
  >>> np.frombuffer(buf, dtype=dt)
 
The data of the resulting array will not be byteswapped,
but will be interpreted correctly.
 
Examples
--------
>>> s = 'hello world'
>>> np.frombuffer(s, dtype='S1', count=5, offset=6)
array(['w', 'o', 'r', 'l', 'd'],
      dtype='|S1')
fromfile(...)
fromfile(file, dtype=float, count=-1, sep='')
 
Construct an array from data in a text or binary file.
 
A highly efficient way of reading binary data with a known data-type,
as well as parsing simply formatted text files.  Data written using the
`tofile` method can be read using this function.
 
Parameters
----------
file : file or string
    Open file object or filename.
dtype : data-type
    Data type of the returned array.
    For binary files, it is used to determine the size and byte-order
    of the items in the file.
count : int
    Number of items to read. ``-1`` means all items (i.e., the complete
    file).
sep : string
    Separator between items if file is a text file.
    Empty ("") separator means the file should be treated as binary.
    Spaces (" ") in the separator match zero or more whitespace characters.
    A separator consisting only of spaces must match at least one
    whitespace.
 
See also
--------
load, save
ndarray.tofile
loadtxt : More flexible way of loading data from a text file.
 
Notes
-----
Do not rely on the combination of `tofile` and `fromfile` for
data storage, as the binary files generated are are not platform
independent.  In particular, no byte-order or data-type information is
saved.  Data can be stored in the platform independent ``.npy`` format
using `save` and `load` instead.
 
Examples
--------
Construct an ndarray:
 
>>> dt = np.dtype([('time', [('min', int), ('sec', int)]),
...                ('temp', float)])
>>> x = np.zeros((1,), dtype=dt)
>>> x['time']['min'] = 10; x['temp'] = 98.25
>>> x
array([((10, 0), 98.25)],
      dtype=[('time', [('min', '<i4'), ('sec', '<i4')]), ('temp', '<f8')])
 
Save the raw data to disk:
 
>>> import os
>>> fname = os.tmpnam()
>>> x.tofile(fname)
 
Read the raw data from disk:
 
>>> np.fromfile(fname, dtype=dt)
array([((10, 0), 98.25)],
      dtype=[('time', [('min', '<i4'), ('sec', '<i4')]), ('temp', '<f8')])
 
The recommended way to store and load data:
 
>>> np.save(fname, x)
>>> np.load(fname + '.npy')
array([((10, 0), 98.25)],
      dtype=[('time', [('min', '<i4'), ('sec', '<i4')]), ('temp', '<f8')])
fromiter(...)
fromiter(iterable, dtype, count=-1)
 
Create a new 1-dimensional array from an iterable object.
 
Parameters
----------
iterable : iterable object
    An iterable object providing data for the array.
dtype : data-type
    The data type of the returned array.
count : int, optional
    The number of items to read from iterable. The default is -1,
    which means all data is read.
 
Returns
-------
out : ndarray
    The output array.
 
Notes
-----
Specify ``count`` to improve performance.  It allows
``fromiter`` to pre-allocate the output array, instead of
resizing it on demand.
 
Examples
--------
>>> iterable = (x*x for x in range(5))
>>> np.fromiter(iterable, np.float)
array([  0.,   1.,   4.,   9.,  16.])
frompyfunc(...)
frompyfunc(func, nin, nout) take an arbitrary python
function that takes nin objects as input and returns
nout objects and return a universal function (ufunc).
This ufunc always returns PyObject arrays
fromstring(...)
fromstring(string, dtype=float, count=-1, sep='')
 
Return a new 1d array initialized from raw binary or text data in
string.
 
Parameters
----------
string : str
    A string containing the data.
dtype : dtype, optional
    The data type of the array. For binary input data, the data must be
    in exactly this format.
count : int, optional
    Read this number of `dtype` elements from the data. If this is
    negative, then the size will be determined from the length of the
    data.
sep : str, optional
    If provided and not empty, then the data will be interpreted as
    ASCII text with decimal numbers. This argument is interpreted as the
    string separating numbers in the data. Extra whitespace between
    elements is also ignored.
 
Returns
-------
arr : array
    The constructed array.
 
Raises
------
ValueError
    If the string is not the correct size to satisfy the requested
    `dtype` and `count`.
 
Examples
--------
>>> np.fromstring('\x01\x02', dtype=np.uint8)
array([1, 2], dtype=uint8)
>>> np.fromstring('1 2', dtype=int, sep=' ')
array([1, 2])
>>> np.fromstring('1, 2', dtype=int, sep=',')
array([1, 2])
>>> np.fromstring('\x01\x02\x03\x04\x05', dtype=np.uint8, count=3)
array([1, 2, 3], dtype=uint8)
 
Invalid inputs:
 
>>> np.fromstring('\x01\x02\x03\x04\x05', dtype=np.int32)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: string size must be a multiple of element size
>>> np.fromstring('\x01\x02', dtype=np.uint8, count=3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: string is smaller than requested size
generic_constructor(self, clname, *args)
Internal function -- acts as a constructor for all getfem objects.
generic_destructor(self, destructible=True)
Internal function -- acts as a destructor for all getfem objects.
getbuffer(...)
getbuffer(obj [,offset[, size]])
 
Create a buffer object from the given object referencing a slice of
length size starting at offset.  Default is the entire buffer. A
read-write buffer is attempted followed by a read-only buffer.
geterrobj(...)
geterrobj()
 
Used internally by `geterr`.
 
Returns
-------
errobj : list
    Internal numpy buffer size, error mask, error callback function.
getfem(...)
Execute a getfem command.
getfem_from_constructor(...)
internal -- Execute a getfem command for building a new object.
inner(...)
inner(a, b)
 
Inner product of two arrays.
 
Ordinary inner product of vectors for 1-D arrays (without complex
conjugation), in higher dimensions a sum product over the last axes.
 
Parameters
----------
a, b : array_like
    If `a` and `b` are nonscalar, their last dimensions of must match.
 
Returns
-------
out : ndarray
    `out.shape = a.shape[:-1] + b.shape[:-1]`
 
Raises
------
ValueError
    If the last dimension of `a` and `b` has different size.
 
See Also
--------
tensordot : Sum products over arbitrary axes.
dot : Generalised matrix product, using second last dimension of `b`.
 
Notes
-----
For vectors (1-D arrays) it computes the ordinary inner-product::
 
    np.inner(a, b) = sum(a[:]*b[:])
 
More generally, if `ndim(a) = r > 0` and `ndim(b) = s > 0`::
 
    np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1))
 
or explicitly::
 
    np.inner(a, b)[i0,...,ir-1,j0,...,js-1]
         = sum(a[i0,...,ir-1,:]*b[j0,...,js-1,:])
 
In addition `a` or `b` may be scalars, in which case::
 
   np.inner(a,b) = a*b
 
Examples
--------
Ordinary inner product for vectors:
 
>>> a = np.array([1,2,3])
>>> b = np.array([0,1,0])
>>> np.inner(a, b)
2
 
A multidimensional example:
 
>>> a = np.arange(24).reshape((2,3,4))
>>> b = np.arange(4)
>>> np.inner(a, b)
array([[ 14,  38,  62],
       [ 86, 110, 134]])
 
An example where `b` is a scalar:
 
>>> np.inner(np.eye(2), 7)
array([[ 7.,  0.],
       [ 0.,  7.]])
int_asbuffer(...)
lexsort(...)
lexsort(keys, axis=-1)
 
Perform an indirect sort using a sequence of keys.
 
Given multiple sorting keys, which can be interpreted as columns in a
spreadsheet, lexsort returns an array of integer indices that describes
the sort order by multiple columns. The last key in the sequence is used
for the primary sort order, the second-to-last key for the secondary sort
order, and so on. The keys argument must be a sequence of objects that
can be converted to arrays of the same shape. If a 2D array is provided
for the keys argument, it's rows are interpreted as the sorting keys and
sorting is according to the last row, second last row etc.
 
Parameters
----------
keys : (k,N) array or tuple containing k (N,)-shaped sequences
    The `k` different "columns" to be sorted.  The last column (or row if
    `keys` is a 2D array) is the primary sort key.
axis : int, optional
    Axis to be indirectly sorted.  By default, sort over the last axis.
 
Returns
-------
indices : (N,) ndarray of ints
    Array of indices that sort the keys along the specified axis.
 
See Also
--------
argsort : Indirect sort.
ndarray.sort : In-place sort.
sort : Return a sorted copy of an array.
 
Examples
--------
Sort names: first by surname, then by name.
 
>>> surnames =    ('Hertz',    'Galilei', 'Hertz')
>>> first_names = ('Heinrich', 'Galileo', 'Gustav')
>>> ind = np.lexsort((first_names, surnames))
>>> ind
array([1, 2, 0])
 
>>> [surnames[i] + ", " + first_names[i] for i in ind]
['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich']
 
Sort two columns of numbers:
 
>>> a = [1,5,1,4,3,4,4] # First column
>>> b = [9,4,0,4,0,2,1] # Second column
>>> ind = np.lexsort((b,a)) # Sort by a, then by b
>>> print ind
[2 0 4 6 5 3 1]
 
>>> [(a[i],b[i]) for i in ind]
[(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)]
 
Note that sorting is first according to the elements of ``a``.
Secondary sorting is according to the elements of ``b``.
 
A normal ``argsort`` would have yielded:
 
>>> [(a[i],b[i]) for i in np.argsort(a)]
[(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)]
 
Structured arrays are sorted lexically by ``argsort``:
 
>>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)],
...              dtype=np.dtype([('x', int), ('y', int)]))
 
>>> np.argsort(x) # or np.argsort(x, order=('x', 'y'))
array([2, 0, 4, 6, 5, 3, 1])
linsolve(what, *args)
linsolve_bicgstab(M, b, P=None, *args)
Solve `M.X = b` with the bi-conjugated gradient stabilized method.
 
Synopsis: X = linsolve_bicgstab(Spmat M, vec b [, Precond P][,'noisy'][,'res',
r][,'maxiter', n])
 
Optionally using `P` as a preconditioner.
linsolve_cg(M, b, P=None, *args)
Solve `M.X = b` with the conjugated gradient method.
 
Synopsis: X = linsolve_cg(Spmat M, vec b [, Precond P][,'noisy'][,'res',
r][,'maxiter', n])
 
Optionally using `P` as preconditioner.
linsolve_gmres(M, b, restart=None, *args)
Solve `M.X = b` with the generalized minimum residuals method.
 
Synopsis: X = linsolve_gmres(Spmat M, vec b[, int restart][, Precond
P][,'noisy'][,'res', r][,'maxiter', n])
 
Optionally using `P` as preconditioner. The default value of the restart
parameter is 50.
linsolve_lu(M, b)
Alias for linsolve_superlu(...)
linsolve_superlu(M, b)
Solve `M.U = b` apply the SuperLU solver (sparse LU factorization).
 
Synopsis: (U, cond) = linsolve_superlu(Spmat M, vec b)
 
The condition number estimate `cond` is returned with the solution `U`.
loads(...)
loads(string) -- Load a pickle from the given string
memstats()
newbuffer(...)
newbuffer(size)
 
Return a new uninitialized buffer object of size bytes
packbits(...)
packbits(myarray, axis=None)
 
Packs the elements of a binary-valued array into bits in a uint8 array.
 
The result is padded to full bytes by inserting zero bits at the end.
 
Parameters
----------
myarray : array_like
    An integer type array whose elements should be packed to bits.
axis : int, optional
    The dimension over which bit-packing is done.
    ``None`` implies packing the flattened array.
 
Returns
-------
packed : ndarray
    Array of type uint8 whose elements represent bits corresponding to the
    logical (0 or nonzero) value of the input elements. The shape of
    `packed` has the same number of dimensions as the input (unless `axis`
    is None, in which case the output is 1-D).
 
See Also
--------
unpackbits: Unpacks elements of a uint8 array into a binary-valued output
            array.
 
Examples
--------
>>> a = np.array([[[1,0,1],
...                [0,1,0]],
...               [[1,1,0],
...                [0,0,1]]])
>>> b = np.packbits(a, axis=-1)
>>> b
array([[[160],[64]],[[192],[32]]], dtype=uint8)
 
Note that in binary 160 = 1010 0000, 64 = 0100 0000, 192 = 1100 0000,
and 32 = 0010 0000.
putmask(...)
putmask(a, mask, values)
 
Changes elements of an array based on conditional and input values.
 
Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``.
 
If `values` is not the same size as `a` and `mask` then it will repeat.
This gives behavior different from ``a[mask] = values``.
 
Parameters
----------
a : array_like
    Target array.
mask : array_like
    Boolean mask array. It has to be the same shape as `a`.
values : array_like
    Values to put into `a` where `mask` is True. If `values` is smaller
    than `a` it will be repeated.
 
See Also
--------
place, put, take
 
Examples
--------
>>> x = np.arange(6).reshape(2, 3)
>>> np.putmask(x, x>2, x**2)
>>> x
array([[ 0,  1,  2],
       [ 9, 16, 25]])
 
If `values` is smaller than `a` it is repeated:
 
>>> x = np.arange(5)
>>> np.putmask(x, x>1, [-33, -44])
>>> x
array([  0,   1, -33, -44, -33])
register_python_factory(...)
register (on initialization) the python function which is used to build objects from a GetfemObject type (internal function)
restoredot(...)
Restore `dot`, `vdot`, and `innerproduct` to the default non-BLAS
implementations.
 
Typically, the user will only need to call this when troubleshooting and
installation problem, reproducing the conditions of a build without an
accelerated BLAS, or when being very careful about benchmarking linear
algebra operations.
 
See Also
--------
alterdot : `restoredot` undoes the effects of `alterdot`.
set_numeric_ops(...)
set_numeric_ops(op1=func1, op2=func2, ...)
 
Set numerical operators for array objects.
 
Parameters
----------
op1, op2, ... : callable
    Each ``op = func`` pair describes an operator to be replaced.
    For example, ``add = lambda x, y: np.add(x, y) % 5`` would replace
    addition by modulus 5 addition.
 
Returns
-------
saved_ops : list of callables
    A list of all operators, stored before making replacements.
 
Notes
-----
.. WARNING::
   Use with care!  Incorrect usage may lead to memory errors.
 
A function replacing an operator cannot make use of that operator.
For example, when replacing add, you may not use ``+``.  Instead,
directly call ufuncs:
 
>>> def add_mod5(x, y):
...     return np.add(x, y) % 5
...
>>> old_funcs = np.set_numeric_ops(add=add_mod5)
 
>>> x = np.arange(12).reshape((3, 4))
>>> x + x
array([[0, 2, 4, 1],
       [3, 0, 2, 4],
       [1, 3, 0, 2]])
 
>>> ignore = np.set_numeric_ops(**old_funcs) # restore operators
set_string_function(...)
set_string_function(f, repr=1)
 
Set a Python function to be used when pretty printing arrays.
 
Parameters
----------
f : Python function
    Function to be used to pretty print arrays. The function should expect
    a single array argument and return a string of the representation of
    the array.
repr : int
    Unknown.
 
Examples
--------
>>> def pprint(arr):
...     return 'HA! - What are you going to do now?'
...
>>> np.set_string_function(pprint)
>>> a = np.arange(10)
>>> a
HA! - What are you going to do now?
>>> print a
[0 1 2 3 4 5 6 7 8 9]
seterrobj(...)
seterrobj(errobj)
 
Used internally by `seterr`.
 
Parameters
----------
errobj : list
    [buffer_size, error_mask, callback_func]
 
See Also
--------
seterrcall
unpackbits(...)
unpackbits(myarray, axis=None)
 
Unpacks elements of a uint8 array into a binary-valued output array.
 
Each element of `myarray` represents a bit-field that should be unpacked
into a binary-valued output array. The shape of the output array is either
1-D (if `axis` is None) or the same shape as the input array with unpacking
done along the axis specified.
 
Parameters
----------
myarray : ndarray, uint8 type
   Input array.
axis : int, optional
   Unpacks along this axis.
 
Returns
-------
unpacked : ndarray, uint8 type
   The elements are binary-valued (0 or 1).
 
See Also
--------
packbits : Packs the elements of a binary-valued array into bits in a uint8
           array.
 
Examples
--------
>>> a = np.array([[2], [7], [23]], dtype=np.uint8)
>>> a
array([[ 2],
       [ 7],
       [23]], dtype=uint8)
>>> b = np.unpackbits(a, axis=1)
>>> b
array([[0, 0, 0, 0, 0, 0, 1, 0],
       [0, 0, 0, 0, 0, 1, 1, 1],
       [0, 0, 0, 1, 0, 1, 1, 1]], dtype=uint8)
util(what, *args)
util_trace_level(level)
Set the verbosity of some getfem++ routines.
 
Synopsis: util_('trace_level',int level)
 
Typically the messages printed by the model bricks, 0 means no trace message
(default is 3).
util_warning_level(level)
Filter the less important warnings displayed by getfem.
 
Synopsis: util_('warning_level',int level)
 
0 means no warnings, default level is 3.
vdot(...)
Return the dot product of two vectors.
 
The vdot(`a`, `b`) function handles complex numbers differently than
dot(`a`, `b`).  If the first argument is complex the complex conjugate
of the first argument is used for the calculation of the dot product.
 
For 2-D arrays it is equivalent to matrix multiplication, and for 1-D
arrays to inner product of vectors (with complex conjugation of `a`).
For N dimensions it is a sum product over the last axis of `a` and
the second-to-last of `b`::
 
    dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m])
 
Parameters
----------
a : array_like
    If `a` is complex the complex conjugate is taken before calculation
    of the dot product.
b : array_like
    Second argument to the dot product.
 
Returns
-------
output : ndarray
    Returns dot product of `a` and `b`.  Can be an int, float, or
    complex depending on the types of `a` and `b`.
 
See Also
--------
dot : Return the dot product without using the complex conjugate of the
      first argument.
 
Notes
-----
The dot product is the summation of element wise multiplication.
 
.. math::
 a \cdot b = \sum_{i=1}^n a_i^*b_i = a_1^*b_1+a_2^*b_2+\cdots+a_n^*b_n
 
Examples
--------
>>> a = np.array([1+2j,3+4j])
>>> b = np.array([5+6j,7+8j])
>>> np.vdot(a, b)
(70-8j)
>>> np.vdot(b, a)
(70+8j)
>>> a = np.array([[1, 4], [5, 6]])
>>> b = np.array([[4, 1], [2, 2]])
>>> np.vdot(a, b)
30
>>> np.vdot(b, a)
30
where(...)
where(condition, [x, y])
 
Return elements, either from `x` or `y`, depending on `condition`.
 
If only `condition` is given, return ``condition.nonzero()``.
 
Parameters
----------
condition : array_like, bool
    When True, yield `x`, otherwise yield `y`.
x, y : array_like, optional
    Values from which to choose.
 
Returns
-------
out : ndarray or tuple of ndarrays
    If both `x` and `y` are specified, the output array, shaped like
    `condition`, contains elements of `x` where `condition` is True,
    and elements from `y` elsewhere.
 
    If only `condition` is given, return the tuple
    ``condition.nonzero()``, the indices where `condition` is True.
 
See Also
--------
nonzero, choose
 
Notes
-----
If `x` and `y` are given and input arrays are 1-D, `where` is
equivalent to::
 
    [xv if c else yv for (c,xv,yv) in zip(condition,x,y)]
 
Examples
--------
>>> x = np.arange(9.).reshape(3, 3)
>>> np.where( x > 5 )
(array([2, 2, 2]), array([0, 1, 2]))
>>> x[np.where( x > 3.0 )]               # Note: result is 1D.
array([ 4.,  5.,  6.,  7.,  8.])
>>> np.where(x < 5, x, -1)               # Note: broadcasting.
array([[ 0.,  1.,  2.],
       [ 3.,  4., -1.],
       [-1., -1., -1.]])
 
>>> np.where([[True, False], [True, True]],
...          [[1, 2], [3, 4]],
...          [[9, 8], [7, 6]])
array([[1, 8],
       [3, 4]])
 
>>> np.where([[0, 1], [1, 0]])
(array([0, 1]), array([1, 0]))
zeros(...)
zeros(shape, dtype=float, order='C')
 
Return a new array of given shape and type, filled with zeros.
 
Parameters
----------
shape : {tuple of ints, int}
    Shape of the new array, e.g., ``(2, 3)`` or ``2``.
dtype : data-type, optional
    The desired data-type for the array, e.g., `numpy.int8`.  Default is
    `numpy.float64`.
order : {'C', 'F'}, optional
    Whether to store multidimensional data in C- or Fortran-contiguous
    (row- or column-wise) order in memory.
 
Returns
-------
out : ndarray
    Array of zeros with the given shape, dtype, and order.
 
See Also
--------
numpy.zeros_like : Return an array of zeros with shape and type of input.
numpy.ones_like : Return an array of ones with shape and type of input.
numpy.empty_like : Return an empty array with shape and type of input.
numpy.ones : Return a new array setting values to one.
numpy.empty : Return a new uninitialized array.
 
Examples
--------
>>> np.zeros(5)
array([ 0.,  0.,  0.,  0.,  0.])
 
>>> np.zeros((5,), dtype=numpy.int)
array([0, 0, 0, 0, 0])
 
>>> np.zeros((2, 1))
array([[ 0.],
       [ 0.]])
 
>>> s = (2,2)
>>> np.zeros(s)
array([[ 0.,  0.],
       [ 0.,  0.]])
 
>>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')])
array([(0, 0), (0, 0)],
      dtype=[('x', '<i4'), ('y', '<i4')])

 
Data
        ALLOW_THREADS = 1
BUFSIZE = 10000
CLIP = 0
ERR_CALL = 3
ERR_DEFAULT = 0
ERR_DEFAULT2 = 2084
ERR_IGNORE = 0
ERR_LOG = 5
ERR_PRINT = 4
ERR_RAISE = 2
ERR_WARN = 1
FLOATING_POINT_SUPPORT = 1
FPE_DIVIDEBYZERO = 1
FPE_INVALID = 8
FPE_OVERFLOW = 2
FPE_UNDERFLOW = 4
False_ = False
Inf = inf
Infinity = inf
MAXDIMS = 32
NAN = nan
NINF = -inf
NZERO = -0.0
NaN = nan
PINF = inf
PZERO = 0.0
RAISE = 2
SHIFT_DIVIDEBYZERO = 0
SHIFT_INVALID = 9
SHIFT_OVERFLOW = 3
SHIFT_UNDERFLOW = 6
ScalarType = (<type 'int'>, <type 'float'>, <type 'complex'>, <type 'long'>, <type 'bool'>, <type 'str'>, <type 'unicode'>, <type 'buffer'>, <type 'numpy.int64'>, <type 'numpy.int16'>, <type 'numpy.float96'>, <type 'numpy.uint32'>, <type 'numpy.int32'>, <type 'numpy.complex64'>, <type 'numpy.unicode_'>, <type 'numpy.uint64'>, <type 'numpy.int8'>, <type 'numpy.complex128'>, <type 'numpy.uint8'>, <type 'numpy.void'>, ...)
True_ = True
UFUNC_BUFSIZE_DEFAULT = 10000
UFUNC_PYVALS_NAME = 'UFUNC_PYVALS'
WRAP = 1
__version__ = '1.3.0'
absolute = <ufunc 'absolute'>
add = <ufunc 'add'>
arccos = <ufunc 'arccos'>
arccosh = <ufunc 'arccosh'>
arcsin = <ufunc 'arcsin'>
arcsinh = <ufunc 'arcsinh'>
arctan = <ufunc 'arctan'>
arctan2 = <ufunc 'arctan2'>
arctanh = <ufunc 'arctanh'>
bitwise_and = <ufunc 'bitwise_and'>
bitwise_not = <ufunc 'invert'>
bitwise_or = <ufunc 'bitwise_or'>
bitwise_xor = <ufunc 'bitwise_xor'>
c_ = <numpy.lib.index_tricks.CClass object at 0xb74df90c>
cast = {<type 'numpy.int64'>: <function <lambda> at 0xb...numpy.bool_'>: <function <lambda> at 0xb75928ec>}
ceil = <ufunc 'ceil'>
conj = <ufunc 'conjugate'>
conjugate = <ufunc 'conjugate'>
cos = <ufunc 'cos'>
cosh = <ufunc 'cosh'>
deg2rad = <ufunc 'deg2rad'>
degrees = <ufunc 'degrees'>
divide = <ufunc 'divide'>
e = 2.7182818284590451
equal = <ufunc 'equal'>
exp = <ufunc 'exp'>
exp2 = <ufunc 'exp2'>
expm1 = <ufunc 'expm1'>
fabs = <ufunc 'fabs'>
floor = <ufunc 'floor'>
floor_divide = <ufunc 'floor_divide'>
fmax = <ufunc 'fmax'>
fmin = <ufunc 'fmin'>
fmod = <ufunc 'fmod'>
frexp = <ufunc 'frexp'>
greater = <ufunc 'greater'>
greater_equal = <ufunc 'greater_equal'>
hypot = <ufunc 'hypot'>
index_exp = <numpy.lib.index_tricks.IndexExpression object at 0xb74dfa6c>
inf = inf
infty = inf
invert = <ufunc 'invert'>
isfinite = <ufunc 'isfinite'>
isinf = <ufunc 'isinf'>
isnan = <ufunc 'isnan'>
ldexp = <ufunc 'ldexp'>
left_shift = <ufunc 'left_shift'>
less = <ufunc 'less'>
less_equal = <ufunc 'less_equal'>
little_endian = True
log = <ufunc 'log'>
log10 = <ufunc 'log10'>
log1p = <ufunc 'log1p'>
logaddexp = <ufunc 'logaddexp'>
logaddexp2 = <ufunc 'logaddexp2'>
logical_and = <ufunc 'logical_and'>
logical_not = <ufunc 'logical_not'>
logical_or = <ufunc 'logical_or'>
logical_xor = <ufunc 'logical_xor'>
maximum = <ufunc 'maximum'>
mgrid = <numpy.lib.index_tricks.nd_grid object at 0xb74df7ec>
minimum = <ufunc 'minimum'>
mod = <ufunc 'remainder'>
modf = <ufunc 'modf'>
multiply = <ufunc 'multiply'>
nan = nan
nbytes = {<type 'numpy.int64'>: 8, <type 'numpy.int16'>: ...type 'numpy.uint32'>: 4, <type 'numpy.bool_'>: 1}
negative = <ufunc 'negative'>
newaxis = None
not_equal = <ufunc 'not_equal'>
obj_count = {}
ogrid = <numpy.lib.index_tricks.nd_grid object at 0xb74df80c>
ones_like = <ufunc 'ones_like'>
pi = 3.1415926535897931
power = <ufunc 'power'>
r_ = <numpy.lib.index_tricks.RClass object at 0xb74df88c>
rad2deg = <ufunc 'rad2deg'>
radians = <ufunc 'radians'>
reciprocal = <ufunc 'reciprocal'>
remainder = <ufunc 'remainder'>
right_shift = <ufunc 'right_shift'>
rint = <ufunc 'rint'>
s_ = <numpy.lib.index_tricks.IndexExpression object at 0xb74dfaac>
sctypeDict = {0: <type 'numpy.bool_'>, 1: <type 'numpy.int8'>, 2: <type 'numpy.uint8'>, 3: <type 'numpy.int16'>, 4: <type 'numpy.uint16'>, 5: <type 'numpy.int32'>, 6: <type 'numpy.uint32'>, 7: <type 'numpy.int32'>, 8: <type 'numpy.uint32'>, 9: <type 'numpy.int64'>, ...}
sctypeNA = {'?': 'Bool', 'B': 'UInt8', 'Bool': <type 'numpy.bool_'>, 'Complex32': <type 'numpy.complex64'>, 'Complex64': <type 'numpy.complex128'>, 'Complex96': <type 'numpy.complex192'>, 'D': 'Complex64', 'F': 'Complex32', 'Float32': <type 'numpy.float32'>, 'Float64': <type 'numpy.float64'>, ...}
sctypes = {'complex': [<type 'numpy.complex64'>, <type 'numpy.complex128'>, <type 'numpy.complex192'>], 'float': [<type 'numpy.float32'>, <type 'numpy.float64'>, <type 'numpy.float96'>], 'int': [<type 'numpy.int8'>, <type 'numpy.int16'>, <type 'numpy.int32'>, <type 'numpy.int32'>, <type 'numpy.int64'>], 'others': [<type 'bool'>, <type 'object'>, <type 'str'>, <type 'unicode'>, <type 'numpy.void'>], 'uint': [<type 'numpy.uint8'>, <type 'numpy.uint16'>, <type 'numpy.uint32'>, <type 'numpy.uint32'>, <type 'numpy.uint64'>]}
sign = <ufunc 'sign'>
signbit = <ufunc 'signbit'>
sin = <ufunc 'sin'>
sinh = <ufunc 'sinh'>
sqrt = <ufunc 'sqrt'>
square = <ufunc 'square'>
subtract = <ufunc 'subtract'>
tan = <ufunc 'tan'>
tanh = <ufunc 'tanh'>
true_divide = <ufunc 'true_divide'>
trunc = <ufunc 'trunc'>
typeDict = {0: <type 'numpy.bool_'>, 1: <type 'numpy.int8'>, 2: <type 'numpy.uint8'>, 3: <type 'numpy.int16'>, 4: <type 'numpy.uint16'>, 5: <type 'numpy.int32'>, 6: <type 'numpy.uint32'>, 7: <type 'numpy.int32'>, 8: <type 'numpy.uint32'>, 9: <type 'numpy.int64'>, ...}
typeNA = {'?': 'Bool', 'B': 'UInt8', 'Bool': <type 'numpy.bool_'>, 'Complex32': <type 'numpy.complex64'>, 'Complex64': <type 'numpy.complex128'>, 'Complex96': <type 'numpy.complex192'>, 'D': 'Complex64', 'F': 'Complex32', 'Float32': <type 'numpy.float32'>, 'Float64': <type 'numpy.float64'>, ...}
typecodes = {'All': '?bhilqpBHILQPfdgFDGSUVO', 'AllFloat': 'fdgFDG', 'AllInteger': 'bBhHiIlLqQpP', 'Character': 'c', 'Complex': 'FDG', 'Float': 'fdg', 'Integer': 'bhilqp', 'UnsignedInteger': 'BHILQP'}