From 6dd0335ecd019291e0656449d8d800d1d244e9a6 Mon Sep 17 00:00:00 2001 From: Francois Henrotte <francois.henrotte@ulg.ac.be> Date: Wed, 16 Sep 2015 19:48:23 +0000 Subject: [PATCH] NewView plugin with variable size NodeData vector --- Plugin/NewView.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Plugin/NewView.cpp b/Plugin/NewView.cpp index 628c3efcb1..572a621571 100644 --- a/Plugin/NewView.cpp +++ b/Plugin/NewView.cpp @@ -7,13 +7,13 @@ // Ruth Sabariego & Francois Henrotte // - #include "NewView.h" #include "GModel.h" #include "MElement.h" StringXNumber NewViewOptions_Number[] = { - {GMSH_FULLRC, "View", NULL, -1.} + {GMSH_FULLRC, "View", NULL, -1.}, + {GMSH_FULLRC, "Number of zero values", NULL, 1.} }; extern "C" @@ -26,7 +26,9 @@ extern "C" std::string GMSH_NewViewPlugin::getHelp() const { - return "Plugin(NewView) creates a new view from a mesh." ; + return "Plugin(NewView) creates a new view from a mesh." + "The parameter is the dimension of the NodeData vector," + "initialized to zero"; } int GMSH_NewViewPlugin::getNbOptions() const @@ -45,13 +47,15 @@ PView *GMSH_NewViewPlugin::execute(PView * v) Msg::Error("No mesh available to create the view: please mesh your model!"); return v ; } + int nbrValues = (int)NewViewOptions_Number[1].def; + std::map<int, std::vector<double> > d; std::vector<GEntity*> entities; GModel::current()->getEntities(entities); for(unsigned int i = 0; i < entities.size(); i++){ for(unsigned int j = 0; j < entities[i]->mesh_vertices.size(); j++){ MVertex *ve = entities[i]->mesh_vertices[j]; - d[ve->getNum()].push_back(0.); + d[ve->getNum()].resize(nbrValues); } } -- GitLab