Example #1
0
	def addLine(self,v1,v2):
		
		
		"""Adds line from v1 to v2 to domain.

		:param v1:  Vertex object.
		:type v1: pyrw.geometry.vertex
		:param v2:  Vertex object.
		:type v2: pyrw.geometry.vertex
		:returns: pyrw.geometry.line -- line object
		
		"""
		
		if len(self.lines)==0:
			new_Id=0
		else:
			Ids=[]
			for e in self.lines:
				Ids.append(e.Id)
			new_Id=max(Ids)+1	
		
		e=RWgeo.line(self,v1,v2,new_Id)
		self.lines.append(e)
		self.edges.append(e)
		
		return e
Example #2
0
	def addArc(self,vstart,vcenter=None,vend=None,angle=None):
		
		"""Adds arc from vstart to vend around vcenter to domain.

		:param vstart:  Vertex object.
		:type vstart: pyrw.geometry.vertex
		:param vcenter:  Vertex object.
		:type vcenter: pyrw.geometry.vertex
		:param vend:  Vertex object.
		:type vend: pyrw.geometry.vertex
		:param angle: Angle.
		:type angle: float
		:returns: pyrw.geometry.arc -- arc object
		
		"""
		
		if len(self.arcs)==0:
			new_Id=0
		else:
			Ids=[]
			for a in self.arcs:
				Ids.append(a.Id)
			new_Id=max(Ids)+1
		a=RWgeo.arc(self,vstart,vcenter,new_Id,vend=vend,angle=angle)
		self.arcs.append(a)
		self.edges.append(a)
		
		return a
Example #3
0
    def addArc(self, vstart, vcenter=None, vend=None, angle=None):
        """Adds arc from vstart to vend around vcenter to domain.

		:param vstart:  Vertex object.
		:type vstart: pyrw.geometry.vertex
		:param vcenter:  Vertex object.
		:type vcenter: pyrw.geometry.vertex
		:param vend:  Vertex object.
		:type vend: pyrw.geometry.vertex
		:param angle: Angle.
		:type angle: float
		:returns: pyrw.geometry.arc -- arc object
		
		"""

        if len(self.arcs) == 0:
            new_Id = 0
        else:
            Ids = []
            for a in self.arcs:
                Ids.append(a.Id)
            new_Id = max(Ids) + 1
        a = RWgeo.arc(self, vstart, vcenter, new_Id, vend=vend, angle=angle)
        self.arcs.append(a)
        self.edges.append(a)

        return a
Example #4
0
    def addCircle(self, vcenter, radius, BC=""):
        """Adds circle around vcenter with r=radius to domain.

		:param vcenter:  Vertex object.
		:type vcenter: pyrw.geometry.vertex
		:param radius:  Radius of circle.
		:type radius: float
		:returns: pyrw.geometry.circle -- circle object
		"""

        c = RWgeo.circle(self, vcenter, radius)
        self.typ = 'circle'

        return c
Example #5
0
	def addCircle(self,vcenter,radius,BC=""):
		
		"""Adds circle around vcenter with r=radius to domain.

		:param vcenter:  Vertex object.
		:type vcenter: pyrw.geometry.vertex
		:param radius:  Radius of circle.
		:type radius: float
		:returns: pyrw.geometry.circle -- circle object
		"""
		
		c=RWgeo.circle(self,vcenter,radius)
		self.typ='circle'
			
		return c
Example #6
0
    def addRectangle(self, voffset, lenx, leny):
        """Adds rectangle with offset voffset and sidelengths lenx,leny to domain.

		:param voffset:  Vertex object.
		:type voffset: pyrw.geometry.vertex
		:param lenx:  Sidelength in x direction.
		:type lenx: float
		:param leny:  Sidelength in y direction.
		:type leny: float
		:returns: pyrw.geometry.rectangle -- rectangle object
		"""

        r = RWgeo.rectangle(self, voffset, lenx, leny)
        self.typ = 'poly'
        return r
Example #7
0
	def addRectangle(self,voffset,lenx,leny):
		
		"""Adds rectangle with offset voffset and sidelengths lenx,leny to domain.

		:param voffset:  Vertex object.
		:type voffset: pyrw.geometry.vertex
		:param lenx:  Sidelength in x direction.
		:type lenx: float
		:param leny:  Sidelength in y direction.
		:type leny: float
		:returns: pyrw.geometry.rectangle -- rectangle object
		"""
		
		r=RWgeo.rectangle(self,voffset,lenx,leny)
		self.typ='poly'
		return r
Example #8
0
    def addVertex(self, x):
        """Adds vertex to domain.

		:param x:  2D coordinate.
		:type x: pyrw.RWRW
		:returns: pyrw.geometry.vertex -- vertex object
		
		"""

        if len(self.vertices) == 0:
            new_Id = 0
        else:
            Ids = []
            for v in self.vertices:
                Ids.append(v.Id)
            new_Id = max(Ids) + 1

        v = RWgeo.vertex(self, x, new_Id)
        self.vertices.append(v)

        return v
Example #9
0
	def addVertex(self,x):
		
		"""Adds vertex to domain.

		:param x:  2D coordinate.
		:type x: pyrw.RWRW
		:returns: pyrw.geometry.vertex -- vertex object
		
		"""
			
		if len(self.vertices)==0:
			new_Id=0
		else:
			Ids=[]
			for v in self.vertices:
				Ids.append(v.Id)
			new_Id=max(Ids)+1	
		
		v=RWgeo.vertex(self,x,new_Id)
		self.vertices.append(v)	
		
		return v
Example #10
0
    def addLine(self, v1, v2):
        """Adds line from v1 to v2 to domain.

		:param v1:  Vertex object.
		:type v1: pyrw.geometry.vertex
		:param v2:  Vertex object.
		:type v2: pyrw.geometry.vertex
		:returns: pyrw.geometry.line -- line object
		
		"""

        if len(self.lines) == 0:
            new_Id = 0
        else:
            Ids = []
            for e in self.lines:
                Ids.append(e.Id)
            new_Id = max(Ids) + 1

        e = RWgeo.line(self, v1, v2, new_Id)
        self.lines.append(e)
        self.edges.append(e)

        return e