forked from CanMatR/Adaptive-Mesh-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutility.h
More file actions
78 lines (71 loc) · 1.28 KB
/
utility.h
File metadata and controls
78 lines (71 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* Copyright (c) 2013 Government of Canada */
#ifndef utilityDEF
#define utilityDEF
#include <iostream>
#include <iomanip>
#include <fstream>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <cmath>
static inline int index(int a, int b, int Na)
{
return (a + (b)*Na);
}
static inline int index(int a, int b, int c, int Na, int Nb)
{
return (a + (b + c*Nb)*Na);
}
static inline int index(int a, int b, int c, int d, int Na, int Nb, int Nc)
{
return a + (b + (c + d*Nc)*Nb)*Na;
}
class cart_vector
{
public:
int Vx, Vy, Vz;
cart_vector(){ Vx = 0; Vy = 0; Vz = 0; }
cart_vector(int Valx, int Valy, int Valz)
{
Vx = Valx;
Vy = Valy;
Vz = Valz;
}
~cart_vector(){}
cart_vector& operator= (const cart_vector &rhs)
{
this->Vx = rhs.Vx;
this->Vy = rhs.Vy;
this->Vz = rhs.Vz;
return *this;
}
void output()
{
printf("origin : x: %d y: %d z: %d | ", Vx, Vy, Vz);
}
};
class cart_vector_d
{
public:
double Vx, Vy, Vz;
cart_vector_d(){}
cart_vector_d(double Valx, double Valy, double Valz)
{
Vx = Valx;
Vy = Valy;
Vz = Valz;
}
~cart_vector_d(){}
cart_vector_d& operator= (const cart_vector_d &rhs)
{
Vx = rhs.Vx;
Vy = rhs.Vy;
Vz = rhs.Vz;
return *this;
}
void output()
{
printf("origin : x: %f y: %f z: %f | ", Vx, Vy, Vz);
}
};
#endif