28 for(std::size_t i = 0; i <
_steps.size(); i++)
delete _steps[i];
36 if((*it)->points.size())
return (*it)->points[0];
41 if((*it)->lines.size())
return (*it)->lines[0];
46 if((*it)->triangles.size())
return (*it)->triangles[0];
51 if((*it)->quadrangles.size())
return (*it)->quadrangles[0];
56 if((*it)->polygons.size())
return (*it)->polygons[0];
61 if((*it)->tetrahedra.size())
return (*it)->tetrahedra[0];
66 if((*it)->hexahedra.size())
return (*it)->hexahedra[0];
71 if((*it)->prisms.size())
return (*it)->prisms[0];
76 if((*it)->pyramids.size())
return (*it)->pyramids[0];
81 if((*it)->polyhedra.size())
return (*it)->polyhedra[0];
89 const std::string &interpolationScheme)
100 int numComp =
_steps[step]->getNumComponents();
101 for(std::size_t i = 0; i <
_steps[step]->getNumData(); i++) {
102 double *d =
_steps[step]->getData(i);
115 for(
int nod = 0; nod <
getNumNodes(step, ent, ele); nod++) {
137 if(interpolationScheme.size()) {
140 Msg::Info(
"Setting interpolation matrices from scheme '%s'",
141 interpolationScheme.c_str());
143 Msg::Error(
"Could not find interpolation scheme '%s'",
144 interpolationScheme.c_str());
145 for(
auto it = m.begin(); it != m.end(); it++) {
146 if(it->second.size() == 2) {
172 else if(it->second.size() == 4) {
175 "You should not specify the geometrical interpolation "
176 "in ElementNodeData: the geometry is completely determined "
177 "by the mesh element type. This feature will be removed");
179 *it->second[2], *it->second[3]);
183 "Wrong number of interpolation matrices (%d) for scheme '%s'",
184 (
int)it->second.size(), interpolationScheme.c_str());
193 for(std::size_t i = 0; i <
sizeof(types) /
sizeof(types[0]); i++) {
257 static int lastStep = -1, lastEnt = -1, lastEle = -1;
259 if(step != lastStep || ent != lastEnt || ele != lastEle)
260 curr =
_steps[step]->getEntity(ent)->getMeshElement(ele);
267 return _steps[step]->getFileName();
274 for(std::size_t i = start; i <
_steps.size(); i++)
275 if(
_steps[i]->getNumData())
return i;
281 if(
_steps.empty())
return 0.;
282 return _steps[step]->getTime();
286 int forceNumComponents,
int componentMap[9])
290 if(onlyVisible || forceNumComponents || tensorRep) {
293 if(onlyVisible &&
skipEntity(step, ent))
continue;
295 if(
skipElement(step, ent, ele, onlyVisible))
continue;
296 for(
int nod = 0; nod <
getNumNodes(step, ent, ele); nod++) {
299 forceNumComponents, componentMap);
300 vmin = std::min(vmin, val);
307 if(step < 0)
return _min;
308 return _steps[step]->getMin();
312 int forceNumComponents,
int componentMap[9])
316 if(onlyVisible || forceNumComponents || tensorRep) {
319 if(onlyVisible &&
skipEntity(step, ent))
continue;
321 if(
skipElement(step, ent, ele, onlyVisible))
continue;
322 for(
int nod = 0; nod <
getNumNodes(step, ent, ele); nod++) {
325 forceNumComponents, componentMap);
326 vmax = std::max(vmax, val);
333 if(step < 0)
return _max;
334 return _steps[step]->getMax();
339 if(step < 0 ||
_steps.empty()) {
341 for(std::size_t i = 0; i <
_steps.size(); i++) {
343 tmp +=
_steps[i]->getBoundingBox();
347 return _steps[step]->getBoundingBox();
352 if(
_steps.empty())
return 0;
360 if(
_steps.empty())
return 0;
368 if(
_steps.empty())
return 0;
376 if(
_steps.empty())
return 0;
380 n += (*it)->points.size();
386 if(
_steps.empty())
return 0;
390 n += (*it)->lines.size();
396 if(
_steps.empty())
return 0;
400 n += (*it)->triangles.size();
406 if(
_steps.empty())
return 0;
410 n += (*it)->quadrangles.size();
416 if(
_steps.empty())
return 0;
420 n += (*it)->polygons.size();
426 if(
_steps.empty())
return 0;
430 n += (*it)->tetrahedra.size();
436 if(
_steps.empty())
return 0;
440 n += (*it)->hexahedra.size();
446 if(
_steps.empty())
return 0;
450 n += (*it)->prisms.size();
456 if(
_steps.empty())
return 0;
460 n += (*it)->pyramids.size();
466 if(
_steps.empty())
return 0;
470 n += (*it)->trihedra.size();
476 if(
_steps.empty())
return 0;
480 n += (*it)->polyhedra.size();
486 if(
_steps.empty())
return 0;
488 if(step < 0)
return _steps[0]->getNumEntities();
489 return _steps[step]->getNumEntities();
494 if(
_steps.empty())
return 0;
496 if(step < 0 && ent < 0)
return _steps[0]->getModel()->getNumMeshElements();
497 if(step < 0)
return _steps[0]->getEntity(ent)->getNumMeshElements();
498 if(ent < 0)
return _steps[step]->getModel()->getNumMeshElements();
499 return _steps[step]->getEntity(ent)->getNumMeshElements();
504 return _steps[step]->getEntity(ent);
509 if(
_steps.empty())
return nullptr;
511 if(step < 0)
return _steps[0]->getEntity(ent)->getMeshElement(
element);
512 return _steps[step]->getEntity(ent)->getMeshElement(
element);
547 double &y,
double &
z)
560 double vx[8], vy[8], vz[8];
566 x = e->
interpolate(vx, p[3 * nod], p[3 * nod + 1], p[3 * nod + 2], 1, 1);
567 y = e->
interpolate(vy, p[3 * nod], p[3 * nod + 1], p[3 * nod + 2], 1, 1);
568 z = e->
interpolate(vz, p[3 * nod], p[3 * nod + 1], p[3 * nod + 2], 1, 1);
599 return _steps[step]->getNumComponents();
616 Msg::Error(
"getNumValues() should not be used on this type of view");
628 int numcomp =
_steps[step]->getNumComponents();
629 int nod = idx / numcomp;
630 int comp = idx % numcomp;
632 val =
_steps[step]->getData(num)[comp];
635 Msg::Error(
"getValue(index) should not be used on this type of view");
646 val =
_steps[step]->getData(num)[comp];
652 static bool first =
true;
654 Msg::Warning(
"Some elements in ElementNodeData have less values than "
659 val =
_steps[step]->getData(
660 e->
getNum())[
_steps[step]->getNumComponents() * nod + comp];
663 default: val =
_steps[step]->getData(e->
getNum())[comp];
break;
674 _steps[step]->getData(num)[comp] = val;
680 static bool first =
true;
682 Msg::Warning(
"Some elements in ElementNodeData have less values than "
688 e->
getNum())[
_steps[step]->getNumComponents() * nod + comp] = val;
691 default:
_steps[step]->getData(e->
getNum())[comp] = val;
break;
713 std::vector<stepData<double> *> _steps2;
714 for(std::size_t step = 0; step <
_steps.size(); step++) {
716 int numComp =
_steps[step]->getNumComponents();
720 _steps2.back()->fillEntities();
721 _steps2.back()->computeBoundingBox();
723 std::map<int, int> nodeConnect;
731 if(nodeConnect.count(v->
getNum()))
732 nodeConnect[v->
getNum()]++;
734 nodeConnect[v->
getNum()] = 1;
735 double *d = _steps2.back()->getData(v->
getNum(),
true);
736 for(
int j = 0; j < numComp; j++)
741 for(std::size_t i = 0; i < _steps2.back()->getNumData(); i++) {
742 double *d = _steps2.back()->getData(i);
744 double f = nodeConnect[i];
746 for(
int j = 0; j < numComp; j++) d[j] /=
f;
750 for(std::size_t i = 0; i <
_steps.size(); i++)
delete _steps[i];
759 for(std::size_t i = 0; i <
_steps.size(); i++)
767 if(nd.
data.size() < 2)
return false;
768 std::vector<PViewDataGModel *> data(nd.
data.size());
769 for(std::size_t i = 0; i < nd.
data.size(); i++) {
779 it != data[0]->_interpolation.end(); it++)
781 for(std::size_t i = 0; i < it->second.size(); i++)
786 for(std::size_t i = 0; i < data.size(); i++)
787 for(std::size_t j = 0; j < data[i]->_steps.size(); j++)
792 if(nd.
name ==
"__all__")
794 else if(nd.
name ==
"__vis__")
799 sprintf(name,
"%s_Combine", tmp.c_str());
809 return !
_steps[step]->getEntity(ent)->getVisibility();
813 bool checkVisibility,
int samplingRate)
817 if(!
_steps[step]->getNumData())
return true;
821 for(
int i = 0; i <
getNumNodes(step, ent, ele); i++)
840 return _steps[step]->getPartitions().find(part) !=
841 _steps[step]->getPartitions().end();
846 if(
_steps.size() <= 1)
return false;
848 for(std::size_t i = 1; i <
_steps.size(); i++)
856 for(std::size_t i = 0; i <
_steps.size(); i++)
864 int comp,
double &val)
866 double *d =
_steps[step]->getData(dataIndex);
872 val = d[
_steps[step]->getNumComponents() * nod + comp];