:py:mod:`bempp.api.grid.io` =========================== .. py:module:: bempp.api.grid.io .. autoapi-nested-parse:: Routines for import and export. Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: bempp.api.grid.io.import_grid bempp.api.grid.io.export bempp.api.grid.io._transform_array .. py:function:: import_grid(filename) Import a grid. This routine uses the meshio library to export grids. A number of types are supported, including vtk, vtu, gmsh, dolphin xml. For a full list see https://github.com/nschloe/meshio .. py:function:: export(filename, grid=None, grid_function=None, data_type=None, transformation=None, write_binary=True) Export grids and grid functions. This method internally uses the meshio library. For a full list of supported data types see https://github.com/nschloe/meshio Note that export of domain indices is only possible for Gmsh (.msh) format files. Parameters ---------- filename : string The name of the file to write out. The data type is chosen based on the file ending. grid : Grid object A grid object to export. grid_function : GridFunction object Grid function to export data_type : string Either 'node' for vertex data or 'element' for data at element centers. transformation : string or callable One of 'real', 'imag', 'abs', 'log_abs', None or a callable object. Transforms the data on input. A callable must return numpy arrays with the same number of dimensions as the input. If transformation is None the data is not modified. write_binary : Boolean Use binary format (write_binary=True) for the data if supported by the file format. .. py:function:: _transform_array(a, mode=None) Transform a data array. Parameters ---------- a : np.ndarray Either a scalar array or a two dimensional data array. mode : string, callable or None One of 'real', 'imag', 'abs', 'log_abs', 'abs_squared', a transformation callable or None. The callable needs to take an input array of dimension 2 and return an array of dimension 2. If mode is None the input array is not modified.