[pooma-dev] Re: [PATCH] Fix some of Particle - Field interaction

Jeffrey D. Oldham oldham at codesourcery.com
Wed Jul 14 15:16:25 UTC 2004


Richard Guenther wrote:

>On Tue, 13 Jul 2004, Jeffrey D. Oldham wrote:
>
>  
>
>>Richard Guenther wrote:
>>
>>    
>>
>>>Inspired by the simplicity of some of the fixes by Roman Krylov I ran
>>>over the interpolate.cpp particle test and tried to make it compile.
>>>The following patch makes that and also makes it pass (by pure luck).
>>>The only transformation I'm not sure about is
>>>  Geometry::indexPoint() -> Mesh::vertexPosition()
>>>Maybe one of the former developers can comment.
>>>
>>>I also needed to introduce setExternalGuards() which implementation
>>>may not be optimal.  But well, better than before.
>>>
>>>Tested particles with no regressions, interpolation now passing.
>>>
>>>Ok?
>>>      
>>>
>>Yes, it's good progress.  I appreciate Krylov's and your work on this.
>>Please see the questions below.
>>There's no need to send replies before committing.
>>
>>Somewhere in the patch, an 'Interpolater' template parameter was added,
>>but I did not see its use within the structure.
>>    
>>
>
>Hm.  This may be a misreading of the patch by you.  Can you point at the
>context?
>  
>
It's hard to tell from this patch fragment if Interpolator is actually 
used in PTraits, but I do not see any used in the next few subsequent 
patch fragments.  (What is the correct terminology for one piece of a 
patch?)

===== Particles/tests/interpolate.cpp 1.2 vs edited =====
--- 1.2/r2/src/Particles/tests/interpolate.cpp    2004-01-07 09:54:08 +01:00
+++ edited/Particles/tests/interpolate.cpp    2004-07-11 16:34:38 +02:00
@@ -47,7 +47,7 @@
 // A traits class for a Particles object
 //-----------------------------------------------------------------------------
 
-template <class EngineTag, class Center, class Mesh, class FL,
+template <class EngineTag, class Mesh, class FL,
           class Interpolator>
 struct PTraits
 {

>>>@@ -328,8 +317,8 @@
>>>               << sum(chargeDensity)
>>>	       << std::endl;
>>>  tester.check("chargeDensity(NGP,attrib) == numparticles",
>>>-               abs(sum(chargeDensity) -
>>>-                   static_cast<double>(createnum))<1.0e-5);
>>>+               fabs(sum(chargeDensity) -
>>>+		    static_cast<double>(createnum))<1.0e-5);
>>>
>>>
>>>
>>>      
>>>
>>In C++, std::abs is overloaded to mean std::fabs.  In other words, the
>>language designers finally get it right.
>>    
>>
>
>Of course, but it used ::abs which causes compile-time warnings of
>implicitly casting from double -> int, so I changed it to fabs - but I'll
>happily change it to std::abs if anyone cares.
>  
>
Either abs or fabs is fine.

-- 
Jeffrey D. Oldham
oldham at codesourcery.com





More information about the pooma-dev mailing list