Skip to content
Snippets Groups Projects
Commit 1f8e6370 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

speed-up reading post-pro files in .msh with huge number of time steps...

speed-up reading post-pro files in .msh with huge number of time steps (usually sparse) - for gauthier
parent c025429d
No related branches found
No related tags found
No related merge requests found
...@@ -66,7 +66,9 @@ bool PViewDataGModel::finalize(bool computeMinMax) ...@@ -66,7 +66,9 @@ bool PViewDataGModel::finalize(bool computeMinMax)
// add interpolation data for known element types (this might be // add interpolation data for known element types (this might be
// overidden later) // overidden later)
if(!haveInterpolationMatrices()){
for(int step = 0; step < getNumTimeSteps(); step++){ for(int step = 0; step < getNumTimeSteps(); step++){
if(!_steps[step]->getNumData()) continue;
GModel *m = _steps[step]->getModel(); GModel *m = _steps[step]->getModel();
for(GModel::eiter it = m->firstEdge(); it != m->lastEdge(); it++){ for(GModel::eiter it = m->firstEdge(); it != m->lastEdge(); it++){
if((*it)->lines.size()) if((*it)->lines.size())
...@@ -93,6 +95,7 @@ bool PViewDataGModel::finalize(bool computeMinMax) ...@@ -93,6 +95,7 @@ bool PViewDataGModel::finalize(bool computeMinMax)
_addInterpolationMatricesForElement((*it)->polyhedra[0]); _addInterpolationMatricesForElement((*it)->polyhedra[0]);
} }
} }
}
return PViewData::finalize(); return PViewData::finalize();
} }
......
...@@ -52,18 +52,24 @@ bool PViewDataGModel::readMSH(std::string fileName, int fileIndex, FILE *fp, ...@@ -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", Msg::Info("Reading step %d (time %g) partition %d: %d records",
step, time, partition, numEnt); step, time, partition, numEnt);
while(step >= (int)_steps.size()) while(step >= (int)_steps.size()){
if(_steps.empty() || _steps.back()->getNumData())
_steps.push_back(new stepData<double>(GModel::current(), numComp)); _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]->setFileName(fileName);
_steps[step]->setFileIndex(fileIndex); _steps[step]->setFileIndex(fileIndex);
_steps[step]->setTime(time); _steps[step]->setTime(time);
/*
// if we already have maxSteps for this view, return // if we already have maxSteps for this view, return
int numSteps = 0, maxSteps = 1000000000; int numSteps = 0, maxSteps = 1000000000;
for(unsigned int i = 0; i < _steps.size(); i++) for(unsigned int i = 0; i < _steps.size(); i++)
numSteps += _steps[i]->getNumData() ? 1 : 0; numSteps += _steps[i]->getNumData() ? 1 : 0;
if(numSteps > maxSteps) return true; if(numSteps > maxSteps) return true;
*/
_steps[step]->resizeData(numEnt); _steps[step]->resizeData(numEnt);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment