MADNESS  version 0.9
slice.h
Go to the documentation of this file.
1 /*
2  This file is part of MADNESS.
3 
4  Copyright (C) 2007,2010 Oak Ridge National Laboratory
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 
20  For more information please contact:
21 
22  Robert J. Harrison
23  Oak Ridge National Laboratory
24  One Bethel Valley Road
25  P.O. Box 2008, MS-6367
26 
27  email: harrisonrj@ornl.gov
28  tel: 865-241-3937
29  fax: 865-572-0680
30 
31 
32  $Id$
33 */
34 
38 
39 #ifndef MADNESS_TENSOR_SLICE_H__INCLUDED
40 #define MADNESS_TENSOR_SLICE_H__INCLUDED
41 
43 
44 namespace madness {
45 
103  class Slice {
104 
105  public:
106  long start;
107  long end;
108  long step;
109 
110  inline Slice() : start(0), end(-1), step(1) {};
111  inline Slice(long s, long e, long stp=1) : start(s), end(e), step(stp) {};
112  inline Slice& operator=(const Slice& s) {
113  start=s.start;
114  end=s.end;
115  step=s.step;
116  return *this;
117  };
118  };
119 
120  std::ostream& operator<<(std::ostream& stream, const Slice& s);
121 
122  static const Slice _(0,-1,1);
123  static const std::vector<Slice> ___ = vector_factory(_,_,_,_,_,_);
124  static const Slice _reverse(-1,0,-1);
125 
126 }
127 #endif // MADNESS_TENSOR_SLICE_H__INCLUDED
Slice & operator=(const Slice &s)
Definition: slice.h:112
long start
Definition: slice.h:106
Slice(long s, long e, long stp=1)
Definition: slice.h:111
long end
Definition: slice.h:107
Declares and implements factories for short vectors.
Slice()
Definition: slice.h:110
long step
Definition: slice.h:108
std::ostream & operator<<(std::ostream &s, const ContractedGaussianShell &c)
Definition: chem/molecularbasis.cc:38
std::vector< T > vector_factory(const T &v0)
Returns a std::vector initialized from the arguments.
Definition: vector_factory.h:50
A slice defines a sub-range or patch of a dimension.
Definition: slice.h:103
Holds machinery to set up Functions/FuncImpls using various Factories and Interfaces.
Definition: chem/atomutil.cc:45