OpenMEEG
Toggle main menu visibility
Loading...
Searching...
No Matches
OpenMEEGMaths
include
range.h
Go to the documentation of this file.
1
// Project Name: OpenMEEG (http://openmeeg.github.io)
2
// © INRIA and ENPC under the French open source license CeCILL-B.
3
// See full copyright notice in the file LICENSE.txt
4
// If you make a copy of this file, you must either:
5
// - provide also LICENSE.txt and modify this header to refer to it.
6
// - replace this header by the LICENSE.txt content.
7
8
#pragma once
9
10
#include <iostream>
11
#include <vector>
12
13
namespace
OpenMEEG::maths
{
14
15
class
Range
{
16
public
:
17
18
Range
(): start_index(0),end_index(0) { }
19
Range
(
const
size_t
s,
const
size_t
e): start_index(s),end_index(e) { }
20
21
size_t
start
()
const
{
return
start_index; }
22
size_t
end
()
const
{
return
end_index; }
23
24
size_t
length
()
const
{
return
end
()-
start
()+1; }
25
26
bool
contains
(
const
size_t
ind)
const
{
return
ind>=
start
() && ind<=
end
(); }
27
bool
intersect
(
const
Range
& r)
const
{
return
contains
(r.
start
()) ||
contains
(r.
end
()); }
28
29
bool
operator==
(
const
Range
& r)
const
{
return
start
()==r.
start
() &&
end
()==r.
end
(); }
30
bool
operator!=
(
const
Range
& r)
const
{
return
start
()!=r.
start
() ||
end
()!=r.
end
(); }
31
32
private
:
33
34
size_t
start_index;
35
size_t
end_index;
36
};
37
38
inline
std::ostream&
operator<<
(std::ostream& os,
const
Range
& r) {
39
return
os <<
'('
<< r.
start
() <<
','
<< r.
end
() <<
')'
;
40
}
41
}
OpenMEEG::maths::Range
Definition
range.h:15
OpenMEEG::maths::Range::end
size_t end() const
Definition
range.h:22
OpenMEEG::maths::Range::operator==
bool operator==(const Range &r) const
Definition
range.h:29
OpenMEEG::maths::Range::Range
Range(const size_t s, const size_t e)
Definition
range.h:19
OpenMEEG::maths::Range::intersect
bool intersect(const Range &r) const
Definition
range.h:27
OpenMEEG::maths::Range::start
size_t start() const
Definition
range.h:21
OpenMEEG::maths::Range::Range
Range()
Definition
range.h:18
OpenMEEG::maths::Range::operator!=
bool operator!=(const Range &r) const
Definition
range.h:30
OpenMEEG::maths::Range::contains
bool contains(const size_t ind) const
Definition
range.h:26
OpenMEEG::maths::Range::length
size_t length() const
Definition
range.h:24
OpenMEEG::maths
Definition
block_matrix.h:19
OpenMEEG::maths::operator<<
std::ostream & operator<<(std::ostream &os, const BlockMatrix &bm)
Definition
block_matrix.h:106
Generated by
1.17.0