From 9cebedcbbc005bcfa853303e3d5684084f29b2b2 Mon Sep 17 00:00:00 2001 From: "Irina K. Tezaur" Date: Thu, 13 Apr 2017 09:49:53 -0700 Subject: [PATCH] LCM: fixing issue #107 (matrix-free with no DTK seg faults) by changing setting of x_, xdot_, etc. using copy constructor from xT, xdotT, etc., rather than setting pointers equal to each other. With this fix, getX() returns a valid pointer to a Tpetra_Vector, for which get1DView() works. --- src/Albany_Application.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Albany_Application.cpp b/src/Albany_Application.cpp index 8961bae049..27afb418f7 100644 --- a/src/Albany_Application.cpp +++ b/src/Albany_Application.cpp @@ -1263,9 +1263,12 @@ computeGlobalResidualImplT( #if defined(ALBANY_LCM) // Store pointers to solution and time derivatives. // Needed for Schwarz coupling. - x_ = xT; - xdot_ = xdotT; - xdotdot_ = xdotdotT; + if (xT != Teuchos::null) x_ = Teuchos::rcp(new Tpetra_Vector(*xT)); + else x_ = Teuchos::null; + if (xdotT != Teuchos::null) xdot_ = Teuchos::rcp(new Tpetra_Vector(*xdotT)); + else xdot_ = Teuchos::null; + if (xdotdotT != Teuchos::null) xdotdot_ = Teuchos::rcp(new Tpetra_Vector(*xdotdotT)); + else xdotdot_ = Teuchos::null; #endif // Mesh motion needs to occur here on the global mesh befor