Trying to understand the particle replacement tutorial API
This is a new post because the logic is different here i am no longer using custom property here unlike my old question
So i am trying to understand the particle replacement API where i have a chain of fibers forming my implementation is working for one particular diameter
Please tell me if this is the sequence that API follows
I have a separate factory called create particle it will create one particle here say it generates 4 particles
First the control comes to
CReplacementFactory.cpp -> CReplacementFactory::createParticle
This function will create a list called as ParticleList once this function is executed a list will be ready that will have the information of the particle chain template i am trying to create.
Next the control flows to CRemoval.cpp->CRemoval::externalForce
In this if the conditions of the if statement are met m_particleManager will mark the particles of interest
Now the flow will move to
CRemoval::processParticleOfInterest
where it will create the new particle cluster and generate the particles in this function then remove the old particle.
If this is the sequence
Now i am trying a different logic I am creating the particle type as type 2 when i create the particle itself in the particle factory. And the good thing is in the debugger i see that a new particle was created in CReplacementFactory.cpp and also in the CRemoval.cpp but when the execution completes the second particle does not get populated. I have defined it as a particle made of same material. I even tried calling it as different material even that did not work (note i defined all interactions)
in your API of particle replacement what i cant understand is this what is the purpose of this function?
in the Cremove:external force, i have changed this
And also in the new type i can see the new bead type name appear
But it is not processing the new type why would this happen? please let me know
Answers
-
Hi Shyam,
With regard to the process the tutorial goes through it's not quite what you describe as processParticleOfInterest doesn't generate the particle, only stores the information in a list.- The code starts and the Particle_Cluster_Data.txt and Particle_Replacement_prefs.txt file information is read via the Setup functions, this doesn't happen during processing but on loading the model into the Creator.
- Simulation processing starts and the CreateParticle function is called and checks if ParticleList is non-zero in size. Initially it will be empty so does nothing.
- externalForce is called and checks if we are at the specified time (if not the factory and body force just do nothing until this is the case). On reaching the time point the specified particle type as read from the .txt file is marked as particle of interest
- processParticleOfInterest is called still as part of externalForce and writes all the marked particle information to the array newPart which is then written to the array ParticleList and then removes the particle. It does not create any particles at this point in time.
- Time moves forward a time-step and CreateParticle is called, if ParticleList is non-zero it creates the cluster of particles based on the info read from the .txt file and stored info from ParticleList
- After this point the body force will be called but will do nothing and consequently the factory next time-step will also be called but do nothing.
Get particleParameterData is related to passing information between CPU and GPU, I'd work on CPU implementation initially before getting the code to work on GPU also. But basically it's taking the name of the particle we want to replace and changing it to an integer (because CUDA GPU doesn't support strings), then passing this integer to the GPU code.
When you say it's not processing the new particle type how do you mean? Is any information been written to the newPart array, is the factory called next time-step to check the array size?
Regards
Stephen
1 -
ohh interesting this simplifies a lot more than what i expected. So based on the sequence you explained i am now able to generate two different fibers without using custom property.
But please tell me this
I think what you explained above is called a sequence flow in any typical object-oriented programming context. Is it possible to generate that sequence flow inside Visual Studio? or have you documented that anywhere?
Because what I cannot understand is in CRemoval.cpp you are not calling this function anywhere processParticleOfInterest.
I am still not sure how to control is flowing to this function. If there is any way of generating this sequence flow by myself it will help me a lot for the example API models put in the forum.
Please let me know.
0 -
Stephen Cole_21117 said:
Hi Shyam,
With regard to the process the tutorial goes through it's not quite what you describe as processParticleOfInterest doesn't generate the particle, only stores the information in a list.- The code starts and the Particle_Cluster_Data.txt and Particle_Replacement_prefs.txt file information is read via the Setup functions, this doesn't happen during processing but on loading the model into the Creator.
- Simulation processing starts and the CreateParticle function is called and checks if ParticleList is non-zero in size. Initially it will be empty so does nothing.
- externalForce is called and checks if we are at the specified time (if not the factory and body force just do nothing until this is the case). On reaching the time point the specified particle type as read from the .txt file is marked as particle of interest
- processParticleOfInterest is called still as part of externalForce and writes all the marked particle information to the array newPart which is then written to the array ParticleList and then removes the particle. It does not create any particles at this point in time.
- Time moves forward a time-step and CreateParticle is called, if ParticleList is non-zero it creates the cluster of particles based on the info read from the .txt file and stored info from ParticleList
- After this point the body force will be called but will do nothing and consequently the factory next time-step will also be called but do nothing.
Get particleParameterData is related to passing information between CPU and GPU, I'd work on CPU implementation initially before getting the code to work on GPU also. But basically it's taking the name of the particle we want to replace and changing it to an integer (because CUDA GPU doesn't support strings), then passing this integer to the GPU code.
When you say it's not processing the new particle type how do you mean? Is any information been written to the newPart array, is the factory called next time-step to check the array size?
Regards
Stephen
Hey Can you please explain the role of bonding time? In which of the above 6 steps bonding time will come into play (bonding v2 )
this is what I understand
at step 3 the particle is marked for replacement (simulation Time = t3) and at step 4 particles will be replaced with fiber (simulation Time = t4).
let us say (bonding time = tb , specified in particle prefs file)
bonding will happen for this time duration tb which means simulation time has to reach (t4+tb)
Please let me know if this understanding is correct or what is the correct interpretation
0