svFSIplus
TrilinosLinearAlgebra.h
1 /* Copyright (c) Stanford University, The Regents of the University of California, and others.
2  *
3  * All Rights Reserved.
4  *
5  * See Copyright-SimVascular.txt for additional details.
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining
8  * a copy of this software and associated documentation files (the
9  * "Software"), to deal in the Software without restriction, including
10  * without limitation the rights to use, copy, modify, merge, publish,
11  * distribute, sublicense, and/or sell copies of the Software, and to
12  * permit persons to whom the Software is furnished to do so, subject
13  * to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included
16  * in all copies or substantial portions of the Software.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
19  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
21  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
22  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef TRILINOS_LINEAR_ALGEBRA_H
32 #define TRILINOS_LINEAR_ALGEBRA_H
33 
34 #include "LinearAlgebra.h"
35 
36 /// @brief The TrilinosLinearAlgebra class implements the LinearAlgebra
37 /// interface for the Trilinos numerical linear algebra package.
38 ///
39 class TrilinosLinearAlgebra : public virtual LinearAlgebra {
40 
41  public:
44 
45  virtual void alloc(ComMod& com_mod, eqType& lEq);
46  virtual void assemble(ComMod& com_mod, const int num_elem_nodes, const Vector<int>& eqN,
47  const Array3<double>& lK, const Array<double>& lR);
48  virtual void check_options(const consts::PreconditionerType prec_cond_type, const consts::LinearAlgebraType assembly_type);
49  virtual void initialize(ComMod& com_mod, eqType& lEq);
50  virtual void set_assembly(consts::LinearAlgebraType atype);
51  virtual void set_preconditioner(consts::PreconditionerType prec_type);
52  virtual void solve(ComMod& com_mod, eqType& lEq, const Vector<int>& incL, const Vector<double>& res);
53 
54  private:
55  static std::set<consts::LinearAlgebraType> valid_assemblers;
56  void initialize_fsils(ComMod& com_mod, eqType& lEq);
57  bool use_fsils_assembly = false;
58  /// @brief The FsilsLinearAlgebra object used to assemble local element matrices.
59  LinearAlgebra* fsils_solver = nullptr;
60  // Private class used to hide Trilinos implementation details.
61  class TrilinosImpl;
62  TrilinosImpl* impl = nullptr;
63 };
64 
65 #endif
66 
The ComMod class duplicates the data structures in the Fortran COMMOD module defined in MOD....
Definition: ComMod.h:1332
The LinearAlgebra class provides an abstract interface to linear algebra frameworks: FSILS,...
Definition: LinearAlgebra.h:40
Definition: trilinos_impl.cpp:1088
The TrilinosLinearAlgebra class implements the LinearAlgebra interface for the Trilinos numerical lin...
Definition: TrilinosLinearAlgebra.h:39
virtual void solve(ComMod &com_mod, eqType &lEq, const Vector< int > &incL, const Vector< double > &res)
Solve a system of linear equations.
Definition: TrilinosLinearAlgebra.cpp:196
virtual void set_preconditioner(consts::PreconditionerType prec_type)
Set the proconditioner.
Definition: TrilinosLinearAlgebra.cpp:183
virtual void assemble(ComMod &com_mod, const int num_elem_nodes, const Vector< int > &eqN, const Array3< double > &lK, const Array< double > &lR)
Assemble local element arrays.
Definition: TrilinosLinearAlgebra.cpp:101
virtual void set_assembly(consts::LinearAlgebraType atype)
Set the linear algebra package for assmbly.
Definition: TrilinosLinearAlgebra.cpp:163
virtual void initialize(ComMod &com_mod, eqType &lEq)
Initialize Trilinos framework.
Definition: TrilinosLinearAlgebra.cpp:138
virtual void check_options(const consts::PreconditionerType prec_cond_type, const consts::LinearAlgebraType assembly_type)
Check the validity of the precondition and assembly options.
Definition: TrilinosLinearAlgebra.cpp:115
virtual void alloc(ComMod &com_mod, eqType &lEq)
Allocate data arrays.
Definition: TrilinosLinearAlgebra.cpp:86
Equation type.
Definition: ComMod.h:1000