class DeformStructureTransformation(AbstractTransformation): """ This transformation deforms a structure by a deformation gradient matrix Args: deformation (array): deformation gradient for the transformation """ def __init__(self, deformation): self.deformation = Deformation(deformation) def apply_transformation(self, structure): return self.deformation.apply_to_structure(structure) def __str__(self): return "DeformStructureTransformation : " + \ "Deformation = {}".format(str(self.deformation.tolist())) def __repr__(self): return self.__str__() @property def inverse(self): return DeformStructureTransformation(self.deformation.inv()) @property def is_one_to_many(self): return False def as_dict(self): return {"name": self.__class__.__name__, "version": __version__, "init_args": {"deformation": self.deformation.tolist()}, "@module": self.__class__.__module__, "@class": self.__class__.__name__}
class DeformStructureTransformation(AbstractTransformation): """ This transformation deforms a structure by a deformation gradient matrix Args: deformation (array): deformation gradient for the transformation """ def __init__(self, deformation=((1, 0, 0), (0, 1, 0), (0, 0, 1))): self._deform = Deformation(deformation) self.deformation = self._deform.tolist() def apply_transformation(self, structure): return self._deform.apply_to_structure(structure) def __str__(self): return "DeformStructureTransformation : " + \ "Deformation = {}".format(str(self.deformation)) def __repr__(self): return self.__str__() @property def inverse(self): return DeformStructureTransformation(self._deform.inv()) @property def is_one_to_many(self): return False
class DeformStructureTransformation(AbstractTransformation): """ This transformation deforms a structure by a deformation gradient matrix """ def __init__(self, deformation=((1, 0, 0), (0, 1, 0), (0, 0, 1))): """ Args: deformation (array): deformation gradient for the transformation """ self._deform = Deformation(deformation) self.deformation = self._deform.tolist() def apply_transformation(self, structure): """ Apply the transformation. Args: structure (Structure): Input Structure Returns: Deformed Structure. """ return self._deform.apply_to_structure(structure) def __str__(self): return f"DeformStructureTransformation : Deformation = {self.deformation}" def __repr__(self): return self.__str__() @property def inverse(self): """ Returns: Inverse Transformation. """ return DeformStructureTransformation(self._deform.inv) @property def is_one_to_many(self): """ Returns: False """ return False