From 3be695f575844ff254809a86119caddca9d3bc8c Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Sat, 10 Jan 2009 08:47:06 +0000
Subject: [PATCH] fix computation of numComp

---
 Post/PViewDataGModelIO.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Post/PViewDataGModelIO.cpp b/Post/PViewDataGModelIO.cpp
index 841774d7f5..f39f2de6dd 100644
--- a/Post/PViewDataGModelIO.cpp
+++ b/Post/PViewDataGModelIO.cpp
@@ -15,8 +15,12 @@ bool PViewDataGModel::addData(GModel *model, std::map<int, std::vector<double> >
                               int step, double time, int partition)
 {
   if(data.empty()) return false;
-  
-  int numComp = data.begin()->second.size();
+
+  int numComp = 9;
+  for(std::map<int, std::vector<double> >::iterator it = data.begin(); 
+      it != data.end(); it++)
+    numComp = std::min(numComp, (int)it->second.size());
+
   while(step >= (int)_steps.size())
     _steps.push_back(new stepData<double>(model, numComp));
   
-- 
GitLab