diff --git a/Post/PViewDataGModel.cpp b/Post/PViewDataGModel.cpp index a0736bf6ce00a342b4ce9e5b8ab2c7fca79f9e51..088276f01b4b7911c543f9fb971218c17187864d 100644 --- a/Post/PViewDataGModel.cpp +++ b/Post/PViewDataGModel.cpp @@ -1,4 +1,4 @@ -// $Id: PViewDataGModel.cpp,v 1.24 2008-03-10 16:01:16 geuzaine Exp $ +// $Id: PViewDataGModel.cpp,v 1.25 2008-03-10 19:59:01 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -66,7 +66,7 @@ int PViewDataGModel::getNumTimeSteps() double PViewDataGModel::getTime(int step) { - if(step < _nodeData.size() && _nodeData[step]) + if(step < (int)_nodeData.size() && _nodeData[step]) return _nodeData[step]->time; return 0.; } @@ -74,14 +74,14 @@ double PViewDataGModel::getTime(int step) double PViewDataGModel::getMin(int step) { if(step < 0) return _min; - if(step < _nodeData.size() && _nodeData[step]) return _nodeData[step]->min; + if(step < (int)_nodeData.size() && _nodeData[step]) return _nodeData[step]->min; return 0.; } double PViewDataGModel::getMax(int step) { if(step < 0) return _max; - if(step < _nodeData.size() && _nodeData[step]) return _nodeData[step]->max; + if(step < (int)_nodeData.size() && _nodeData[step]) return _nodeData[step]->max; return 0.; } @@ -142,12 +142,12 @@ bool PViewDataGModel::skipEntity(int ent) bool PViewDataGModel::skipElement(int ent, int ele, int step) { - if(step >= _nodeData.size() || !_nodeData[step]) return true; + if(step >= (int)_nodeData.size() || !_nodeData[step]) return true; MElement *e = _entities[ent]->getMeshElement(ele); if(!e->getVisibility()) return true; for(int i = 0; i < e->getNumVertices(); i++){ int index = e->getVertex(i)->getDataIndex(); - if(index < 0 || index >= _nodeData[step]->values.size()) return true; + if(index < 0 || index >= (int)_nodeData[step]->values.size()) return true; if(_nodeData[step]->values[index].empty()) return true; } return false; @@ -155,8 +155,8 @@ bool PViewDataGModel::skipElement(int ent, int ele, int step) bool PViewDataGModel::hasTimeStep(int step) { - if(step < _nodeData.size() && _nodeData[step]) return true; - if(step < _elementData.size() && _elementData[step]) return true; + if(step < (int)_nodeData.size() && _nodeData[step]) return true; + if(step < (int)_elementData.size() && _elementData[step]) return true; return false; } diff --git a/Post/PViewDataGModel.h b/Post/PViewDataGModel.h index fe2ec9f0f81015d0da1c83191e1856c44880755d..b0ed770970c261b907645ef053018edefe642617 100644 --- a/Post/PViewDataGModel.h +++ b/Post/PViewDataGModel.h @@ -28,12 +28,10 @@ template<class real> class stepData{ public: - std::string fileName; // we allow to read steps from different files - int fileIndex; double time, min, max; // vector of data, indexed by dataIndex std::vector<std::vector<real> > values; - stepData() : fileIndex(0), time(0.), min(VAL_INF), max(-VAL_INF){} + stepData() : time(0.), min(VAL_INF), max(-VAL_INF){} ~stepData() {} }; @@ -52,8 +50,6 @@ class PViewDataGModel : public PViewData { SBoundingBox3d _bbox; // a set of all "partitions" encountered in the input data std::set<int> _partitions; - // create old-style list-based dataset from this one - PViewDataList *_cloneToList(); public: PViewDataGModel(GModel *model); ~PViewDataGModel(); @@ -76,6 +72,9 @@ class PViewDataGModel : public PViewData { bool hasTimeStep(int step); bool hasPartition(int part); + // create old-style list-based dataset from this one + //PViewDataList *convertToPViewDataList(); + // I/O routines bool readMSH(FILE *fp, bool binary, bool swap, int timeStep, double time, int partition, int numComp, int numNodes); diff --git a/Post/PViewDataGModelIO.cpp b/Post/PViewDataGModelIO.cpp index 2813284574a89ae37b556a0a843c54986d24b668..eb6f33aad4ecbee3521af9a82ed3caa9a7a57fa5 100644 --- a/Post/PViewDataGModelIO.cpp +++ b/Post/PViewDataGModelIO.cpp @@ -1,4 +1,4 @@ -// $Id: PViewDataGModelIO.cpp,v 1.5 2008-03-10 16:01:16 geuzaine Exp $ +// $Id: PViewDataGModelIO.cpp,v 1.6 2008-03-10 19:59:01 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -35,7 +35,7 @@ bool PViewDataGModel::readMSH(FILE *fp, bool binary, bool swap, int timeStep, Msg(INFO, "Reading step %d (time %g) partition %d: %d nodes", timeStep, time, partition, numNodes); - while(timeStep >= _nodeData.size()) _nodeData.push_back(0); + while(timeStep >= (int)_nodeData.size()) _nodeData.push_back(0); if(!_nodeData[timeStep]) _nodeData[timeStep] = new stepData<double>(); @@ -64,10 +64,10 @@ bool PViewDataGModel::readMSH(FILE *fp, bool binary, bool swap, int timeStep, v->setDataIndex(max + 1); } int index = v->getDataIndex(); - if(index >= _nodeData[timeStep]->values.size()) + if(index >= (int)_nodeData[timeStep]->values.size()) _nodeData[timeStep]->values.resize(index + 100); // optimize this if(binary){ - if(fread(&tmp[0], sizeof(double), numComp, fp) != numComp) return false; + if((int)fread(&tmp[0], sizeof(double), numComp, fp) != numComp) return false; if(swap) swapBytes((char*)&tmp[0], sizeof(double), numComp); } else{ @@ -124,7 +124,7 @@ bool PViewDataGModel::writeMSH(std::string name, bool binary) fprintf(fp, "\"%s\"\n", getName().c_str()); fprintf(fp, "%d %.16g 0 0 %d %d\n", ts, _nodeData[ts]->time, numComp, numNodes); for(unsigned int i = 0; i < _nodeData[ts]->values.size(); i++){ - if(_nodeData[ts]->values[i].size() >= numComp){ + if((int)_nodeData[ts]->values[i].size() >= numComp){ if(binary){ fwrite(&tags[i], sizeof(int), 1, fp); fwrite(&_nodeData[ts]->values[i][0], sizeof(double), numComp, fp); diff --git a/Post/PViewDataListIO.cpp b/Post/PViewDataListIO.cpp index 0425b64d5796b1b63b5532e8f70ca13d1cc1d711..637934f2541e9facda5b127680f9d6a6bffe28a6 100644 --- a/Post/PViewDataListIO.cpp +++ b/Post/PViewDataListIO.cpp @@ -1,4 +1,4 @@ -// $Id: PViewDataListIO.cpp,v 1.15 2008-03-10 16:01:17 geuzaine Exp $ +// $Id: PViewDataListIO.cpp,v 1.16 2008-03-10 19:59:01 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -584,7 +584,6 @@ bool PViewDataList::writeMSH(std::string name, bool binary) writeElementsMSH(fp, NbTY, TY, 5, 9, 3, &nodes, &numelm); fprintf(fp, "$EndElements\n"); -#if 1 // test new node-based storage int numNodes = nodes.size(); if(numNodes){ int numComp = nodes.begin()->Val.size() / NbTimeStep; @@ -603,7 +602,6 @@ bool PViewDataList::writeMSH(std::string name, bool binary) fprintf(fp, "$EndNodeData\n"); } } -#endif fclose(fp); return true;