New question #684115 on Yade:
https://answers.launchpad.net/yade/+question/684115

Hi. Now i am studying the source code of FrictPhys.cpp. I am confused about 
some concepts even after i check the programmer manual.  My questions are 
mainly about these codes, 

1. const shared_ptr<FrictMat>& mat1 = YADE_PTR_CAST<FrictMat>(b1); 

     1.1  Is the shared_ptr<FrictMat> a template class and will instantiate a 
pointer to FricMat? I have checked the definition of shared_ptr but it is too 
complicated for a c++ newer to understand. 

     1.2  The YADE_PTR_CAST will do change the b1 type to FrictMat? But if b1 
is not a pointer to FrictMat, like a CohFrictMat, will it cause a material type 
mismatch between the particle material and the IPhysFunctor?   
  
2. Ra=sphCont->refR1>0?sphCont->refR1:sphCont->refR2; 
Rb=sphCont->refR2>0?sphCont->refR2:sphCont->refR1;
    
    2.1  The Ra, Rb here are the stiffness related particle size?  Why these 
two values could be negative? 
 
3. interaction->phys = shared_ptr<FrictPhys>(new FrictPhys());  
    const shared_ptr<FrictPhys>& contactPhysics = 
YADE_PTR_CAST<FrictPhys>(interaction->phys);
    contactPhysics->kn = Kn;   contactPhysics->ks = Ks;

    3.1 Also the conversion of interaction->phys to FrictPhy type. Another is 
that since the reference  contactPhysics has decoration of const, why it is 
able to change the value of its pointing memory?  

4. Real Kn = (!kn) ? 2*kna*knb/(kna+knb) : (*kn)(mat1->id,mat2->id,kna,knb);

    4.1 I understand the true part of this expression. What does the false part 
means? (*kn) is a function?  

Thanks for your patience to look through all my questions. 

Xuesong  

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

_______________________________________________
Mailing list: https://launchpad.net/~yade-users
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp

Reply via email to