hippylib.utils package

Submodules

hippylib.utils.checkDolfinVersion module

hippylib.utils.checkDolfinVersion.checkdlversion()[source]

Check if FEniCS version is supported. Currently hIPPYlib requires FEniCS version 1.6.0 and newer.

hippylib.utils.checkDolfinVersion.dlversion()[source]

hippylib.utils.parameterList module

class hippylib.utils.parameterList.ParameterList(data)[source]

Bases: object

A small abstract class for storing parameters and their description. This class will raise an exception if the key one tries to access is not present.

data is a dictionary where each value is the pair (value, description)

showMe(indent='')[source]

hippylib.utils.vector2function module

hippylib.utils.vector2function.vector2Function(x, Vh, **kwargs)[source]

Wrap a finite element vector x into a finite element function in the space Vh. kwargs is optional keywords arguments to be passed to the construction of a dolfin Function.

hippylib.utils.random module

class hippylib.utils.random.Random(myid=0, nproc=1, blocksize=1000000, seed=1)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

This class handles parallel generation of random numbers in hippylib.

Create a parallel random number number generator.

INPUTS:

  • myid: id of the calling process.
  • nproc: number of processor in the communicator.
  • blocksize: number of consecutive random number to be generated before jumping headed in the stream.
  • seed: random seed to initialize the random engine.
normal(sigma, out=None)[source]

Sample from normal distribution with given variance.

normal_perturb(sigma, out)[source]

Add a normal perturbation to a Vector/MultiVector.

rademacher(out=None)[source]

Sample from Rademacher distribution.

uniform(a, b, out=None)[source]

Sample from uniform distribution.

hippylib.utils.random.parRandom

This class handles parallel generation of random numbers in hippylib.

hippylib.utils.nb module

hippylib.utils.nb._mesh2triang(mesh)[source]
hippylib.utils.nb._mplot_cellfunction(cellfn)[source]
hippylib.utils.nb._mplot_function(f, vmin, vmax, logscale)[source]
hippylib.utils.nb.animate(Vh, state, same_colorbar=True, colorbar=True, subplot_loc=None, mytitle=None, show_axis='off', logscale=False)[source]

Show animation for a :code:TimeDependentVector

hippylib.utils.nb.coarsen_v(fun, nx=16, ny=16)[source]
hippylib.utils.nb.multi1_plot(objs, titles, same_colorbar=True, show_axis='off', logscale=False, vmin=None, vmax=None, cmap=None)[source]

Plot a list of generic dolfin object in a single row

hippylib.utils.nb.plot(obj, colorbar=True, subplot_loc=None, mytitle=None, show_axis='off', vmin=None, vmax=None, logscale=False, cmap=None)[source]

Plot a generic dolfin object (if supported)

hippylib.utils.nb.plot_eigenvalues(d, mytitle=None, subplot_loc=None)[source]

Plot eigenvalues

hippylib.utils.nb.plot_eigenvectors(Vh, U, mytitle, which=[0, 1, 2, 5, 10, 15], cmap=None)[source]

Plot specified vectors in a :code:MultiVector

hippylib.utils.nb.plot_pts(points, values, colorbar=True, subplot_loc=None, mytitle=None, show_axis='on', vmin=None, vmax=None, xlim=(0, 1), ylim=(0, 1), cmap=None)[source]

Plot a cloud of points

hippylib.utils.nb.show_solution(Vh, ic, state, same_colorbar=True, colorbar=True, mytitle=None, show_axis='off', logscale=False, times=[0, 0.4, 1.0, 2.0, 3.0, 4.0], cmap=None)[source]

Plot a :code:TimeDependentVector at specified time steps

Module contents