Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
IndexedSpace.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 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/* IndexedSpace.h (C) 2014 */
9/* */
10/* Space for linear algebra. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_INDEXEDSPACE_H
13#define ARCANE_INDEXEDSPACE_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17//#include "arcane/ArcaneTypes.h"
18#include "fake.h"
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
23ARCANE_BEGIN_NAMESPACE
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
31{
32 public:
33 IndexedSpace() {}
34 IndexedSpace(const IndexedSpace& src) {}
35
36 virtual ~IndexedSpace() {}
37
38 IndexedSpace& operator=(const IndexedSpace& src) {return *this;}
39
43 virtual bool isSubspace(const IndexedSpace& other) const { return true;}
44
48 virtual bool isSame(const IndexedSpace& other) const { return true;}
49
53 virtual bool isCompatible(const IndexedSpace& other) const { return true;}
54};
55
56
58{
59 public:
61 EmptyIndexedSpace(const IndexedSpace& src) {}
62
64
68 bool isSubspace(const IndexedSpace& other) const { return false;}
69
73 bool isSame(const IndexedSpace& other) const { return false;}
74
78 bool isCompatible(const IndexedSpace& other) const { return true;}
79};
80
81
82
83
84
85
86
87bool
88operator<(const IndexedSpace& s1, const IndexedSpace& s2)
89{
90 return s2.isSubspace(s1);
91}
92
93const IndexedSpace&
94operator+( const IndexedSpace& s1, const IndexedSpace& s2)
95{
96 if (!s1.isCompatible(s2)) { // Error.
97 return s1; // TODO: Throw an exception.
98 }
99
100 if (s1 < s2) { // m_out is a subspace of s2
101 return s2;
102 }
103 return s1;
104}
105
106
107
108/*---------------------------------------------------------------------------*/
109/*---------------------------------------------------------------------------*/
110
111ARCANE_END_NAMESPACE
112
113/*---------------------------------------------------------------------------*/
114/*---------------------------------------------------------------------------*/
115
116#endif // ARCANE_INDEXEDSPACE_H
bool isCompatible(const IndexedSpace &other) const
Return if the spaces can interoperate.
bool isSubspace(const IndexedSpace &other) const
Return whether the given space is a subspace.
bool isSame(const IndexedSpace &other) const
Return if the given space and us are the same.
Indexed set/space to define matrix and vector support.
virtual bool isSubspace(const IndexedSpace &other) const
Return whether the given space is a subspace.
virtual bool isSame(const IndexedSpace &other) const
Return if the given space and us are the same.
virtual bool isCompatible(const IndexedSpace &other) const
Return if the spaces can interoperate.