RepastHPC
2.3.1
src
repast_hpc
GridDimensions.h
1
/*
2
* Repast for High Performance Computing (Repast HPC)
3
*
4
* Copyright (c) 2010 Argonne National Laboratory
5
* All rights reserved.
6
*
7
* Redistribution and use in source and binary forms, with
8
* or without modification, are permitted provided that the following
9
* conditions are met:
10
*
11
* Redistributions of source code must retain the above copyright notice,
12
* this list of conditions and the following disclaimer.
13
*
14
* Redistributions in binary form must reproduce the above copyright notice,
15
* this list of conditions and the following disclaimer in the documentation
16
* and/or other materials provided with the distribution.
17
*
18
* Neither the name of the Argonne National Laboratory nor the names of its
19
* contributors may be used to endorse or promote products derived from
20
* this software without specific prior written permission.
21
*
22
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
25
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE TRUSTEES OR
26
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
32
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
*
34
*
35
* GridDimensions.h
36
*
37
* Created on: 20 June 2012
38
* Author: nick
39
*/
40
41
#ifndef GRIDDIMENSIONS_H_
42
#define GRIDDIMENSIONS_H_
43
44
#include <vector>
45
46
#include "RepastErrors.h"
47
#include "Point.h"
48
49
namespace
repast {
50
58
class
GridDimensions
{
59
60
private
:
61
friend
bool
operator==(
const
GridDimensions
&one,
const
GridDimensions
&two);
62
friend
std::ostream& operator<<(std::ostream& os,
const
GridDimensions
& dimensions);
63
Point<double>
_extents, _origin;
64
65
public
:
66
GridDimensions
();
67
explicit
GridDimensions
(
Point<double>
extent);
68
72
GridDimensions
(
Point<double>
origin
,
Point<double>
extent);
73
74
bool
contains(
const
Point<int>
& pt)
const
;
75
bool
contains(
const
std::vector<int>& pt)
const
;
76
77
bool
contains(
const
Point<double>
& pt)
const
;
78
bool
contains(
const
std::vector<double>& pt)
const
;
79
83
const
Point<double>
&
origin
()
const
{
84
return
_origin;
85
}
86
90
const
Point<double>
&
extents
()
const
{
91
return
_extents;
92
}
93
94
const
double
&
origin
(
int
index)
const
{
95
return
_origin[index];
96
}
97
98
const
double
&
extents
(
int
index)
const
{
99
return
_extents[index];
100
}
101
102
size_t
dimensionCount()
const
{
103
return
_extents.
dimensionCount
();
104
}
105
106
};
107
108
bool
operator==(
const
GridDimensions &one,
const
GridDimensions &two);
109
bool
operator!=(
const
GridDimensions &one,
const
GridDimensions &two);
110
std::ostream& operator<<(std::ostream& os,
const
GridDimensions& dimensions);
111
112
}
113
114
#endif
/* GRIDDIMENSIONS_H_ */
115
repast::GridDimensions::extents
const Point< double > & extents() const
Gets the extents along each dimension.
Definition:
GridDimensions.h:90
repast::GridDimensions::origin
const Point< double > & origin() const
Gets the origin.
Definition:
GridDimensions.h:83
repast::GridDimensions
Basic structure for specifying grid dimenions.
Definition:
GridDimensions.h:58
repast::Point::dimensionCount
size_t dimensionCount() const
Gets the number of dimensions of this point.
Definition:
Point.h:196
repast::Point< double >
Generated on Thu Oct 21 2021 10:07:40 for RepastHPC by
1.8.17