def load(self, path, parameters=TTI3D, prefix='', suffix=''): dict = Container() nproc = self.mesh_properties.nproc for iproc in range(nproc): for key in parameters: key = prefix + key + suffix dict[key] = self.io.read_slice(path, key, iproc) if parameters == TTI3D: dict.map(self.forward, nproc) return dict
def split(self, m, parameters=[]): """ Converts model from vector to dictionary representation """ nproc = self.mesh_properties.nproc ngll = self.mesh_properties.ngll model = Container() for idim, key in enumerate(parameters or self.parameters): model[key] = [] for iproc in range(nproc): imin = sum(ngll) * idim + sum(ngll[:iproc]) imax = sum(ngll) * idim + sum(ngll[:iproc + 1]) model[key] += [m[imin:imax]] return model
def load(self, path, parameters=['vp', 'vs', 'rho'], prefix='', suffix=''): """ Reads isotropic elastic model """ dict = Container() nproc = self.mesh_properties.nproc for iproc in range(nproc): for key in parameters: key = prefix + key + suffix dict[key] = self.io.read_slice(path, key, iproc) if parameters == ['vp', 'vs', 'rho']: dict.map(self.forward, nproc) return dict
def load(self, path, parameters=VOIGT2D, prefix='', suffix=''): """ Reads fully anisotropic 2D model """ dict = Container() nproc = self.mesh_properties.nproc for iproc in range(nproc): for key in parameters: key = prefix + key + suffix dict[key] = self.io.read_slice(path, key, iproc) if parameters == VOIGT2D: dict.map(self.forward, nproc) return dict
def load(self, path, parameters=[], prefix='', suffix=''): """ Loads SPECFEM2D/3D models or kernels :input path :: directory from which model is read :input parameters :: list of material parameters to be read (if empty, defaults to self.parameters) :input prefix :: optional filename prefix :input suffix :: optional filename suffix, eg '_kernel' :output dict :: model or kernels indexed by material parameter and processor rank, ie dict[parameter][iproc] """ dict = Container() for iproc in range(self.mesh_properties.nproc): for key in parameters or self.parameters: dict[key] += self.io.read_slice(path, prefix + key + suffix, iproc) return dict