[cig-commits] commit: Add equation as a VC and make it the default

Mercurial hg at geodynamics.org
Wed Nov 9 00:55:08 PST 2011


changeset:   632:35b60e73d3f0
user:        Walter Landry <wlandry at caltech.edu>
date:        Wed Nov 09 00:54:23 2011 -0800
files:       Swarm/src/SwarmShapeVC.cxx Utils/src/AllElementsVC.cxx Utils/src/AllNodesVC.cxx Utils/src/CornerVC.cxx Utils/src/InnerWallVC.cxx Utils/src/MeshShapeVC.cxx Utils/src/Utils.h Utils/src/WallVC.cxx
description:
Add equation as a VC and make it the default


diff -r b590952e873d -r 35b60e73d3f0 Swarm/src/SwarmShapeVC.cxx
--- a/Swarm/src/SwarmShapeVC.cxx	Wed Nov 09 00:52:31 2011 -0800
+++ b/Swarm/src/SwarmShapeVC.cxx	Wed Nov 09 00:54:23 2011 -0800
@@ -223,6 +223,10 @@ void _SwarmShapeVC_Print(void* variableC
 				case VC_ValueType_CFIndex:
 					Journal_Printf( stream, "\t\t\t\ttype: VC_ValueType_CFIndex\n");
 					Journal_Printf( stream, "\t\t\t\tasCFIndex: %u\n", self->_entryTbl[entry_I].value.as.typeCFIndex);
+					break;
+				case VC_ValueType_Equation:
+					Journal_Printf( stream, "\t\t\t\ttype: VC_ValueType_Equation\n");
+					Journal_Printf( stream, "\t\t\t\tasEquation: %s\n", self->_entryTbl[entry_I].value.as.equation);
 					break;
 			}
 		}
@@ -382,7 +386,15 @@ void _SwarmShapeVC_ReadDictionary( void*
 				Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"name") );
 				
 			valType = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"type") );
-			if (0 == strcasecmp(valType, "func")) {
+			if (strlen(valType)==0 || 0==strcasecmp(valType, "equation"))
+                          {
+                            self->_entryTbl[entry_I].value.type = VC_ValueType_Equation;
+                            /* This leaks memory */
+                            self->_entryTbl[entry_I].value.as.equation=
+                              StG_Strdup(Dictionary_Entry_Value_AsString(valueEntry));
+                          }
+			else if (0 == strcasecmp(valType, "func"))
+                          {
 				char*	funcName = Dictionary_Entry_Value_AsString(valueEntry);
 				Index	cfIndex;
 				
@@ -402,7 +414,7 @@ void _SwarmShapeVC_ReadDictionary( void*
 					assert(0);
 				}	
 				self->_entryTbl[entry_I].value.as.typeCFIndex = cfIndex;
-			}
+                          }
 			else if (0 == strcasecmp(valType, "array"))
 			{
 				Dictionary_Entry_Value*	valueElement;
@@ -443,12 +455,8 @@ void _SwarmShapeVC_ReadDictionary( void*
 				self->_entryTbl[entry_I].value.as.typePtr = (void*) ( (ArithPointer)Dictionary_Entry_Value_AsUnsignedInt( valueEntry ));
 			}
 			else {
-				/* Assume double */
-				Journal_DPrintf( 
-					Journal_Register( InfoStream_Type, (Name)"myStream"  ), 
-					"Type to variable on variable condition not given, assuming double\n" );
-				self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
-				self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
+                          Journal_Firewall(False,Journal_Register(Error_Type,SwarmShapeVC_Type),
+                                           "Unknown type for SwarmShapeVC: %s\n",valType);
 			}
 		}
 	}
diff -r b590952e873d -r 35b60e73d3f0 Utils/src/AllElementsVC.cxx
--- a/Utils/src/AllElementsVC.cxx	Wed Nov 09 00:52:31 2011 -0800
+++ b/Utils/src/AllElementsVC.cxx	Wed Nov 09 00:54:23 2011 -0800
@@ -168,7 +168,15 @@ void _AllElementsVC_ReadDictionary( void
 				
 			valType = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"type") );
 
