GeoTessCPP: rstt/GeoTessCPP/include/GeoTessHorizonDepth.h Source File

GeoTessCPP 2.2.3 Software to facilitate storage and retrieval of 3D information about the Earth.

GeoTessHorizonDepth.h
Go to the documentation of this file.
1 //- ****************************************************************************
2 //-
3 //- Copyright 2009 National Technology & Engineering Solutions of Sandia, LLC
4 //- (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
5 //- Government retains certain rights in this software.
6 //-
7 //- BSD Open Source License
8 //- All rights reserved.
9 //-
10 //- Redistribution and use in source and binary forms, with or without
11 //- modification, are permitted provided that the following conditions are met:
12 //-
13 //- 1. Redistributions of source code must retain the above copyright notice,
14 //- this list of conditions and the following disclaimer.
15 //-
16 //- 2. Redistributions in binary form must reproduce the above copyright
17 //- notice, this list of conditions and the following disclaimer in the
18 //- documentation and/or other materials provided with the distribution.
19 //-
20 //- 3. Neither the name of the copyright holder nor the names of its
21 //- contributors may be used to endorse or promote products derived from
22 //- this software without specific prior written permission.
23 //-
24 //- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 //- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 //- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 //- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
28 //- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 //- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 //- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 //- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 //- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 //- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 //- POSSIBILITY OF SUCH DAMAGE.
35 //-
36 //- ****************************************************************************
37
38 #ifndef HORIZONDEPTH_H_
39 #define HORIZONDEPTH_H_
40
41 // **** _SYSTEM INCLUDES_ ******************************************************
42
43 #include <iostream>
44 #include <fstream>
45 #include <string>
46 #include <climits>
47
48 // use standard library objects
49 using namespace std;
50
51 // **** _LOCAL INCLUDES_ *******************************************************
52
53 #include "CPPUtils.h"
54 #include "GeoTessHorizon.h"
55 #include "GeoTessProfile.h"
56 #include "GeoTessPosition.h"
57
58 // **** _BEGIN GEOTESS NAMESPACE_ *********************************************
59
60 namespace geotess {
61
62 // **** _FORWARD REFERENCES_ ***************************************************
63
64 // **** _CLASS DEFINITION_ *****************************************************
65
74 class GEOTESS_EXP_IMP GeoTessHorizonDepth : public GeoTessHorizon
75 {
76
77 private:
78
82 double depth;
83
84 public:
85
94 GeoTessHorizonDepth(const double& dpth) : GeoTessHorizon(-1), depth(dpth)
95 {};
96
107 GeoTessHorizonDepth(const double& dpth, const int& lyrIndex) : GeoTessHorizon(lyrIndex), depth(dpth)
108 {};
109
113 virtual ~GeoTessHorizonDepth() {};
114
118 GeoTessHorizonDepth(GeoTessHorizonDepth& other) : GeoTessHorizon(other.getLayerIndex()), depth(other.depth)
119 {
120 }
121
125 GeoTessHorizonDepth& operator=(const GeoTessHorizonDepth& other)
126 {
127 layerIndex = other.layerIndex;
128 depth = other.depth;
129 return *this;
130 }
131
132 virtual string class_name() { return "HorizonDepth"; };
133
134 virtual double getValue() { return depth; };
135
136 virtual double getRadius(const double* position, GeoTessProfile** profiles)
137 {
138 double radius = GeoTessUtils::getEarthRadius(position)-depth;
139
140 if (layerIndex < 0)
141 return radius;
142 double bottom = profiles[layerIndex]->getRadiusBottom();
143 if (radius <= bottom)
144 return bottom;
145 double top = profiles[layerIndex]->getRadiusTop();
146 if (radius >= top)
147 return top;
148 return radius;
149 }
150
151 virtual double getRadius(GeoTessPosition& position)
152 {
153 double radius = position.getEarthRadius()-depth;
154 if (layerIndex < 0)
155 return radius;
156 double bottom = position.getRadiusBottom(layerIndex);
157 if (radius <= bottom)
158 return bottom;
159 double top = position.getRadiusTop(layerIndex);
160 if (radius >= top)
161 return top;
162 return radius;
163 }
164
165 virtual string str()
166 {
167 string s = "depth " + CPPUtils::dtos(depth) + " " + CPPUtils::itos(layerIndex);
168 return s;
169 }
170
171 }; // end class DataValue
172
173 } // end namespace geotess
174
175 #endif /* HORIZONDEPTH_H_ */
geotess::GeoTessHorizonDepth::GeoTessHorizonDepth
GeoTessHorizonDepth(const double &dpth)
Definition: GeoTessHorizonDepth.h:94
geotess
Definition: ArrayReuse.h:57
geotess::GeoTessProfile
Abstract class that manages the radii and data values that span a single layer associated with a sing...
Definition: GeoTessProfile.h:99
geotess::GeoTessPosition::getEarthRadius
double getEarthRadius()
Definition: GeoTessPosition.h:842
geotess::GeoTessProfile::getRadiusTop
virtual float getRadiusTop() const
geotess::GeoTessHorizonDepth::getValue
virtual double getValue()
Definition: GeoTessHorizonDepth.h:134
GeoTessProfile.h
geotess::GeoTessHorizonDepth::GeoTessHorizonDepth
GeoTessHorizonDepth(const double &dpth, const int &lyrIndex)
Definition: GeoTessHorizonDepth.h:107
geotess::GeoTessHorizonDepth
Defines a "surface" in a model that resides at a constant depth.
Definition: GeoTessHorizonDepth.h:75
geotess::GeoTessHorizonDepth::~GeoTessHorizonDepth
virtual ~GeoTessHorizonDepth()
Definition: GeoTessHorizonDepth.h:113
geotess::GeoTessHorizon
An abstract class that represents a single "surface" within a model.
Definition: GeoTessHorizon.h:82
geotess::GeoTessHorizonDepth::getRadius
virtual double getRadius(const double *position, GeoTessProfile **profiles)
Definition: GeoTessHorizonDepth.h:136
geotess::GeoTessProfile::getRadiusBottom
virtual float getRadiusBottom() const
geotess::GeoTessHorizonDepth::str
virtual string str()
Definition: GeoTessHorizonDepth.h:165
geotess::GeoTessHorizonDepth::operator=
GeoTessHorizonDepth & operator=(const GeoTessHorizonDepth &other)
Definition: GeoTessHorizonDepth.h:125
GEOTESS_EXP_IMP
#define GEOTESS_EXP_IMP
Definition: CPPGlobals.h:73
GeoTessPosition.h
geotess::GeoTessHorizonDepth::getRadius
virtual double getRadius(GeoTessPosition &position)
Definition: GeoTessHorizonDepth.h:151
geotess::GeoTessHorizonDepth::GeoTessHorizonDepth
GeoTessHorizonDepth(GeoTessHorizonDepth &other)
Definition: GeoTessHorizonDepth.h:118
geotess::GeoTessHorizonDepth::class_name
virtual string class_name()
Definition: GeoTessHorizonDepth.h:132
geotess::GeoTessPosition
Information about an interpolated point at an arbitrary position in a model.
Definition: GeoTessPosition.h:104
GeoTessHorizon.h
geotess::GeoTessHorizon::layerIndex
int layerIndex
Definition: GeoTessHorizon.h:94
geotess::GeoTessPosition::getRadiusTop
double getRadiusTop(int layid)
geotess::GeoTessPosition::getRadiusBottom
double getRadiusBottom(int layid)
CPPUtils.h