Exemplo n.º 1
0
    def config_changed(self, update_parent=True):
        """ Calculate and save our unit conversion factor.
        """
        super(UnitConversionPComp, self).config_changed(update_parent)

        src = PhysicalQuantity(1.0, self._srcunits)
        target = self._meta['out0'].get('units')
        src.convert_to_unit(target)
        self.grad = src.get_value()
Exemplo n.º 2
0
    def ensure_init(self):
        """Make sure our inputs and outputs have been
        initialized.
        """
        super(UnitConversionPComp, self).ensure_init()

        src    = PhysicalQuantity(1.0, self._srcunits)
        target = self._meta['out0'].get('units')
        src.convert_to_unit(target)
        self.grad = src.get_value()
Exemplo n.º 3
0
    def ensure_init(self):
        """Make sure our inputs and outputs have been
        initialized.
        """
        super(UnitConversionPComp, self).ensure_init()

        src = PhysicalQuantity(1.0, self._srcunits)
        target = self._meta['out0'].get('units')
        src.convert_to_unit(target)
        self.grad = src.get_value()