From fdc10999fefdc6d23b16ba22bb007b3668dc853b Mon Sep 17 00:00:00 2001 From: kronbichler Date: Sat, 15 May 2010 14:05:24 +0000 Subject: [PATCH] Include shared_ptr.h to make patch 21128 really work. Change usage of boost::shared_ptr to std_cxx1x::shared_ptr. git-svn-id: https://svn.dealii.org/trunk@21131 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/filtered_matrix.h | 3 +- deal.II/lac/include/lac/matrix_block.h | 10 +- deal.II/lac/include/lac/slepc_solver.h | 4 +- .../lac/slepc_spectral_transformation.h | 4 +- deal.II/lac/include/lac/trilinos_solver.h | 1 + .../lac/include/lac/trilinos_sparse_matrix.h | 1 + deal.II/lac/include/lac/trilinos_vector.h | 18 +- .../lac/include/lac/trilinos_vector_base.h | 9 +- deal.II/lac/source/trilinos_precondition.cc | 2 +- deal.II/lac/source/trilinos_solver.cc | 68 +++--- deal.II/lac/source/trilinos_sparse_matrix.cc | 219 +++++++----------- .../lac/source/trilinos_sparsity_pattern.cc | 70 +++--- deal.II/lac/source/trilinos_vector.cc | 66 +++--- deal.II/lac/source/trilinos_vector_base.cc | 20 +- 14 files changed, 208 insertions(+), 287 deletions(-) diff --git a/deal.II/lac/include/lac/filtered_matrix.h b/deal.II/lac/include/lac/filtered_matrix.h index e249a059de..20de47e91c 100644 --- a/deal.II/lac/include/lac/filtered_matrix.h +++ b/deal.II/lac/include/lac/filtered_matrix.h @@ -808,8 +808,7 @@ inline void FilteredMatrix::initialize (const MATRIX &m, bool ecs) { - matrix = std_cxx1x::shared_ptr > ( - new_pointer_matrix_base(m, VECTOR())); + matrix.reset (new_pointer_matrix_base(m, VECTOR())); expect_constrained_source = ecs; } diff --git a/deal.II/lac/include/lac/matrix_block.h b/deal.II/lac/include/lac/matrix_block.h index 504110d061..c3752db5b2 100644 --- a/deal.II/lac/include/lac/matrix_block.h +++ b/deal.II/lac/include/lac/matrix_block.h @@ -16,10 +16,10 @@ #include #include #include +#include #include #include -#include DEAL_II_NAMESPACE_OPEN @@ -341,7 +341,7 @@ class MatrixBlock * @author Baerbel Janssen, Guido Kanschat, 2010 */ template -class MatrixBlockVector : public NamedData > > +class MatrixBlockVector : public NamedData > > { public: /** @@ -383,7 +383,7 @@ class MatrixBlockVector : public NamedData * @author Baerbel Janssen, Guido Kanschat, 2010 */ template -class MGMatrixBlockVector : public NamedData > > +class MGMatrixBlockVector : public NamedData > > { public: /** @@ -611,8 +611,8 @@ MatrixBlockVector::add( const std::string& name, const BlockIndices* block_indices) { - boost::shared_ptr > p(new MatrixBlock(row, column, block_indices)); - NamedData > >::add(p, name); + std_cxx1x::shared_ptr > p(new MatrixBlock(row, column, block_indices)); + NamedData > >::add(p, name); } diff --git a/deal.II/lac/include/lac/slepc_solver.h b/deal.II/lac/include/lac/slepc_solver.h index 598ad45a7a..deb4438ca0 100644 --- a/deal.II/lac/include/lac/slepc_solver.h +++ b/deal.II/lac/include/lac/slepc_solver.h @@ -20,11 +20,11 @@ #ifdef DEAL_II_USE_SLEPC +# include # include # include # include # include -# include # include # include @@ -387,7 +387,7 @@ namespace SLEPcWrappers EPS eps; }; - boost::shared_ptr solver_data; + std_cxx1x::shared_ptr solver_data; }; /** diff --git a/deal.II/lac/include/lac/slepc_spectral_transformation.h b/deal.II/lac/include/lac/slepc_spectral_transformation.h index 608d794635..974046c937 100644 --- a/deal.II/lac/include/lac/slepc_spectral_transformation.h +++ b/deal.II/lac/include/lac/slepc_spectral_transformation.h @@ -20,8 +20,8 @@ #ifdef DEAL_II_USE_SLEPC +# include # include -# include # include # include @@ -96,7 +96,7 @@ namespace SLEPcWrappers ST st; }; - boost::shared_ptr transformation_data; + std_cxx1x::shared_ptr transformation_data; }; /** diff --git a/deal.II/lac/include/lac/trilinos_solver.h b/deal.II/lac/include/lac/trilinos_solver.h index 852b925f48..3f9fa9ae42 100644 --- a/deal.II/lac/include/lac/trilinos_solver.h +++ b/deal.II/lac/include/lac/trilinos_solver.h @@ -18,6 +18,7 @@ #ifdef DEAL_II_USE_TRILINOS +# include # include # include # include diff --git a/deal.II/lac/include/lac/trilinos_sparse_matrix.h b/deal.II/lac/include/lac/trilinos_sparse_matrix.h index e60fff121c..9991065825 100644 --- a/deal.II/lac/include/lac/trilinos_sparse_matrix.h +++ b/deal.II/lac/include/lac/trilinos_sparse_matrix.h @@ -18,6 +18,7 @@ #ifdef DEAL_II_USE_TRILINOS +# include # include # include # include diff --git a/deal.II/lac/include/lac/trilinos_vector.h b/deal.II/lac/include/lac/trilinos_vector.h index be23cbea55..b948dac479 100644 --- a/deal.II/lac/include/lac/trilinos_vector.h +++ b/deal.II/lac/include/lac/trilinos_vector.h @@ -18,6 +18,7 @@ #ifdef DEAL_II_USE_TRILINOS +# include # include # include # include @@ -504,8 +505,7 @@ namespace TrilinosWrappers const dealii::Vector &v) { if (&*vector != 0 && vector->Map().SameAs(parallel_partitioner)) - vector = std_cxx1x::shared_ptr - (new Epetra_FEVector(parallel_partitioner)); + vector.reset (new Epetra_FEVector(parallel_partitioner)); const int size = parallel_partitioner.NumMyElements(); @@ -533,14 +533,14 @@ namespace TrilinosWrappers { if (size() != v.size()) { - vector = std_cxx1x::shared_ptr - (new Epetra_FEVector(Epetra_Map (v.size(), 0, + vector.reset (new Epetra_FEVector(Epetra_Map + (v.size(), 0, #ifdef DEAL_II_COMPILER_SUPPORTS_MPI - Epetra_MpiComm(MPI_COMM_SELF) + Epetra_MpiComm(MPI_COMM_SELF) #else - Epetra_SerialComm() + Epetra_SerialComm() #endif - ))); + ))); } reinit (vector_partitioner(), v); @@ -753,7 +753,7 @@ namespace TrilinosWrappers Vector::Vector (const dealii::Vector &v) { Epetra_LocalMap map ((int)v.size(), 0, Utilities::Trilinos::comm_self()); - vector = std_cxx1x::shared_ptr (new Epetra_FEVector(map)); + vector.reset (new Epetra_FEVector(map)); *this = v; } @@ -780,7 +780,7 @@ namespace TrilinosWrappers Epetra_LocalMap map ((int)v.size(), 0, Utilities::Trilinos::comm_self()); - vector = std_cxx1x::shared_ptr (new Epetra_FEVector(map)); + vector.reset (new Epetra_FEVector(map)); } const Epetra_Map & map = vector_partitioner(); diff --git a/deal.II/lac/include/lac/trilinos_vector_base.h b/deal.II/lac/include/lac/trilinos_vector_base.h index 8302aee955..3f1db34a67 100644 --- a/deal.II/lac/include/lac/trilinos_vector_base.h +++ b/deal.II/lac/include/lac/trilinos_vector_base.h @@ -18,6 +18,7 @@ #ifdef DEAL_II_USE_TRILINOS +# include # include # include # include @@ -846,7 +847,7 @@ namespace TrilinosWrappers * class. */ void print (const char* format = 0) const; - + /** * Print to a stream. @p * precision denotes the desired @@ -1112,7 +1113,7 @@ namespace TrilinosWrappers ExcMessage("Vector has not been constructed properly.")); if (fast == false || local_range() != v.local_range()) - vector = std_cxx1x::shared_ptr(new Epetra_FEVector(*v.vector)); + vector.reset (new Epetra_FEVector(*v.vector)); } @@ -1803,8 +1804,8 @@ namespace TrilinosWrappers { return static_cast(vector->Map()); } - - + + #endif // DOXYGEN } diff --git a/deal.II/lac/source/trilinos_precondition.cc b/deal.II/lac/source/trilinos_precondition.cc index e1f2b06155..8f4a58e608 100644 --- a/deal.II/lac/source/trilinos_precondition.cc +++ b/deal.II/lac/source/trilinos_precondition.cc @@ -657,7 +657,7 @@ namespace TrilinosWrappers vector_distributor.reset (new Epetra_Map(n_rows, 0, communicator)); if (&*Matrix==0) - Matrix = std_cxx1x::shared_ptr (new SparseMatrix()); + Matrix.reset (new SparseMatrix()); Matrix->reinit (*vector_distributor, *vector_distributor, deal_ii_sparse_matrix, drop_tolerance, true, diff --git a/deal.II/lac/source/trilinos_solver.cc b/deal.II/lac/source/trilinos_solver.cc index 2ae4df4e55..055734cb43 100644 --- a/deal.II/lac/source/trilinos_solver.cc +++ b/deal.II/lac/source/trilinos_solver.cc @@ -74,7 +74,7 @@ namespace TrilinosWrappers const PreconditionBase &preconditioner) { int ierr; - + linear_problem.reset(); // We need an @@ -82,8 +82,8 @@ namespace TrilinosWrappers // to let the AztecOO solver // know about the matrix and // vectors. - linear_problem = std_cxx1x::shared_ptr - (new Epetra_LinearProblem(const_cast(&A.trilinos_matrix()), + linear_problem.reset + (new Epetra_LinearProblem(const_cast(&A.trilinos_matrix()), &x.trilinos_vector(), const_cast(&b.trilinos_vector()))); @@ -122,12 +122,12 @@ namespace TrilinosWrappers AssertThrow (ierr == 0, ExcTrilinosError(ierr)); // ... set some options, ... - solver.SetAztecOption (AZ_output, additional_data.output_solver_details ? + solver.SetAztecOption (AZ_output, additional_data.output_solver_details ? AZ_all : AZ_none); solver.SetAztecOption (AZ_conv, AZ_noscaled); // ... and then solve! - ierr = solver.Iterate (solver_control.max_steps(), + ierr = solver.Iterate (solver_control.max_steps(), solver_control.tolerance()); AssertThrow (ierr >= 0, ExcTrilinosError(ierr)); @@ -154,7 +154,7 @@ namespace TrilinosWrappers const PreconditionBase &preconditioner) { int ierr; - + linear_problem.reset(); // In case we call the solver with @@ -177,9 +177,9 @@ namespace TrilinosWrappers // to let the AztecOO solver // know about the matrix and // vectors. - linear_problem = std_cxx1x::shared_ptr - (new Epetra_LinearProblem - (const_cast(&A.trilinos_matrix()), &ep_x, &ep_b)); + linear_problem.reset (new Epetra_LinearProblem + (const_cast(&A.trilinos_matrix()), + &ep_x, &ep_b)); // Next we can allocate the // AztecOO solver... @@ -216,12 +216,12 @@ namespace TrilinosWrappers AssertThrow (ierr == 0, ExcTrilinosError(ierr)); // ... set some options, ... - solver.SetAztecOption (AZ_output, additional_data.output_solver_details ? + solver.SetAztecOption (AZ_output, additional_data.output_solver_details ? AZ_all : AZ_none); solver.SetAztecOption (AZ_conv, AZ_noscaled); // ... and then solve! - ierr = solver.Iterate (solver_control.max_steps(), + ierr = solver.Iterate (solver_control.max_steps(), solver_control.tolerance()); AssertThrow (ierr >= 0, ExcTrilinosError(ierr)); @@ -238,11 +238,11 @@ namespace TrilinosWrappers throw SolverControl::NoConvergence (solver_control.last_step(), solver_control.last_value()); } - - - + + + /* ---------------------- SolverCG ------------------------ */ SolverCG::AdditionalData:: @@ -261,7 +261,7 @@ namespace TrilinosWrappers { solver_name = cg; } - + /* ---------------------- SolverGMRES ------------------------ */ @@ -273,8 +273,8 @@ namespace TrilinosWrappers restart_parameter (restart_parameter) {} - - + + SolverGMRES::SolverGMRES (SolverControl &cn, const AdditionalData &data) : @@ -284,7 +284,7 @@ namespace TrilinosWrappers { solver_name = gmres; } - + /* ---------------------- SolverBicgstab ------------------------ */ @@ -306,7 +306,7 @@ namespace TrilinosWrappers solver_name = bicgstab; } - + /* ---------------------- SolverCGS ------------------------ */ SolverCGS::AdditionalData:: @@ -326,7 +326,7 @@ namespace TrilinosWrappers { solver_name = cgs; } - + /* ---------------------- SolverTFQMR ------------------------ */ @@ -367,12 +367,12 @@ namespace TrilinosWrappers additional_data (data.output_solver_details) {} - + SolverDirect::~SolverDirect () {} - + SolverControl & SolverDirect::control() const @@ -390,7 +390,7 @@ namespace TrilinosWrappers // First set whether we want to print // the solver information to screen // or not. - ConditionalOStream verbose_cout (std::cout, + ConditionalOStream verbose_cout (std::cout, additional_data.output_solver_details); linear_problem.reset(); @@ -401,15 +401,14 @@ namespace TrilinosWrappers // to let the AztecOO solver // know about the matrix and // vectors. - linear_problem = std_cxx1x::shared_ptr - (new Epetra_LinearProblem(const_cast(&A.trilinos_matrix()), + linear_problem.reset + (new Epetra_LinearProblem(const_cast(&A.trilinos_matrix()), &x.trilinos_vector(), const_cast(&b.trilinos_vector()))); // Next we can allocate the // AztecOO solver... - solver = std_cxx1x::shared_ptr (Amesos().Create("Amesos_Klu", - *linear_problem)); + solver.reset (Amesos().Create("Amesos_Klu", *linear_problem)); verbose_cout << "Starting symbolic factorization" << std::endl; solver->SymbolicFactorization(); @@ -444,7 +443,7 @@ namespace TrilinosWrappers // First set whether we want to print // the solver information to screen // or not. - ConditionalOStream verbose_cout (std::cout, + ConditionalOStream verbose_cout (std::cout, additional_data.output_solver_details); linear_problem.reset(); @@ -468,14 +467,13 @@ namespace TrilinosWrappers // to let the AztecOO solver // know about the matrix and // vectors. - linear_problem = std_cxx1x::shared_ptr - (new Epetra_LinearProblem - (const_cast(&A.trilinos_matrix()), &ep_x, &ep_b)); + linear_problem.reset (new Epetra_LinearProblem + (const_cast(&A.trilinos_matrix()), + &ep_x, &ep_b)); // Next we can allocate the // AztecOO solver... - solver = std_cxx1x::shared_ptr (Amesos().Create("Amesos_Klu", - *linear_problem)); + solver.reset (Amesos().Create("Amesos_Klu", *linear_problem)); verbose_cout << "Starting symbolic factorization" << std::endl; solver->SymbolicFactorization(); @@ -499,8 +497,8 @@ namespace TrilinosWrappers throw SolverControl::NoConvergence (solver_control.last_step(), solver_control.last_value()); } - - + + } diff --git a/deal.II/lac/source/trilinos_sparse_matrix.cc b/deal.II/lac/source/trilinos_sparse_matrix.cc index 3b6654ab9a..fea6fb0b7a 100644 --- a/deal.II/lac/source/trilinos_sparse_matrix.cc +++ b/deal.II/lac/source/trilinos_sparse_matrix.cc @@ -100,12 +100,10 @@ namespace TrilinosWrappers // interface. SparseMatrix::SparseMatrix () : - column_space_map (std_cxx1x::shared_ptr - (new Epetra_Map (0, 0, - Utilities::Trilinos::comm_self()))), - matrix (std_cxx1x::shared_ptr - (new Epetra_FECrsMatrix(View, *column_space_map, - *column_space_map, 0))), + column_space_map (new Epetra_Map (0, 0, + Utilities::Trilinos::comm_self())), + matrix (new Epetra_FECrsMatrix(View, *column_space_map, + *column_space_map, 0)), last_action (Zero), compressed (true) { @@ -117,11 +115,9 @@ namespace TrilinosWrappers SparseMatrix::SparseMatrix (const Epetra_Map &input_map, const unsigned int n_max_entries_per_row) : - column_space_map (std_cxx1x::shared_ptr - (new Epetra_Map (input_map))), - matrix (std_cxx1x::shared_ptr - (new Epetra_FECrsMatrix(Copy, *column_space_map, - int(n_max_entries_per_row), false))), + column_space_map (new Epetra_Map (input_map)), + matrix (new Epetra_FECrsMatrix(Copy, *column_space_map, + int(n_max_entries_per_row), false)), last_action (Zero), compressed (false) {} @@ -131,12 +127,11 @@ namespace TrilinosWrappers SparseMatrix::SparseMatrix (const Epetra_Map &input_map, const std::vector &n_entries_per_row) : - column_space_map (std_cxx1x::shared_ptr - (new Epetra_Map (input_map))), - matrix (std_cxx1x::shared_ptr - (new Epetra_FECrsMatrix(Copy, *column_space_map, - (int*)const_cast(&(n_entries_per_row[0])), - false))), + column_space_map (new Epetra_Map (input_map)), + matrix (new Epetra_FECrsMatrix + (Copy, *column_space_map, + (int*)const_cast(&(n_entries_per_row[0])), + false)), last_action (Zero), compressed (false) {} @@ -147,11 +142,9 @@ namespace TrilinosWrappers const Epetra_Map &input_col_map, const unsigned int n_max_entries_per_row) : - column_space_map (std_cxx1x::shared_ptr - (new Epetra_Map (input_col_map))), - matrix (std_cxx1x::shared_ptr - (new Epetra_FECrsMatrix(Copy, input_row_map, - int(n_max_entries_per_row), false))), + column_space_map (new Epetra_Map (input_col_map)), + matrix (new Epetra_FECrsMatrix(Copy, input_row_map, + int(n_max_entries_per_row), false)), last_action (Zero), compressed (false) {} @@ -162,12 +155,10 @@ namespace TrilinosWrappers const Epetra_Map &input_col_map, const std::vector &n_entries_per_row) : - column_space_map (std_cxx1x::shared_ptr - (new Epetra_Map (input_col_map))), - matrix (std_cxx1x::shared_ptr - (new Epetra_FECrsMatrix(Copy, input_row_map, + column_space_map (new Epetra_Map (input_col_map)), + matrix (new Epetra_FECrsMatrix(Copy, input_row_map, (int*)const_cast(&(n_entries_per_row[0])), - false))), + false)), last_action (Zero), compressed (false) {} @@ -178,9 +169,8 @@ namespace TrilinosWrappers const unsigned int n, const unsigned int n_max_entries_per_row) : - column_space_map (std_cxx1x::shared_ptr - (new Epetra_Map (n, 0, - Utilities::Trilinos::comm_self()))), + column_space_map (new Epetra_Map (n, 0, + Utilities::Trilinos::comm_self())), // on one processor only, we know how the // columns of the matrix will be @@ -190,13 +180,12 @@ namespace TrilinosWrappers // can't do so in parallel, where the // information from columns is only // available when entries have been added - matrix (std_cxx1x::shared_ptr - (new Epetra_FECrsMatrix(Copy, - Epetra_Map (m, 0, - Utilities::Trilinos::comm_self()), - *column_space_map, - n_max_entries_per_row, - false))), + matrix (new Epetra_FECrsMatrix(Copy, + Epetra_Map (m, 0, + Utilities::Trilinos::comm_self()), + *column_space_map, + n_max_entries_per_row, + false)), last_action (Zero), compressed (false) {} @@ -207,16 +196,14 @@ namespace TrilinosWrappers const unsigned int n, const std::vector &n_entries_per_row) : - column_space_map (std_cxx1x::shared_ptr - (new Epetra_Map (n, 0, - Utilities::Trilinos::comm_self()))), - matrix (std_cxx1x::shared_ptr - (new Epetra_FECrsMatrix(Copy, - Epetra_Map (m, 0, - Utilities::Trilinos::comm_self()), - *column_space_map, + column_space_map (new Epetra_Map (n, 0, + Utilities::Trilinos::comm_self())), + matrix (new Epetra_FECrsMatrix(Copy, + Epetra_Map (m, 0, + Utilities::Trilinos::comm_self()), + *column_space_map, (int*)const_cast(&(n_entries_per_row[0])), - false))), + false)), last_action (Zero), compressed (false) {} @@ -227,14 +214,12 @@ namespace TrilinosWrappers const MPI_Comm &communicator, const unsigned int n_max_entries_per_row) : - column_space_map (std_cxx1x::shared_ptr - (new Epetra_Map(parallel_partitioning. - make_trilinos_map(communicator, false)))), - matrix (std_cxx1x::shared_ptr - (new Epetra_FECrsMatrix(Copy, - *column_space_map, - n_max_entries_per_row, - false))), + column_space_map (new Epetra_Map(parallel_partitioning. + make_trilinos_map(communicator, false))), + matrix (new Epetra_FECrsMatrix(Copy, + *column_space_map, + n_max_entries_per_row, + false)), last_action (Zero), compressed (false) {} @@ -245,14 +230,12 @@ namespace TrilinosWrappers const MPI_Comm &communicator, const std::vector &n_entries_per_row) : - column_space_map (std_cxx1x::shared_ptr - (new Epetra_Map(parallel_partitioning. - make_trilinos_map(communicator, false)))), - matrix (std_cxx1x::shared_ptr - (new Epetra_FECrsMatrix(Copy, - *column_space_map, + column_space_map (new Epetra_Map(parallel_partitioning. + make_trilinos_map(communicator, false))), + matrix (new Epetra_FECrsMatrix(Copy, + *column_space_map, (int*)const_cast(&(n_entries_per_row[0])), - false))), + false)), last_action (Zero), compressed (false) {} @@ -264,15 +247,13 @@ namespace TrilinosWrappers const MPI_Comm &communicator, const unsigned int n_max_entries_per_row) : - column_space_map (std_cxx1x::shared_ptr - (new Epetra_Map(col_parallel_partitioning. - make_trilinos_map(communicator, false)))), - matrix (std_cxx1x::shared_ptr - (new Epetra_FECrsMatrix(Copy, - row_parallel_partitioning. - make_trilinos_map(communicator, false), - n_max_entries_per_row, - false))), + column_space_map (new Epetra_Map(col_parallel_partitioning. + make_trilinos_map(communicator, false))), + matrix (new Epetra_FECrsMatrix(Copy, + row_parallel_partitioning. + make_trilinos_map(communicator, false), + n_max_entries_per_row, + false)), last_action (Zero), compressed (false) {} @@ -284,15 +265,13 @@ namespace TrilinosWrappers const MPI_Comm &communicator, const std::vector &n_entries_per_row) : - column_space_map (std_cxx1x::shared_ptr - (new Epetra_Map(col_parallel_partitioning. - make_trilinos_map(communicator, false)))), - matrix (std_cxx1x::shared_ptr - (new Epetra_FECrsMatrix(Copy, - row_parallel_partitioning. - make_trilinos_map(communicator, false), + column_space_map (new Epetra_Map(col_parallel_partitioning. + make_trilinos_map(communicator, false))), + matrix (new Epetra_FECrsMatrix(Copy, + row_parallel_partitioning. + make_trilinos_map(communicator, false), (int*)const_cast(&(n_entries_per_row[0])), - false))), + false)), last_action (Zero), compressed (false) {} @@ -301,12 +280,10 @@ namespace TrilinosWrappers SparseMatrix::SparseMatrix (const SparsityPattern &sparsity_pattern) : - column_space_map (std_cxx1x::shared_ptr - (new Epetra_Map (sparsity_pattern.domain_partitioner()))), - matrix (std_cxx1x::shared_ptr - (new Epetra_FECrsMatrix(Copy, - sparsity_pattern.trilinos_sparsity_pattern(), - false))), + column_space_map (new Epetra_Map (sparsity_pattern.domain_partitioner())), + matrix (new Epetra_FECrsMatrix(Copy, + sparsity_pattern.trilinos_sparsity_pattern(), + false)), last_action (Zero), compressed (true) { @@ -320,10 +297,8 @@ namespace TrilinosWrappers SparseMatrix::SparseMatrix (const SparseMatrix &input_matrix) : Subscriptor(), - column_space_map (std_cxx1x::shared_ptr - (new Epetra_Map (input_matrix.domain_partitioner()))), - matrix (std_cxx1x::shared_ptr - (new Epetra_FECrsMatrix(*input_matrix.matrix))), + column_space_map (new Epetra_Map (input_matrix.domain_partitioner())), + matrix (new Epetra_FECrsMatrix(*input_matrix.matrix)), last_action (Zero), compressed (true) {} @@ -347,10 +322,8 @@ namespace TrilinosWrappers *matrix = *m.matrix; else { - column_space_map = std_cxx1x::shared_ptr - (new Epetra_Map (m.domain_partitioner())); - matrix = std_cxx1x::shared_ptr - (new Epetra_FECrsMatrix(*m.matrix)); + column_space_map.reset (new Epetra_Map (m.domain_partitioner())); + matrix.reset (new Epetra_FECrsMatrix(*m.matrix)); } compress(); @@ -407,7 +380,7 @@ namespace TrilinosWrappers sparsity_pattern.n_cols())); } - column_space_map = std_cxx1x::shared_ptr (new Epetra_Map (input_col_map)); + column_space_map.reset (new Epetra_Map (input_col_map)); std::vector n_entries_per_row(n_rows); @@ -438,14 +411,13 @@ namespace TrilinosWrappers // columns as well. Compare this with bug // # 4123 in the Sandia Bugzilla. std_cxx1x::shared_ptr graph; + int * first_row_length = &n_entries_per_row[input_row_map.MinMyGID()]; if (input_row_map.Comm().NumProc() > 1) - graph = std_cxx1x::shared_ptr - (new Epetra_CrsGraph (Copy, input_row_map, - &n_entries_per_row[input_row_map.MinMyGID()], true)); + graph.reset (new Epetra_CrsGraph (Copy, input_row_map, first_row_length, + true)); else - graph = std_cxx1x::shared_ptr - (new Epetra_CrsGraph (Copy, input_row_map, input_col_map, - &n_entries_per_row[input_row_map.MinMyGID()], true)); + graph.reset (new Epetra_CrsGraph (Copy, input_row_map, input_col_map, + first_row_length, true)); // This functions assumes that the // sparsity pattern sits on all processors @@ -488,8 +460,7 @@ namespace TrilinosWrappers sparsity_pattern.n_cols())); // And now finally generate the matrix. - matrix = std_cxx1x::shared_ptr - (new Epetra_FECrsMatrix(Copy, *graph, false)); + matrix.reset (new Epetra_FECrsMatrix(Copy, *graph, false)); last_action = Zero; @@ -521,13 +492,10 @@ namespace TrilinosWrappers { // reinit with a (parallel) Trilinos // sparsity pattern. - matrix.reset(); - - column_space_map = std_cxx1x::shared_ptr - (new Epetra_Map (sparsity_pattern.domain_partitioner())); - matrix = std_cxx1x::shared_ptr - (new Epetra_FECrsMatrix(Copy, sparsity_pattern.trilinos_sparsity_pattern(), - false)); + column_space_map.reset (new Epetra_Map + (sparsity_pattern.domain_partitioner())); + matrix.reset (new Epetra_FECrsMatrix + (Copy, sparsity_pattern.trilinos_sparsity_pattern(), false)); compress(); } @@ -536,14 +504,10 @@ namespace TrilinosWrappers void SparseMatrix::reinit (const SparseMatrix &sparse_matrix) { - matrix.reset(); + column_space_map.reset (new Epetra_Map (sparse_matrix.domain_partitioner())); - column_space_map = std_cxx1x::shared_ptr - (new Epetra_Map (sparse_matrix.domain_partitioner())); - - matrix = std_cxx1x::shared_ptr - (new Epetra_FECrsMatrix(Copy, sparse_matrix.trilinos_sparsity_pattern(), - false)); + matrix.reset (new Epetra_FECrsMatrix + (Copy, sparse_matrix.trilinos_sparsity_pattern(), false)); compress(); } @@ -623,10 +587,9 @@ namespace TrilinosWrappers goto set_matrix_values; { - std_cxx1x::shared_ptr trilinos_sparsity; - trilinos_sparsity = std_cxx1x::shared_ptr (new SparsityPattern()); - trilinos_sparsity->reinit (input_row_map, input_col_map, sparsity_pattern); - reinit (*trilinos_sparsity); + SparsityPattern trilinos_sparsity; + trilinos_sparsity.reinit (input_row_map, input_col_map, sparsity_pattern); + reinit (trilinos_sparsity); } set_matrix_values: @@ -694,18 +657,14 @@ namespace TrilinosWrappers SparseMatrix::reinit (const Epetra_CrsMatrix &input_matrix, const bool copy_values) { - matrix.reset(); - Assert (input_matrix.Filled()==true, ExcMessage("Input CrsMatrix has not called FillComplete()!")); - column_space_map = std_cxx1x::shared_ptr - (new Epetra_Map (input_matrix.DomainMap())); + column_space_map.reset (new Epetra_Map (input_matrix.DomainMap())); const Epetra_CrsGraph *graph = &input_matrix.Graph(); - matrix = std_cxx1x::shared_ptr - (new Epetra_FECrsMatrix(Copy, *graph, false)); + matrix.reset (new Epetra_FECrsMatrix(Copy, *graph, false)); matrix->FillComplete (*column_space_map, input_matrix.RangeMap(), true); @@ -729,13 +688,9 @@ namespace TrilinosWrappers // When we clear the matrix, reset // the pointer and generate an // empty matrix. - matrix.reset(); - column_space_map.reset(); - - column_space_map = std_cxx1x::shared_ptr - (new Epetra_Map (0, 0, Utilities::Trilinos::comm_self())); - matrix = std_cxx1x::shared_ptr - (new Epetra_FECrsMatrix(View, *column_space_map, 0)); + column_space_map.reset (new Epetra_Map (0, 0, + Utilities::Trilinos::comm_self())); + matrix.reset (new Epetra_FECrsMatrix(View, *column_space_map, 0)); matrix->FillComplete(); diff --git a/deal.II/lac/source/trilinos_sparsity_pattern.cc b/deal.II/lac/source/trilinos_sparsity_pattern.cc index 71bf649124..9e214f4636 100644 --- a/deal.II/lac/source/trilinos_sparsity_pattern.cc +++ b/deal.II/lac/source/trilinos_sparsity_pattern.cc @@ -86,10 +86,8 @@ namespace TrilinosWrappers : compressed (true) { - column_space_map = std_cxx1x::shared_ptr - (new Epetra_Map (0, 0, Utilities::Trilinos::comm_self())); - graph = std_cxx1x::shared_ptr - (new Epetra_FECrsGraph(View, *column_space_map, *column_space_map, 0)); + column_space_map.reset(new Epetra_Map (0, 0, Utilities::Trilinos::comm_self())); + graph.reset (new Epetra_FECrsGraph(View, *column_space_map, *column_space_map, 0)); graph->FillComplete(); } @@ -150,12 +148,10 @@ namespace TrilinosWrappers SparsityPattern::SparsityPattern (const SparsityPattern &input_sparsity) : Subscriptor(), - column_space_map (std_cxx1x::shared_ptr - (new Epetra_Map(0, 0, Utilities::Trilinos::comm_self()))), + column_space_map (new Epetra_Map(0, 0, Utilities::Trilinos::comm_self())), compressed (false), - graph (std_cxx1x::shared_ptr - (new Epetra_FECrsGraph(View, *column_space_map, - *column_space_map, 0))) + graph (new Epetra_FECrsGraph(View, *column_space_map, + *column_space_map, 0)) { Assert (input_sparsity.n_rows() == 0, ExcMessage ("Copy constructor only works for empty sparsity patterns.")); @@ -193,8 +189,7 @@ namespace TrilinosWrappers const Epetra_Map &input_col_map, const unsigned int n_entries_per_row) { - column_space_map = std_cxx1x::shared_ptr (new Epetra_Map (input_col_map)); - graph.reset(); + column_space_map.reset (new Epetra_Map (input_col_map)); compressed = false; // for more than one processor, need to @@ -208,12 +203,11 @@ namespace TrilinosWrappers // processor, we can directly assign the // columns as well. if (input_row_map.Comm().NumProc() > 1) - graph = std_cxx1x::shared_ptr - (new Epetra_FECrsGraph(Copy, input_row_map, n_entries_per_row, false)); + graph.reset (new Epetra_FECrsGraph(Copy, input_row_map, + n_entries_per_row, false)); else - graph = std_cxx1x::shared_ptr - (new Epetra_FECrsGraph(Copy, input_row_map, input_col_map, - n_entries_per_row, false)); + graph.reset (new Epetra_FECrsGraph(Copy, input_row_map, input_col_map, + n_entries_per_row, false)); } @@ -250,20 +244,17 @@ namespace TrilinosWrappers ExcDimensionMismatch (n_entries_per_row.size(), input_row_map.NumGlobalElements())); - column_space_map = std_cxx1x::shared_ptr (new Epetra_Map (input_col_map)); - graph.reset(); + column_space_map.reset (new Epetra_Map (input_col_map)); compressed = false; if (input_row_map.Comm().NumProc() > 1) - graph = std_cxx1x::shared_ptr - (new Epetra_FECrsGraph(Copy, input_row_map, - n_entries_per_row[input_row_map.MinMyGID()], - false)); + graph.reset(new Epetra_FECrsGraph(Copy, input_row_map, + n_entries_per_row[input_row_map.MinMyGID()], + false)); else - graph = std_cxx1x::shared_ptr - (new Epetra_FECrsGraph(Copy, input_row_map, input_col_map, - n_entries_per_row[input_row_map.MinMyGID()], - false)); + graph.reset(new Epetra_FECrsGraph(Copy, input_row_map, input_col_map, + n_entries_per_row[input_row_map.MinMyGID()], + false)); } @@ -295,8 +286,7 @@ namespace TrilinosWrappers ExcDimensionMismatch (sp.n_cols(), input_col_map.NumGlobalElements())); - column_space_map = std_cxx1x::shared_ptr (new Epetra_Map (input_col_map)); - graph.reset(); + column_space_map.reset (new Epetra_Map (input_col_map)); compressed = false; Assert (input_row_map.LinearMap() == true, @@ -311,15 +301,13 @@ namespace TrilinosWrappers n_entries_per_row[row-input_row_map.MinMyGID()] = sp.row_length(row); if (input_row_map.Comm().NumProc() > 1) - graph = std_cxx1x::shared_ptr - (new Epetra_FECrsGraph(Copy, input_row_map, - n_entries_per_row[0], - false)); + graph.reset(new Epetra_FECrsGraph(Copy, input_row_map, + n_entries_per_row[0], + false)); else - graph = std_cxx1x::shared_ptr - (new Epetra_FECrsGraph(Copy, input_row_map, input_col_map, - n_entries_per_row[0], - false)); + graph.reset (new Epetra_FECrsGraph(Copy, input_row_map, input_col_map, + n_entries_per_row[0], + false)); Assert (graph->NumGlobalRows() == (int)sp.n_rows(), ExcDimensionMismatch (graph->NumGlobalRows(), @@ -396,13 +384,9 @@ namespace TrilinosWrappers // When we clear the matrix, reset // the pointer and generate an // empty sparsity pattern. - column_space_map.reset(); - graph.reset(); - - column_space_map = std_cxx1x::shared_ptr - (new Epetra_Map (0, 0, Utilities::Trilinos::comm_self())); - graph = std_cxx1x::shared_ptr - (new Epetra_FECrsGraph(View, *column_space_map, *column_space_map, 0)); + column_space_map.reset (new Epetra_Map (0, 0, Utilities::Trilinos::comm_self())); + graph.reset (new Epetra_FECrsGraph(View, *column_space_map, + *column_space_map, 0)); graph->FillComplete(); compressed = true; diff --git a/deal.II/lac/source/trilinos_vector.cc b/deal.II/lac/source/trilinos_vector.cc index e3db1a6ede..ce51fc79a3 100644 --- a/deal.II/lac/source/trilinos_vector.cc +++ b/deal.II/lac/source/trilinos_vector.cc @@ -34,8 +34,7 @@ namespace TrilinosWrappers Vector::Vector () { last_action = Zero; - vector = std_cxx1x::shared_ptr - (new Epetra_FEVector(Epetra_Map(0,0,0,Utilities::Trilinos::comm_self()))); + vector.reset(new Epetra_FEVector(Epetra_Map(0,0,0,Utilities::Trilinos::comm_self()))); } @@ -60,7 +59,7 @@ namespace TrilinosWrappers VectorBase() { last_action = Zero; - vector = std_cxx1x::shared_ptr (new Epetra_FEVector(*v.vector)); + vector.reset (new Epetra_FEVector(*v.vector)); } @@ -77,10 +76,10 @@ namespace TrilinosWrappers last_action = Zero; if (input_map.SameAs(v.vector->Map()) == true) - vector = std_cxx1x::shared_ptr (new Epetra_FEVector(*v.vector)); + vector.reset (new Epetra_FEVector(*v.vector)); else { - vector = std_cxx1x::shared_ptr (new Epetra_FEVector(input_map)); + vector.reset (new Epetra_FEVector(input_map)); reinit (v, false, true); } } @@ -99,9 +98,9 @@ namespace TrilinosWrappers last_action = Zero; - vector = std_cxx1x::shared_ptr - (new Epetra_FEVector(parallel_partitioner.make_trilinos_map(communicator, - true))); + vector.reset (new Epetra_FEVector + (parallel_partitioner.make_trilinos_map(communicator, + true))); reinit (v, false, true); } @@ -117,7 +116,7 @@ namespace TrilinosWrappers const bool fast) { if (!vector->Map().SameAs(input_map)) - vector = std_cxx1x::shared_ptr (new Epetra_FEVector(input_map)); + vector.reset (new Epetra_FEVector(input_map)); else if (fast == false) { const int ierr = vector->PutScalar(0.); @@ -157,10 +156,7 @@ namespace TrilinosWrappers { if (vector->Map().SameAs(v.vector->Map()) == false) { - vector.reset(); - - vector = std_cxx1x::shared_ptr - (new Epetra_FEVector(v.vector->Map())); + vector.reset (new Epetra_FEVector(v.vector->Map())); last_action = Zero; } else if (fast == false) @@ -245,10 +241,10 @@ namespace TrilinosWrappers v.block(0).vector_partitioner().Comm()); if (import_data == false) - vector = std_cxx1x::shared_ptr (new Epetra_FEVector (new_map)); + vector.reset (new Epetra_FEVector (new_map)); - Teuchos::RCP actual_vec = (import_data == true) ? - Teuchos::rcp (new Epetra_FEVector (new_map), true) : + Teuchos::RCP actual_vec = (import_data == true) ? + Teuchos::rcp (new Epetra_FEVector (new_map), true) : Teuchos::rcp (&*vector, false); TrilinosScalar* entries = (*actual_vec)[0]; @@ -261,9 +257,9 @@ namespace TrilinosWrappers if (import_data == true) { - AssertThrow (static_cast(actual_vec->GlobalLength()) + AssertThrow (static_cast(actual_vec->GlobalLength()) == v.size(), - ExcDimensionMismatch (actual_vec->GlobalLength(), + ExcDimensionMismatch (actual_vec->GlobalLength(), v.size())); Epetra_Import data_exchange (vector->Map(), actual_vec->Map()); @@ -328,9 +324,7 @@ namespace TrilinosWrappers } else { - vector.reset(); - vector = std_cxx1x::shared_ptr - (new Epetra_FEVector(*v.vector)); + vector.reset (new Epetra_FEVector(*v.vector)); last_action = Zero; } @@ -370,7 +364,7 @@ namespace TrilinosWrappers if (vector->Map().SameAs(m.col_partitioner()) == false) { Epetra_Map map = m.col_partitioner(); - vector = std_cxx1x::shared_ptr (new Epetra_FEVector(map)); + vector.reset (new Epetra_FEVector(map)); } Epetra_Import data_exchange (vector->Map(), v.vector->Map()); @@ -390,7 +384,7 @@ namespace TrilinosWrappers { last_action = Zero; Epetra_LocalMap map (0, 0, Utilities::Trilinos::comm_self()); - vector = std_cxx1x::shared_ptr (new Epetra_FEVector(map)); + vector.reset (new Epetra_FEVector(map)); } @@ -399,7 +393,7 @@ namespace TrilinosWrappers { last_action = Zero; Epetra_LocalMap map ((int)n, 0, Utilities::Trilinos::comm_self()); - vector = std_cxx1x::shared_ptr (new Epetra_FEVector (map)); + vector.reset (new Epetra_FEVector (map)); } @@ -410,7 +404,7 @@ namespace TrilinosWrappers Epetra_LocalMap map (input_map.NumGlobalElements(), input_map.IndexBase(), input_map.Comm()); - vector = std_cxx1x::shared_ptr (new Epetra_FEVector(map)); + vector.reset (new Epetra_FEVector(map)); } @@ -427,7 +421,7 @@ namespace TrilinosWrappers Epetra_SerialComm()); (void)communicator; #endif - vector = std_cxx1x::shared_ptr (new Epetra_FEVector(map)); + vector.reset (new Epetra_FEVector(map)); } @@ -438,7 +432,7 @@ namespace TrilinosWrappers Epetra_LocalMap map (v.vector->Map().NumGlobalElements(), v.vector->Map().IndexBase(), v.vector->Map().Comm()); - vector = std_cxx1x::shared_ptr (new Epetra_FEVector(map)); + vector.reset (new Epetra_FEVector(map)); if (vector->Map().SameAs(v.vector->Map()) == true) { @@ -458,11 +452,9 @@ namespace TrilinosWrappers { if (size() != n) { - vector.reset(); - Epetra_LocalMap map ((int)n, 0, Utilities::Trilinos::comm_self()); - vector = std_cxx1x::shared_ptr (new Epetra_FEVector (map)); + vector.reset (new Epetra_FEVector (map)); } else if (fast == false) { @@ -485,11 +477,10 @@ namespace TrilinosWrappers { if (vector->Map().NumGlobalElements() != input_map.NumGlobalElements()) { - vector.reset(); Epetra_LocalMap map (input_map.NumGlobalElements(), input_map.IndexBase(), input_map.Comm()); - vector = std_cxx1x::shared_ptr (new Epetra_FEVector (map)); + vector.reset (new Epetra_FEVector (map)); } else if (fast == false) { @@ -514,7 +505,6 @@ namespace TrilinosWrappers if (vector->Map().NumGlobalElements() != static_cast(partitioning.size())) { - vector.reset(); Epetra_LocalMap map (partitioning.size(), 0, #ifdef DEAL_II_COMPILER_SUPPORTS_MPI @@ -523,7 +513,7 @@ namespace TrilinosWrappers Epetra_SerialComm()); (void)communicator; #endif - vector = std_cxx1x::shared_ptr (new Epetra_FEVector(map)); + vector.reset (new Epetra_FEVector(map)); } else if (fast == false) { @@ -556,11 +546,10 @@ namespace TrilinosWrappers { if (local_range() != v.local_range()) { - vector.reset(); Epetra_LocalMap map (v.vector->GlobalLength(), v.vector->Map().IndexBase(), v.vector->Comm()); - vector = std_cxx1x::shared_ptr (new Epetra_FEVector(map)); + vector.reset (new Epetra_FEVector(map)); } else { @@ -612,11 +601,10 @@ namespace TrilinosWrappers { if (size() != v.size()) { - vector.reset(); Epetra_LocalMap map (v.vector->Map().NumGlobalElements(), v.vector->Map().IndexBase(), v.vector->Comm()); - vector = std_cxx1x::shared_ptr (new Epetra_FEVector(map)); + vector.reset (new Epetra_FEVector(map)); } reinit (v, false, true); @@ -633,7 +621,7 @@ namespace TrilinosWrappers Epetra_LocalMap map (v.vector->Map().NumGlobalElements(), v.vector->Map().IndexBase(), v.vector->Comm()); - vector = std_cxx1x::shared_ptr (new Epetra_FEVector(map)); + vector.reset (new Epetra_FEVector(map)); } const int ierr = vector->Update(1.0, *v.vector, 0.0); diff --git a/deal.II/lac/source/trilinos_vector_base.cc b/deal.II/lac/source/trilinos_vector_base.cc index 0bb6e2591b..28873eb827 100644 --- a/deal.II/lac/source/trilinos_vector_base.cc +++ b/deal.II/lac/source/trilinos_vector_base.cc @@ -57,13 +57,11 @@ namespace TrilinosWrappers last_action (Zero), compressed (true), #ifdef DEAL_II_COMPILER_SUPPORTS_MPI - vector(std_cxx1x::shared_ptr - (new Epetra_FEVector( - Epetra_Map(0,0,Epetra_MpiComm(MPI_COMM_SELF))))) + vector(new Epetra_FEVector( + Epetra_Map(0,0,Epetra_MpiComm(MPI_COMM_SELF)))) #else - vector(std_cxx1x::shared_ptr - (new Epetra_FEVector( - Epetra_Map(0,0,Epetra_SerialComm())))) + vector(new Epetra_FEVector( + Epetra_Map(0,0,Epetra_SerialComm()))) #endif {} @@ -74,8 +72,7 @@ namespace TrilinosWrappers Subscriptor(), last_action (Zero), compressed (true), - vector(std_cxx1x::shared_ptr - (new Epetra_FEVector(*v.vector))) + vector(new Epetra_FEVector(*v.vector)) {} @@ -91,15 +88,13 @@ namespace TrilinosWrappers // When we clear the vector, // reset the pointer and generate // an empty vector. - vector.reset(); - #ifdef DEAL_II_COMPILER_SUPPORTS_MPI Epetra_Map map (0, 0, Epetra_MpiComm(MPI_COMM_SELF)); #else Epetra_Map map (0, 0, Epetra_SerialComm()); #endif - vector = std_cxx1x::shared_ptr (new Epetra_FEVector(map)); + vector.reset (new Epetra_FEVector(map)); last_action = Zero; } @@ -113,9 +108,8 @@ namespace TrilinosWrappers if (local_range() != v.local_range()) { - vector.reset(); last_action = Zero; - vector = std_cxx1x::shared_ptr(new Epetra_FEVector(*v.vector)); + vector.reset (new Epetra_FEVector(*v.vector)); } else { -- 2.39.5