Flow123d
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
flow123d
src
mesh
ngh
src
abscissa.cpp
Go to the documentation of this file.
1
#include <cmath>
2
3
#include "
mesh/ngh/include/abscissa.h
"
4
#include "stdio.h"
5
6
int
TAbscissa::numberInstance
= 0;
7
8
int
TAbscissa::generateId
() {
9
return
TAbscissa::numberInstance
++;
10
}
11
12
TAbscissa::TAbscissa
() {
13
id
=
generateId
();
14
}
15
16
TAbscissa::TAbscissa
(
const
TPoint
& PP0,
const
TPoint
& PP1)
17
:
TBisector
(PP0, PP1)
18
{
19
id
=
generateId
();
20
21
ComputeLength
();
22
}
23
24
25
TAbscissa::TAbscissa
(
const
Element
& ele)
26
:
TBisector
(ele)
27
{
28
id
=
generateId
();
29
30
ComputeLength
();
31
}
32
33
34
35
TAbscissa
&
TAbscissa::operator =
(
const
TAbscissa
& a) {
36
37
*
U
= *(a.
U
);
38
*
X0
= *(a.
X0
);
39
40
length
= a.
length
;
41
42
return
*
this
;
43
}
44
45
TAbscissa::~TAbscissa
() {
46
// delete P0;
47
// delete P1;
48
}
49
50
void
TAbscissa::SetPoints
(
const
TPoint
& PP0,
const
TPoint
& PP1) {
51
// *P0 = PP0;
52
// *P1 = PP1;
53
54
TBisector::SetPoints
(PP0, PP1);
55
ComputeLength
();
56
}
57
58
void
TAbscissa::ComputeLength
() {
59
60
length
=
U
->
Length
();
61
}
62
63
double
TAbscissa::Length
() {
64
return
length
;
65
}
66
67
BoundingBox
&
TAbscissa::get_bounding_box
() {
68
arma::vec3
minCoor;
69
arma::vec3
maxCoor;
70
71
for
(
int
i=0; i<3; ++i) {
72
minCoor(i) =
GetMin
(i+1);
73
maxCoor(i) =
GetMax
(i+1);
74
}
75
76
boundingBox
=
BoundingBox
(minCoor, maxCoor);
77
78
return
boundingBox
;
79
}
80
81
double
TAbscissa::GetMin
(
int
x)
const
{
82
if
(
U
== NULL ) printf(
"U is null!"
);
83
if
(
U
->
Get
(x) < 0 ) {
84
return
U
->
Get
(x)+
X0
->
Get
(x);
85
}
else
{
86
return
X0
->
Get
(x);
87
}
88
}
89
90
double
TAbscissa::GetMax
(
int
x)
const
{
91
if
(
U
->
Get
(x) > 0 ) {
92
return
U
->
Get
(x)+
X0
->
Get
(x);
93
}
else
{
94
return
X0
->
Get
(x);
95
}
96
}
Generated on Thu May 29 2014 23:14:49 for Flow123d by
1.8.4