Alien  1.3.0
Developer documentation
Loading...
Searching...
No Matches
SchurOp.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2023 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#pragma once
8
10#include <alien/data/IVector.h>
11#include <alien/kernels/simple_csr/SimpleCSRMatrix.h>
12#include <alien/kernels/simple_csr/SimpleCSRVector.h>
13#include <alien/utils/Precomp.h>
14
15/*---------------------------------------------------------------------------*/
16/*---------------------------------------------------------------------------*/
17
18namespace Alien
19{
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
28class ALIEN_EXPORT SchurOp
29{
30 public:
32
35 {
36 NoError,
37 WithErrors
38 };
39
44
46 SchurOp(IMatrix& A, IVector& b);
47
49 virtual ~SchurOp() {}
50
57 eErrorType computePrimarySystem(IMatrix& pA, IVector& pb) const;
58
59 eErrorType computeSolutionFromPrimaryUnknowns(IVector const& pX, IVector& sX) const;
60
61 private:
62 eErrorType _apply_schur(Integer block_size,
63 MatrixImpl& A,
64 VectorImpl& B,
65 Integer p_block_size,
66 MatrixImpl& pA,
67 VectorImpl& pB) const;
68
69 eErrorType _apply_schur(Integer block_size,
70 MatrixImpl& A,
71 VectorImpl& B,
72 VBlock const* p_vblock,
73 MatrixImpl& pA,
74 VectorImpl& pB) const;
75
76 eErrorType _apply_schur(VBlock const* vblock,
77 MatrixImpl& A,
78 VectorImpl& B,
79 Integer p_block_size,
80 MatrixImpl& pA,
81 VectorImpl& pB) const;
82
83 eErrorType _apply_schur(VBlock const* vblock,
84 MatrixImpl& A,
85 VectorImpl& B,
86 VBlock const* p_vblock,
87 MatrixImpl& pA,
88 VectorImpl& pB) const;
89
90 eErrorType _compute_solution(VBlock const* vblock,
91 MatrixImpl const& A,
92 VectorImpl const& B,
93 Integer p_block_size,
94 VectorImpl const& px,
95 VectorImpl& x) const;
96
97 eErrorType _compute_solution(VBlock const* vblock,
98 MatrixImpl const& A,
99 VectorImpl const& B,
100 VBlock const* p_vblock,
101 VectorImpl const& px,
102 VectorImpl& x) const;
103
104 void _copy(ConstArrayView<Real> in, ArrayView<Real> out) const
105 {
106 for (Integer i = 0; i < out.size(); ++i)
107 out(i) = in(i);
108 }
109
110 void _copy(ConstArray2View<Real> in, Array2View<Real> out) const
111 {
112 for (Integer i = 0; i < out.dim1Size(); ++i)
113 for (Integer j = 0; j < out.dim2Size(); ++j)
114 out(i, j) = in(i, j);
115 }
116
117 IMatrix& m_A;
118
119 IVector& m_B;
120
121 mutable UniqueArray<Real> m_ghost_diag_values;
122};
123
124/*---------------------------------------------------------------------------*/
125/*---------------------------------------------------------------------------*/
126
127/*---------------------------------------------------------------------------*/
128/*---------------------------------------------------------------------------*/
129
130} // namespace Alien
131
132/*---------------------------------------------------------------------------*/
133/*---------------------------------------------------------------------------*/
IMatrix.h.
IVector.h.
Interface for all matrices.
Definition IMatrix.h:51
Interface for all vectors.
Definition IVector.h:51
SchurOp(IMatrix &A, IVector &b)
Constructor.
Definition SchurOp.cc:28
SimpleCSRMatrix< Arccore::Real > MatrixImpl
Type of the matrix implementation.
Definition SchurOp.h:41
eErrorType
Type of algorithm.
Definition SchurOp.h:35
virtual ~SchurOp()
Free resources.
Definition SchurOp.h:49
SimpleCSRVector< Arccore::Real > VectorImpl
Type of the vector implementation.
Definition SchurOp.h:43
Variable size block elements for block matrices.
Definition VBlock.h:46
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17