14#include "arcane/utils/Array.h"
15#include "arcane/utils/String.h"
16#include "arcane/utils/FatalErrorException.h"
18#include "arcane/core/matvec/Vector.h"
23namespace Arcane::MatVec
39 : m_values(size, init_value)
42 m_values.fill(init_value);
53 VectorImpl(
const VectorImpl& rhs)
54 : m_values(rhs.m_values)
61 void operator=(
const VectorImpl& rhs);
65 Integer size()
const {
return m_values.size(); }
68 void dump(std::ostream& o)
const
71 o <<
"(Vector ptr=" <<
this <<
" size=" << size <<
")\n";
72 for (
Integer i = 0; i < size; ++i)
73 o <<
"[" << i <<
"]=" << m_values[i] <<
'\n';
78 return new VectorImpl(m_values);
80 void copy(
const VectorImpl& rhs)
82 m_values.copy(rhs.m_values);
93 void removeReference()
96 if (m_nb_reference == 0)
153 m_impl->removeReference();
164 m_impl->removeReference();
207dump(std::ostream& o)
const
220 for (
Integer i = 0; i < size; ++i) {
221 Real v2 = math::abs(m_values[i]);
243 std::ifstream ifile(file_name.
localstr());
245 ARCANE_FATAL(
"Can not read Hypre vector file='{0}'", file_name);
248 ifile >> ws >> xmin >> ws >> xmax;
249 Integer nb = (xmax - xmin) + 1;
252 for (
Integer i = 0; i < nb; ++i) {
255 ifile >> ws >> column_id >> ws >> v;
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
Integer size() const
Number of elements in the vector.
void dump(std::ostream &o) const
Prints the vector values.
static Vector readHypre(const String &file_name)
Initializes a vector using a Hypre format file.
const Vector & operator=(const Vector &rhs)
Changes the vector reference.
Integer size() const
Number of elements in the vector.
~Vector()
Destroys the reference.
VectorImpl * m_impl
Internal representation of the group.
RealArrayView values()
Vector values.
Vector()
Creates an empty vector.
void copy(const Vector &rhs)
Copies the elements of rhs into this vector.
Unicode character string.
const char * localstr() const
Returns the conversion of the instance into UTF-8 encoding.
1D data vector with value semantics (STL style).
Int32 Integer
Type representing an integer.
double Real
Type representing a real number.
ArrayView< Real > RealArrayView
C equivalent of a 1D array of reals.
ConstArrayView< Real > RealConstArrayView
C equivalent of a 1D array of reals.