ESyS-Particle
2.2
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
dslice.h
Go to the documentation of this file.
1
2
// //
3
// Copyright (c) 2003-2013 by The University of Queensland //
4
// Earth Systems Science Computational Centre (ESSCC) //
5
// http://www.uq.edu.au/esscc //
6
// //
7
// Primary Business: Brisbane, Queensland, Australia //
8
// Licensed under the Open Software License version 3.0 //
9
// http://www.opensource.org/licenses/osl-3.0.php //
10
// //
12
13
#ifndef __DSLICE_H
14
#define __DSLICE_H
15
16
//--- IO includes ---
17
#include <iostream>
18
using
std::ostream;
19
using
std::endl;
20
21
class
DSlice
22
{
23
private
:
24
int
m_start
;
25
int
m_length1
,
m_length2
;
26
int
m_stride1
,
m_stride2
;
27
28
public
:
29
DSlice
(
int
st,
int
l1,
int
s1,
int
l2,
int
s2):
30
m_start
(st),
m_length1
(l1),
m_length2
(l2),
m_stride1
(s1),
m_stride2
(s2)
31
{}
32
33
inline
unsigned
int
size
()
const
{
return
m_length1
*
m_length2
;}
34
inline
int
operator[]
(
int
idx)
const
35
{
return
m_start
+(idx%
m_length1
)*
m_stride1
+(idx/
m_length1
)*
m_stride2
;}
36
37
friend
bool
operator==
(
const
DSlice
&,
const
DSlice
&);
38
friend
bool
operator!=
(
const
DSlice
&,
const
DSlice
&);
39
40
friend
ostream&
operator<<
(ostream&,
const
DSlice
&);
41
};
42
43
#endif //__DSLICE_H
ntable
src
dslice.h
Generated on Mon May 6 2013 23:26:30 for ESyS-Particle by
1.8.3.1