char *getNumber(TokenizerT * tk, char* tmp, int charIndex){ while(isdigit(tk->str[tk->pindex])){ tmp[charIndex] = tk->str[tk->pindex]; charIndex++; tk->pindex++; } if(tk->str[tk->pindex] == '.' && isdigit(tk->str[tk->pindex + 1])){ // checks for float tmp[charIndex] = tk->str[tk->pindex]; charIndex++; tk->pindex++; tmp = getFloat(tk, tmp, charIndex); return tmp; } printf("decimal \"%s\"\n", tmp); return tmp; }
void MineralEQ3::initThermoXML(XML_Node& phaseNode, const std::string& id_) { // Find the Thermo XML node if (!phaseNode.hasChild("thermo")) { throw CanteraError("HMWSoln::initThermoXML", "no thermo XML node"); } const XML_Node* xsp = speciesData()[0]; XML_Node* aStandardState = 0; if (xsp->hasChild("standardState")) { aStandardState = &xsp->child("standardState"); } else { throw CanteraError("MineralEQ3::initThermoXML", "no standard state mode"); } doublereal volVal = 0.0; if (aStandardState->attrib("model") != "constantVolume") { throw CanteraError("MineralEQ3::initThermoXML", "wrong standard state mode"); } if (aStandardState->hasChild("V0_Pr_Tr")) { XML_Node& aV = aStandardState->child("V0_Pr_Tr"); double Afactor = toSI("cm3/gmol"); if (aV.hasAttrib("units")) { Afactor = toSI(aV.attrib("units")); } volVal = getFloat(*aStandardState, "V0_Pr_Tr"); m_V0_pr_tr= volVal; volVal *= Afactor; } else { throw CanteraError("MineralEQ3::initThermoXML", "wrong standard state mode"); } setDensity(molecularWeight(0) / volVal); const XML_Node& MinEQ3node = xsp->child("thermo").child("MinEQ3"); m_deltaG_formation_pr_tr = getFloat(MinEQ3node, "DG0_f_Pr_Tr", "actEnergy") / actEnergyToSI("cal/gmol"); m_deltaH_formation_pr_tr = getFloat(MinEQ3node, "DH0_f_Pr_Tr", "actEnergy") / actEnergyToSI("cal/gmol"); m_Entrop_pr_tr = getFloat(MinEQ3node, "S0_Pr_Tr", "toSI") / toSI("cal/gmol/K"); m_a = getFloat(MinEQ3node, "a", "toSI") / toSI("cal/gmol/K"); m_b = getFloat(MinEQ3node, "b", "toSI") / toSI("cal/gmol/K2"); m_c = getFloat(MinEQ3node, "c", "toSI") / toSI("cal-K/gmol"); convertDGFormation(); }
void InstantRadiosityRenderer::beginFrame() { auto lightPathDepth = m_nMaxDepth - 2; m_EmissionVPLBuffer.clear(); m_EmissionVPLBuffer.reserve(m_nLightPathCount); m_SurfaceVPLBuffer.clear(); m_SurfaceVPLBuffer.reserve(m_nLightPathCount * lightPathDepth); for(auto i: range(m_nLightPathCount)) { auto power = Vec3f(1.f / m_nLightPathCount); EmissionVPL vpl; vpl.pLight = m_Sampler.sample(getScene(), getFloat(0u), vpl.lightPdf); if(vpl.pLight && vpl.lightPdf) { float emissionVertexPdf; RaySample exitantRaySample; vpl.emissionVertexSample = getFloat2(0u); auto Le = vpl.pLight->sampleExitantRay(getScene(), vpl.emissionVertexSample, getFloat2(0u), exitantRaySample, emissionVertexPdf); m_EmissionVPLBuffer.emplace_back(vpl); if(Le != zero<Vec3f>() && exitantRaySample.pdf) { auto intersection = getScene().intersect(exitantRaySample.value); if(intersection) { power *= Le / (vpl.lightPdf * exitantRaySample.pdf); m_SurfaceVPLBuffer.emplace_back(intersection, -exitantRaySample.value.dir, getScene(), power); for(auto depth = 1u; depth < lightPathDepth; ++depth) { Sample3f outgoingDir; float cosThetaOutDir; auto fs = m_SurfaceVPLBuffer.back().bsdf.sample(getFloat3(0u), outgoingDir, cosThetaOutDir, nullptr, true); if(fs != zero<Vec3f>() && outgoingDir.pdf) { Ray ray(m_SurfaceVPLBuffer.back().intersection, outgoingDir.value); auto intersection = getScene().intersect(ray); if(intersection) { power *= fs * abs(cosThetaOutDir) / outgoingDir.pdf; m_SurfaceVPLBuffer.emplace_back(intersection, -ray.dir, getScene(), power); } } } } } } } }
void StoichSubstance::initThermoXML(XML_Node& phaseNode, const std::string& id_) { // Find the Thermo XML node if (!phaseNode.hasChild("thermo")) { throw CanteraError("StoichSubstance::initThermoXML", "no thermo XML node"); } XML_Node& tnode = phaseNode.child("thermo"); std::string model = tnode["model"]; if (model != "StoichSubstance" && model != "StoichSubstanceSSTP") { throw CanteraError("StoichSubstance::initThermoXML", "thermo model attribute must be StoichSubstance"); } double dens = getFloat(tnode, "density", "toSI"); setDensity(dens); SingleSpeciesTP::initThermoXML(phaseNode, id_); }
std::string ConfigValue::getString() { switch(getType()) { case ConfigValue::Bool: return getBool() ? "true" : "false"; case ConfigValue::Integer: return Utils::convertToString(getInt()); case ConfigValue::Float: return Utils::convertToString(getFloat()); case ConfigValue::String: return getString(nullptr); } return getString(nullptr); }
bool extend(const Scene& scene, const RandomGenerator& rng) { if(!m_Intersection) { // Cannot extend from infinity invalidate(); return false; } Sample3f woSample; float cosThetaOutDir; uint32_t sampledEvent; auto fs = m_BSDF.sample(Vec3f(getFloat(rng), getFloat2(rng)), woSample, cosThetaOutDir, &sampledEvent, m_bSampleAdjoint); if(woSample.pdf == 0.f || fs == zero<Vec3f>()) { invalidate(); return false; } m_nSampledEvent = sampledEvent; m_Power *= abs(cosThetaOutDir) * fs / woSample.pdf; ++m_nLength; auto nextI = scene.intersect(Ray(m_Intersection, woSample.value)); if(!nextI) { m_Intersection = nextI; return true; } auto incidentDirection = -woSample.value; auto sqrLength = sqr(nextI.distance); if(sqrLength == 0.f) { invalidate(); return false; } auto pdfWrtArea = woSample.pdf * abs(dot(nextI.Ns, incidentDirection)) / sqrLength; if(pdfWrtArea == 0.f) { invalidate(); return false; } m_Intersection = nextI; m_BSDF.init(incidentDirection, nextI, scene); return true; }
uint8_t Any::toByte() const { assert(!empty()); switch (type()) { case Any::Int: return ((uint8_t)getInt()); case Any::Float: return ((uint8_t)getFloat()); case Any::String: if (dString == 0) return 0; try { return boost::lexical_cast<uint8_t>(dString->str); } catch (boost::bad_lexical_cast &) { return 0; } } FIXME("Unsupported cast %s >= %s", typeInfo().name(), typeid(uint8_t).name()); return 0; }
static void setFloat(const char *offsetStr, const char *valueStr) { int offset = atoi(offsetStr); if (absI(offset) == absI(ERROR_CODE)) { scheduleMsg(&logger, "invalid offset [%s]", offsetStr); return; } if (isOutOfBounds(offset)) return; float value = atoff(valueStr); if (cisnan(value)) { scheduleMsg(&logger, "invalid value [%s]", valueStr); return; } float *ptr = (float *) (&((char *) engine->engineConfiguration)[offset]); *ptr = value; getFloat(offset); }
bool GFF4Struct::getVectorMatrix(uint32 field, std::vector<float> &vectorMatrix) const { const Field *f; Common::SeekableReadStream *data = getField(field, f); if (!data) return false; if (f->isList) throw Common::Exception("GFF4: Tried reading list as singular value"); const uint32 length = getVectorMatrixLength(*f, 16); vectorMatrix.resize(length); for (uint32 i = 0; i < length; i++) vectorMatrix[i] = getFloat(*data, kIFieldTypeFloat32); return true; }
//------------------------------------------------------------------------------ // makeText() -- make the text string use the current value and formats //------------------------------------------------------------------------------ void DirectionReadout::makeText() { bool neg = false; double degrees = getFloat(); if (degrees < 0.0) { degrees = -degrees; neg = true; } switch (tmode) { case ddmmss : { // Degrees, Minutes, and seconds int ideg = int(degrees); double min = (degrees - double(ideg))*60.0f; int imin = int(min); double sec = (min - double(imin))*60.0f; if (neg) ideg = -ideg; std::sprintf(cbuf, format, ideg, imin, sec); } break; case ddmm : { // Degrees and minutes int ideg = int(degrees); double min = (degrees - double(ideg))*60.0f; if (neg) ideg = -ideg; std::sprintf(cbuf, format, ideg, min); } break; case dd : { // Degrees only if (neg) degrees = -degrees; std::sprintf(cbuf, format, degrees); } break; } // then turn any '@' characters to degree symbols. { size_t len = strlen(cbuf); for (unsigned int i = 0; i < len; i++) { if (cbuf[i] == '@') cbuf[i] = char(0xB0); } } }
std::string List::toString() const { std::string line; std::stringstream itoa; for(int i = 0; i < objects.size(); ++i) { if(isFloat(i)) { itoa << getFloat(i); line += itoa.str(); itoa.str(""); } else line += getSymbol(i); line += " "; } return line; }
int searchByAverage(Result *person, int amount) { float tempGrade; int flag = 0; int i; printf("Please enter the student's average grade which you want to find\n"); tempGrade = getFloat(); for(i = 0; i < amount; i++) { if(tempGrade >= person[i].average) { printf("Found!\nThe student's name: %s\n", person[i].name.content); printf("The average: %f\n", person[i].average); flag = 1; } } return flag; }
void OutletRes1D::restore(const XML_Node& dom, doublereal* soln, int loglevel) { Domain1D::restore(dom, soln, loglevel); m_temp = getFloat(dom, "temperature"); m_yres.assign(m_nsp, 0.0); for (size_t i = 0; i < dom.nChildren(); i++) { const XML_Node& node = dom.child(i); if (node.name() == "massFraction") { size_t k = m_flow->phase().speciesIndex(node.attrib("type")); if (k != npos) { m_yres[k] = node.fp_value(); } } } resize(1,1); }
int parseSet( char * data, Object *o, int mode ) { int off = 0; off += getInt( data+off, o->id ); if ( mode == 1 ) off += getInt( data+off, o->fi ); else o->fi = -1; off += getFloat( data+off, o->x ); off += getFloat( data+off, o->y ); if ( mode == 1 ) off += getFloat( data+off, o->a ); off += getFloat( data+off, o->X ); off += getFloat( data+off, o->Y ); if ( mode == 1 ) off += getFloat( data+off, o->A ); off += getFloat( data+off, o->m ); if ( mode == 1 ) off += getFloat( data+off, o->r ); return off; }
int32_t Any::toInt() const { assert(!empty()); switch (type()) { case Any::Int: return getInt(); case Any::Float: return ((int32_t)(getFloat() + 0.5f)); case Any::String: if (dString == 0) return 0; try { std::string tmp = dString->str; boost::algorithm::trim(tmp); return boost::lexical_cast<int32_t>(tmp); } catch (boost::bad_lexical_cast &) { return 0; } } FIXME("Unsupported cast %s >= %s", typeInfo().name(), typeid(int32_t).name()); return 0; }
bool GFF4Struct::getVectorMatrix(uint32 field, std::vector< std::vector<float> > &list) const { const Field *f; Common::SeekableReadStream *data = getField(field, f); if (!data) return false; const uint32 length = getVectorMatrixLength(*f, 16); const uint32 count = getListCount(*data, *f); list.resize(count); for (uint32 i = 0; i < count; i++) { list[i].resize(length); for (uint32 j = 0; j < length; j++) list[i][j] = getFloat(*data, kIFieldTypeFloat32); } return true; }
int rdii_readRdiiInflow(char* tok[], int ntoks) // // Input: tok[] = array of string tokens // ntoks = number of tokens // Output: returns an error code // Purpose: reads properties of an RDII inflow from a line of input. // { int j, k; float a; TRdiiInflow* inflow; // --- check for proper number of items if ( ntoks < 3 ) return error_setInpError(ERR_ITEMS, ""); // --- check that node receiving RDII exists j = project_findObject(NODE, tok[0]); if ( j < 0 ) return error_setInpError(ERR_NAME, tok[0]); // --- check that RDII unit hydrograph exists k = project_findObject(UNITHYD, tok[1]); if ( k < 0 ) return error_setInpError(ERR_NAME, tok[1]); // --- read in sewer area value if ( !getFloat(tok[2], &a) || a < 0.0 ) return error_setInpError(ERR_NUMBER, tok[2]); // --- create the RDII inflow object if it doesn't already exist inflow = Node[j].rdiiInflow; if ( inflow == NULL ) { inflow = (TRdiiInflow *) malloc(sizeof(TRdiiInflow)); if ( !inflow ) return error_setInpError(ERR_MEMORY, ""); } // --- assign UH & area to inflow object inflow->unitHyd = k; inflow->area = a / UCF(LANDAREA); // --- assign inflow object to node Node[j].rdiiInflow = inflow; return 0; }
static void skipElementValue(void** attributes) { jint length; jbyte tag = getByte(attributes); switch (tag) { case 'Z': case 'B': case 'S': case 'C': case 'I': getInt(attributes); break; case 'J': getLong(attributes); break; case 'F': getFloat(attributes); break; case 'D': getDouble(attributes); break; case 's': getString(attributes); break; case 'c': getString(attributes); break; case 'e': getString(attributes); // Enum class name getString(attributes); // Enum constant name break; case '[': length = getChar(attributes); while (length > 0) { skipElementValue(attributes); length--; } break; case '@': skipAnnotationElementValue(attributes); break; } }
void printCell(Cell *cell){ switch(cell->ctype){ case INT32: printf("%d\t",getInt32(cell->value)); break; case UINT32: printf("%d\t",getUint32(cell->value)); break; case INT64: printf("%ld\t",getInt64(cell->value)); break; case UINT64: printf("%lu\t",getUint64(cell->value)); break; case INT8: printf("%d",getInt8(cell->value)); break; case INT16: printf("%d",getInt16(cell->value)); break; case FLOAT: printf("%f\t",getFloat(cell->value)); break; case DOUBLE: printf("%f\t",getDouble(cell->value)); break; case STRING: //MySQL type BINARY may be STRING { char *value =(char *) cell->value; printf("%s\t",(char*)value); break; } case BINARY: printf("BINARY\t"); break; default: printf("UNKNOW\t"); break; } }
SUMOTime SUMOSAXAttributes::getOptSUMOTimeReporting(int attr, const char* objectid, bool& ok, SUMOTime defaultValue, bool report) const { if (!hasAttribute(attr)) { return defaultValue; } try { return (SUMOTime)(getFloat(attr) * 1000.); } catch (NumberFormatException&) { if (report) { emitFormatError(getName(attr), "a real number", objectid); } } catch (EmptyData&) { if (report) { emitEmptyError(getName(attr), objectid); } } ok = false; return (SUMOTime) - 1; }
void ItemAttribute::serialize(PropWriteStream& stream) const { stream.addByte((uint8_t)type); switch(type) { case STRING: stream.addLongString(*getString()); break; case INTEGER: stream.addLong(*(uint32_t*)getInteger()); break; case FLOAT: stream.addLong(*(uint32_t*)getFloat()); break; case BOOLEAN: stream.addByte(*(uint8_t*)getBoolean()); default: break; } }
void ReactingSurf1D::restore(const XML_Node& dom, doublereal* soln, int loglevel) { Domain1D::restore(dom, soln, loglevel); soln[0] = m_temp = getFloat(dom, "temperature"); m_fixed_cov.assign(m_nsp, 0.0); for (size_t i = 0; i < dom.nChildren(); i++) { const XML_Node& node = dom.child(i); if (node.name() == "coverage") { size_t k = m_sphase->speciesIndex(node.attrib("type")); if (k != npos) { m_fixed_cov[k] = soln[k+1] = node.fp_value(); } } } m_sphase->setCoverages(&m_fixed_cov[0]); resize(m_nsp+1,1); }
const ValVec<htmRange> & htmInterface::circleRegionCmd( char *str ) { cmd_ = str; if(t_)delete t_; t_ = new VarStrToken(cmd_); float64 v[3]; float64 d; cmdCode code = getCode(); getDepth(); if(! parseVec(code, v) ) throw SpatialInterfaceError("htmInterface:circleRegionCmd: Expect vector in Command. ", cmd_.data()); d = getFloat(); if( code == J2000 ) return circleRegion(v[0], v[1], d); return circleRegion(v[0], v[1], v[2], d); }
bool JoystickMapper::setValue(string name, string value) { if (name == "inputDevice") inputDevice = value; else if (name == "deviceId") deviceId = getOEInt(value); else if (name.substr(0, 4) == "axis") setMap(JOYSTICK_AXIS1 + getOEInt(name.substr(4)), value); else if (name.substr(0, 6) == "button") setMap(JOYSTICK_BUTTON1 + getOEInt(name.substr(6)), value); else if (name.substr(0, 15) == "sensitivityAxis") setSensitivity(JOYSTICK_AXIS1 + getOEInt(name.substr(15)), getFloat(value)); else if (name.substr(0, 11) == "reverseAxis") setReverse(JOYSTICK_AXIS1 + getOEInt(name.substr(11)), getOEInt(value)); else if (name.substr(0, 3) == "map") inputDeviceMap[name.substr(3)] = value; else return false; return true; }
//------------------------------------------------------------------------- bool PUCollisionAvoidanceAffectorTranslator::translateChildProperty( PUScriptCompiler* compiler, PUAbstractNode *node ) { PUPropertyAbstractNode* prop = reinterpret_cast<PUPropertyAbstractNode*>(node); PUAffector* af = static_cast<PUAffector*>(prop->parent->context); PUCollisionAvoidanceAffector* affector = static_cast<PUCollisionAvoidanceAffector*>(af); if (prop->name == token[TOKEN_AVOIDANCE_RADIUS]) { if (passValidateProperty(compiler, prop, token[TOKEN_AVOIDANCE_RADIUS], VAL_REAL)) { float val = 0.0f; if(getFloat(*prop->values.front(), &val)) { affector->setRadius(val); return true; } } } return false; }
//------------------------------------------------------------------------- bool PUOnVelocityObserverTranslator::translateChildProperty( PUScriptCompiler* compiler, PUAbstractNode *node ) { PUPropertyAbstractNode* prop = reinterpret_cast<PUPropertyAbstractNode*>(node); PUObserver* ob = static_cast<PUObserver*>(prop->parent->context); PUOnVelocityObserver* observer = static_cast<PUOnVelocityObserver*>(ob); if (prop->name == token[TOKEN_ONVELOCITY_THRESHOLD]) { // Property: velocity_threshold if (passValidatePropertyNumberOfValues(compiler, prop, token[TOKEN_ONVELOCITY_THRESHOLD], 2)) { std::string compareType; float val = 0.0f; PUAbstractNodeList::const_iterator i = prop->values.begin(); if(getString(**i, &compareType)) { if (compareType == token[TOKEN_LESS_THAN]) { observer->setCompare(CO_LESS_THAN); } else if (compareType == token[TOKEN_GREATER_THAN]) { observer->setCompare(CO_GREATER_THAN); } else if (compareType == token[TOKEN_EQUALS]) { observer->setCompare(CO_EQUALS); } ++i; if(getFloat(**i, &val)) { observer->setThreshold(val); return true; } } } } return false; }
TiffEntryBE::TiffEntryBE(FileMap* f, uint32 offset, uint32 up_offset) { own_data = NULL; empty_data = 0; file = f; parent_offset = up_offset; type = TIFF_UNDEFINED; // We set type to undefined to avoid debug assertion errors. data = f->getDataWrt(offset, 8); tag = (TiffTag)getShort(); data += 2; TiffDataType _type = (TiffDataType)getShort(); data += 2; count = getInt(); type = _type; //Now we can set it to the proper type if (type > 13) ThrowTPE("Error reading TIFF structure. Unknown Type 0x%x encountered.", type); uint64 bytesize = (uint64)count << datashifts[type]; if (bytesize > UINT32_MAX) ThrowTPE("TIFF entry is supposedly %llu bytes", bytesize); if (bytesize == 0) // Better return empty than NULL-dereference later data = (uchar8 *) &empty_data; else if (bytesize <= 4) data = f->getDataWrt(offset + 8, bytesize); else { // it's an offset data = f->getDataWrt(offset + 8, 4); data_offset = (unsigned int)data[0] << 24 | (unsigned int)data[1] << 16 | (unsigned int)data[2] << 8 | (unsigned int)data[3]; data = f->getDataWrt(data_offset, bytesize); } #ifdef _DEBUG debug_intVal = 0xC0CAC01A; debug_floatVal = sqrtf(-1); if (type == TIFF_LONG || type == TIFF_SHORT) debug_intVal = getInt(); if (type == TIFF_FLOAT || type == TIFF_DOUBLE) debug_floatVal = getFloat(); #endif }
void LatticePhase::initThermoXML(XML_Node& phaseNode, const std::string& id_) { if (!id_.empty() && id_ != phaseNode.id()) { throw CanteraError("LatticePhase::initThermoXML", "ids don't match"); } // Check on the thermo field. Must have: // <thermo model="Lattice" /> if (phaseNode.hasChild("thermo")) { XML_Node& thNode = phaseNode.child("thermo"); std::string mString = thNode.attrib("model"); if (lowercase(mString) != "lattice") { throw CanteraError("LatticePhase::initThermoXML", "Unknown thermo model: " + mString); } } else { throw CanteraError("LatticePhase::initThermoXML", "Unspecified thermo model"); } // Now go get the molar volumes. use the default if not found XML_Node& speciesList = phaseNode.child("speciesArray"); XML_Node* speciesDB = get_XML_NameID("speciesData", speciesList["datasrc"], &phaseNode.root()); for (size_t k = 0; k < m_kk; k++) { m_speciesMolarVolume[k] = m_site_density; XML_Node* s = speciesDB->findByAttr("name", speciesName(k)); if (!s) { throw CanteraError(" LatticePhase::initThermoXML", "database problems"); } XML_Node* ss = s->findByName("standardState"); if (ss && ss->findByName("molarVolume")) { m_speciesMolarVolume[k] = getFloat(*ss, "molarVolume", "toSI"); } } // Call the base initThermo, which handles setting the initial state. ThermoPhase::initThermoXML(phaseNode, id_); }
void VPSSMgr_Water_ConstVol::initThermoXML(XML_Node& phaseNode, std::string id) { VPSSMgr::initThermoXML(phaseNode, id); XML_Node& speciesList = phaseNode.child("speciesArray"); XML_Node* speciesDB = get_XML_NameID("speciesData", speciesList["datasrc"], &phaseNode.root()); const vector<string>&sss = m_vptp_ptr->speciesNames(); if (!m_waterSS) { throw CanteraError("VPSSMgr_Water_ConstVol::initThermoXML", "bad dynamic cast"); } m_waterSS->setState_TP(300., OneAtm); m_Vss[0] = (m_waterSS->density()) / m_vptp_ptr->molecularWeight(0); for (int k = 1; k < m_kk; k++) { const XML_Node* s = speciesDB->findByAttr("name", sss[k]); if (!s) { throw CanteraError("VPSSMgr_Water_ConstVol::initThermoXML", "no species Node for species " + sss[k]); } const XML_Node *ss = s->findByName("standardState"); if (!ss) { std::string sName = s->operator[]("name"); throw CanteraError("VPSSMgr_Water_ConstVol::initThermoXML", "no standardState Node for species " + sName); } std::string model = (*ss)["model"]; if (model != "constant_incompressible") { std::string sName = s->operator[]("name"); throw CanteraError("VPSSMgr_Water_ConstVol::initThermoXML", "standardState model for species isn't " "constant_incompressible: " + sName); } m_Vss[k] = getFloat(*ss, "molarVolume", "toSI"); } }
static void parseDEPTHFile(const QString&datFileName, Mesh* mesh, const QVector<float>& elevations) { // this file is optional, so if not present, reading is skipped QFileInfo fi(datFileName); QString nodesFileName(fi.dir().filePath("DEPTH.OUT")); QFile nodesFile(nodesFileName); if (!nodesFile.open(QIODevice::ReadOnly | QIODevice::Text)) return; QTextStream nodesStream(&nodesFile); int nnodes = mesh->nodes().size(); QVector<float> maxDepth(nnodes); QVector<float> maxWaterLevel(nnodes); int node_inx = 0; // DEPTH.OUT - COORDINATES (NODE NUM, X, Y, MAX DEPTH) while (!nodesStream.atEnd()) { if (node_inx == nnodes) throw LoadStatus::Err_IncompatibleMesh; QString line = nodesStream.readLine(); QStringList lineParts = line.split(" ", QString::SkipEmptyParts); if (lineParts.size() != 4) { throw LoadStatus::Err_UnknownFormat; } float val = getFloat(lineParts[3]); maxDepth[node_inx] = val; //water level if (!is_nodata(val)) val += elevations[node_inx]; maxWaterLevel[node_inx] = val; node_inx++; } addStaticDataset(maxDepth, "Depth/Maximums", DataSet::Scalar, datFileName, mesh); addStaticDataset(maxWaterLevel, "Water Level/Maximums", DataSet::Scalar, datFileName, mesh); }