Commit e03c1952 authored by Sreekanth Arikatla's avatar Sreekanth Arikatla
Browse files

ENH: Allow modifying scalar data of individual nodes

parent 67a9c2db
......@@ -188,8 +188,14 @@ public:
OBB computeOBB() const;
static OBB evaluateOBB(const StdVectorOfVec3d& points);
std::vector<double> getNodalScalarData() { return m_scalarData; };
void setNodalScalarData(std::vector<double>& data) { m_scalarData = data; }
std::vector<float> getNodalScalarData() { return m_scalarData; };
void setNodalScalarData(std::vector<float>& data) { m_scalarData = data; }
void setNodeScalarData(const unsigned int nodeId, const float val)
{
m_scalarData.at(nodeId) = val;
m_dataModified = true;
}
protected:
......@@ -212,7 +218,7 @@ protected:
StdVectorOfVec3d m_vertexPositions; ///> Current positions of vertices
StdVectorOfVec3d m_vertexPositionsPostTransform; ///> Positions of vertices after transform
std::vector<double> m_scalarData;
std::vector<float> m_scalarData;
std::map<std::string, StdVectorOfVectorf> m_pointDataMap; ///> vector of data arrays per vertice
......
......@@ -86,7 +86,6 @@ VTKTetrahedralMeshRenderDelegate::VTKTetrahedralMeshRenderDelegate(std::shared_p
scalars->SetValue(i, scalarData[i]);
}
m_meshConnectivity->GetPointData()->SetScalars(scalars);
}
......@@ -155,6 +154,18 @@ VTKTetrahedralMeshRenderDelegate::updateDataSource()
}
m_meshConnectivity->Modified();
m_geometry->setTopologyChangedFlag(false);
/*auto scalars = vtkSmartPointer<vtkFloatArray>::New();
auto scalarData = m_geometry->getNodalScalarData();
for (size_t i = 0; i < m_geometry->getNumVertices(); ++i)
{
if (scalarData[i] != 4)
{
scalarData[i] = 1;
}
}
scalars->SetArray(scalarData.data(), scalarData.size(), 1);
m_meshConnectivity->GetPointData()->SetScalars(scalars);*/
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment