trilinos_helpers.h
Go to the documentation of this file.
1 // LIC// ====================================================================
2 // LIC// This file forms part of oomph-lib, the object-oriented,
3 // LIC// multi-physics finite-element library, available
4 // LIC// at http://www.oomph-lib.org.
5 // LIC//
6 // LIC// Copyright (C) 2006-2022 Matthias Heil and Andrew Hazel
7 // LIC//
8 // LIC// This library is free software; you can redistribute it and/or
9 // LIC// modify it under the terms of the GNU Lesser General Public
10 // LIC// License as published by the Free Software Foundation; either
11 // LIC// version 2.1 of the License, or (at your option) any later version.
12 // LIC//
13 // LIC// This library is distributed in the hope that it will be useful,
14 // LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // LIC// Lesser General Public License for more details.
17 // LIC//
18 // LIC// You should have received a copy of the GNU Lesser General Public
19 // LIC// License along with this library; if not, write to the Free Software
20 // LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 // LIC// 02110-1301 USA.
22 // LIC//
23 // LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
24 // LIC//
25 // LIC//====================================================================
26 #ifndef OOMPH_TRILINOS_HELPERS_HEADER
27 #define OOMPH_TRILINOS_HELPERS_HEADER
28 
29 
30 // Config header generated by autoconfig
31 #ifdef HAVE_CONFIG_H
32 #include <oomph-lib-config.h>
33 #endif
34 
35 #ifdef OOMPH_HAS_MPI
36 #include "mpi.h"
37 #endif
38 
39 
40 // trilinos headers
41 #include "Epetra_Map.h"
42 #include "Epetra_LocalMap.h"
43 #include "Epetra_Vector.h"
44 #include "Epetra_CrsMatrix.h"
45 #include "EpetraExt_MatrixMatrix.h"
46 #include "ml_epetra_utils.h"
47 
48 #ifdef OOMPH_HAS_MPI
49 #include "Epetra_MpiComm.h"
50 #else
51 #include "Epetra_SerialComm.h"
52 #endif
53 
54 // oomph-lib headers
55 #include "matrices.h"
56 
57 // mpi includes
58 #ifdef OOMPH_HAS_MPI
59 #include "double_vector.h"
61 #endif
62 
63 namespace oomph
64 {
66  class CRDoubleMatrix;
67 
68 
69  //=============================================================================
74  //=============================================================================
75  namespace TrilinosEpetraHelpers
76  {
77  // VECTOR METHODS
78  // ============================================================
79 
85  Epetra_Vector* create_distributed_epetra_vector(
86  const DoubleVector& oomph_vec);
87 
95  Epetra_Vector* create_distributed_epetra_vector(
96  const LinearAlgebraDistribution* dist_pt);
97 
104  Epetra_Vector* create_epetra_vector_view_data(DoubleVector& oomph_vec);
105 
109  void copy_to_oomphlib_vector(const Epetra_Vector* epetra_vec_pt,
110  DoubleVector& oomph_vec);
111 
112  // MATRIX METHODS
113  // ============================================================
114 
123  Epetra_CrsMatrix* create_distributed_epetra_matrix(
124  const CRDoubleMatrix* oomph_matrix_pt,
125  const LinearAlgebraDistribution* dist_pt);
126 
137  CRDoubleMatrix* oomph_matrix_pt);
138 
139  // MATRIX OPERATION METHODS
140  // ==================================================
141 
148  void multiply(const CRDoubleMatrix* matrix,
149  const DoubleVector& x,
150  DoubleVector& soln);
151 
160  void multiply(const CRDoubleMatrix& matrix_1,
161  const CRDoubleMatrix& matrix_2,
162  CRDoubleMatrix& matrix_soln,
163  const bool& use_ml = false);
164 
165  // HELPER METHODS
166  // ============================================================
167 
169  Epetra_Map* create_epetra_map(const LinearAlgebraDistribution* const dist);
170  }; // namespace TrilinosEpetraHelpers
171 } // namespace oomph
172 #endif
Definition: matrices.h:888
Definition: double_vector.h:58
Definition: linear_algebra_distribution.h:64
Eigen::Map< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor >, 0, Eigen::OuterStride<> > matrix(T *data, int rows, int cols, int stride)
Definition: common.h:85
Epetra_CrsMatrix * create_distributed_epetra_matrix(const CRDoubleMatrix *oomph_matrix_pt, const LinearAlgebraDistribution *dist_pt)
Definition: trilinos_helpers.cc:289
Epetra_CrsMatrix * create_distributed_epetra_matrix_for_aztecoo(CRDoubleMatrix *oomph_matrix_pt)
Definition: trilinos_helpers.cc:474
void copy_to_oomphlib_vector(const Epetra_Vector *epetra_vec_pt, DoubleVector &oomph_vec)
Definition: trilinos_helpers.cc:180
void multiply(const CRDoubleMatrix *matrix, const DoubleVector &x, DoubleVector &soln)
Definition: trilinos_helpers.cc:657
Epetra_Map * create_epetra_map(const LinearAlgebraDistribution *const dist)
create an Epetra_Map corresponding to the LinearAlgebraDistribution
Definition: trilinos_helpers.cc:977
Epetra_Vector * create_distributed_epetra_vector(const DoubleVector &oomph_vec)
Definition: trilinos_helpers.cc:41
Epetra_Vector * create_epetra_vector_view_data(DoubleVector &oomph_vec)
Definition: trilinos_helpers.cc:146
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
list x
Definition: plotDoE.py:28