[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203
Stephane Popinet
s.popinet at niwa.co.nz
Fri May 15 02:51:58 UTC 2009
The following commit has been merged in the upstream branch:
commit 3a5a94a1ea5072c7b1165da9535e2f0ee49d7591
Author: Stephane Popinet <s.popinet at niwa.co.nz>
Date: Mon Jun 13 15:41:49 2005 +1000
New macro ftt_vector_norm()
darcs-hash:20050613054149-fbd8f-df165bc5d6e1019b92e9f6d057bc2fd1dba07020.gz
diff --git a/src/ftt.h b/src/ftt.h
index 202789e..bef9cef 100644
--- a/src/ftt.h
+++ b/src/ftt.h
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <string.h>
+#include <math.h>
#include <glib.h>
#include <gts.h>
@@ -50,6 +51,12 @@ struct _FttVector {
gdouble x, y, z;
};
+#if FTT_2D
+# define ftt_vector_norm(v) (sqrt((v)->x*(v)->x + (v)->y*(v)->y))
+#else /* 3D */
+# define ftt_vector_norm(v) (sqrt((v)->x*(v)->x + (v)->y*(v)->y + (v)->z*(v)->z))
+#endif /* 3D */
+
typedef enum
{
FTT_TRAVERSE_LEAFS = 1 << 0,
diff --git a/src/utils.c b/src/utils.c
index a7e3559..0b5e9c4 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -63,7 +63,7 @@ static gdouble cell_solid_area (FttCell * cell)
{
FttVector n;
gfs_solid_normal (cell, &n);
- return sqrt (n.x*n.x + n.y*n.y + n.z*n.z);
+ return ftt_vector_norm (&n);
}
GfsDerivedVariable gfs_derived_variable[] = {
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list