Alien  1.3.0
Developer documentation
Loading...
Searching...
No Matches
SystemWriter.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 <map>
22
23#include "SystemInfo.h"
24#include <alien/ref/AlienRefSemanticPrecomp.h>
25#include <arccore/base/ArccoreGlobal.h>
26#include <arccore/message_passing/IMessagePassingMng.h>
27
28namespace Alien
29{
30class Matrix;
31class Vector;
32class BlockMatrix;
33class BlockVector;
34struct Exporter;
35
36class ALIEN_REFSEMANTIC_EXPORT SystemWriter
37{
38 public:
39 SystemWriter(std::string const& filename, std::string format = "ascii",
40 Arccore::MessagePassing::IMessagePassingMng* parallel_mng = nullptr);
41 virtual ~SystemWriter();
42
43 void dump(Matrix const& A);
44 void dump(Matrix const& A, Vector const& rhs);
45 void dump(Matrix const& A, Vector const& rhs, Vector const& sol,
46 const SolutionInfo& sol_info);
47 void dump(BlockMatrix const& A, BlockVector const& rhs);
48 void dump(BlockMatrix const& A, BlockVector const& rhs, BlockVector const& sol,
49 const SolutionInfo& sol_info);
50
51 private:
52 template <typename FileNodeT>
53 void _writeMatrixInfo(Exporter& exporter, FileNodeT& parent_node, int nrows, int ncols,
54 int nnz, int blk_size, int blk_size2);
55
56 template <typename FileNodeT>
57 void _writeCSRProfile(Exporter& exporter, FileNodeT& parent_node, int nrows, int nnz,
58 int const* kcol, int const* cols);
59
60 template <typename FileNodeT>
61 void _writeMatrixValues(Exporter& exporter, FileNodeT& parent_node, int nnz,
62 int blk_size, int blk_size2, double const* values);
63
64 template <typename FileNodeT>
65 void _writeVector(Exporter& exporter, FileNodeT& vector_node, int nrows, int blk_size,
66 double const* values);
67
68 template <typename FileNodeT>
69 void _writeSolutionInfo(
70 Exporter& exporter, FileNodeT& parent_node, const SolutionInfo& sol_info);
71
72 template <typename FileNodeT>
73 void _beginDump(Exporter*& exporter, FileNodeT& base_node);
74
75 template <typename FileNodeT>
76 void _endDump(Exporter* exporter, FileNodeT& base_node);
77
78 std::string m_filename;
79 std::string m_format;
80 int m_prec;
81 Arccore::Integer m_rank, m_nproc;
82 Arccore::MessagePassing::IMessagePassingMng* m_parallel_mng;
83
84 std::map<SolutionInfo::eConvCrit, std::string> m_conv_crit_to_str;
85};
86
87} // namespace Alien
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17