OGS
StationBorehole.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#include "StationBorehole.h"
5
6#include <algorithm>
7#include <cmath>
8#include <cstdlib>
9#include <fstream>
10
11#include "BaseLib/DateTools.h"
12#include "BaseLib/Logging.h"
13#include "BaseLib/StringTools.h"
14
15namespace GeoLib
16{
18// The Borehole class //
20
21StationBorehole::StationBorehole(double x, double y, double z,
22 double const depth, const std::string& name,
23 int date)
24 : Station(x, y, z, name), _depth(depth), _date(date)
25{
26 // add first point of borehole
27 _profilePntVec.push_back(this);
28 _soilName.emplace_back("");
29}
30
32{
33 // deletes profile vector of borehole, starting at layer 1
34 // the first point is NOT deleted as it points to the station object itself
35 for (std::size_t k(1); k < _profilePntVec.size(); k++)
36 {
37 delete _profilePntVec[k];
38 }
39}
40
42 double x,
43 double y,
44 double z,
45 double depth,
46 const std::string& date)
47{
48 int integer_date = 0;
49 if (date != "0000-00-00")
50 {
51 integer_date = BaseLib::xmlDate2int(date);
52 }
53 return new StationBorehole(x, y, z, depth, name, integer_date);
54}
55
56void StationBorehole::addSoilLayer(double thickness,
57 const std::string& soil_name)
58{
59 /*
60 // TF - Altmark
61 if (_profilePntVec.empty())
62 addSoilLayer ((*this)[0], (*this)[1], (*this)[2]-thickness, soil_name);
63 else {
64 std::size_t idx (_profilePntVec.size());
65 // read coordinates from last above
66 double x((*_profilePntVec[idx-1])[0]);
67 double y((*_profilePntVec[idx-1])[1]);
68 double z((*_profilePntVec[idx-1])[2]-thickness);
69 addSoilLayer (x, y, z, soil_name);
70 }
71 */
72
73 // KR - Bode
74 if (_profilePntVec.empty())
75 {
76 addSoilLayer((*this)[0], (*this)[1], (*this)[2], soil_name);
77 }
78
79 std::size_t idx(_profilePntVec.size());
80 double x((*_profilePntVec[idx - 1])[0]);
81 double y((*_profilePntVec[idx - 1])[1]);
82 double z((*_profilePntVec[0])[2] - thickness);
83 addSoilLayer(x, y, z, soil_name);
84}
85
87 double y,
88 double z,
89 const std::string& soil_name)
90{
91 _profilePntVec.push_back(new Point(x, y, z));
92 _soilName.push_back(soil_name);
93}
94
95bool isBorehole(GeoLib::Point const* pnt)
96{
97 auto const* bh(dynamic_cast<GeoLib::StationBorehole const*>(pnt));
98 return bh != nullptr;
99}
100
101} // namespace GeoLib
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.
Station(double x=0.0, double y=0.0, double z=0.0, std::string name="")
Constructor.
Definition Station.cpp:14
int xmlDate2int(const std::string &s)
bool isBorehole(GeoLib::Point const *pnt)