[cig-commits] commit: Add ability to define new variables in HydrostaticTerm
Mercurial
hg at geodynamics.org
Tue May 17 13:07:02 PDT 2011
changeset: 421:0e5b02b5ce65
tag: tip
user: Walter Landry <wlandry at caltech.edu>
date: Tue May 17 13:05:33 2011 -0700
files: Utils/src/HydrostaticTerm.cxx
description:
Add ability to define new variables in HydrostaticTerm
diff -r c9b939865b8a -r 0e5b02b5ce65 Utils/src/HydrostaticTerm.cxx
--- a/Utils/src/HydrostaticTerm.cxx Sat May 14 20:52:35 2011 -0700
+++ b/Utils/src/HydrostaticTerm.cxx Tue May 17 13:05:33 2011 -0700
@@ -59,6 +59,7 @@
#include <assert.h>
#include <string.h>
+#include <list>
/* Textual name of this class */
const Type HydrostaticTerm_Type = "HydrostaticTerm";
@@ -349,6 +350,14 @@ double HydrostaticTerm_Temperature(void*
return T;
}
+mu::value_type* HydrostaticTerm_AddVariable(const mu::char_type *a_szName,
+ void *a_pUserData)
+{
+ static std::list<mu::value_type> variables;
+ variables.push_front(0);
+ return &(*(variables.begin()));
+}
+
double HydrostaticTerm_Density( void* forceTerm, Coord coord)
{
HydrostaticTerm *self=(HydrostaticTerm *)forceTerm;
@@ -359,6 +368,7 @@ double HydrostaticTerm_Density( void* fo
d.DefineVar("y", coord+1);
d.DefineVar("z", coord+2);
d.DefineVar("t", &(self->context->currentTime));
+ d.SetVarFactory(HydrostaticTerm_AddVariable, &d);
d.SetExpr(self->density_equation);
return d.Eval();
}
@@ -413,6 +423,7 @@ double HydrostaticTerm_Pressure( void* f
p.DefineVar("y", coord+1);
p.DefineVar("z", coord+2);
p.DefineVar("t", &(self->context->currentTime));
+ p.SetVarFactory(HydrostaticTerm_AddVariable, &p);
p.SetExpr(self->pressure_equation);
return p.Eval();
}
More information about the CIG-COMMITS
mailing list