diff --git a/Post/PViewDataGModel.cpp b/Post/PViewDataGModel.cpp index 26ef74a7b6fb3a4637570665360e75276c76053d..abbe772e38c28b29092cc20c22a56601aee6a886 100644 --- a/Post/PViewDataGModel.cpp +++ b/Post/PViewDataGModel.cpp @@ -66,31 +66,34 @@ bool PViewDataGModel::finalize(bool computeMinMax) // add interpolation data for known element types (this might be // overidden later) - for(int step = 0; step < getNumTimeSteps(); step++){ - GModel *m = _steps[step]->getModel(); - for(GModel::eiter it = m->firstEdge(); it != m->lastEdge(); it++){ - if((*it)->lines.size()) - _addInterpolationMatricesForElement((*it)->lines[0]); - } - for(GModel::fiter it = m->firstFace(); it != m->lastFace(); it++){ - if((*it)->triangles.size()) - _addInterpolationMatricesForElement((*it)->triangles[0]); - if((*it)->quadrangles.size()) - _addInterpolationMatricesForElement((*it)->quadrangles[0]); - if((*it)->polygons.size()) - _addInterpolationMatricesForElement((*it)->polygons[0]); - } - for(GModel::riter it = m->firstRegion(); it != m->lastRegion(); it++){ - if((*it)->tetrahedra.size()) - _addInterpolationMatricesForElement((*it)->tetrahedra[0]); - if((*it)->hexahedra.size()) - _addInterpolationMatricesForElement((*it)->hexahedra[0]); - if((*it)->prisms.size()) - _addInterpolationMatricesForElement((*it)->prisms[0]); - if((*it)->pyramids.size()) - _addInterpolationMatricesForElement((*it)->pyramids[0]); - if((*it)->polyhedra.size()) - _addInterpolationMatricesForElement((*it)->polyhedra[0]); + if(!haveInterpolationMatrices()){ + for(int step = 0; step < getNumTimeSteps(); step++){ + if(!_steps[step]->getNumData()) continue; + GModel *m = _steps[step]->getModel(); + for(GModel::eiter it = m->firstEdge(); it != m->lastEdge(); it++){ + if((*it)->lines.size()) + _addInterpolationMatricesForElement((*it)->lines[0]); + } + for(GModel::fiter it = m->firstFace(); it != m->lastFace(); it++){ + if((*it)->triangles.size()) + _addInterpolationMatricesForElement((*it)->triangles[0]); + if((*it)->quadrangles.size()) + _addInterpolationMatricesForElement((*it)->quadrangles[0]); + if((*it)->polygons.size()) + _addInterpolationMatricesForElement((*it)->polygons[0]); + } + for(GModel::riter it = m->firstRegion(); it != m->lastRegion(); it++){ + if((*it)->tetrahedra.size()) + _addInterpolationMatricesForElement((*it)->tetrahedra[0]); + if((*it)->hexahedra.size()) + _addInterpolationMatricesForElement((*it)->hexahedra[0]); + if((*it)->prisms.size()) + _addInterpolationMatricesForElement((*it)->prisms[0]); + if((*it)->pyramids.size()) + _addInterpolationMatricesForElement((*it)->pyramids[0]); + if((*it)->polyhedra.size()) + _addInterpolationMatricesForElement((*it)->polyhedra[0]); + } } } diff --git a/Post/PViewDataGModelIO.cpp b/Post/PViewDataGModelIO.cpp index 4d572d70b41738cace4f8517b314775d547f0ed7..b4719700400149d2a0a35b28677f3b3a6409a8ff 100644 --- a/Post/PViewDataGModelIO.cpp +++ b/Post/PViewDataGModelIO.cpp @@ -52,18 +52,24 @@ bool PViewDataGModel::readMSH(std::string fileName, int fileIndex, FILE *fp, Msg::Info("Reading step %d (time %g) partition %d: %d records", step, time, partition, numEnt); - while(step >= (int)_steps.size()) - _steps.push_back(new stepData<double>(GModel::current(), numComp)); - + while(step >= (int)_steps.size()){ + if(_steps.empty() || _steps.back()->getNumData()) + _steps.push_back(new stepData<double>(GModel::current(), numComp)); + else // faster since we avoid computing model bounds + _steps.push_back(new stepData<double>(*_steps.back())); + } + _steps[step]->setFileName(fileName); _steps[step]->setFileIndex(fileIndex); _steps[step]->setTime(time); + /* // if we already have maxSteps for this view, return int numSteps = 0, maxSteps = 1000000000; for(unsigned int i = 0; i < _steps.size(); i++) numSteps += _steps[i]->getNumData() ? 1 : 0; if(numSteps > maxSteps) return true; + */ _steps[step]->resizeData(numEnt);