Arcane  v4.1.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
HybridBuiltinBackend.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/* HybridBuiltinBackend.h (C) 2000-2026 */
9/* */
10/* Builtin backend that uses scalar and block format matrix. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCCORE_ALINA_HYBRIDBUILTINBACKEND_H
13#define ARCCORE_ALINA_HYBRIDBUILTINBACKEND_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/ValueTypeInterface.h"
28#include "arccore/alina/Adapters.h"
29
30/*---------------------------------------------------------------------------*/
31/*---------------------------------------------------------------------------*/
32
33namespace Arcane::Alina::backend
34{
35
36/*---------------------------------------------------------------------------*/
37/*---------------------------------------------------------------------------*/
38
43template <typename BlockType, typename ColumnType = ptrdiff_t, typename PointerType = ColumnType>
44struct HybridBuiltinBackend : public BuiltinBackend<typename math::scalar_of<BlockType>::type, ColumnType, PointerType>
45{
46 typedef typename math::scalar_of<BlockType>::type ScalarType;
49 struct provides_row_iterator : std::false_type
50 {};
51
52 static std::shared_ptr<matrix>
53 copy_matrix(std::shared_ptr<typename Base::matrix> As, const typename Base::params&)
54 {
55 return std::make_shared<matrix>(Alina::adapter::block_matrix<BlockType>(*As));
56 }
57};
58
59template <typename B1, typename B2, typename C, typename P>
60struct backends_compatible<HybridBuiltinBackend<B1, C, P>, HybridBuiltinBackend<B2, C, P>> : std::true_type
61{};
62
63template <typename T1, typename B2, typename C, typename P>
64struct backends_compatible<BuiltinBackend<T1, C, P>, HybridBuiltinBackend<B2, C, P>> : std::true_type
65{};
66
67template <typename B1, typename T2, typename C, typename P>
68struct backends_compatible<HybridBuiltinBackend<B1, C, P>, BuiltinBackend<T2, C, P>> : std::true_type
69{};
70
71/*---------------------------------------------------------------------------*/
72/*---------------------------------------------------------------------------*/
73
74} // namespace Arcane::Alina::backend
75
76/*---------------------------------------------------------------------------*/
77/*---------------------------------------------------------------------------*/
78
79#endif
Sparse matrix stored in CSR (Compressed Sparse Row) format.
Definition CSRMatrix.h:98
Hybrid backend uses scalar matrices to build the hierarchy, but stores the computed matrices in the b...
Metafunction that checks if two backends are compatible.