def __init__(self, curr=I, dim=d, pos=(0.0, 0.0, 0.0), angle=0.0, axis=(0.0, 0.0, 1.0)): # inherit class lineCurrent # - pos, Mrot, MrotInv, curr # - moveBy, rotateBy LineCurrent.__init__(self, pos, angle, axis, curr) # secure input type and check input format of dim assert dim >= 0, 'Bad input dimension' self.dimension = float(dim)
def __init__(self, curr=I, vertices=listOfPos, pos=(0.0, 0.0, 0.0), angle=0.0, axis=(0.0, 0.0, 1.0)): # inherit class lineCurrent # - pos, Mrot, MrotInv, curr # - moveBy, rotateBy LineCurrent.__init__(self, pos, angle, axis, curr) # secure input type and check input format of dim assert isinstance(vertices, list) or isinstance( vertices, ndarray), 'Line Current: enter a list of position vertices - Ex: Line(vertices=[(1,2,3),(3,2,1)])' assert all(isinstance(pos, tuple) or isinstance(pos, list) or isinstance(pos, ndarray) for pos in vertices), 'Line-current: Input position (3D) tuples or lists within the list - Ex: Line(vertices=[(1,2,3),(3,2,1)])' assert all(len( d) == 3 for d in vertices), 'Line-current: Bad input dimension, vectors in list must be 3D' self.vertices = array(vertices, dtype=float64, copy=False)