Example #1
0
 def _propagate(self, inputs):
     if self.propagateInvalid and None in inputs:
         new = (None,)*len(self.output)
     else:
         inputs = [x for x in inputs if x is not None]
         new = self.process(*inputs)
         assert(len(self.output)==len(new))
         new = tuple(join(oldv, newv) for oldv, newv in zip(self.output, new))
     return new
Example #2
0
 def _propagate(self, inputs):
     if self.propagateInvalid and None in inputs:
         new = (None, ) * len(self.output)
     else:
         inputs = [x for x in inputs if x is not None]
         new = self.process(*inputs)
         assert (len(self.output) == len(new))
         new = tuple(
             join(oldv, newv) for oldv, newv in zip(self.output, new))
     return new
Example #3
0
    def update(self):
        if not self.sources:
            return False

        inputs = [node.output[key] for node,key in self.sources]
        if self.propagateInvalid and None in inputs:
            new = [None]*len(self.output)
        else:
            inputs = [x for x in inputs if x is not None]
            new = self.process(*inputs)
            new = [(None if newv is None else join(oldv, newv)) for oldv, newv in zip(self.output, new)]

        if new != self.output:
            self.output = new
            self.itercount += 1
            return True
        return False
Example #4
0
def noClad(dopant, N, diameter, lightL, darkL, ll):
    generator = components.SolarGenerator(params.solarIrradiance, ll, vector3.new(0, -1, 0), vector3.new(2*diameter, 0, 0), vector3.new(0, 0, lightL), origin=vector3.new(-2*diameter/2, diameter+1e-5, 0));

    cint1 = constraints.Interval(0, lightL+darkL);
    cint2 = constraints.Cylinder(diameter/2);
    cint3 = constraints.join(cint1, cint2);
    #cint4 = constraints.Interval(-math.inf, 0, axis=1);
    collector = components.Collector(interphases.PlaneInterphase(vector3.new(0, 0, 1), origin=vector3.new(0, 0, lightL+darkL)), len(ll), cint=cint2);
    cmp1 = components.Refractor(interphases.CylinderInterphase(diameter/2), "air", "PMMA", ll, cint=cint1);
    cmp2 = components.Attenuation("PMMA", ll, cint=cint3);
    cmp3 = components.DyeDopant("Rh6G", 1.5e22, ll, cint=cint3);
    #cmp4 = components.Mirror(interphases.PlaneInterphase(vector3.new(0, 1, 0), origin=vector3.new(0, -diameter/2-1e-6, 0)));
    #cmp4 = components.Mirror(interphases.ParabolaInterphase(3*diameter/4, origin=vector3.new(0, -diameter/2-1e-6, 0)));
    #cmp4 = components.Mirror(interphases.CylinderInterphase(diameter), cint=cint4);
    #cmp5 = components.Mirror(interphases.PlaneInterphase(vector3.new(0, 0, 1)), cint=cint2);
    #cmpList = [collector, cmp1, cmp2, cmp3, cmp4, cmp5];
    cmpList = [collector, cmp1, cmp2, cmp3];

    return generator, collector, cmpList;