OGS
StationBorehole.cpp
Go to the documentation of this file.
1
15#include "StationBorehole.h"
16
17#include <algorithm>
18#include <cmath>
19#include <cstdlib>
20#include <fstream>
21
22#include "BaseLib/DateTools.h"
23#include "BaseLib/Logging.h"
24#include "BaseLib/StringTools.h"
25
26namespace GeoLib
27{
29// The Borehole class //
31
32StationBorehole::StationBorehole(double x, double y, double z,
33 double const depth, const std::string& name,
34 int date)
35 : Station(x, y, z, name), _depth(depth), _date(date)
36{
37 // add first point of borehole
38 _profilePntVec.push_back(this);
39 _soilName.emplace_back("");
40}
41
43{
44 // deletes profile vector of borehole, starting at layer 1
45 // the first point is NOT deleted as it points to the station object itself
46 for (std::size_t k(1); k < _profilePntVec.size(); k++)
47 {
48 delete _profilePntVec[k];
49 }
50}
51
53 double x,
54 double y,
55 double z,
56 double depth,
57 const std::string& date)
58{
59 int integer_date = 0;
60 if (date != "0000-00-00")
61 {
62 integer_date = BaseLib::xmlDate2int(date);
63 }
64 return new StationBorehole(x, y, z, depth, name, integer_date);
65}
66
67void StationBorehole::addSoilLayer(double thickness,
68 const std::string& soil_name)
69{
70 /*
71 // TF - Altmark
72 if (_profilePntVec.empty())
73 addSoilLayer ((*this)[0], (*this)[1], (*this)[2]-thickness, soil_name);
74 else {
75 std::size_t idx (_profilePntVec.size());
76 // read coordinates from last above
77 double x((*_profilePntVec[idx-1])[0]);
78 double y((*_profilePntVec[idx-1])[1]);
79 double z((*_profilePntVec[idx-1])[2]-thickness);
80 addSoilLayer (x, y, z, soil_name);
81 }
82 */
83
84 // KR - Bode
85 if (_profilePntVec.empty())
86 {
87 addSoilLayer((*this)[0], (*this)[1], (*this)[2], soil_name);
88 }
89
90 std::size_t idx(_profilePntVec.size());
91 double x((*_profilePntVec[idx - 1])[0]);
92 double y((*_profilePntVec[idx - 1])[1]);
93 double z((*_profilePntVec[0])[2] - thickness);
94 addSoilLayer(x, y, z, soil_name);
95}
96
98 double y,
99 double z,
100 const std::string& soil_name)
101{
102 _profilePntVec.push_back(new Point(x, y, z));
103 _soilName.push_back(soil_name);
104}
105
106bool isBorehole(GeoLib::Point const* pnt)
107{
108 auto const* bh(dynamic_cast<GeoLib::StationBorehole const*>(pnt));
109 return bh != nullptr;
110}
111
112} // namespace GeoLib
Definition of date helper functions.
Definition of the StationBorehole class.
Definition of string helper functions.
Point()=default
A borehole as a geometric object.
static StationBorehole * createStation(const std::string &name, double x, double y, double z, double depth, const std::string &date="")
Creates a new borehole object based on the given parameters.
void addSoilLayer(double thickness, const std::string &soil_name)
Add a soil layer to the boreholes stratigraphy.
std::vector< Point * > _profilePntVec
Contains the points for the lower boundaries of all layers.
StationBorehole(double x, double y, double z, double const depth, const std::string &name, int date)
std::vector< std::string > _soilName
Contains the names for all the soil layers.
A Station (observation site) is basically a Point with some additional information.
Definition Station.h:37
int xmlDate2int(const std::string &s)
bool isBorehole(GeoLib::Point const *pnt)