Go to www.awrcorp.com
Back to search page Click to download printable version of this guide. Particles: Properties

Starting from an analyst.IParticles object you can access the number of particles via the SizeParticles() function and individual particles (see analyst.IParticle) via the GetParticle function. Most of the functions in the analyst.IParticle interface are self-explanatory but below is a simple example that prints out many of the details of a set of particles. This script is valid for both steady state and time domain particles and can produce massive output if fed a large amount of particle data.

          Particles_1 = ParticleAnnotation_1.GetParticles()
          ParticleScalars_1 = ParticleAnnotation_1.GetParticleScalars()
          ParticleVectors_1 = ParticleAnnotation_1.GetParticleVectors()
          NumParticles = Particles_1.SizeParticles()
          print ("Number of Particles: {0}".format(NumParticles))
          for i in range(0, NumParticles):
            p = Particles_1.GetParticle(i)
            print ("*************************")
            print ("Particle Index {0}".format(i))
            print ("Birth Index = {0}".format(p.GetBirthIndex()))
            print ("Primary Birth Index = {0}".format(p.GetPrimaryBirthIndex()))
            print ("Species Index = {0}".format(p.GetSpecieIndex()))
            print ("Type Index = {0}".format(p.GetTypeIndex()))
            print ("Generation Index = {0}".format(p.GetGenerationIndex()))
            print ("Species Label = {0}".format(Particles_1.GetSpecie(p.GetSpecieIndex())))
            print ("Type Label = {0}".format(Particles_1.GetType(p.GetTypeIndex())))
            print ("Generation Label = {0}".format(Particles_1.GetGeneration(p.GetGenerationIndex())))
            print ("Number of Knots = {0}".format(p.SizeKnots()))
            print ("=================")	
            NumKnots = p.SizeKnots()
            for j in range(0, NumKnots):
            	loc = p.GetPosition(j) # get all knots
            	print ("Knot {0} Position = {1}".format(j, loc))
            	if ParticleVectors_1 != None:
            		print ("Knot {0} Vectors = {1}".format(j, ParticleVectors_1.GetValue(p, j)))
            	if ParticleScalars_1 != None:
            		print ("Knot {0} Scalars = {1}".format(j, ParticleScalars_1.GetValue(p, j)))
            print ("=================")	
          print ("*************************")

Please send email to awr.support@cadence.com if you would like to provide feedback on this article. Please make sure to include the article link in the email.

Legal and Trademark Notice