Arcane  4.1.11.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 Backend>
47: public DistributedDirectSolverBase<Backend, DistributedSkylineLUDirectSolver<Backend>>
48{
49 using Base = DistributedDirectSolverBase<Backend, DistributedSkylineLUDirectSolver<Backend>>;
50
51 public:
52
53 typedef typename Backend::value_type value_type;
55 typedef typename Solver::params params;
56 typedef Backend::matrix build_matrix;
57
59 template <class Matrix>
61 const params& prm = params{})
62 : prm(prm)
63 {
64 static_cast<Base*>(this)->init(comm, A);
65 }
66
67 static size_t coarse_enough()
68 {
69 return Solver::coarse_enough();
70 }
71
72 int comm_size(int /*n*/) const
73 {
74 return 1;
75 }
76
77 void init(mpi_communicator, const build_matrix& A)
78 {
79 S = std::make_shared<Solver>(A, prm);
80 }
81
88 template <class Vec1, class Vec2>
89 void solve(const Vec1& rhs, Vec2& x) const
90 {
91 (*S)(rhs, x);
92 }
93
94 private:
95
96 params prm;
97 std::shared_ptr<Solver> S;
98};
99
100/*---------------------------------------------------------------------------*/
101/*---------------------------------------------------------------------------*/
102
103} // namespace Arcane::Alina
104
105/*---------------------------------------------------------------------------*/
106/*---------------------------------------------------------------------------*/
107
108#endif
void solve(const Vec1 &rhs, Vec2 &x) const
Solves the problem for the given right-hand side.
DistributedSkylineLUDirectSolver(mpi_communicator comm, const Matrix &A, const params &prm=params{})
Constructor.
Direct solver that uses Skyline LU factorization.
Matrix class, to be used by user.
Convenience wrapper around MPI_Comm.