freepooma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Finish/clean Div.UR.h


From: Jeffrey D. Oldham
Subject: Re: [PATCH] Finish/clean Div.UR.h
Date: Thu, 15 Jul 2004 15:57:15 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Debian/1.6-5

Richard Guenther wrote:

Finishes (DivCellToVert) and cleans the Divergence operator implementation. Tested with only Div test. As I was in the neighbourhood.

Ok?

Richard.


2004Jul15  Richard Guenther <address@hidden>

    * src/Field/DiffOps/Div.h: adjust documentation.
    src/Field/DiffOps/Div.UR.h: implement DivCellToVert,
    clean implementation.


  template<class F>
  inline OutputElement_t
  operator()(const F &f, int i1, int i2) const
  {
-    return 0.5 *
-      (fact_m(0) *
-       (f(i1 + 1, i2    )(0) - f(i1    , i2    )(0) +
-       f(i1 + 1, i2 + 1)(0) - f(i1    , i2 + 1)(0)
-       ) +
-       fact_m(1) *
-       (f(i1    , i2 + 1)(1) - f(i1    , i2    )(1) +
-       f(i1 + 1, i2 + 1)(1) - f(i1 + 1, i2    )(1)
-       )
-       );
+    return OutputElement_t
+      (fact_m(0) * (f.read(i1+1, i2)(0) - f.read(i1, i2)(0))
+       + fact_m(1) * (f.read(i1, i2+1)(1) - f.read(i1, i2)(1)));
  }
Yes, this is a good patch. For the operator()s, I suggest placing the + at the end of lines rather than at the beginning of the next line. Doing so will vertically align the addends, easing reading.

--
Jeffrey D. Oldham
address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]