source: src/base/index.cpp@ 716da7

Last change on this file since 716da7 was 716da7, checked in by Julian Iseringhausen <isering@…>, 14 years ago

Fix energy calculation.

git-svn-id: https://svn.version.fz-juelich.de/scafacos/trunk@1729 5161e1c8-67bf-11de-9fd5-51895aff932f

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/**
2 * @file index.cpp
3 * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
4 * @date Mon Apr 18 12:19:16 2011
5 *
6 */
7
8#ifdef HAVE_CONFIG_H
9#include <config.h>
10#endif
11
12#include "base/index.hpp"
13#include "base/stencil.hpp"
14#include "base/vector.hpp"
15
16using VMG::Index;
17using VMG::Vector;
18
19Index::Index(const Index& rhs)
20{
21 std::memcpy(this->i, rhs.i, 3*sizeof(int));
22}
23
24Index::Index(const Vector& vec)
25{
26 i[0] = static_cast<int>(vec.X());
27 i[1] = static_cast<int>(vec.Y());
28 i[2] = static_cast<int>(vec.Z());
29}
30
31Vector Index::operator+(const Vector& rhs) const
32{
33 return Vector(*this) += rhs;
34}
35
36Vector Index::operator-(const Vector& rhs) const
37{
38 return Vector(*this) -= rhs;
39}
40
41Vector Index::operator*(const Vector& rhs) const
42{
43 return Vector(*this) *= rhs;
44}
45
46Vector Index::operator/(const Vector& rhs) const
47{
48 return Vector(*this) /= rhs;
49}
50
51Vector Index::operator+(const vmg_float& rhs) const
52{
53 return Vector(*this) += rhs;
54}
55
56Vector Index::operator-(const vmg_float& rhs) const
57{
58 return Vector(*this) -= rhs;
59}
60
61Vector Index::operator*(const vmg_float& rhs) const
62{
63 return Vector(*this) *= rhs;
64}
65
66Vector Index::operator/(const vmg_float& rhs) const
67{
68 return Vector(*this) /= rhs;
69}
70
71std::ostream& VMG::operator<<(std::ostream& out, const Index& index)
72{
73 out << "{" << index.X() << " " << index.Y() << " " << index.Z() << "}";
74
75 return out;
76}
Note: See TracBrowser for help on using the repository browser.