Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91069112
compute_interaction.hh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Nov 7, 13:25
Size
1 KB
Mime Type
text/x-c++
Expires
Sat, Nov 9, 13:25 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22159758
Attached To
R9482 SP4E_Homework_Ashtari_Sieber
compute_interaction.hh
View Options
#ifndef __COMPUTE_INTERACTION__HH__
#define __COMPUTE_INTERACTION__HH__
/* -------------------------------------------------------------------------- */
#include "compute.hh"
//! Base class for interaction computation
class
ComputeInteraction
:
public
Compute
{
public
:
//! Apply a functor on all particle pairs
template
<
typename
Functor
>
void
applyOnPairs
(
Functor
func
,
System
&
system
);
};
/* -------------------------------------------------------------------------- */
/* Template implementation */
/* -------------------------------------------------------------------------- */
template
<
typename
Functor
>
void
ComputeInteraction
::
applyOnPairs
(
Functor
func
,
System
&
system
)
{
UInt
size
=
system
.
getNbParticles
();
for
(
UInt
p1
=
0
;
p1
<
size
;
++
p1
)
{
Particle
&
par1
=
system
.
getParticle
(
p1
);
for
(
UInt
p2
=
p1
+
1
;
p2
<
size
;
++
p2
)
{
Particle
&
par2
=
system
.
getParticle
(
p2
);
func
(
par1
,
par2
);
}
}
}
/* -------------------------------------------------------------------------- */
#endif
//__COMPUTE_INTERACTION__HH__
Event Timeline
Log In to Comment