esys.weipa Package — esys.escript 5.6 documentation

# esys.weipa Package

## Classes

- `EscriptToTVTK`

class `esys.weipa.` `EscriptToTVTK`(domain=None)

  Bases: `object`

  a simple interface from escript to TVTK for rendering with mayavi.mlab

  `__init__`(domain=None)

    sets up driver for translating Data objects in domain to TVTK object.

  `getDomain`()
  `getTVTK`()
  `setData`(**kwargs)

    set the scalar data set:

  `setDomain`(domain)

    resets the domain

## Functions

`esys.weipa.` `convertToNumpy`(data)

  Writes `Data` objects to a numpy array.

  The keyword args are Data objects to save. If a scalar `Data` object is passed with the name `mask`, then only samples which correspond to positive values in `mask` will be output.

  Example usage:

  s=Scalar(..) v=Vector(..) t=Tensor(..) f=float() array = getNumpy(a=s, b=v, c=t, d=f)

`esys.weipa.` `createDataset`(domain=None, **data)

  Creates and returns an esys.weipa dataset consisting of a Domain and Data objects. The returned object provides methods to access and export data.

`esys.weipa.` `hasFeature`((str)name) → bool :

  Check if escript was compiled with a certain feature

  Parameters: | name (`string`) – feature to lookup

`esys.weipa.` `interpolateEscriptData`(domain, data)

  esys.weipa does not support the function spaces Solution and ReducedSolution. This function interpolates Data defined on those function spaces to compatible alternatives.

`esys.weipa.` `saveSilo`(filename, domain=None, write_meshdata=False, time=0.0, cycle=0, **data)

  Writes `Data` objects and their mesh to a file using the SILO file format.

  Example:

      temp=Scalar(..)
      v=Vector(..)
      saveSilo("solution.silo", temperature=temp, velocity=v)

  `temp` and `v` are written to “solution.silo” where `temp` is named “temperature” and `v` is named “velocity”.

  Parameters: | filename (`str`) – name of the output file (‘.silo’ is added if required) domain (`escript.Domain`) – domain of the `Data` objects. If not specified, the domain of the given `Data` objects is used. write_meshdata (`bool`) – whether to save mesh-related data such as element identifiers, ownership etc. This is mainly useful for debugging. time (`float`) – the timestamp to save within the file cycle (`int`) – the cycle (or timestep) of the data <name> – writes the assigned value to the Silo file using <name> as identifier
  Note: | All data objects have to be defined on the same domain but they may be defined on separate `FunctionSpace` s.

`esys.weipa.` `saveVTK`(filename, domain=None, metadata='', metadata_schema=None, write_meshdata=False, time=0.0, cycle=0, **data)

  Writes `Data` objects and their mesh to a file using the VTK XML file format.

  Example:

      temp=Scalar(..)
      v=Vector(..)
      saveVTK("solution.vtu", temperature=temp, velocity=v)

  `temp` and `v` are written to “solution.vtu” where `temp` is named “temperature” and `v` is named “velocity”.

  Meta tags, e.g. a timeStamp, can be added to the file, for instance:

      tmp=Scalar(..)
      v=Vector(..)
      saveVTK("solution.vtu", temperature=tmp, velocity=v,
              metadata="<timeStamp>1.234</timeStamp>",
              metadata_schema={"gml":"http://www.opengis.net/gml"})

  The argument `metadata_schema` allows the definition of name spaces with a schema used in the definition of meta tags.

  Parameters: | filename (`str`) – name of the output file (‘.vtu’ is added if required) domain (`escript.Domain`) – domain of the `Data` objects. If not specified, the domain of the given `Data` objects is used. <name> – writes the assigned value to the VTK file using <name> as identifier metadata (`str`) – additional XML meta data which are inserted into the VTK file. The meta data are marked by the tag `<MetaData>`. metadata_schema (`dict` with `metadata_schema[<namespace>]=<URI>` to assign the scheme `<URI>` to the name space `<namespace>`.) – assigns schemas to namespaces which have been used to define meta data. write_meshdata (`bool`) – whether to save mesh-related data such as element identifiers, ownership etc. This is mainly useful for debugging. time (`float`) – the timestamp to save within the file, seperate to metadata cycle (`int`) – the cycle (or timestep) of the data
  Note: | All data objects have to be defined on the same domain. They may not be in the same `FunctionSpace` but not all combinations of `FunctionSpace` s can be written to a single VTK file. Typically, data on the boundary and on the interior cannot be mixed.

`esys.weipa.` `saveVoxet`(filename, **data)

  Writes `Data` objects to a file using the GOCAD Voxet file format as separate properties on the same grid. At the moment only Data on a `ripley` domain can be saved in this format. Note that this function will produce one header file (ending in .vo) and a separate property file for each `Data` object.

  Parameters: | filename (`str`) – name of the output file (‘.vo’ is added if required)
  Note: | All data objects have to be defined on the same ripley domain and either defined on reduced Function or on a `FunctionSpace` that allows interpolation to reduced Function.

`esys.weipa.` `visitInitialize`((str)simFile[, (str)comment='']) → bool

`esys.weipa.` `visitPublishData`((EscriptDataset)dataset) → bool

## Others

- HAVE_TVTK

## Packages