-			if (0 == strcasecmp(valType, "func")) {
+			if (strlen(valType)==0 || 0==strcasecmp(valType, "equation"))
+                          {
+                            self->_entryTbl[entry_I].value.type = VC_ValueType_Equation;
+                            /* This leaks memory */
+                            self->_entryTbl[entry_I].value.as.equation=
+                              StG_Strdup(Dictionary_Entry_Value_AsString(valueEntry));
+                          }
+			else if (0 == strcasecmp(valType, "func"))
+                          {
 				char*	funcName = Dictionary_Entry_Value_AsString(valueEntry);
 				Index	cfIndex;
 				
@@ -226,12 +234,8 @@ void _AllElementsVC_ReadDictionary( void
 				self->_entryTbl[entry_I].value.as.typePtr = (void*)((ArithPointer)Dictionary_Entry_Value_AsUnsignedInt( valueEntry ));
 			}
 			else {
-				/* Assume double */
-				Journal_DPrintf( 
-					Journal_Register( InfoStream_Type, (Name)"myStream"  ), 
-					"Type to variable on variable condition not given, assuming double\n" );
-				self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
-				self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
+                          Journal_Firewall(False,Journal_Register(Error_Type,AllElementsVC_Type),
+                                           "Unknown type for AllElementsVC: %s\n",valType);
 			}
 		}
 	}
@@ -330,6 +334,10 @@ void _AllElementsVC_Print( void* allElem
 					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_CFIndex\n");
 					Journal_Printf( info, "\t\t\t\tasCFIndex: %u\n", self->_entryTbl[entry_I].value.as.typeCFIndex);
 					break;
+				case VC_ValueType_Equation:
+					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Equation\n");
+					Journal_Printf( info, "\t\t\t\tasEquation: %s\n", self->_entryTbl[entry_I].value.as.equation);
+					break;
 			}
 		}
 	}
diff -r b590952e873d -r 35b60e73d3f0 Utils/src/AllNodesVC.cxx
--- a/Utils/src/AllNodesVC.cxx	Wed Nov 09 00:52:31 2011 -0800
+++ b/Utils/src/AllNodesVC.cxx	Wed Nov 09 00:54:23 2011 -0800
@@ -171,7 +171,15 @@ void _AllNodesVC_ReadDictionary( void* v
 				
 			valType = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"type") );
 
-			if (0 == strcasecmp(valType, "func")) {
+			if (strlen(valType)==0 || 0==strcasecmp(valType, "equation"))
+                          {
+                            self->_entryTbl[entry_I].value.type = VC_ValueType_Equation;
+                            /* This leaks memory */
+                            self->_entryTbl[entry_I].value.as.equation=
+                              StG_Strdup(Dictionary_Entry_Value_AsString(valueEntry));
+                          }
+			else if (0 == strcasecmp(valType, "func"))
+                          {
 				char*	funcName = Dictionary_Entry_Value_AsString(valueEntry);
 				Index	cfIndex;
 				
@@ -192,7 +200,7 @@ void _AllNodesVC_ReadDictionary( void* v
 					assert(0);
 				}	
 				self->_entryTbl[entry_I].value.as.typeCFIndex = cfIndex;
-			}	
+                          }	
 			else if (!strcasecmp(valType, "array")) {
 				Dictionary_Entry_Value*	valueElement;
 				Index			i;
@@ -229,12 +237,8 @@ void _AllNodesVC_ReadDictionary( void* v
 				self->_entryTbl[entry_I].value.as.typePtr = (void*) ((ArithPointer)Dictionary_Entry_Value_AsUnsignedInt( valueEntry ));
 			}
 			else {
-				/* Assume double */
-				Journal_Printf( 
-					Journal_Register( InfoStream_Type, (Name)"myStream"  ), 
-					"Type to variable on variable condition not given, assuming double\n" );
-				self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
-				self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
+                          Journal_Firewall(False,Journal_Register(Error_Type,AllNodesVC_Type),
+                                           "Unknown type for AllNodesVC: %s\n",valType);
 			}
 		}
 	}
