From e10d4cf17d32edca3a051da3443b741eb2f1b7a0 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Tue, 29 Apr 2014 17:09:39 +0000 Subject: [PATCH] better error messages --- Post/PViewDataIO.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Post/PViewDataIO.cpp b/Post/PViewDataIO.cpp index 1d0138bd4e..5b1105003e 100644 --- a/Post/PViewDataIO.cpp +++ b/Post/PViewDataIO.cpp @@ -215,8 +215,13 @@ bool PViewData::toVector(std::vector<std::vector<double> > &vec) bool PViewData::fromVector(const std::vector<std::vector<double> > &vec) { + if(empty() || !getNumTimeSteps()){ + Msg::Warning("Cannot import vector in an empty view; skipping"); + return false; + } + if((int)vec.size() != getNumTimeSteps()){ - Msg::Error("Incompatible number of steps in vector (%d) and view (%d)", + Msg::Error("Incompatible number of steps in vector for view import (%d!=%d)", (int)vec.size(), getNumTimeSteps()); return false; } @@ -234,7 +239,8 @@ bool PViewData::fromVector(const std::vector<std::vector<double> > &vec) setValue(step, ent, ele, nod, comp, vec[step][i++]); } else{ - Msg::Error("Bad index (%d) in vector (%d)", i, (int)vec[step].size()); + Msg::Error("Bad index (%d) in vector (%d) for view import", + i, (int)vec[step].size()); return false; } } -- GitLab