votca 2024.2-dev
Loading...
Searching...
No Matches
vc2index.h
Go to the documentation of this file.
1/*
2 * Copyright 2009-2020 The VOTCA Development Team
3 * (http://www.votca.org)
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License")
6 *
7 * You may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 */
19
20#pragma once
21#ifndef VOTCA_XTP_VC2INDEX_H
22#define VOTCA_XTP_VC2INDEX_H
23
24// VOTCA includes
25#include <votca/tools/types.h>
26
27namespace votca {
28namespace xtp {
36class vc2index {
37
38 public:
39 vc2index(Index vmin, Index cmin, Index ctotal)
40 : vmin_(vmin), cmin_(cmin), ctotal_(ctotal) {};
41
42 inline Index I(Index v, Index c) const {
43 return ctotal_ * (v - vmin_) + (c - cmin_);
44 }
45
46 inline Index v(Index index) const { return (index / ctotal_ + vmin_); }
47
48 inline Index c(Index index) const { return (index % ctotal_ + cmin_); }
49
50 private:
54};
55} // namespace xtp
56} // namespace votca
57
58#endif // VOTCA_XTP_VC2INDEX_H
This class transforms a pair of indices v,c into a compound index I, via I=ctotal*v+c the fast dimens...
Definition vc2index.h:36
vc2index(Index vmin, Index cmin, Index ctotal)
Definition vc2index.h:39
Index I(Index v, Index c) const
Definition vc2index.h:42
Index c(Index index) const
Definition vc2index.h:48
Index v(Index index) const
Definition vc2index.h:46
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26