Esempio n. 1
0
#geometry.addCircle( (-0.5, -0.5), 0.25  )
geometry.addCircle( (  0.,   0.), radius )
geometry.addLine( (-0.5,  0), (-1, 0), type=1 ) #type: 1->Periodic, 0->Real
geometry.addLine( ( 0,  0.5), ( 0, 1), type=1 )
geometry.addLine( ( 0.5,  0), ( 1, 0), type=1 )
geometry.addLine( ( 0, -0.5), ( 0,-1), type=1 )
nCircles, circlesCaract_h, nLines, linesCaract_h = geometry.prepareCUDA( cudaP=cudaP )

if usingAnimation:
  pAnim.nPoints = nParticles
  pAnim.viewXmin, pAnim.viewXmax = -2500., 2500.
  pAnim.viewYmin, pAnim.viewYmax = -2500., 2500.
  pAnim.viewZmin, pAnim.viewZmax = -1, 1
  pAnim.showGrid = True
  pAnim.nPointsPerCircle = 50
  pAnim.cirPos, pAnim.cirCol, pAnim.nCirclesGrid = geometry.circlesGrid( radius, -30., 30., -20., 20., nPoints=pAnim.nPointsPerCircle)

###########################################################################
###########################################################################
#Initialize and select CUDA device
if usingAnimation: 
  pAnim.initGL()
  pAnim.CUDA_initialized = True
  configAnimation()
cudaDev = setCudaDevice( devN = devN, usingAnimation = usingAnimation )

#Read and compile CUDA code
print "\nCompiling CUDA code\n"
codeFiles = [ "vector2D.h", "circle.h", "line.h", "cudaBillar.cu"]
for fileName in codeFiles:
  codeString = open(fileName, "r").read().replace("cudaP", cudaP)