source: src/base/index.cpp@ e3dbbf

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

Parallel performance update.

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

  • Property mode set to 100644
File size: 1.5 KB
RevLine 
[48b662]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
[dfed1c]16using VMG::Index;
17using VMG::Vector;
18
19Index::Index(const Index& rhs)
20{
21 std::memcpy(this->i, rhs.i, 3*sizeof(int));
22}
[48b662]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
[dfed1c]31Vector Index::operator+(const Vector& rhs) const
[48b662]32{
33 return Vector(*this) += rhs;
34}
35
[dfed1c]36Vector Index::operator-(const Vector& rhs) const
[48b662]37{
38 return Vector(*this) -= rhs;
39}
40
[dfed1c]41Vector Index::operator*(const Vector& rhs) const
[48b662]42{
43 return Vector(*this) *= rhs;
44}
45
[dfed1c]46Vector Index::operator/(const Vector& rhs) const
[48b662]47{
48 return Vector(*this) /= rhs;
49}
50
[dfed1c]51Vector Index::operator+(const vmg_float& rhs) const
[48b662]52{
53 return Vector(*this) += rhs;
54}
55
[dfed1c]56Vector Index::operator-(const vmg_float& rhs) const
[48b662]57{
58 return Vector(*this) -= rhs;
59}
60
[dfed1c]61Vector Index::operator*(const vmg_float& rhs) const
[48b662]62{
63 return Vector(*this) *= rhs;
64}
65
[dfed1c]66Vector Index::operator/(const vmg_float& rhs) const
[48b662]67{
68 return Vector(*this) /= rhs;
69}
70
71const Index Max(const Index& index1, const Index& index2)
72{
73 return Index(std::max(index1.X(), index2.X()), std::max(index1.Y(), index2.Y()), std::max(index1.Z(), index2.Z()));
74}
75
[dfed1c]76std::ostream& VMG::operator<<(std::ostream& out, const Index& index)
[48b662]77{
[dfed1c]78 out << "{" << index.X() << " " << index.Y() << " " << index.Z() << "}";
79
80 return out;
[48b662]81}
Note: See TracBrowser for help on using the repository browser.