# SimPEG.maps.SurjectUnits#

class SimPEG.maps.SurjectUnits(indices, **kwargs)[source]#

Surjective mapping to all mesh cells.

Let $$\mathbf{m}$$ be a model that contains a physical property value for nP geological units. SurjectUnits is used to construct a surjective mapping that projects $$\mathbf{m}$$ to the set of voxel cells defining a mesh. As a result, the mapping $$\mathbf{u(\mathbf{m})}$$ is defined as a projection matrix $$\mathbf{P}$$ acting on the model. Thus:

$\mathbf{u}(\mathbf{m}) = \mathbf{Pm}$

The mapping therefore has dimensions (mesh.nC, nP).

Parameters
indices(nP) list of (mesh.nC) numpy.ndarray

Each entry in the list is a boolean numpy.ndarray of length mesh.nC that assigns the corresponding physical property value to the appropriate mesh cells.

Examples

For this example, we have a model that defines the property values for two units. Using SurjectUnit, we construct the mapping from the model to a 1D mesh where the 1st unit’s value is assigned to all cells whose centers are located at x < 0 and the 2nd unit’s value is assigned to all cells whose centers are located at x > 0.

>>> from SimPEG.maps import SurjectUnits
>>> from discretize import TensorMesh
>>> import numpy as np

>>> nP = 8
>>> mesh = TensorMesh([np.ones(nP)], 'C')
>>> unit_1_ind = mesh.cell_centers < 0

>>> indices_list = [unit_1_ind, ~unit_1_ind]
>>> mapping = SurjectUnits(indices_list, nP=nP)

>>> m = np.r_[0.01, 0.05]
>>> mapping * m
array([0.01, 0.01, 0.01, 0.01, 0.05, 0.05, 0.05, 0.05])


Attributes

 P Projection matrix from model parameters to mesh cells. indices List assigning a given physical property to specific model cells. nP Number of parameters the mapping acts on. shape Dimensions of the mapping

Methods

 deriv(m[, v]) Derivative of the mapping with respect to the input parameters.

Maps: ComboMaps

Maps: ComboMaps