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,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]);
}
}
}
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment