[cig-commits] commit: Figure out what the mesh is more reliably, especially when the temperature and velocity have different meshes
Mercurial
hg at geodynamics.org
Sat Nov 19 20:10:27 PST 2011
changeset: 820:b195ce531b45
tag: tip
user: Walter Landry <wlandry at caltech.edu>
date: Sat Nov 19 20:10:16 2011 -0800
files: Base/Context/src/ConditionFunction.cxx Base/Context/src/VariableCondition.cxx
description:
Figure out what the mesh is more reliably, especially when the temperature and velocity have different meshes
diff -r dce90f521d0d -r b195ce531b45 Base/Context/src/ConditionFunction.cxx
--- a/Base/Context/src/ConditionFunction.cxx Thu Nov 10 01:11:51 2011 -0800
+++ b/Base/Context/src/ConditionFunction.cxx Sat Nov 19 20:10:16 2011 -0800
@@ -177,10 +177,34 @@ void ConditionFunction_Apply(void* condi
void* _context, void* result)
{
FiniteElementContext *context=(FiniteElementContext*)_context;
- FeVariable *feVariable=(FeVariable*)FieldVariable_Register_GetByName
- (context->fieldVariable_Register, "VelocityField");
+ Mesh* mesh;
+ Variable* var=context->variable_Register->_variable[var_I];
+ if(Stg_Class_IsInstance(var,MeshVariable_Type))
+ {
+ mesh=((MeshVariable*)var)->mesh;
+ }
+ else
+ {
+ FeVariable *feVariable;
+ if(var->name==std::string("temperature"))
+ {
+ feVariable=(FeVariable*)
+ FieldVariable_Register_GetByName
+ (((FiniteElementContext*)context)
+ ->fieldVariable_Register,
+ "TemperatureField");
+ }
+ else
+ {
+ feVariable=(FeVariable*)
+ FieldVariable_Register_GetByName
+ (((FiniteElementContext*)context)
+ ->fieldVariable_Register,
+ "VelocityField");
+ }
+ mesh=(Mesh*)(feVariable->feMesh);
+ }
- FeMesh* mesh=feVariable->feMesh;
assert( mesh != NULL );
double* coord = Mesh_GetVertex( mesh, index );
ConditionFunction_Apply(conditionFunction,coord,context,result);
diff -r dce90f521d0d -r b195ce531b45 Base/Context/src/VariableCondition.cxx
--- a/Base/Context/src/VariableCondition.cxx Thu Nov 10 01:11:51 2011 -0800
+++ b/Base/Context/src/VariableCondition.cxx Sat Nov 19 20:10:16 2011 -0800
@@ -457,9 +457,32 @@ void VariableCondition_ApplyToIndex( voi
{
case VC_ValueType_Equation:
{
- FeVariable *feVariable=(FeVariable*)FieldVariable_Register_GetByName
- (((FiniteElementContext*)context)->fieldVariable_Register, "VelocityField");
- FeMesh* mesh=feVariable->feMesh;
+ Mesh* mesh;
+ if(Stg_Class_IsInstance(var,MeshVariable_Type))
+ {
+ mesh=((MeshVariable*)var)->mesh;
+ }
+ else
+ {
+ FeVariable *feVariable;
+ if(var->name==std::string("temperature"))
+ {
+ feVariable=(FeVariable*)
+ FieldVariable_Register_GetByName
+ (((FiniteElementContext*)context)
+ ->fieldVariable_Register,
+ "TemperatureField");
+ }
+ else
+ {
+ feVariable=(FeVariable*)
+ FieldVariable_Register_GetByName
+ (((FiniteElementContext*)context)
+ ->fieldVariable_Register,
+ "VelocityField");
+ }
+ mesh=(Mesh*)(feVariable->feMesh);
+ }
assert( mesh != NULL );
double* coord = Mesh_GetVertex( mesh, self->indexTbl[index] );
Variable_SetValueDouble(var,
More information about the CIG-COMMITS
mailing list