Alien  1.3.0
Developer documentation
Loading...
Searching...
No Matches
StreamVBlockMatrixBuilder.h
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
19#pragma once
20
21#include <alien/utils/Precomp.h>
22
23#include <alien/ref/data/block/VBlockMatrix.h>
24
25/*---------------------------------------------------------------------------*/
26
27namespace Alien
28{
29
30class IBlockBuilder;
31template <typename Scalar>
32class SimpleCSRMatrix;
33
34/*---------------------------------------------------------------------------*/
35
36template <typename ValueT = Real>
38{
39 public:
40 class Inserter;
41 class BaseInserter;
42 class Profiler;
43 class Filler;
44
45 public:
47 StreamVBlockMatrixBuilderT(VBlockMatrix& matrix, bool init_and_start = true);
48
51
52 public:
53 void init();
54
55 void start();
56 void finalize();
57 void end();
58
59 Inserter& getNewInserter();
60
61 Inserter& getInserter(Integer id);
62
63 void allocate();
64
65 void fillZero();
66
67 const VBlock* vblock() const;
68
69 private:
70 UniqueArray<Inserter*> m_inserters;
71
72 private:
73 void _freeInserters();
75
76 protected:
77 IMatrix& m_matrix;
78 SimpleCSRMatrix<ValueT>* m_matrix_impl;
79
80 Integer m_local_size;
81 Integer m_global_size;
82 Integer m_local_offset;
83
84 UniqueArray<Integer> m_ghost_row_size;
85 UniqueArray<Integer> m_block_ghost_row_size;
86 Integer m_ghost_size;
87 Integer m_block_ghost_size;
88 UniqueArray<Integer> m_offset;
89 Integer m_matrix_size;
90 Integer m_block_matrix_size;
91 UniqueArray<Integer> m_row_size;
92 UniqueArray<Integer> m_block_row_size;
93 Integer m_myrank, m_nproc;
94
95 enum ColOrdering
96 {
97 eUndef,
98 eOwnAndGhost,
99 eFull
100 };
101 ColOrdering m_col_ordering;
102
103 IMessagePassingMng* m_parallel_mng;
104 ITraceMng* m_trace;
105
106 enum State
107 {
108 eNone,
109 eInit,
110 ePrepared,
111 eStart
112 };
113 State m_state;
114};
115
116/*---------------------------------------------------------------------------*/
117
118typedef StreamVBlockMatrixBuilderT<double> StreamVBlockMatrixBuilder;
119
120/*---------------------------------------------------------------------------*/
121
122} // namespace Alien
123
124/*---------------------------------------------------------------------------*/
125
126#include "StreamVBlockMatrixBuilderInserter.h"
127#include "StreamVBlockMatrixBuilderInserterT.h"
128#include "StreamVBlockMatrixBuilderT.h"
Interface for non uniform block elements.
Interface for all matrices.
Definition IMatrix.h:51
StreamVBlockMatrixBuilderT(VBlockMatrix &matrix, bool init_and_start=true)
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