示例#1
0
    # growthParameters[3,:3] = -0.02,-0.12,0.06	
		
    # growthParameters[4,:3] = 0.18,0.23,0.06
    # growthParameters[5,:3] = 0.19,0.14,0.05
    # growthParameters[6,:3] = -0.13,-0.03,0.04
    # growthParameters[7,:3] = -0.02,-0.12,0.06	

    # growthParameters[8,:3] = 0.18,0.23,0.06
    # growthParameters[9,:3] = 0.19,0.14,0.05
    # growthParameters[10,:3] = -0.13,-0.03,0.04
    # growthParameters[11,:3] = -0.02,-0.12,0.06	

    # growthParameters[0:4,3:]=0.0
    # growthParameters[4:8,3:]=0.0
    # growthParameters[8:,3:]=0.0
    growthLogic = TubeGrower(circumferentialElements,axialElements,wallElements,discret,length,innerRadius,outerRadius,fixBottom,fixTop, DMBC,humphrey, neoHookean) # ,stage,division, layers)
    growthLogic.setupProblem()
    #filename = "HeartTubeGrowth_" + "Undeformed"
    #growthLogic.saveResults(filename)
    try:
        targetCoordinates = growthLogic.solveAndGetSurfaceDescriptors(growthParameters)
        #filename = "HeartTubeGrowth_" + "target"
        #filename = "HeartTubeGrowth_" + "deformed"
        #growthLogic.saveResults(filename)		
        result = {'nodePositions':targetCoordinates.tolist()}
    except Exception as e:
        result={'error':str(e)}
    print('POSResSTART\n%s\nPOSResEND'%json.dumps(result),file=sys.stderr)

# if __name__ == '__main__':
    # obj = TubeGrower(4,3,1,DMBC=True, humphrey = False, neoHookean=True)
示例#2
0
#from opencmiss.iron import iron

if __name__ == '__main__':
    data = json.load(sys.stdin)
    growthParameters = np.array(data['optmin'])
    circumferentialElements = 8
    axialElements = 8
    wallElements = 2
    discret = 10
    length = 2.0
    innerRadius = 1.5
    outerRadius = 2.0
    fixBottom = True
    fixTop = False
    stage = 2

    growthLogic = TubeGrower(circumferentialElements, axialElements,
                             wallElements, discret, length, innerRadius,
                             outerRadius, fixBottom, fixTop, stage)
    growthLogic.setupProblem()

    # write out the files ...

    try:
        targetCoordinates = growthLogic.solveAndGetSurfaceDescriptors(
            growthParameters)
        result = {'nodePositions': targetCoordinates.tolist()}
    except Exception as e:
        result = {'error': str(e)}
    print('POSResSTART\n%s\nPOSResEND' % json.dumps(result), file=sys.stderr)