BCSides.cpp
1 #include "BCSides.hpp"
2 
3 #include <cmath>
4 
5 BCSides::BCSides(double down1, double up1,
6  double left1, double right1):
7  up(up1),down(down1),left(left1),right(right1)
8 {
9  if(down>=up||left>=right){
10  WrongBCSidesOrderException eo(down, up, left, right);
11  throw eo;
12  }
13 }
14 
15 BCSides::~BCSides(void)
16 {
17 }
18 
20  up(0), down(0), left(0), right(0) {}
21 
23  up(bc.GetUp()),
24  down(bc.GetDown()),
25  left(bc.GetLeft()),
26  right(bc.GetRight()) {}
27 
29 {
30  if (this == &bc)
31  return *this;
32  up=bc.GetUp();
33  down=bc.GetDown();
34  left=bc.GetLeft();
35  right=bc.GetRight();
36  return *this;
37 }
38 
39 double BCSides::GetUp(void) const
40 {
41  return up;
42 }
43 
44 double BCSides::GetDown(void) const
45 {
46  return down;
47 }
48 
49 double BCSides::GetLeft(void) const
50 {
51  return left;
52 }
53 
54 double BCSides::GetRight(void) const
55 {
56  return right;
57 }
58 
59 WrongBCSidesOrderException::WrongBCSidesOrderException (double down, double up, double left, double right)
60 : _up(up), _down(down), _left(left), _right(right)
61 {}
62 
65  _up(origin._up),
66  _down(origin._down),
67  _left(origin._left),
68  _right(origin._right) {}
69 
70 WrongBCSidesOrderException::~WrongBCSidesOrderException(void)
71 {
72 }
73 
75 {
76  return _up;
77 }
78 
80 {
81  return _down;
82 }
83 
85 {
86  return _left;
87 }
88 
90 {
91  return _right;
92 }
Sides of the boundary of the computational domain.
double GetDown(void) const
y coordinate of the lower boundary
Definition: BCSides.cpp:44
double GetDown(void) const
Returns the y coordinate of the lower boundary.
Definition: BCSides.cpp:79
Exception thrown if the boundaries are given in the wrong order.
Definition: BCSides.hpp:71
BCSides(void)
Default constructor, initlizes to zero.
Definition: BCSides.cpp:19
double GetUp(void) const
Returns the y coordinate of the upper boundary.
Definition: BCSides.cpp:74
double GetLeft(void) const
Returns the x coordinate of the left boundary.
Definition: BCSides.cpp:84
double GetLeft(void) const
Returns the x coordinate of the left boundary.
Definition: BCSides.cpp:49
double GetRight(void) const
Returns the x coordinate of the right boundary.
Definition: BCSides.cpp:89
BCSides & operator=(const BCSides &bc)
Assigment Operator.
Definition: BCSides.cpp:28
double GetUp(void) const
y coordinate of the upper boundary
Definition: BCSides.cpp:39
double GetRight(void) const
Returns the x coordinate of the right boundary.
Definition: BCSides.cpp:54
WrongBCSidesOrderException(double down, double up, double left, double right)
Class constructor.
Definition: BCSides.cpp:59
Positions of boundaries.
Definition: BCSides.hpp:13