29 return "Plugin(NewView) creates a new model-based view from the "
30 "current mesh, with `NumComp' field components, set to value "
32 "If `ViewTag' is positive, force that tag for the created view. "
33 "The view type is determined by `Type' (NodeData or ElementData). "
34 "In the case of an ElementData type, the view can be restricted "
35 "to a specific physical group with a positive `PhysicalGroup'.";
67 Msg::Error(
"No mesh available to create the view: please mesh your model!");
71 Msg::Error(
"Bad number of components for Plugin(NewView)");
74 if(!(type ==
"NodeData" || type ==
"ElementData")) {
75 Msg::Error(
"Unknown data type for Plugin(NewView)");
79 std::map<int, std::vector<double> > d;
80 if(type ==
"NodeData")
nodeData(numComp, value, d);
81 if(type ==
"ElementData")
elementData(numComp, value, d, phys);
88 std::map<
int, std::vector<double> > &d)
90 std::vector<GEntity *> entities;
92 for(std::size_t i = 0; i < entities.size(); i++) {
93 for(std::size_t j = 0; j < entities[i]->mesh_vertices.size(); j++) {
94 MVertex *ve = entities[i]->mesh_vertices[j];
95 d[ve->
getNum()].resize(numComp, value);
101 std::map<
int, std::vector<double> > &d,
104 std::vector<GEntity *> entities;
107 std::map<int, std::vector<GEntity *> > groups;
109 entities = groups[phys];
112 for(std::size_t i = 0; i < entities.size(); i++) {
113 for(std::size_t j = 0; j < entities[i]->getNumMeshElements(); j++) {
114 MElement *e = entities[i]->getMeshElement(j);
115 d[e->
getNum()].resize(numComp, value);