Arcane  v4.1.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
DistributedSkylineLUDirectSolver.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* DistributedSkylineLUDirectSolver.h (C) 2000-2026 */
9/* */
10/* Distributed direct solver that uses Skyline LU factorization. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCCORE_ALINA_MPI_DISTRIBUTEDSKYLINELUDIRECTSOLVER_H
13#define ARCCORE_ALINA_MPI_DISTRIBUTEDSKYLINELUDIRECTSOLVER_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16/*
17 * This file is based on the work on AMGCL library (version march 2026)
18 * which can be found at https://github.com/ddemidov/amgcl.
19 *
20 * Copyright (c) 2012-2022 Denis Demidov <dennis.demidov@gmail.com>
21 * SPDX-License-Identifier: MIT
22 */
23/*---------------------------------------------------------------------------*/
24/*---------------------------------------------------------------------------*/
25
26#include "arccore/alina/BuiltinBackend.h"
27#include "arccore/alina/Adapters.h"
28#include "arccore/alina/SkylineLUSolver.h"
29#include "arccore/alina/DistributedDirectSolverBase.h"
30
31/*---------------------------------------------------------------------------*/
32/*---------------------------------------------------------------------------*/
33
34namespace Arcane::Alina
35{
36
37/*---------------------------------------------------------------------------*/
38/*---------------------------------------------------------------------------*/
45template <typename value_type>
47: public DistributedDirectSolverBase<value_type, DistributedSkylineLUDirectSolver<value_type>>
48{
49 public:
50
52 typedef typename Solver::params params;
53 typedef CSRMatrix<value_type> build_matrix;
54
56 template <class Matrix>
58 const params& prm = params{})
59 : prm(prm)
60 {
61 static_cast<Base*>(this)->init(comm, A);
62 }
63
64 static size_t coarse_enough()
65 {
66 return Solver::coarse_enough();
67 }
68
69 int comm_size(int /*n*/) const
70 {
71 return 1;
72 }
73
74 void init(mpi_communicator, const build_matrix& A)
75 {
76 S = std::make_shared<Solver>(A, prm);
77 }
78
85 template <class Vec1, class Vec2>
86 void solve(const Vec1& rhs, Vec2& x) const
87 {
88 (*S)(rhs, x);
89 }
90
91 private:
92
94 params prm;
95 std::shared_ptr<Solver> S;
96};
97
98/*---------------------------------------------------------------------------*/
99/*---------------------------------------------------------------------------*/
100
101} // namespace Arcane::Alina
102
103/*---------------------------------------------------------------------------*/
104/*---------------------------------------------------------------------------*/
105
106#endif
Base class for distributed direct solver.
DistributedSkylineLUDirectSolver(mpi_communicator comm, const Matrix &A, const params &prm=params{})
Constructor.
void solve(const Vec1 &rhs, Vec2 &x) const
Solves the problem for the given right-hand side.
Direct solver that uses Skyline LU factorization.
Matrix class, to be used by user.
Sparse matrix stored in CSR (Compressed Sparse Row) format.
Definition CSRMatrix.h:98
Convenience wrapper around MPI_Comm.