-
Notifications
You must be signed in to change notification settings - Fork 8
/
intersected_cell.cpp
150 lines (122 loc) · 4.74 KB
/
intersected_cell.cpp
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/******************************************************************************
Copyright (C) 2015-2016 Hilmar M. Magnusson <hilmarmag@gmail.com>
Modified by Einar J.M. Baumann (2016) <einar.baumann@gmail.com>
Modified by Alin G. Chitu (2016-2017) <alin.chitu@tno.nl, chitu_alin@yahoo.com>
Modified by Einar J.M. Baumann (2017) <einar.baumann@gmail.com>
This file and the WellIndexCalculator as a whole is part of the
FieldOpt project. However, unlike the rest of FieldOpt, the
WellIndexCalculator is provided under the GNU Lesser General Public
License.
WellIndexCalculator is free software: you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
WellIndexCalculator is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with WellIndexCalculator. If not, see
<http://www.gnu.org/licenses/>.
******************************************************************************/
#include "intersected_cell.h"
#include <iostream>
using namespace std;
namespace Reservoir {
namespace WellIndexCalculation {
Vector3d IntersectedCell::xvec() const {
return corners()[5] - corners()[4];
}
Vector3d IntersectedCell::yvec() const {
return corners()[6] - corners()[4];
}
Vector3d IntersectedCell::zvec() const {
return corners()[0] - corners()[4];
}
double IntersectedCell::dx() const {
return xvec().norm();
}
double IntersectedCell::dy() const {
return yvec().norm();
}
double IntersectedCell::dz() const {
return zvec().norm();
}
Vector3d IntersectedCell::get_segment_entry_point(int segment_index) const {
return entry_points_[segment_index];
}
Vector3d IntersectedCell::get_segment_exit_point(int segment_index) const {
return exit_points_[segment_index];
}
double IntersectedCell::get_segment_radius(int segment_index) const {
return segment_radius_[segment_index];
}
double IntersectedCell::get_segment_skin(int segment_index) const {
return segment_skin_[segment_index];
}
void IntersectedCell::update_last_segment_exit_point(Vector3d exit_point) {
exit_points_[exit_points_.size()-1] = exit_point;
}
int IntersectedCell::num_segments() const{
return entry_points_.size();
}
void IntersectedCell::add_new_segment(Vector3d entry_point, Vector3d exit_point,
double radius, double skin_factor) {
entry_points_.push_back(entry_point);
exit_points_.push_back(exit_point);
segment_radius_.push_back(radius);
segment_skin_.push_back(skin_factor);
}
double IntersectedCell::cell_well_index_matrix() const {
return well_index_matrix_;
}
void IntersectedCell::set_cell_well_index_matrix(double well_index) {
well_index_matrix_ = well_index;
}
double IntersectedCell::cell_well_index_fracture() const {
return well_index_fracture_;
}
void IntersectedCell::set_cell_well_index_fracture(double well_index) {
well_index_fracture_ = well_index;
}
void IntersectedCell::set_segment_calculation_data(int segment_index,
string name,
double value) {
// Check if this name already exists
map<std::string, vector<double>>::iterator it = calculation_data_.find(name);
if(it != calculation_data_.end()) {
if (segment_index >= 0 && segment_index < calculation_data_[name].size()) {
calculation_data_[name].at(segment_index) = value;
}
else if(segment_index == calculation_data_[name].size()) {
calculation_data_[name].push_back(value);
}
else {
runtime_error("This segment index is out of bounds.");
}
}
else {
calculation_data_[name].push_back(value);
}
}
std::map<std::string, std::vector<double>>& IntersectedCell::get_calculation_data() {
return calculation_data_;
}
int IntersectedCell::GetIntersectedCellIndex(vector<IntersectedCell> &cells,
Grid::Cell grdcell){
if (cells.size() == 0) {
cells.push_back(IntersectedCell(grdcell));
return 0;
}
else {
for(int cell_index = 0 ; cell_index < cells.size(); cell_index++) {
if (cells.at(cell_index).global_index() == grdcell.global_index()) {
return cell_index;
}
}
cells.push_back(IntersectedCell(grdcell));
return cells.size() - 1;
}
}
}
}