-
Notifications
You must be signed in to change notification settings - Fork 0
/
MPI_Map.h
56 lines (38 loc) · 1.13 KB
/
MPI_Map.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// MPI_Map.h
//
// Description:
// Represents a piecewise linear curve in two dimensions.
//
#ifndef __MPI_MAP_H__
#define __MPI_MAP_H__
#include <list>
#include <algorithm>
#include <ostream>
class MPI_Point2D;
class MPI_Map
{
public:
void appendBreakpoint( MPI_Point2D const& point );
bool inRange( float x ) const;
bool inRangeOpenEnd( float x ) const;
bool isEmpty( void ) const;
float evaluate( float x ) const;
MPI_Point2D const& getBreakpointAtOrBefore( float x ) const;
MPI_Point2D const& getBreakpointAfter( float x ) const;
MPI_Point2D const& getFirstBreakpoint( void ) const;
MPI_Point2D const& getLastBreakpoint( void ) const;
void print( std::ostream &os ) const;
private:
// comparison operator for working with the sorted list of breakpoints.
// operator() returns true if a.getX() < b.getX().
class BreakpointBefore
{
public:
bool operator()( MPI_Point2D const& a, MPI_Point2D const& b ) const;
};
std::list<MPI_Point2D> breakpoints_;
};
std::ostream &operator<<( std::ostream &os, MPI_Map const &map );
#endif
// vim:sw=4:et:cindent: