Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
matrix-to-buffer.h
1
/*
2
** Copyright 2007-2024, RTE (https://www.rte-france.com)
3
** See AUTHORS.txt
4
** SPDX-License-Identifier: MPL-2.0
5
** This file is part of Antares-Simulator,
6
** Adequacy and Performance assessment for interconnected energy networks.
7
**
8
** Antares_Simulator is free software: you can redistribute it and/or modify
9
** it under the terms of the Mozilla Public Licence 2.0 as published by
10
** the Mozilla Foundation, either version 2 of the License, or
11
** (at your option) any later version.
12
**
13
** Antares_Simulator is distributed in the hope that it will be useful,
14
** but WITHOUT ANY WARRANTY; without even the implied warranty of
15
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
** Mozilla Public Licence 2.0 for more details.
17
**
18
** You should have received a copy of the Mozilla Public Licence 2.0
19
** along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
20
*/
21
22
#ifndef __ANTARES_LIBS_ARRAY_MATRIX_TO_BUFFER_SENDER_H__
23
#define __ANTARES_LIBS_ARRAY_MATRIX_TO_BUFFER_SENDER_H__
24
25
#include <yuni/core/string.h>
26
27
namespace
Antares
28
{
29
template
<
class
T,
class
ReadWriteT>
30
class
Matrix;
31
}
32
33
namespace
Antares
34
{
35
// Forward declarations
36
const
char
* get_format(
bool
isDecimal, uint precision);
37
template
<
class
T,
class
ReadWriteT,
class
PredicateT>
38
class
I_mtx_to_buffer_dumper;
39
40
class
matrix_to_buffer_dumper_factory
41
{
42
public
:
43
matrix_to_buffer_dumper_factory
()
44
{
45
}
46
47
~matrix_to_buffer_dumper_factory
()
48
{
49
}
50
51
template
<
class
T,
class
ReadWriteT,
class
PredicateT>
52
I_mtx_to_buffer_dumper<T, ReadWriteT, PredicateT>
* get_dumper(
const
Matrix<T, ReadWriteT>
* mtx,
53
std::string& data,
54
PredicateT& predicate);
55
};
56
57
template
<
class
T,
class
ReadWriteT,
class
PredicateT>
58
class
I_mtx_to_buffer_dumper
59
{
60
public
:
61
I_mtx_to_buffer_dumper
(
const
Matrix<T, ReadWriteT>
* mtx,
62
std::string& data,
63
PredicateT& predicate):
64
mtx_(mtx),
65
buffer_(data),
66
predicate_(predicate),
67
format_(
nullptr
)
68
{
69
}
70
71
void
set_print_format(
bool
isDecimal, uint precision);
72
virtual
void
run() = 0;
73
74
~I_mtx_to_buffer_dumper
()
75
{
76
delete
format_;
77
}
78
79
protected
:
80
const
Matrix<T, ReadWriteT>
* mtx_;
81
std::string& buffer_;
82
PredicateT& predicate_;
83
const
char
* format_;
84
};
85
86
template
<
class
T,
class
ReadWriteT,
class
PredicateT>
87
class
one_column__dumper
:
public
I_mtx_to_buffer_dumper
<T, ReadWriteT, PredicateT>
88
{
89
public
:
90
one_column__dumper
(
const
Matrix<T, ReadWriteT>
* mtx, std::string& data, PredicateT& predicate):
91
I_mtx_to_buffer_dumper<T, ReadWriteT, PredicateT>
(mtx, data, predicate)
92
{
93
}
94
95
void
run()
override
;
96
};
97
98
template
<
class
T,
class
ReadWriteT,
class
PredicateT>
99
class
multiple_columns__dumper
:
public
I_mtx_to_buffer_dumper
<T, ReadWriteT, PredicateT>
100
{
101
public
:
102
multiple_columns__dumper
(
const
Matrix<T, ReadWriteT>
* mtx,
103
std::string& data,
104
PredicateT& predicate):
105
I_mtx_to_buffer_dumper<T, ReadWriteT, PredicateT>
(mtx, data, predicate)
106
{
107
}
108
109
void
run()
override
;
110
};
111
112
}
// namespace Antares
113
114
#include "matrix-to-buffer.hxx"
115
116
#endif
// __ANTARES_LIBS_ARRAY_MATRIX_TO_BUFFER_SENDER_H__
Antares::I_mtx_to_buffer_dumper
Definition
matrix-to-buffer.h:59
Antares::Matrix
A n-by-n matrix.
Definition
jit.h:30
Antares::matrix_to_buffer_dumper_factory
Definition
matrix-to-buffer.h:41
Antares::multiple_columns__dumper
Definition
matrix-to-buffer.h:100
Antares::one_column__dumper
Definition
matrix-to-buffer.h:88
src
libs
antares
array
include
antares
array
matrix-to-buffer.h
Generated by
1.12.0