import sys
import math
import posix

from orbit.lattice import AccLattice, AccNode, AccActionsContainer

lattice = AccLattice("test_lattice")

elem1 = AccNode("el-1")
elem2 = AccNode("el-2")
elem3 = AccNode("el-3")

elem1.setLength(1.1)
elem2.setLength(2.1)
elem3.setLength(3.1)

lattice.addNode(elem1)
lattice.addNode(elem2)
lattice.addNode(elem3)

elem1_1 = AccNode("el-1-1")
elem1_1.setnParts(2)
elem1_1_1 = AccNode("el-1-1-1")
elem1_1_2 = AccNode("el-1-1-2")
elem1_1_3 = AccNode("el-1-1-3")
elem1_1_4 = AccNode("el-1-1-4")

elem1.addChildNode(elem1_1, AccNode.ENTRANCE)
elem1_1.addChildNode(elem1_1_1, AccNode.ENTRANCE)
elem1_1.addChildNode(elem1_1_2, AccNode.BODY, 0)
elem1_1.addChildNode(elem1_1_3, AccNode.BODY, 1)
Esempio n. 2
0
import sys
import math
import posix

from orbit.lattice import AccLattice, AccNode, AccActionsContainer

lattice = AccLattice("test_lattice")

elem1 = AccNode("el-1")
elem2 = AccNode("el-2")
elem3 = AccNode("el-3")

elem1.setLength(1.1)
elem2.setLength(2.1)
elem3.setLength(3.1)

lattice.addNode(elem1)
lattice.addNode(elem2)
lattice.addNode(elem3)

elem1_1 = AccNode("el-1-1")
elem1_1.setnParts(2)
elem1_1_1 = AccNode("el-1-1-1")
elem1_1_2 = AccNode("el-1-1-2")
elem1_1_3 = AccNode("el-1-1-3")
elem1_1_4 = AccNode("el-1-1-4")

elem1.addChildNode(elem1_1,AccNode.ENTRANCE)
elem1_1.addChildNode(elem1_1_1,AccNode.ENTRANCE)
elem1_1.addChildNode(elem1_1_2,AccNode.BODY,0)
elem1_1.addChildNode(elem1_1_3,AccNode.BODY,1)
Esempio n. 3
0
	txt += os.linesep
	for node in accNode.getChildNodes(AccNode.EXIT):
		txt = printAccNodeStructure(node,txt,txt_shift + txt_shift_local*2)			
	txt += txt_shift + txt_shift_local + "==== END of AccNode = " + accNode.getName()	
	txt += os.linesep
	return txt

print "============== INITIAL NODE STRUCTURE ============="

accNode = AccNode("test_node")
accNode.setnParts(5)

L = 0.
nParts = accNode.getnParts()
for ind in range(nParts):
	accNode.setLength(ind+1.0,ind)
	L += accNode.getLength(ind)
accNode.setLength(L)
for ind in range(nParts):
	accNode.setLength(ind+1.0,ind)
	L += accNode.getLength(ind)

accNode.addChildNode(AccNode("chEntrn0"),AccNode.ENTRANCE)
accNode.addChildNode(AccNode("chEntrn1"),AccNode.ENTRANCE)
accNode.addChildNode(AccNode("chEntrn2"),AccNode.ENTRANCE)

accNode.addChildNode(AccNode("chExit0"),AccNode.EXIT)
accNode.addChildNode(AccNode("chExit1"),AccNode.EXIT)
accNode.addChildNode(AccNode("chExit2"),AccNode.EXIT)

accNode.initialize()