From 2e846ca4edcc33aca9770bd41ab137cfed7a274c Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <dmitri.naumov@ufz.de>
Date: Fri, 4 May 2018 21:31:04 +0200
Subject: [PATCH] [PL] SD: Update output of nodal forces.

---
 ProcessLib/SmallDeformation/SmallDeformationProcess.cpp | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp b/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp
index e23adf00d6c..67b24bf70c1 100644
--- a/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp
+++ b/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp
@@ -15,6 +15,7 @@
 #include "BaseLib/Functional.h"
 #include "ProcessLib/Process.h"
 #include "ProcessLib/SmallDeformation/CreateLocalAssemblers.h"
+#include "ProcessLib/Utils/GlobalVectorUtils.h"
 
 #include "SmallDeformationFEM.h"
 
@@ -93,8 +94,6 @@ void SmallDeformationProcess<DisplacementDim>::initializeConcreteProcess(
             std::move(all_mesh_subsets_single_component),
             // by location order is needed for output
             NumLib::ComponentOrder::BY_LOCATION);
-    _nodal_forces->resize(DisplacementDim * mesh.getNumberOfNodes());
-    _material_forces->resize(DisplacementDim * mesh.getNumberOfNodes());
 
     Base::_secondary_variables.addSecondaryVariable(
         "free_energy_density",
@@ -249,9 +248,8 @@ void SmallDeformationProcess<DisplacementDim>::
         _local_assemblers, dof_table, t, x, xdot, dxdot_dx, dx_dx, M, K, b, Jac,
         _coupled_solutions);
 
-    b.copyValues(*_nodal_forces);
-    std::transform(_nodal_forces->begin(), _nodal_forces->end(),
-                   _nodal_forces->begin(), [](double val) { return -val; });
+    transformVariableFromGlobalVector(b, 0, *_local_to_global_index_map,
+                                      *_nodal_forces, std::negate<double>());
 }
 
 template <int DisplacementDim>
-- 
GitLab