svMultiPhysics
Loading...
Searching...
No Matches
LinearAlgebra.h
1// SPDX-FileCopyrightText: Copyright (c) Stanford University, The Regents of the University of California, and others.
2// SPDX-License-Identifier: BSD-3-Clause
3
4#ifndef LINEAR_ALGEBRA_H
5#define LINEAR_ALGEBRA_H
6
7#include "ComMod.h"
8#include "consts.h"
9
10/// @brief The LinearAlgebra class provides an abstract interface to linear algebra
11/// frameworks: FSILS, Trilinos, PETSc, etc.
12//
14 public:
15 static const std::map<std::string, consts::LinearAlgebraType> name_to_type;
16 static const std::map<consts::LinearAlgebraType, std::string> type_to_name;
17 static void check_equation_compatibility(const consts::EquationType eq_phys,
18 const consts::LinearAlgebraType lin_alg_type, const consts::LinearAlgebraType assembly_type);
19
21 virtual ~LinearAlgebra() { };
22 virtual void alloc(ComMod& com_mod, eqType& lEq) = 0;
23 virtual void assemble(ComMod& com_mod, const int num_elem_nodes, const Vector<int>& eqN,
24 const Array3<double>& lK, const Array<double>& lR) = 0;
25 virtual void check_options(const consts::PreconditionerType prec_cond_type, const consts::LinearAlgebraType assembly_type) = 0;
26 virtual void initialize(ComMod& com_mod, eqType& lEq) = 0;
27 virtual void set_assembly(consts::LinearAlgebraType assembly_type) = 0;
28 virtual void set_preconditioner(consts::PreconditionerType prec_type) = 0;
29 virtual void solve(ComMod& com_mod, eqType& lEq, const Vector<int>& incL, const Vector<double>& res) = 0;
30
31 virtual consts::LinearAlgebraType get_interface_type() { return interface_type; }
32
33 consts::LinearAlgebraType interface_type = consts::LinearAlgebraType::none;
34 consts::LinearAlgebraType assembly_type = consts::LinearAlgebraType::none;
35 consts::PreconditionerType preconditioner_type = consts::PreconditionerType::PREC_NONE;
36};
37
38/// @brief The LinearAlgebraFactory class provides a factory used to create objects derived from LinearAlgebra.
40 public:
41 static LinearAlgebra* create_interface(consts::LinearAlgebraType interface_type);
42};
43
44
45#endif
46
The Array3 template class implements a simple interface to 3D arrays.
Definition Array3.h:25
The ComMod class duplicates the data structures in the Fortran COMMOD module defined in MOD....
Definition ComMod.h:1514
The LinearAlgebraFactory class provides a factory used to create objects derived from LinearAlgebra.
Definition LinearAlgebra.h:39
static LinearAlgebra * create_interface(consts::LinearAlgebraType interface_type)
Create objects derived from LinearAlgebra.
Definition LinearAlgebra.cpp:45
The LinearAlgebra class provides an abstract interface to linear algebra frameworks: FSILS,...
Definition LinearAlgebra.h:13
static void check_equation_compatibility(const consts::EquationType eq_phys, const consts::LinearAlgebraType lin_alg_type, const consts::LinearAlgebraType assembly_type)
Check that equation physics is compatible with LinearAlgebra type.
Definition LinearAlgebra.cpp:25
The Vector template class is used for storing int and double data.
Definition Vector.h:23
Equation type.
Definition ComMod.h:1069