Alien  1.3.0
User documentation
Loading...
Searching...
No Matches
Redistributor.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#pragma once
9
10#include <alien/kernels/redistributor/RedistributorCommPlan.h>
11#include <alien/utils/Precomp.h>
12#include <memory>
13
14namespace Alien
15{
16
17class MultiMatrixImpl;
18class MultiVectorImpl;
19
20/**
21 * @brief Change MultiObj current representation to another communicator.
22 *
23 * This object is used to defined the input communicator and create another, included,
24 * communicator, depending on the user wish to keep or not the current process.
25 * It also provides functions to convert Matrix and Vector from their original
26 * communicator (input) to the target communicator.
27 * And the other way as well for Vectors.
28 *
29 */
30class ALIEN_EXPORT Redistributor
31{
32 public:
33 enum class Method { dok, csr };
34
35 Redistributor(int globalSize, IMessagePassingMng* super, IMessagePassingMng* target, Method method = Method::dok);
36 virtual ~Redistributor() = default;
37
38 /**
39 * @brief Convert a Matrix from its communicator to the target communicator.
40 * Matrix initial communicator must be the same than the one used when creating
41 * the Redistributor object.
42 */
43 std::shared_ptr<MultiMatrixImpl> redistribute(MultiMatrixImpl* mat);
44
45 /**
46 * @brief Convert a Vector from its communicator to the target communicator.
47 * Vector initial communicator must be the same than the one used when creating
48 * the Redistributor object.
49 */
50 std::shared_ptr<MultiVectorImpl> redistribute(MultiVectorImpl* vect);
51
52 /**
53 * @brief Convert back a Vector : from the target to its original communicator.
54 * Vector original communicator must be the same than the one used when creating
55 * the Redistributor object.
56 */
58
59 const RedistributorCommPlan* commPlan() const;
60
61 private:
62 IMessagePassingMng* m_super_pm;
63 std::unique_ptr<RedistributorCommPlan> m_distributor;
64 Method m_method = Method::dok;
65};
66
67} // namespace Alien
Multi matrices representation container.
void redistributeBack(MultiVectorImpl *vect)
Convert back a Vector : from the target to its original communicator. Vector original communicator mu...
std::shared_ptr< MultiMatrixImpl > redistribute(MultiMatrixImpl *mat)
Convert a Matrix from its communicator to the target communicator. Matrix initial communicator must b...
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17