def __init__(self, Nb = 0, Dim = 3, s = 1):
		"""Set aside the needed memory to handle the fiber."""
		
		Fiber.__init__(self, Nb, Dim)
		
		self.Tether = self.X.copy()
		self.s = s
    def __init__(self, Nb=0, Dim=3, s=1):
        """Set aside the needed memory to handle the fiber."""

        Fiber.__init__(self, Nb, Dim)

        self.Tether = self.X.copy()
        self.s = s
	def __init__(self, fluid, N=0, Dim=2, Mask=None, Groups=3):
		"""N is the number of fiber points to create along one length of the fluid domain."""

		self.fluid = fluid
		
		Fiber.__init__(self, N**2, Dim = Dim)

		h = fluid.dims / N

		self.GroupStartIndices = GroupStartIndices = [0]
		
		GroupWidth = N / Groups
		if GroupWidth == 0:
			GroupWidth = Groups = 1
		NumOfBigGroups = N % Groups # The remainder is the number of groups that must be one column wider
			
		index = 0
		EndOfGroup = GroupWidth
		CurGroup = 0
		for j in range(N):
			# Check to see if we need to start a new group
			if j == EndOfGroup:
				CurGroup += 1
				GroupStartIndices.append(index)
				
				# Calculate the ending index of the new group
				if CurGroup < Groups - NumOfBigGroups:
					EndOfGroup += GroupWidth
				else:
					EndOfGroup += GroupWidth + 1				
			
			# Loop through all the points in this column
			for k in range(N):
				# Calculate the physical position of the current point
				x, y = (j + .5) * h[0], (k + .5) * h[1]
				
				# Check to see if the point is masked
				if Mask != None:
					n, m = int(x / fluid.h[0]), int(y / fluid.h[1])
					if Mask[n,m] != 0:
						continue				
				
				self.X[index,:] = [x, y]
				
				index += 1
				
		GroupStartIndices.append(index)
		self.Groups = Groups
				
		hold = self.X
		Fiber.__init__(self, index, Dim = Dim)
		self.X = hold[:self.Nb]
    def __init__(self, fluid, N=0, Dim=2, Mask=None, Groups=3):
        """N is the number of fiber points to create along one length of the fluid domain."""

        self.fluid = fluid

        Fiber.__init__(self, N**2, Dim=Dim)

        h = fluid.dims / N

        self.GroupStartIndices = GroupStartIndices = [0]

        GroupWidth = N / Groups
        if GroupWidth == 0:
            GroupWidth = Groups = 1
        NumOfBigGroups = N % Groups  # The remainder is the number of groups that must be one column wider

        index = 0
        EndOfGroup = GroupWidth
        CurGroup = 0
        for j in range(N):
            # Check to see if we need to start a new group
            if j == EndOfGroup:
                CurGroup += 1
                GroupStartIndices.append(index)

                # Calculate the ending index of the new group
                if CurGroup < Groups - NumOfBigGroups:
                    EndOfGroup += GroupWidth
                else:
                    EndOfGroup += GroupWidth + 1

            # Loop through all the points in this column
            for k in range(N):
                # Calculate the physical position of the current point
                x, y = (j + .5) * h[0], (k + .5) * h[1]

                # Check to see if the point is masked
                if Mask != None:
                    n, m = int(x / fluid.h[0]), int(y / fluid.h[1])
                    if Mask[n, m] != 0:
                        continue

                self.X[index, :] = [x, y]

                index += 1

        GroupStartIndices.append(index)
        self.Groups = Groups

        hold = self.X
        Fiber.__init__(self, index, Dim=Dim)
        self.X = hold[:self.Nb]
Example #5
0
	def __init__(self, Nb, s, c, p1, p2, Dim = 2):
		"""Initialize an ellipsoidal fiber.
				
		Nb is the number of fiber points.
		s is a stiffness constant.
		
		c is the center.
		p1, p2 are the endpoints of the semimajor and minor axis."""
		
		Fiber.__init__(self, Nb, Dim)
		
		self.s = s
		
		self.MakeEllipse(c, p1, p2)
Example #6
0
    def __init__(self, id, cross_section):
        self.k_section = None
        self.f_section_resist = None
        self.total_deformation = np.zeros((2, 1))
        self.total_force = np.zeros((2, 1))
        self.id = id
        self.cross_section = cross_section
        self.fibers = np.empty(cross_section.no_of_fibers, dtype=Fiber)
        fiber_height = cross_section.height / cross_section.no_of_fibers

        for fiber_id in range(cross_section.no_of_fibers):
            y = fiber_height * (cross_section.no_of_fibers - 1 - 2 * fiber_id) / 2
            # y = fiber_height * (1 - (1/cross_section.no_of_fibers) - 2 * (fiber_id/cross_section.no_of_fibers)) / 2
            fiber = Fiber(fiber_id, y, cross_section.width, fiber_height, cross_section.material_id)
            self.fibers.put(fiber_id, fiber)