@@ -333,6 +337,10 @@ void _AllNodesVC_Print( void* allNodesVC
 					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_CFIndex\n");
 					Journal_Printf( info, "\t\t\t\tasCFIndex: %u\n", self->_entryTbl[entry_I].value.as.typeCFIndex);
 					break;
+				case VC_ValueType_Equation:
+					Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Equation\n");
+					Journal_Printf( info, "\t\t\t\tasEquation: %s\n", self->_entryTbl[entry_I].value.as.equation);
+					break;
 			}
 		}
 	
diff -r b590952e873d -r 35b60e73d3f0 Utils/src/CornerVC.cxx
--- a/Utils/src/CornerVC.cxx	Wed Nov 09 00:52:31 2011 -0800
+++ b/Utils/src/CornerVC.cxx	Wed Nov 09 00:54:23 2011 -0800
@@ -208,7 +208,15 @@ void _CornerVC_ReadDictionary( void* var
 				
 			valType = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"type") );
 
-			if (0 == strcasecmp(valType, "func")) {
+			if (strlen(valType)==0 || 0==strcasecmp(valType, "equation"))
+                          {
+                            self->_entryTbl[entry_I].value.type = VC_ValueType_Equation;
+                            /* This leaks memory */
+                            self->_entryTbl[entry_I].value.as.equation=
+                              StG_Strdup(Dictionary_Entry_Value_AsString(valueEntry));
+                          }
+			else if (0 == strcasecmp(valType, "func"))
+                          {
 				char*	funcName = Dictionary_Entry_Value_AsString(valueEntry);
 				Index	cfIndex;
 				
@@ -229,7 +237,7 @@ void _CornerVC_ReadDictionary( void* var
 					assert(0);
 				}	
 				self->_entryTbl[entry_I].value.as.typeCFIndex = cfIndex;
-			}
+                          }
 			else if (0 == strcasecmp(valType, "array")) {
 				Dictionary_Entry_Value*	valueElement;
 				Index							i;
@@ -267,12 +275,8 @@ void _CornerVC_ReadDictionary( void* var
 				self->_entryTbl[entry_I].value.as.typePtr = (void*) ( (ArithPointer)Dictionary_Entry_Value_AsUnsignedInt( valueEntry ));
 			}
 			else {
-				/* Assume double */
-				Journal_DPrintf( 
-					Journal_Register( InfoStream_Type, (Name)"myStream"  ), 
-					"Type to variable on variable condition not given, assuming double\n" );
-					self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
-					self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
+                          Journal_Firewall(False,Journal_Register(Error_Type,CornerVC_Type),
+                                           "Unknown type for CornerVC: %s\n",valType);
 			}
 		}
 	}
@@ -375,6 +379,10 @@ void _CornerVC_Print(void* cornerVC, Str
 	       Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_CFIndex\n");
 	       Journal_Printf( info, "\t\t\t\tasCFIndex: %u\n", self->_entryTbl[entry_I].value.as.typeCFIndex);
 	       break;
+         case VC_ValueType_Equation:
+           Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Equation\n");
+           Journal_Printf( info, "\t\t\t\tasEquation: %s\n", self->_entryTbl[entry_I].value.as.equation);
+           break;
 	 }
       }
    Journal_Printf( info, "\t_mesh (ptr): %p\n", self->_mesh);
diff -r b590952e873d -r 35b60e73d3f0 Utils/src/InnerWallVC.cxx
--- a/Utils/src/InnerWallVC.cxx	Wed Nov 09 00:52:31 2011 -0800
+++ b/Utils/src/InnerWallVC.cxx	Wed Nov 09 00:54:23 2011 -0800
@@ -206,7 +206,14 @@ void _InnerWallVC_ReadDictionary( void* 
 				Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"name") );
 				
 			valType = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"type") );
