Text archives Help
- From: brownlee@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [Manta] r2254 - trunk/Model/Readers
- Date: Tue, 6 May 2008 16:23:54 -0600 (MDT)
Author: brownlee
Date: Tue May 6 16:23:54 2008
New Revision: 2254
Modified:
trunk/Model/Readers/UDAReader.cc
trunk/Model/Readers/UDAReader.h
Log:
added support for CCVariable:double
Modified: trunk/Model/Readers/UDAReader.cc
==============================================================================
--- trunk/Model/Readers/UDAReader.cc (original)
+++ trunk/Model/Readers/UDAReader.cc Tue May 6 16:23:54 2008
@@ -72,7 +72,7 @@
{
string name = string((const char*)xmlGetProp(t,(const
xmlChar*)"name"));
string type = string((const
char*)xmlGetProp(t,(const xmlChar*)"type"));
- if (type.find("float") != string::npos &&
type.find("CCVariable") != string::npos)
+ if ((type.find("double") != string::npos ||
type.find("float") != string::npos) && type.find("CCVariable") !=
string::npos)
_varHeaders[name] = VarHeader(name, "CCVariable",
"float");
}
t = t->next;
@@ -272,6 +272,11 @@
return *((float*)p);
}
+double UDAReader::readDouble(char* p)
+{
+ return *((double*)p);
+}
+
#define SWAP_2(u2)/* IronDoc macro to swap two byte quantity */ \
{ unsigned char* _p = (unsigned char*)(&(u2)); \
unsigned char _c = *_p; *_p = _p[1]; _p[1] = _c; }
@@ -493,6 +498,11 @@
value = readFloat(bufferP);
bufferP += sizeof(float);
}
+ if (var.dataType == doubleT)
+ {
+ value = readDouble(bufferP);
+ bufferP += sizeof(double);
+ }
(*(t.volume))(x,y,z) = value;
}
}
@@ -541,6 +551,8 @@
v.dataType = pointT;
else if (type.find("float") != string::npos)
v.dataType = floatT;
+ else if (type.find("double") != string::npos)
+ v.dataType = doubleT;
while (t != NULL)
{
if ((!xmlStrcmp(t->name, (const xmlChar*)"variable")))
Modified: trunk/Model/Readers/UDAReader.h
==============================================================================
--- trunk/Model/Readers/UDAReader.h (original)
+++ trunk/Model/Readers/UDAReader.h Tue May 6 16:23:54 2008
@@ -74,6 +74,7 @@
void readData(std::string filename, Timestep& t);
Vector readPoint(char* p);
float readFloat(char* p);
+ double readDouble(char* p);
std::map<std::string, VarHeader> _varHeaders;
};
- [Manta] r2254 - trunk/Model/Readers, brownlee, 05/06/2008
Archive powered by MHonArc 2.6.16.