GeoTessCPP  2.2.3
Software to facilitate storage and retrieval of 3D information about the Earth.
GeoTessHorizonLayer.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 HORIZONLAYER_H_
39 #define HORIZONLAYER_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 "GeoTessHorizon.h"
54 #include "GeoTessProfile.h"
55 #include "GeoTessPosition.h"
56 
57 // **** _BEGIN GEOTESS NAMESPACE_ *********************************************
58 
59 namespace geotess {
60 
61 // **** _FORWARD REFERENCES_ ***************************************************
62 
63 // **** _CLASS DEFINITION_ *****************************************************
64 
76 {
77 
78 private:
79 
84  double fraction;
85 
86 public:
87 
98  GeoTessHorizonLayer(const double& fractionalPosition, const int& lyrIndex)
99  : GeoTessHorizon(lyrIndex), fraction(fractionalPosition)
100  {};
101 
105  GeoTessHorizonLayer(GeoTessHorizonLayer& other) : GeoTessHorizon(other.getLayerIndex()), fraction(other.fraction)
106  {
107  }
108 
113  {
114  layerIndex = other.layerIndex;
115  fraction = other.fraction;
116  return *this;
117  }
118 
122  virtual ~GeoTessHorizonLayer() {};
123 
124  virtual double getValue() { return fraction; };
125 
126  virtual double getRadius(const double* position, GeoTessProfile** profiles)
127  {
128  double bottom = profiles[layerIndex]->getRadiusBottom();
129  if (fraction <= 0. )
130  return bottom;
131  double top = profiles[layerIndex]->getRadiusTop();
132  if (fraction >= 1.)
133  return top;
134  return bottom + fraction*(top-bottom);
135  }
136 
137  virtual string class_name() { return "HorizonLayer"; };
138 
139  virtual double getRadius(GeoTessPosition& position)
140  {
141  double bottom = position.getRadiusBottom(layerIndex);
142  if (fraction <= 0. )
143  return bottom;
144  double top = position.getRadiusTop(layerIndex);
145  if (fraction >= 1.)
146  return top;
147  return bottom + fraction*(top-bottom);
148  }
149 
150  virtual string str()
151  {
152  string s = "layer " + CPPUtils::dtos(fraction) + " " + CPPUtils::itos(layerIndex);
153  return s;
154  }
155 
156 }; // end class DataValue
157 
158 } // end namespace geotess
159 
160 #endif /* HORIZONLAYER_H_ */
geotess::GeoTessHorizonLayer::str
virtual string str()
Definition: GeoTessHorizonLayer.h:150
geotess::GeoTessHorizonLayer
Defines a "surface" in a model that resides at a constant fractional radius within a specified layer.
Definition: GeoTessHorizonLayer.h:76
geotess::GeoTessHorizonLayer::getValue
virtual double getValue()
Definition: GeoTessHorizonLayer.h:124
geotess
Definition: ArrayReuse.h:57
geotess::GeoTessHorizonLayer::~GeoTessHorizonLayer
virtual ~GeoTessHorizonLayer()
Definition: GeoTessHorizonLayer.h:122
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::GeoTessProfile::getRadiusTop
virtual float getRadiusTop() const
GeoTessProfile.h
geotess::GeoTessHorizon
An abstract class that represents a single "surface" within a model.
Definition: GeoTessHorizon.h:82
geotess::GeoTessProfile::getRadiusBottom
virtual float getRadiusBottom() const
geotess::GeoTessHorizonLayer::GeoTessHorizonLayer
GeoTessHorizonLayer(const double &fractionalPosition, const int &lyrIndex)
Definition: GeoTessHorizonLayer.h:98
geotess::GeoTessHorizonLayer::GeoTessHorizonLayer
GeoTessHorizonLayer(GeoTessHorizonLayer &other)
Definition: GeoTessHorizonLayer.h:105
GEOTESS_EXP_IMP
#define GEOTESS_EXP_IMP
Definition: CPPGlobals.h:73
geotess::GeoTessHorizonLayer::class_name
virtual string class_name()
Definition: GeoTessHorizonLayer.h:137
GeoTessPosition.h
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::GeoTessHorizonLayer::getRadius
virtual double getRadius(GeoTessPosition &position)
Definition: GeoTessHorizonLayer.h:139
geotess::GeoTessPosition::getRadiusBottom
double getRadiusBottom(int layid)
geotess::GeoTessHorizonLayer::getRadius
virtual double getRadius(const double *position, GeoTessProfile **profiles)
Definition: GeoTessHorizonLayer.h:126
geotess::GeoTessHorizonLayer::operator=
GeoTessHorizonLayer & operator=(const GeoTessHorizonLayer &other)
Definition: GeoTessHorizonLayer.h:112