-			if (0 == strcasecmp(valType, "func"))
+			if (strlen(valType)==0 || 0==strcasecmp(valType, "equation"))
+			{
+                          self->_entryTbl[entry_I].value.type = VC_ValueType_Equation;
+                          /* This leaks memory */
+                          self->_entryTbl[entry_I].value.as.equation=
+                            StG_Strdup(Dictionary_Entry_Value_AsString(valueEntry));
+                        }
+			else if (0 == strcasecmp(valType, "func"))
 			{
 				char*	funcName = Dictionary_Entry_Value_AsString(valueEntry);
 				Index	cfIndex;
@@ -268,12 +275,8 @@ void _InnerWallVC_ReadDictionary( void* 
 				self->_entryTbl[entry_I].value.as.typePtr = (void*) ( (ArithPointer)Dictionary_Entry_Value_AsUnsignedInt( valueEntry ));
 			}
 			else {
-				/* Assume double */
-				Journal_DPrintf( 
-					Journal_Register( InfoStream_Type, (Name)"myStream"  ), 
-					"Type to variable on variable condition not given, assuming double\n" );
-				self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
-				self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
+                          Journal_Firewall(False,Journal_Register(Error_Type,InnerWallVC_Type),
+                                           "Unknown type for InnerWallVC: %s\n",valType);
 			}
 		}
 	}
@@ -377,6 +380,10 @@ void _InnerWallVC_Print(void* innerWallV
 				Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_CFIndex\n");
 				Journal_Printf( info, "\t\t\t\tasCFIndex: %u\n", self->_entryTbl[entry_I].value.as.typeCFIndex);
 				break;
+                        case VC_ValueType_Equation:
+                          Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Equation\n");
+                          Journal_Printf( info, "\t\t\t\tasEquation: %s\n", self->_entryTbl[entry_I].value.as.equation);
+                          break;
 			}
 		}
 	Journal_Printf( info, "\t_mesh (ptr): %p\n", self->_mesh);
diff -r b590952e873d -r 35b60e73d3f0 Utils/src/MeshShapeVC.cxx
--- a/Utils/src/MeshShapeVC.cxx	Wed Nov 09 00:52:31 2011 -0800
+++ b/Utils/src/MeshShapeVC.cxx	Wed Nov 09 00:54:23 2011 -0800
@@ -220,6 +220,10 @@ void _MeshShapeVC_Print(void* variableCo
 					Journal_Printf( stream, "\t\t\t\ttype: VC_ValueType_CFIndex\n");
 					Journal_Printf( stream, "\t\t\t\tasCFIndex: %u\n", self->_entryTbl[entry_I].value.as.typeCFIndex);
 					break;
+				case VC_ValueType_Equation:
+					Journal_Printf( stream, "\t\t\t\ttype: VC_ValueType_Equation\n");
+					Journal_Printf( stream, "\t\t\t\tasEquation: %s\n", self->_entryTbl[entry_I].value.as.equation);
+					break;
 			}
 		}
 	}
@@ -338,7 +342,15 @@ void _MeshShapeVC_ReadDictionary( void* 
 				Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"name") );
 				
 			valType = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"type") );
-			if (0 == strcasecmp(valType, "func")) {
+			if (strlen(valType)==0 || 0==strcasecmp(valType, "equation"))
+                          {
+                            self->_entryTbl[entry_I].value.type = VC_ValueType_Equation;
+                            /* This leaks memory */
+                            self->_entryTbl[entry_I].value.as.equation=
+                              StG_Strdup(Dictionary_Entry_Value_AsString(valueEntry));
+                          }
+			else if (0 == strcasecmp(valType, "func"))
+                          {
 				char*	funcName = Dictionary_Entry_Value_AsString(valueEntry);
 				Index	cfIndex;
 				
@@ -358,7 +370,7 @@ void _MeshShapeVC_ReadDictionary( void* 
 					assert(0);
 				}	
 				self->_entryTbl[entry_I].value.as.typeCFIndex = cfIndex;
-			}
+                          }
 			else if (0 == strcasecmp(valType, "array"))
 			{
 				Dictionary_Entry_Value*	valueElement;
@@ -399,12 +411,8 @@ void _MeshShapeVC_ReadDictionary( void* 
 				self->_entryTbl[entry_I].value.as.typePtr = (void*) ( (ArithPointer)Dictionary_Entry_Value_AsUnsignedInt( valueEntry ));
 			}
 			else {
-				/* Assume double */
-				Journal_DPrintf( 
-					Journal_Register( InfoStream_Type, (Name)"myStream"  ), 
-					"Type to variable on variable condition not given, assuming double\n" );
-				self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
-				self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
+                          Journal_Firewall(False,Journal_Register(Error_Type,MeshShapeVC_Type),
+                                           "Unknown type for MeshShapeVC: %s\n",valType);
 			}
 		}
 	}
diff -r b590952e873d -r 35b60e73d3f0 Utils/src/Utils.h
--- a/Utils/src/Utils.h	Wed Nov 09 00:52:31 2011 -0800
+++ b/Utils/src/Utils.h	Wed Nov 09 00:54:23 2011 -0800
@@ -78,5 +78,6 @@
 */
 	#include "Init.h"
 	#include "Finalise.h"
+        #include "Equation.h"
 	
 #endif /* __StgDomain_Utils_Utils_h__ */
diff -r b590952e873d -r 35b60e73d3f0 Utils/src/WallVC.cxx
--- a/Utils/src/WallVC.cxx	Wed Nov 09 00:52:31 2011 -0800
+++ b/Utils/src/WallVC.cxx	Wed Nov 09 00:54:23 2011 -0800
@@ -203,7 +203,14 @@ void _WallVC_ReadDictionary( void* varia
 				Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"name") );
 				
 			valType = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember( varDictListVal, (Dictionary_Entry_Key)"type") );
-			if (0 == strcasecmp(valType, "func"))
+			if (strlen(valType)==0 || 0==strcasecmp(valType, "equation"))
+			{
+                          self->_entryTbl[entry_I].value.type = VC_ValueType_Equation;
+                          /* This leaks memory */
+                          self->_entryTbl[entry_I].value.as.equation=
+                            StG_Strdup(Dictionary_Entry_Value_AsString(valueEntry));
+                        }
+			else if (0 == strcasecmp(valType, "func"))
 			{
 				char*	funcName = Dictionary_Entry_Value_AsString(valueEntry);
 				Index	cfIndex;
@@ -265,12 +272,8 @@ void _WallVC_ReadDictionary( void* varia
 				self->_entryTbl[entry_I].value.as.typePtr = (void*) ( (ArithPointer)Dictionary_Entry_Value_AsUnsignedInt( valueEntry ));
 			}
 			else {
-				/* Assume double */
-				Journal_DPrintf( 
-					Journal_Register( InfoStream_Type, (Name)"myStream"  ), 
-					"Type to variable on variable condition not given, assuming double\n" );
-				self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
-				self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
+                          Journal_Firewall(False,Journal_Register(Error_Type,WallVC_Type),
+                                           "Unknown type for WallVC: %s\n",valType);
 			}
 		}
 	}
@@ -374,6 +377,10 @@ void _WallVC_Print(void* wallVC, Stream*
 				Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_CFIndex\n");
 				Journal_Printf( info, "\t\t\t\tasCFIndex: %u\n", self->_entryTbl[entry_I].value.as.typeCFIndex);
 				break;
+                        case VC_ValueType_Equation:
+                          Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Equation\n");
+                          Journal_Printf( info, "\t\t\t\tasEquation: %s\n", self->_entryTbl[entry_I].value.as.equation);
+                          break;
 			}
 		}
 	Journal_Printf( info, "\t_mesh (ptr): %p\n", self->_mesh);



More information about the CIG-COMMITS mailing list