Skip to content
Snippets Groups Projects
Commit 6dd0335e authored by Francois Henrotte's avatar Francois Henrotte
Browse files

NewView plugin with variable size NodeData vector

parent 7f12ea19
No related branches found
No related tags found
No related merge requests found
...@@ -7,13 +7,13 @@ ...@@ -7,13 +7,13 @@
// Ruth Sabariego & Francois Henrotte // Ruth Sabariego & Francois Henrotte
// //
#include "NewView.h" #include "NewView.h"
#include "GModel.h" #include "GModel.h"
#include "MElement.h" #include "MElement.h"
StringXNumber NewViewOptions_Number[] = { StringXNumber NewViewOptions_Number[] = {
{GMSH_FULLRC, "View", NULL, -1.} {GMSH_FULLRC, "View", NULL, -1.},
{GMSH_FULLRC, "Number of zero values", NULL, 1.}
}; };
extern "C" extern "C"
...@@ -26,7 +26,9 @@ extern "C" ...@@ -26,7 +26,9 @@ extern "C"
std::string GMSH_NewViewPlugin::getHelp() const 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 int GMSH_NewViewPlugin::getNbOptions() const
...@@ -45,13 +47,15 @@ PView *GMSH_NewViewPlugin::execute(PView * v) ...@@ -45,13 +47,15 @@ PView *GMSH_NewViewPlugin::execute(PView * v)
Msg::Error("No mesh available to create the view: please mesh your model!"); Msg::Error("No mesh available to create the view: please mesh your model!");
return v ; return v ;
} }
int nbrValues = (int)NewViewOptions_Number[1].def;
std::map<int, std::vector<double> > d; std::map<int, std::vector<double> > d;
std::vector<GEntity*> entities; std::vector<GEntity*> entities;
GModel::current()->getEntities(entities); GModel::current()->getEntities(entities);
for(unsigned int i = 0; i < entities.size(); i++){ for(unsigned int i = 0; i < entities.size(); i++){
for(unsigned int j = 0; j < entities[i]->mesh_vertices.size(); j++){ for(unsigned int j = 0; j < entities[i]->mesh_vertices.size(); j++){
MVertex *ve = entities[i]->mesh_vertices[j]; MVertex *ve = entities[i]->mesh_vertices[j];
d[ve->getNum()].push_back(0.); d[ve->getNum()].resize(nbrValues);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment