[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203
Stephane Popinet
popinet at users.sf.net
Fri May 15 02:53:33 UTC 2009
The following commit has been merged in the upstream branch:
commit 39a17645f99fd62b7f14feac90131e0faa7d5375
Author: Stephane Popinet <popinet at users.sf.net>
Date: Mon Jan 30 20:40:57 2006 +1100
VariableFiltered uses K8 smoothing kernel
darcs-hash:20060130094057-d4795-ecbe3300566ea109999d41d6699a88df9b55c95d.gz
diff --git a/src/variable.c b/src/variable.c
index ba82cc2..c0e54b4 100644
--- a/src/variable.c
+++ b/src/variable.c
@@ -396,15 +396,56 @@ static void filter (FttCell * cell, gpointer * data)
GFS_VARIABLE (cell, b->i) = val/(4*(FTT_DIMENSION - 1));
}
+static void K8 (FttCell * cell, gpointer * data)
+{
+ GfsVariable * a = data[0];
+ gdouble * w = data[2], * eps = data[4], * val = data[5];
+ FttVector * c = data[3], p;
+ gdouble r2, eps2 = (*eps)*(*eps);
+
+ ftt_cell_pos (cell, &p);
+ r2 = ((p.x - c->x)*(p.x - c->x) +
+ (p.y - c->y)*(p.y - c->y) +
+ (p.z - c->z)*(p.z - c->z));
+ if (r2 < eps2) {
+ gdouble w1 = (1. - r2/eps2);
+
+ w1 = w1*w1*w1*w1;
+ *val += w1*GFS_VARIABLE (cell, a->i);
+ *w += w1;
+ }
+}
+
+static void filter_K8 (FttCell * cell, gpointer * data)
+{
+ GfsVariable * a = data[0];
+ GfsVariable * b = data[1];
+ FttVector p;
+ gdouble w = 0., eps = 2./32., val = 0.;
+ GtsBBox bb;
+
+ ftt_cell_pos (cell, &p);
+ bb.x1 = p.x - eps; bb.y1 = p.y - eps; bb.z1 = p.z - eps;
+ bb.x2 = p.x + eps; bb.y2 = p.y + eps; bb.z2 = p.z + eps;
+ data[2] = &w;
+ data[3] = &p;
+ data[4] = &eps;
+ data[5] = &val;
+ gfs_domain_cell_traverse_box (a->domain, &bb, FTT_PRE_ORDER, FTT_TRAVERSE_LEAFS, -1,
+ (FttCellTraverseFunc) K8, data);
+ g_assert (w > 0.);
+ GFS_VARIABLE (cell, b->i) = val/w;
+}
+
static void variable_filtered_event_half (GfsEvent * event, GfsSimulation * sim)
{
guint n, niter = GFS_VARIABLE_FILTERED (event)->niter - 1;
- gpointer data[2];
+ gpointer data[6];
data[0] = GFS_VARIABLE_FILTERED (event)->v;
data[1] = event;
gfs_domain_cell_traverse (GFS_DOMAIN (sim), FTT_PRE_ORDER, FTT_TRAVERSE_LEAFS, -1,
- (FttCellTraverseFunc) filter, data);
+ (FttCellTraverseFunc) filter_K8, data);
gfs_domain_copy_bc (GFS_DOMAIN (sim), FTT_TRAVERSE_LEAFS, -1, data[0], data[1]);
if (niter > 0) {
data[0] = event;
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list