From f9f682640ab874a5eceace0beba6f394acf97655 Mon Sep 17 00:00:00 2001 From: makkemal Date: Sat, 7 Jan 2017 16:06:49 +0100 Subject: [PATCH] FEM: VTK tools, add stress and strain vectors (x,y,z) --- src/Mod/Fem/App/FemVTKTools.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/Mod/Fem/App/FemVTKTools.cpp b/src/Mod/Fem/App/FemVTKTools.cpp index 2e30251c8..e1d3faa8a 100644 --- a/src/Mod/Fem/App/FemVTKTools.cpp +++ b/src/Mod/Fem/App/FemVTKTools.cpp @@ -851,6 +851,37 @@ void FemVTKTools::exportMechanicalResult(const App::DocumentObject* obj, vtkSmar grid->GetPointData()->AddArray(data); }} + + if(!res->StressVectors.getValues().empty()) { + const std::vector& vec = res->StressVectors.getValues(); + if (vec.size()>1) { + vtkSmartPointer data = vtkSmartPointer::New(); + data->SetNumberOfComponents(3); + data->SetName("Stress Vectors"); + + for(std::vector::const_iterator it=vec.begin(); it!=vec.end(); ++it) { + double tuple[] = {it->x, it->y , it->z}; + data->InsertNextTuple(tuple); + } + + grid->GetPointData()->AddArray(data); + }} + + if(!res->StrainVectors.getValues().empty()) { + const std::vector& vec = res->StrainVectors.getValues(); + if (vec.size()>1) { + vtkSmartPointer data = vtkSmartPointer::New(); + data->SetNumberOfComponents(3); + data->SetName("Strain Vectors"); + + for(std::vector::const_iterator it=vec.begin(); it!=vec.end(); ++it) { + double tuple[] = {it->x, it->y, it->z}; + data->InsertNextTuple(tuple); + } + + grid->GetPointData()->AddArray(data); + }} + } } // namespace