<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class="">Dear all,</div>
<div class="">I am working on a molecular dynamics code using Vc for vectorisation - obviously.</div>
<div class="">the core of the problem is an outer loop (over all atoms), and an inner loop over all neighbours of the atom of the outer loop. The inner loop is vectorised (using Vc) and computes a force from a potential. The potential varies, depending on the
 nature of the problem, but the inner loop is always the same. I want to obtain a generic code for the outer and inner loop in which the potential can be passed in as a pointer to a (vectorised) function (or functor) or a template parameter for that function.
 how should i pass the vector arguments to a function?</div>
<div class="">by  value?</div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(147, 26, 104);" class="">
<span style="color: #000000" class="">    </span>inline</div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
    Vc::<span style="color: #006141" class="">Vector</span><<span style="color: #785841" class="">float</span>,<span style="color: #785841" class="">Abi</span>></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
    lj_force_factor2</div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
      ( Vc::<span style="color: #006141" class="">Vector</span><<span style="color: #785841" class="">float</span>,<span style="color: #785841" class="">Abi</span>> r2
<span style="color: #4e9072" class="">// squared distance</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
      ) {…}</div>
<div class="">
<div class="">by  const value?</div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(147, 26, 104);" class="">
<span style="color: rgb(0, 0, 0);" class="">    </span>inline</div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
    Vc::<span style="color: rgb(0, 97, 65);" class="">Vector</span><<span style="color: rgb(120, 88, 65);" class="">float</span>,<span style="color: rgb(120, 88, 65);" class="">Abi</span>></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
    lj_force_factor2</div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
      ( Vc::<span style="color: rgb(0, 97, 65);" class="">Vector</span><<font color="#785841" class="">float</font>,<span style="color: rgb(120, 88, 65);" class="">Abi</span>> r2 <span style="color: rgb(78, 144, 114);" class="">// squared distance</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
      ) {…}</div>
</div>
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">by  reference?</div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(147, 26, 104);" class="">
<span style="color: rgb(0, 0, 0);" class="">    </span>inlined</div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
    Vc::<span style="color: rgb(0, 97, 65);" class="">Vector</span><<span style="color: rgb(120, 88, 65);" class="">float</span>,<span style="color: rgb(120, 88, 65);" class="">Abi</span>></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
    lj_force_factor2</div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
      ( Vc::<span style="color: rgb(0, 97, 65);" class="">Vector</span><<font color="#785841" class="">float</font>,<span style="color: rgb(120, 88, 65);" class="">Abi</span>>& r2 <span style="color: rgb(78, 144, 114);" class="">// squared distance</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
      ) {…}</div>
</div>
</div>
</div>
</div>
<div class="">
<div class="">
<div class="">by  reference?</div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(147, 26, 104);" class="">
<span style="color: rgb(0, 0, 0);" class="">    </span>inlined</div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
    Vc::<span style="color: rgb(0, 97, 65);" class="">Vector</span><<span style="color: rgb(120, 88, 65);" class="">float</span>,<span style="color: rgb(120, 88, 65);" class="">Abi</span>></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
    lj_force_factor2</div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
      ( Vc::<span style="color: rgb(0, 97, 65);" class="">Vector</span><<font color="#785841" class="">float</font>,<span style="color: rgb(120, 88, 65);" class="">Abi</span>> const& r2 <span style="color: rgb(78, 144, 114);" class="">// squared distance</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
      ) {…}</div>
</div>
</div>
<div class="">thanks for your advice in advance and kindest regards,</div>
<div class=""><br class="">
</div>
<div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class="">Dr [Engel]bert Tijskens<br class="">
HPC Analyst/Consultant<br class="">
<br class="">
Flemish Supercomputer Center<span class="Apple-tab-span" style="white-space: pre;">
</span><a href="http://vscentrum.be" class="">vscentrum.be</a> <br class="">
HPC core facility CalcUA<span class="Apple-tab-span" style="white-space: pre;"> </span>
<span class="Apple-tab-span" style="white-space: pre;"></span><a href="http://uantwerp.be/calcua" class="">uantwerp.be/calcua</a><br class="">
Computational mathematics<span class="Apple-tab-span" style="white-space: pre;"> </span>
<span class="Apple-tab-span" style="white-space: pre;"></span><a href="http://www.uantwerpen.be/en/rg/cma" class="">www.uantwerpen.be/en/rg/cma</a><br class="">
<br class="">
University of Antwerp <br class="">
Middelheimlaan1 G.309, B-2020 Antwerp, Belgium<br class="">
<br class="">
<a href="mailto:engelbert.tijskens@uantwerpen.be" class="">engelbert.tijskens@uantwerpen.be</a><br class="">
++32 3 265 3879</div>
</div>
</div>
<br class="">
</body>
</html>