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

Loading...
Searching...
No Matches
GeoTessHorizonDepth.h
Go to the documentation of this file.
1//- ****************************************************************************
2//-
3//- Copyright 2009 Sandia Corporation. Under the terms of Contract
4//- DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
5//- 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//- * Redistributions of source code must retain the above copyright notice,
14//- this list of conditions and the following disclaimer.
15//- * Redistributions in binary form must reproduce the above copyright
16//- notice, this list of conditions and the following disclaimer in the
17//- documentation and/or other materials provided with the distribution.
18//- * Neither the name of Sandia National Laboratories nor the names of its
19//- contributors may be used to endorse or promote products derived from
20//- this software without specific prior written permission.
21//-
22//- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23//- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24//- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25//- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
26//- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27//- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28//- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29//- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30//- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31//- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32//- POSSIBILITY OF SUCH DAMAGE.
33//-
34//- ****************************************************************************
35
36#ifndef HORIZONDEPTH_H_
37#define HORIZONDEPTH_H_
38
39// **** _SYSTEM INCLUDES_ ******************************************************
40
41#include <iostream>
42#include <fstream>
43#include <string>
44#include <climits>
45
46// use standard library objects
47 using namespace std;
48
49// **** _LOCAL INCLUDES_ *******************************************************
50
51#include "CPPUtils.h"
52#include "GeoTessHorizon.h"
53#include "GeoTessProfile.h"
54#include "GeoTessPosition.h"
55
56// **** _BEGIN GEOTESS NAMESPACE_ *********************************************
57
58 namespace geotess {
59
60// **** _FORWARD REFERENCES_ ***************************************************
61
62// **** _CLASS DEFINITION_ *****************************************************
63
72 class GEOTESS_EXP_IMP GeoTessHorizonDepth : public GeoTessHorizon
73{
74
75 private:
76
80 double depth;
81
82 public:
83
92 GeoTessHorizonDepth(const double& dpth) : GeoTessHorizon(-1), depth(dpth)
93 {};
94
105 GeoTessHorizonDepth(const double& dpth, const int& lyrIndex) : GeoTessHorizon(lyrIndex), depth(dpth)
106 {};
107
111 virtual ~GeoTessHorizonDepth() {};
112
116 GeoTessHorizonDepth(GeoTessHorizonDepth& other) : GeoTessHorizon(other.getLayerIndex()), depth(other.depth)
117 {
118 }
119
123 GeoTessHorizonDepth& operator=(const GeoTessHorizonDepth& other)
124 {
125 layerIndex = other.layerIndex;
126 depth = other.depth;
127 return *this;
128 }
129
130 virtual string class_name() { return "HorizonDepth"; };
131
132 virtual double getValue() { return depth; };
133
134 virtual double getRadius(const double* position, GeoTessProfile** profiles)
135 {
136 double radius = GeoTessUtils::getEarthRadius(position)-depth;
137
138 if (layerIndex < 0)
139 return radius;
140 double bottom = profiles[layerIndex]->getRadiusBottom();
141 if (radius <= bottom)
142 return bottom;
143 double top = profiles[layerIndex]->getRadiusTop();
144 if (radius >= top)
145 return top;
146 return radius;
147 }
148
149 virtual double getRadius(GeoTessPosition& position)
150 {
151 double radius = position.getEarthRadius()-depth;
152 if (layerIndex < 0)
153 return radius;
154 double bottom = position.getRadiusBottom(layerIndex);
155 if (radius <= bottom)
156 return bottom;
157 double top = position.getRadiusTop(layerIndex);
158 if (radius >= top)
159 return top;
160 return radius;
161 }
162
163 virtual string str()
164 {
165 string s = "depth " + CPPUtils::dtos(depth) + " " + CPPUtils::itos(layerIndex);
166 return s;
167 }
168
169}; // end class DataValue
170
171} // end namespace geotess
172
173#endif /* HORIZONDEPTH_H_ */
GEOTESS_EXP_IMP
#define GEOTESS_EXP_IMP
Definition CPPGlobals.h:71
CPPUtils.h
GeoTessHorizon.h
GeoTessPosition.h
GeoTessProfile.h
geotess::CPPUtils::dtos
static string dtos(double d, const string &frmt="%.14f")
geotess::CPPUtils::itos
static string itos(int i, const string &frmt="%d")
geotess::GeoTessHorizonDepth::GeoTessHorizonDepth
GeoTessHorizonDepth(GeoTessHorizonDepth &other)
Definition GeoTessHorizonDepth.h:116
geotess::GeoTessHorizonDepth::class_name
virtual string class_name()
Definition GeoTessHorizonDepth.h:130
geotess::GeoTessHorizonDepth::getRadius
virtual double getRadius(const double *position, GeoTessProfile **profiles)
Definition GeoTessHorizonDepth.h:134
geotess::GeoTessHorizonDepth::GeoTessHorizonDepth
GeoTessHorizonDepth(const double &dpth, const int &lyrIndex)
Definition GeoTessHorizonDepth.h:105
geotess::GeoTessHorizonDepth::operator=
GeoTessHorizonDepth & operator=(const GeoTessHorizonDepth &other)
Definition GeoTessHorizonDepth.h:123
geotess::GeoTessHorizonDepth::GeoTessHorizonDepth
GeoTessHorizonDepth(const double &dpth)
Definition GeoTessHorizonDepth.h:92
geotess::GeoTessHorizonDepth::getRadius
virtual double getRadius(GeoTessPosition &position)
Definition GeoTessHorizonDepth.h:149
geotess::GeoTessHorizonDepth::str
virtual string str()
Definition GeoTessHorizonDepth.h:163
geotess::GeoTessHorizonDepth::~GeoTessHorizonDepth
virtual ~GeoTessHorizonDepth()
Definition GeoTessHorizonDepth.h:111
geotess::GeoTessHorizonDepth::getValue
virtual double getValue()
Definition GeoTessHorizonDepth.h:132
geotess::GeoTessHorizon::layerIndex
int layerIndex
Definition GeoTessHorizon.h:92
geotess::GeoTessHorizon::GeoTessHorizon
GeoTessHorizon(const int &lyrIndex)
Definition GeoTessHorizon.h:100
geotess::GeoTessHorizon::getLayerIndex
virtual int getLayerIndex()
Definition GeoTessHorizon.h:146
geotess::GeoTessPosition
Information about an interpolated point at an arbitrary position in a model.
Definition GeoTessPosition.h:102
geotess::GeoTessPosition::getRadiusTop
double getRadiusTop(int layid)
geotess::GeoTessPosition::getEarthRadius
double getEarthRadius()
Definition GeoTessPosition.h:840
geotess::GeoTessPosition::getRadiusBottom
double getRadiusBottom(int layid)
geotess::GeoTessProfile
Abstract class that manages the radii and data values that span a single layer associated with a sing...
Definition GeoTessProfile.h:97
geotess::GeoTessProfile::getRadiusTop
virtual float getRadiusTop() const
geotess::GeoTessProfile::getRadiusBottom
virtual float getRadiusBottom() const
geotess::GeoTessUtils::getEarthRadius
static double getEarthRadius(const double *const v)
Definition GeoTessUtils.h:553
geotess
Definition ArrayReuse.h:55