source: src/base/vector.cpp@ dfed1c

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

Major vmg update.

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

  • Property mode set to 100644
File size: 952 bytes
Line 
1/**
2 * @file vector.cpp
3 * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
4 * @date Mon Apr 18 12:25:24 2011
5 *
6 * @brief VMG::Vector
7 *
8 */
9
10
11#ifdef HAVE_CONFIG_H
12#include <config.h>
13#endif
14
15#include "base/index.hpp"
16#include "base/vector.hpp"
17
18using namespace VMG;
19
20Vector::Vector(const Index& index)
21{
22 i[0] = static_cast<vmg_float>(index.X());
23 i[1] = static_cast<vmg_float>(index.Y());
24 i[2] = static_cast<vmg_float>(index.Z());
25}
26
27Vector::Vector(const vmg_float& x, const vmg_float& y, const vmg_float& z)
28{
29 i[0]=x;
30 i[1]=y;
31 i[2]=z;
32}
33
34Vector::Vector(const vmg_float& val)
35{
36 i[0]=val;
37 i[1]=val;
38 i[2]=val;
39}
40
41Vector::Vector(const vmg_float* arr)
42{
43 i[0]=arr[0];
44 i[1]=arr[1];
45 i[2]=arr[2];
46}
47
48Vector::Vector()
49{
50 i[0]=0.0;
51 i[1]=0.0;
52 i[2]=0.0;
53}
54
55std::ostream& VMG::operator<<(std::ostream& out, const Vector& vector)
56{
57 out << "{" << vector.X() << " " << vector.Y() << " " << vector.Z() << "}";
58
59 return out;
60}
Note: See TracBrowser for help on using the repository browser.