where is the class of TmplParticle defined?

Asked by Kan

hi,

I see a lot of code like:
template <typename TmplParticle> .....
or
template <class TmplParticle> ....

but I did not find where is the class class TmplParticle defined,
can you tell me in which file and what is the class defined .

thanks.

ken

Question information

Language:
English Edit question
Status:
Answered
For:
ESyS-Particle Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
SteffenAbe (s-abe) said :
#1

TmplParticle is just a template parameter, i.e. a placeholder (for details on C++ templates see for example B. Stroustrup, "The C++ Programming Language" 3rd ed. p. 327ff). In short, the is no such thing as a "TmplParticle" - its replaced by a real class name when the template is instantiated.
For example the class to store dynamically created interactions is defined as template<typename P,typename I> class ParallelInteractionStorage_ED where P and I are the template parameters (see file pis/pi_storage_ed.h). Specifically I is the particular type of Interaction which is stored. In the TSubLattice class (see function TSubLattice<T>::doAddPIG(...) in file Parallel/SubLattice.hpp) a number of ParallelInteractionStorage_ED instances with different template parameters are created, i.e. the call " new_pis=new ParallelInteractionStorage_ED<T,CFrictionInteraction>(m_ppa,figp)" creates an object of type ParallelInteractionStorage_ED where the parameter "I" in the declaration is replaced by "CFrictionInteraction" and so on.

Can you help with this problem?

Provide an answer of your own, or ask Kan for more information if necessary.

To post a message you must log in.