|
@@ -0,0 +1,129 @@
|
|
1
|
+/* This file is part of Lemma, a geophysical modelling and inversion API.
|
|
2
|
+ * More information is available at http://lemmasoftware.org
|
|
3
|
+ */
|
|
4
|
+
|
|
5
|
+/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
6
|
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
7
|
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
8
|
+ */
|
|
9
|
+
|
|
10
|
+/**
|
|
11
|
+ * @file
|
|
12
|
+ * @date 08/28/2017 03:32:34 PM
|
|
13
|
+ * @version $Id$
|
|
14
|
+ * @author Trevor Irons (ti)
|
|
15
|
+ * @email tirons@egi.utah.edu
|
|
16
|
+ * @copyright Copyright (c) 2017, University of Utah
|
|
17
|
+ * @copyright Copyright (c) 2017, Lemma Software, LLC
|
|
18
|
+ */
|
|
19
|
+
|
|
20
|
+#include "LayeredEarthMR.h"
|
|
21
|
+
|
|
22
|
+namespace Lemma {
|
|
23
|
+
|
|
24
|
+ // ==================== FRIEND METHODS =====================
|
|
25
|
+
|
|
26
|
+ std::ostream &operator << (std::ostream &stream, const LayeredEarthMR &ob) {
|
|
27
|
+ stream << ob.Serialize() << "\n---\n"; // End of doc ---
|
|
28
|
+ return stream;
|
|
29
|
+ }
|
|
30
|
+
|
|
31
|
+ // ==================== LIFECYCLE =======================
|
|
32
|
+
|
|
33
|
+ //--------------------------------------------------------------------------------------
|
|
34
|
+ // Class: LayeredEarthMR
|
|
35
|
+ // Method: LayeredEarthMR
|
|
36
|
+ // Description: constructor (locked)
|
|
37
|
+ //--------------------------------------------------------------------------------------
|
|
38
|
+ LayeredEarthMR::LayeredEarthMR (const ctor_key&) : LayeredEarth( ) {
|
|
39
|
+
|
|
40
|
+ } // ----- end of method LayeredEarthMR::LayeredEarthMR (constructor) -----
|
|
41
|
+
|
|
42
|
+ //--------------------------------------------------------------------------------------
|
|
43
|
+ // Class: LayeredEarthMR
|
|
44
|
+ // Method: LayeredEarthMR
|
|
45
|
+ // Description: DeSerializing constructor (locked)
|
|
46
|
+ //--------------------------------------------------------------------------------------
|
|
47
|
+ LayeredEarthMR::LayeredEarthMR (const YAML::Node& node, const ctor_key&) : LayeredEarth(node) {
|
|
48
|
+
|
|
49
|
+ } // ----- end of method LayeredEarthMR::LayeredEarthMR (constructor) -----
|
|
50
|
+
|
|
51
|
+ //--------------------------------------------------------------------------------------
|
|
52
|
+ // Class: LayeredEarthMR
|
|
53
|
+ // Method: NewSP()
|
|
54
|
+ // Description: public constructor returing a shared_ptr
|
|
55
|
+ //--------------------------------------------------------------------------------------
|
|
56
|
+ std::shared_ptr< LayeredEarthMR > LayeredEarthMR::NewSP() {
|
|
57
|
+ return std::make_shared< LayeredEarthMR >( ctor_key() );
|
|
58
|
+ }
|
|
59
|
+
|
|
60
|
+ //--------------------------------------------------------------------------------------
|
|
61
|
+ // Class: LayeredEarthMR
|
|
62
|
+ // Method: ~LayeredEarthMR
|
|
63
|
+ // Description: destructor (protected)
|
|
64
|
+ //--------------------------------------------------------------------------------------
|
|
65
|
+ LayeredEarthMR::~LayeredEarthMR () {
|
|
66
|
+
|
|
67
|
+ } // ----- end of method LayeredEarthMR::~LayeredEarthMR (destructor) -----
|
|
68
|
+
|
|
69
|
+ //--------------------------------------------------------------------------------------
|
|
70
|
+ // Class: LayeredEarthMR
|
|
71
|
+ // Method: Serialize
|
|
72
|
+ //--------------------------------------------------------------------------------------
|
|
73
|
+ YAML::Node LayeredEarthMR::Serialize ( ) const {
|
|
74
|
+ YAML::Node node = LayeredEarth::Serialize();
|
|
75
|
+ node.SetTag( GetName() );
|
|
76
|
+ // FILL IN CLASS SPECIFICS HERE
|
|
77
|
+ node["Merlin_VERSION"] = MERLIN_VERSION;
|
|
78
|
+ node["T2StarBins"] = T2StarBins;
|
|
79
|
+ node["T2StarBinEdges"] = T2StarBinEdges;
|
|
80
|
+ return node;
|
|
81
|
+ } // ----- end of method LayeredEarthMR::Serialize -----
|
|
82
|
+
|
|
83
|
+ //--------------------------------------------------------------------------------------
|
|
84
|
+ // Class: LayeredEarthMR
|
|
85
|
+ // Method: DeSerialize
|
|
86
|
+ //--------------------------------------------------------------------------------------
|
|
87
|
+ std::shared_ptr<LayeredEarthMR> LayeredEarthMR::DeSerialize ( const YAML::Node& node ) {
|
|
88
|
+ if (node.Tag() != "LayeredEarthMR" ) {
|
|
89
|
+ throw DeSerializeTypeMismatch( "LayeredEarthMR", node.Tag());
|
|
90
|
+ }
|
|
91
|
+ return std::make_shared< LayeredEarthMR > ( node, ctor_key() );
|
|
92
|
+ } // ----- end of method LayeredEarthMR::DeSerialize -----
|
|
93
|
+
|
|
94
|
+ //--------------------------------------------------------------------------------------
|
|
95
|
+ // Class: LayeredEarthMR
|
|
96
|
+ // Method: SetNumberOfLayers
|
|
97
|
+ //--------------------------------------------------------------------------------------
|
|
98
|
+ void LayeredEarthMR::SetNumberOfLayers ( const int& nlay ) {
|
|
99
|
+ return ;
|
|
100
|
+ } // ----- end of method LayeredEarthMR::SetNumberOfLayers -----
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+ //--------------------------------------------------------------------------------------
|
|
104
|
+ // Class: LayeredEarthMR
|
|
105
|
+ // Method: SetNumberOfT2StarBins
|
|
106
|
+ //--------------------------------------------------------------------------------------
|
|
107
|
+ void LayeredEarthMR::SetT2StarBins ( const Real& first, const Real& last, const int& nT2 ) {
|
|
108
|
+ T2StarBinEdges = VectorXr::Zero(nT2+1);
|
|
109
|
+ Real m = 1./(nT2);
|
|
110
|
+ Real quotient = std::pow(last/first, m);
|
|
111
|
+ T2StarBinEdges[0] = first;
|
|
112
|
+ for (int i=1; i<nT2+1; ++i) {
|
|
113
|
+ T2StarBinEdges[i] = T2StarBinEdges[i-1]*quotient;
|
|
114
|
+ }
|
|
115
|
+ T2StarBins = (T2StarBinEdges.head(nT2) + T2StarBinEdges.tail(nT2)) / 2;
|
|
116
|
+ return;
|
|
117
|
+ } // ----- end of method LayeredEarthMR::SetNumberOfT2StarBins -----
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+} // ---- end of namespace Lemma ----
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+/* vim: set tabstop=4 expandtab: */
|
|
127
|
+/* vim: set filetype=cpp: */
|
|
128
|
+
|
|
129
|
+
|