Alien  1.3.0
Developer documentation
Loading...
Searching...
No Matches
EigenSolverT.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 IFPEN-CEA
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * SPDX-License-Identifier: Apache-2.0
17 */
18
23
24#pragma once
25
26#include <alien/core/backend/EigenSolver.h>
27
30#include <alien/data/IMatrix.h>
31#include <alien/data/IVector.h>
32
33/*---------------------------------------------------------------------------*/
34/*---------------------------------------------------------------------------*/
35
36namespace Alien
37{
38
39/*---------------------------------------------------------------------------*/
40/*---------------------------------------------------------------------------*/
41
42template <class TagT, typename VectorT>
43Integer
45{
46 return this->m_A.impl()->distribution().rowDistribution().localSize();
47}
48
49/*---------------------------------------------------------------------------*/
50/*---------------------------------------------------------------------------*/
51
52template <class TagT, typename VectorT>
55{
56 return this->m_A.impl()->template get<TagT>();
57}
58
59/*---------------------------------------------------------------------------*/
60/*---------------------------------------------------------------------------*/
61
62template <class TagT, typename VectorT>
63Integer
65{
66 return this->m_A.impl()->distribution().rowDistribution().localSize();
67}
68
69/*---------------------------------------------------------------------------*/
70/*---------------------------------------------------------------------------*/
71
72template <class TagT, typename VectorT>
75{
76 return this->m_A.impl()->template get<TagT>();
77}
78
79/*---------------------------------------------------------------------------*/
80/*---------------------------------------------------------------------------*/
81
82template <class TagT, typename VectorT>
85{
86 return this->m_B.impl()->template get<TagT>();
87}
88
89/*---------------------------------------------------------------------------*/
90/*---------------------------------------------------------------------------*/
91
92template <class Tag>
93EigenSolver<Tag>::EigenSolver(IMessagePassingMng* parallel_mng, IOptions* options)
94: m_solver(AlgebraTraits<Tag>::eigen_solver_factory(parallel_mng, options))
95{}
96
97/*---------------------------------------------------------------------------*/
98/*---------------------------------------------------------------------------*/
99
100template <class Tag>
101String
106
107/*---------------------------------------------------------------------------*/
108/*---------------------------------------------------------------------------*/
109
110template <class Tag>
112{
113 m_solver->init();
114}
115
116/*---------------------------------------------------------------------------*/
117/*---------------------------------------------------------------------------*/
118
119template <class Tag>
121{
122 return m_solver->solve(p);
123}
124
125/*---------------------------------------------------------------------------*/
126/*---------------------------------------------------------------------------*/
127
128template <class Tag>
130{
131 return m_solver->hasParallelSupport();
132}
133
134/*---------------------------------------------------------------------------*/
135/*---------------------------------------------------------------------------*/
136
137template <class Tag>
140{
141 return m_solver->getStatus();
142}
143
144/*---------------------------------------------------------------------------*/
145/*---------------------------------------------------------------------------*/
146
147template <class Tag>
150{
151 return m_solver.get();
152}
153
154/*---------------------------------------------------------------------------*/
155/*---------------------------------------------------------------------------*/
156
157template <class Tag>
159IMessagePassingMng* parallel_mng, IOptions* options)
160: m_solver(AlgebraTraits<Tag>::eigen_solver_factory(parallel_mng, options))
161{}
162
163/*---------------------------------------------------------------------------*/
164/*---------------------------------------------------------------------------*/
165
166template <class Tag>
167String
172
173/*---------------------------------------------------------------------------*/
174/*---------------------------------------------------------------------------*/
175
176template <class Tag>
178{
179 m_solver->init();
180}
181
182/*---------------------------------------------------------------------------*/
183/*---------------------------------------------------------------------------*/
184
185template <class Tag>
190
191/*---------------------------------------------------------------------------*/
192/*---------------------------------------------------------------------------*/
193
194template <class Tag>
197{
198 return m_solver->getStatus();
199}
200
201/*---------------------------------------------------------------------------*/
202/*---------------------------------------------------------------------------*/
203
204template <class Tag>
207{
208 return m_solver.get();
209}
210/*---------------------------------------------------------------------------*/
211/*---------------------------------------------------------------------------*/
212
213} // namespace Alien
214
215/*---------------------------------------------------------------------------*/
216/*---------------------------------------------------------------------------*/
IMatrix.h.
IVector.h.
MultiMatrixImpl.h.
MultiVectorImpl.h.
AlgebraTraits< Tag >::matrix_type KernelMatrix
Type of the matrix used.
Definition EigenSolver.h:61
KernelMatrix const & getA() const
Get the eigen matrix.
Arccore::Integer localSize() const
Get the local size of the problem.
Defines an eigen problem.
IMatrix const & m_A
The eigen matrix.
bool hasParallelSupport() const
Indicates if the kernel is parallel.
AlgebraTraits< Tag >::eigen_solver_type KernelSolver
Type of the eigen solver used.
KernelSolver * implem()
Get kernel solver implementation.
const IEigenSolver::Status & getStatus() const
Get solver resolution status.
Arccore::String getBackEndName() const
Get kernel back end name.
void init()
Initialize the eigen solver.
std::unique_ptr< KernelSolver > m_solver
The eigen solver.
bool solve(EigenProblem &p)
Solve the eigen problem.
EigenSolver(Arccore::MessagePassing::IMessagePassingMng *parallel_mng=nullptr, IOptions *options=nullptr)
Eigen solver constructor.
AlgebraTraits< Tag >::matrix_type KernelMatrix
Type of the matrix used.
KernelMatrix const & getB() const
Get the second eigen matrix of the generalized eigen problem.
Arccore::Integer localSize() const
Get the local size of the problem.
KernelMatrix const & getA() const
Get the first eigen matrix of the generalized eigen problem.
Defines a generalized eigen problem.
IMatrix const & m_B
The second matrix.
const IEigenSolver::Status & getStatus() const
Get solver resolution status.
std::unique_ptr< KernelSolver > m_solver
The generalized eigen solver.
AlgebraTraits< Tag >::generalized_eigen_solver_type KernelSolver
Type of the eigen solver used.
bool solve(GeneralizedEigenProblem &A)
Solve the eigen problem.
GeneralizedEigenSolver(IMessagePassingMng *parallel_mng=nullptr, IOptions *options=nullptr)
Eigen solver constructor.
KernelSolver * implem()
Get kernel solver implementation.
Arccore::String getBackEndName() const
Get kernel back end name.
void init()
Initialize the eigen solver.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17
Eigen solver status.