Browse Source

Addition of data and forward modeling classes, not yet completed

master
Trevor Irons 7 years ago
parent
commit
7ea0dbfbe3

+ 18
- 5
CMakeLists.txt View File

@@ -1,24 +1,37 @@
1
+# Configure Merlin 
2
+set(MERLIN_VERSION_MAJOR "0")
3
+set(MERLIN_VERSION_MINOR "0")
4
+set(MERLIN_VERSION_PATCH "1")
5
+set(MERLIN_VERSION "\"${MERLIN_VERSION_MAJOR}.${MERLIN_VERSION_MINOR}.${MERLIN_VERSION_PATCH}\"")
6
+set(MERLIN_VERSION_NOQUOTES "${MERLIN_VERSION_MAJOR}.${MERLIN_VERSION_MINOR}.${MERLIN_VERSION_PATCH}")
7
+
8
+configure_file (
9
+	"${CMAKE_CURRENT_SOURCE_DIR}/config/MerlinConfig.h.in"
10
+	"${PROJECT_BINARY_DIR}/include/MerlinConfig.h"
11
+)
12
+install ( FILES  ${PROJECT_BINARY_DIR}/include/MerlinConfig.h   DESTINATION ${CMAKE_INSTALL_PREFIX}/include/Lemma/ )
13
+
1 14
 add_subdirectory("src")
2 15
 add_library( merlin ${MERLINSOURCE} )  
3 16
 target_include_directories( merlin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" )
4 17
 
5 18
 set_target_properties(merlin PROPERTIES 
6
-	VERSION  "${LEMMA_VERSION_NOQUOTES}"
7
-	SOVERSION "${LEMMA_VERSION_MAJOR}.${LEMMA_VERSION_MINOR}"
8
-	PROJECT_LABEL "FDEM1D ${LABEL_SUFFIX}"
19
+	VERSION  "${MERLIN_VERSION_NOQUOTES}"
20
+	SOVERSION "${MERLIN_VERSION_MAJOR}.${MERLIN_VERSION_MINOR}"
21
+	PROJECT_LABEL "MERLIN ${LABEL_SUFFIX}"
9 22
 )
10 23
 
11 24
 # Linking
12 25
 target_link_libraries(merlin "lemmacore" "fdem1d" )
13 26
 
14 27
 # Linking
15
-if ( LEMMA_VTK6_SUPPORT OR LEMMA_VTK7_SUPPORT ) 
28
+if ( MERLIN_VTK6_SUPPORT OR MERLIN_VTK7_SUPPORT ) 
16 29
 	target_link_libraries(merlin ${VTK_LIBRARIES})
17 30
 #	target_link_libraries(lemmacore "matplot")
18 31
 endif()
19 32
 
20 33
 # Testing
21
-if (LEMMA_ENABLE_TESTING)
34
+if (MERLIN_ENABLE_TESTING)
22 35
 	add_subdirectory(testing)
23 36
 endif()
24 37
 

+ 23
- 0
config/MerlinConfig.h.in View File

@@ -0,0 +1,23 @@
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      01/15/2016 09:52:10 PM
13
+ * @author    Trevor Irons (ti)
14
+ * @email     tirons@egi.utah.edu
15
+ * @copyright Copyright (c) 2016, University of Utah
16
+ * @copyright Copyright (c) 2016, Trevor Irons & Lemma Software, LLC
17
+ */
18
+
19
+// Sets the Lemma version used in keeping track of releases
20
+#define MERLIN_VERSION_MAJOR @MERLIN_VERSION_MAJOR@
21
+#define MERLIN_VERSION_MINOR @MERLIN_VERSION_MINOR@
22
+#define MERLIN_VERSION_PATCH @MERLIN_VERSION_PATCH@
23
+#define MERLIN_VERSION @MERLIN_VERSION@

+ 3
- 0
examples/CMakeLists.txt View File

@@ -7,6 +7,9 @@ target_link_libraries(  KernelV0-2  "lemmacore" "fdem1d" "merlin")
7 7
 add_executable( KV0-3loops KV0-3loops.cpp  )
8 8
 target_link_libraries(  KV0-3loops  "lemmacore" "fdem1d" "merlin")
9 9
 
10
+add_executable( ForwardFID ForwardFID.cpp  )
11
+target_link_libraries(  ForwardFID  "lemmacore" "fdem1d" "merlin")
12
+
10 13
 add_executable( Coupling Coupling.cpp  )
11 14
 target_link_libraries(  Coupling  "lemmacore" "fdem1d" "merlin")
12 15
 

+ 39
- 0
examples/ForwardFID.cpp View File

@@ -0,0 +1,39 @@
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 09:07:04 AM
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 <Merlin>
21
+using namespace Lemma;
22
+
23
+int main(int argc, char** argv) {
24
+
25
+    if (argc<5) {
26
+        std::cout << "./ForwardFID Kernel.yaml TxString RxString  vtkoutput<true/false> \n";
27
+    //    return(EXIT_FAILURE);
28
+    }
29
+
30
+    auto Forward = ForwardFID::NewSP();
31
+        Forward->SetWindowEdges( VectorXr::LinSpaced(10,0,1) );
32
+
33
+    std::cout << *Forward << std::endl;
34
+
35
+    //auto FID = Forward->ForwardModel();
36
+    //std::cout << *FID << std::endl;
37
+
38
+    return EXIT_SUCCESS;
39
+}

+ 1
- 0
examples/KernelV0-2.cpp View File

@@ -68,6 +68,7 @@ int main(int argc, char** argv) {
68 68
     out << *Kern;
69 69
     out.close();
70 70
 
71
+    return EXIT_SUCCESS;
71 72
 }
72 73
 
73 74
 

+ 134
- 0
include/DataFID.h View File

@@ -0,0 +1,134 @@
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 01:04:12 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
+#ifndef  DATAFID_INC
21
+#define  DATAFID_INC
22
+
23
+#pragma once
24
+#include "MerlinObject.h"
25
+
26
+namespace Lemma {
27
+
28
+    /**
29
+     * \ingroup Merlin
30
+     * \brief   Base class for representation of FID data in Merlin.
31
+     * \details Simplest form of FID data used in Merlin. Field data derives
32
+                from this class for specific instrumentation details. See
33
+                the Akvo project for further details (akvo.lemmasoftware.org).
34
+     */
35
+    class DataFID : public MerlinObject {
36
+
37
+        friend std::ostream &operator<<(std::ostream &stream, const DataFID &ob);
38
+
39
+        protected:
40
+        /*
41
+         *  This key is used to lock the constructor. It is protected so that inhereted
42
+         *  classes also have the key to contruct their base class.
43
+         */
44
+        struct ctor_key {};
45
+
46
+        public:
47
+
48
+        // ====================  LIFECYCLE     =======================
49
+
50
+        /**
51
+         * Default constructor.
52
+         * @note This method is locked, and cannot be called directly.
53
+         *       The reason that the method is public is to enable the use
54
+         *       of make_shared whilst enforcing the use of shared_ptr,
55
+         *       in c++-17, this curiosity may be resolved.
56
+         * @see DataFID::NewSP
57
+         */
58
+        explicit DataFID ( const ctor_key& );
59
+
60
+        /**
61
+         * DeSerializing constructor.
62
+         * @note This method is locked, and cannot be called directly.
63
+         *       The reason that the method is public is to enable the use
64
+         *       of make_shared whilst enforcing the use of shared_ptr,
65
+         *       in c++-17, this curiosity may be resolved.
66
+         * @see DataFID::DeSerialize
67
+         */
68
+        DataFID ( const YAML::Node& node, const ctor_key& );
69
+
70
+        /**
71
+         * Default destructor.
72
+         * @note This method should never be called due to the mandated
73
+         *       use of smart pointers. It is necessary to keep the method
74
+         *       public in order to allow for the use of the more efficient
75
+         *       make_shared constructor.
76
+         */
77
+        virtual ~DataFID ();
78
+
79
+        /**
80
+         *  Uses YAML to serialize this object.
81
+         *  @return a YAML::Node
82
+         *  @see DataFID::DeSerialize
83
+         */
84
+        virtual YAML::Node Serialize() const;
85
+
86
+        /*
87
+         *  Factory method for generating concrete class.
88
+         *  @return a std::shared_ptr of type DataFID
89
+         */
90
+        static std::shared_ptr< DataFID > NewSP();
91
+
92
+        /**
93
+         *   Constructs an DataFID object from a YAML::Node.
94
+         *   @see DataFID::Serialize
95
+         */
96
+        static std::shared_ptr<DataFID> DeSerialize(const YAML::Node& node);
97
+
98
+        // ====================  OPERATORS     =======================
99
+
100
+        // ====================  OPERATIONS    =======================
101
+
102
+        // ====================  ACCESS        =======================
103
+
104
+        // ====================  INQUIRY       =======================
105
+        /**
106
+         *  Returns the name of the underlying class, similiar to Python's type
107
+         *  @return string of class name
108
+         */
109
+        virtual inline std::string GetName() const {
110
+            return CName;
111
+        }
112
+
113
+        protected:
114
+
115
+        // ====================  LIFECYCLE     =======================
116
+
117
+        /** Copy is disabled */
118
+        DataFID( const DataFID& ) = delete;
119
+
120
+        // ====================  DATA MEMBERS  =========================
121
+
122
+        private:
123
+
124
+        /** ASCII string representation of the class name */
125
+        static constexpr auto CName = "DataFID";
126
+
127
+    }; // -----  end of class  DataFID  -----
128
+}  // -----  end of namespace Lemma ----
129
+
130
+/* vim: set tabstop=4 expandtab: */
131
+/* vim: set filetype=cpp: */
132
+
133
+
134
+#endif   // ----- #ifndef DATAFID_INC  -----

+ 160
- 0
include/ForwardFID.h View File

@@ -0,0 +1,160 @@
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 08:49:51 AM
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
+#ifndef  FORWARDFID_INC
21
+#define  FORWARDFID_INC
22
+
23
+#pragma once
24
+#include "LayeredEarthEM.h"
25
+#include "PolygonalWireAntenna.h"
26
+#include "EMEarth1D.h"
27
+#include "MerlinObject.h"
28
+#include "DataFID.h"
29
+#include "KernelV0.h"
30
+
31
+namespace Lemma {
32
+
33
+    /**
34
+     * \ingroup Merlin
35
+     * \brief Forward modelling for FID sNMR pulses
36
+     * \details This class performs forward modelling of sNMR
37
+     *          FID experiments.
38
+     */
39
+    class ForwardFID : public MerlinObject {
40
+
41
+        friend std::ostream &operator<<(std::ostream &stream, const ForwardFID &ob);
42
+
43
+        protected:
44
+        /*
45
+         *  This key is used to lock the constructor. It is protected so that inhereted
46
+         *  classes also have the key to contruct their base class.
47
+         */
48
+        struct ctor_key {};
49
+
50
+        public:
51
+
52
+        // ====================  LIFECYCLE     =======================
53
+
54
+        /**
55
+         * Default constructor.
56
+         * @note This method is locked, and cannot be called directly.
57
+         *       The reason that the method is public is to enable the use
58
+         *       of make_shared whilst enforcing the use of shared_ptr,
59
+         *       in c++-17, this curiosity may be resolved.
60
+         * @see ForwardFID::NewSP
61
+         */
62
+        explicit ForwardFID ( const ctor_key& );
63
+
64
+        /**
65
+         * DeSerializing constructor.
66
+         * @note This method is locked, and cannot be called directly.
67
+         *       The reason that the method is public is to enable the use
68
+         *       of make_shared whilst enforcing the use of shared_ptr,
69
+         *       in c++-17, this curiosity may be resolved.
70
+         * @see ForwardFID::DeSerialize
71
+         */
72
+        ForwardFID ( const YAML::Node& node, const ctor_key& );
73
+
74
+        /**
75
+         * Default destructor.
76
+         * @note This method should never be called due to the mandated
77
+         *       use of smart pointers. It is necessary to keep the method
78
+         *       public in order to allow for the use of the more efficient
79
+         *       make_shared constructor.
80
+         */
81
+        virtual ~ForwardFID ();
82
+
83
+        /**
84
+         *  Uses YAML to serialize this object.
85
+         *  @return a YAML::Node
86
+         *  @see ForwardFID::DeSerialize
87
+         */
88
+        virtual YAML::Node Serialize() const;
89
+
90
+        /*
91
+         *  Factory method for generating concrete class.
92
+         *  @return a std::shared_ptr of type ForwardFID
93
+         */
94
+        static std::shared_ptr< ForwardFID > NewSP();
95
+
96
+        /**
97
+         *   Constructs an ForwardFID object from a YAML::Node.
98
+         *   @see ForwardFID::Serialize
99
+         */
100
+        static std::shared_ptr<ForwardFID> DeSerialize(const YAML::Node& node);
101
+
102
+        // ====================  OPERATORS     =======================
103
+
104
+        // ====================  OPERATIONS    =======================
105
+
106
+        /**
107
+         *  Performs forward model calculation based on input parameters
108
+         *  @return Merlin class representing data
109
+         */
110
+        std::shared_ptr<DataFID> ForwardModel();
111
+
112
+        // ====================  ACCESS        =======================
113
+        /**
114
+         *  Sets windows using the edges in a Eigen VectorXr
115
+         *  @param[in] Edges are the edges of the time gate windows
116
+         */
117
+        void SetWindowEdges( const VectorXr& Edges );
118
+
119
+        // ====================  INQUIRY       =======================
120
+        /**
121
+         *  Returns the name of the underlying class, similiar to Python's type
122
+         *  @return string of class name
123
+         */
124
+        virtual inline std::string GetName() const {
125
+            return CName;
126
+        }
127
+
128
+        protected:
129
+
130
+        // ====================  LIFECYCLE     =======================
131
+
132
+        /** Copy is disabled */
133
+        ForwardFID( const ForwardFID& ) = delete;
134
+
135
+        // ====================  DATA MEMBERS  =========================
136
+        private:
137
+
138
+        /** ASCII string representation of the class name */
139
+        static constexpr auto CName = "ForwardFID";
140
+
141
+        /** Imaging kernel used in calculation */
142
+        std::shared_ptr< KernelV0 >   Kernel = nullptr;
143
+
144
+        /** Time gate windows */
145
+        VectorXr WindowEdges;
146
+
147
+        /** Time gate centres */
148
+        VectorXr WindowCentres;
149
+
150
+        /** Include RDP effects? */
151
+        bool RDP = false;
152
+
153
+    }; // -----  end of class  ForwardFID  -----
154
+
155
+}  // -----  end of namespace Lemma ----
156
+
157
+/* vim: set tabstop=4 expandtab: */
158
+/* vim: set filetype=cpp: */
159
+
160
+#endif   // ----- #ifndef FORWARDFID_INC  -----

+ 2
- 0
include/Merlin View File

@@ -1,6 +1,8 @@
1 1
 #include "KernelV0.h"
2
+#include "ForwardFID.h"
2 3
 #include "Coupling.h"
3 4
 #include "LoopInteractions.h"
5
+#include "DataFID.h"
4 6
 
5 7
 /* vim: set tabstop=4 expandtab: */
6 8
 /* vim: set filetype=cpp: */

+ 135
- 0
include/MerlinObject.h View File

@@ -0,0 +1,135 @@
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 11:40:40 AM
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
+#ifndef  MERLINOBJECT_INC
21
+#define  MERLINOBJECT_INC
22
+
23
+
24
+#pragma once
25
+#include "LemmaObject.h"
26
+#include "LemmaObject.h"
27
+#include "MerlinConfig.h"
28
+
29
+namespace Lemma {
30
+
31
+    /**
32
+     * \ingroup Merlin
33
+     * \brief  Abstract base class for all of Merlin
34
+     * \details
35
+     */
36
+    class MerlinObject : public LemmaObject {
37
+
38
+        friend std::ostream &operator<<(std::ostream &stream, const MerlinObject &ob);
39
+
40
+        protected:
41
+        /*
42
+         *  This key is used to lock the constructor. It is protected so that inhereted
43
+         *  classes also have the key to contruct their base class.
44
+         */
45
+
46
+        public:
47
+
48
+        // ====================  LIFECYCLE     =======================
49
+
50
+        /**
51
+         * Default constructor.
52
+         * @note This method is locked, and cannot be called directly.
53
+         *       The reason that the method is public is to enable the use
54
+         *       of make_shared whilst enforcing the use of shared_ptr,
55
+         *       in c++-17, this curiosity may be resolved.
56
+         * @see MerlinObject::NewSP
57
+         */
58
+        explicit MerlinObject ( );
59
+
60
+        /**
61
+         * DeSerializing constructor.
62
+         * @note This method is locked, and cannot be called directly.
63
+         *       The reason that the method is public is to enable the use
64
+         *       of make_shared whilst enforcing the use of shared_ptr,
65
+         *       in c++-17, this curiosity may be resolved.
66
+         * @see MerlinObject::DeSerialize
67
+         */
68
+        MerlinObject ( const YAML::Node& node );
69
+
70
+        /**
71
+         * Default destructor.
72
+         * @note This method should never be called due to the mandated
73
+         *       use of smart pointers. It is necessary to keep the method
74
+         *       public in order to allow for the use of the more efficient
75
+         *       make_shared constructor.
76
+         */
77
+        virtual ~MerlinObject ();
78
+
79
+        /**
80
+         *  Uses YAML to serialize this object.
81
+         *  @return a YAML::Node
82
+         *  @see MerlinObject::DeSerialize
83
+         */
84
+        virtual YAML::Node Serialize() const ;
85
+
86
+        /*
87
+         *  Factory method for generating concrete class.
88
+         *  @return a std::shared_ptr of type MerlinObject
89
+         */
90
+        static std::shared_ptr< MerlinObject > NewSP();
91
+
92
+        /**
93
+         *   Constructs an MerlinObject object from a YAML::Node.
94
+         *   @see MerlinObject::Serialize
95
+         */
96
+        static std::shared_ptr<MerlinObject> DeSerialize(const YAML::Node& node);
97
+
98
+        // ====================  OPERATORS     =======================
99
+
100
+        // ====================  OPERATIONS    =======================
101
+
102
+        // ====================  ACCESS        =======================
103
+
104
+        // ====================  INQUIRY       =======================
105
+        /**
106
+         *  Returns the name of the underlying class, similiar to Python's type
107
+         *  @return string of class name
108
+         */
109
+        virtual inline std::string GetName() const {
110
+            return CName;
111
+        }
112
+
113
+        protected:
114
+
115
+        // ====================  LIFECYCLE     =======================
116
+
117
+        /** Copy is disabled */
118
+        MerlinObject( const MerlinObject& ) = delete;
119
+
120
+        // ====================  DATA MEMBERS  =========================
121
+
122
+        private:
123
+
124
+        /** ASCII string representation of the class name */
125
+        static constexpr auto CName = "MerlinObject";
126
+
127
+    }; // -----  end of class  MerlinObject  -----
128
+}  // -----  end of namespace Lemma ----
129
+
130
+/* vim: set tabstop=4 expandtab: */
131
+/* vim: set filetype=cpp: */
132
+
133
+
134
+#endif   // ----- #ifndef MERLINOBJECT_INC  -----
135
+

+ 3
- 0
src/CMakeLists.txt View File

@@ -1,6 +1,9 @@
1 1
 set (MERLINSOURCE
2
+	${CMAKE_CURRENT_SOURCE_DIR}/MerlinObject.cpp
2 3
 	${CMAKE_CURRENT_SOURCE_DIR}/KernelV0.cpp
4
+	${CMAKE_CURRENT_SOURCE_DIR}/ForwardFID.cpp
3 5
 	${CMAKE_CURRENT_SOURCE_DIR}/Coupling.cpp
4 6
 	${CMAKE_CURRENT_SOURCE_DIR}/LoopInteractions.cpp
7
+	${CMAKE_CURRENT_SOURCE_DIR}/DataFID.cpp
5 8
 	PARENT_SCOPE
6 9
 )

+ 97
- 0
src/DataFID.cpp View File

@@ -0,0 +1,97 @@
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 01:04:19 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
+
21
+#include "DataFID.h"
22
+
23
+namespace Lemma {
24
+
25
+    // ====================  FRIEND METHODS  =====================
26
+
27
+    std::ostream &operator << (std::ostream &stream, const DataFID &ob) {
28
+        stream << ob.Serialize()  << "\n---\n"; // End of doc ---
29
+        return stream;
30
+    }
31
+
32
+    // ====================  LIFECYCLE     =======================
33
+
34
+    //--------------------------------------------------------------------------------------
35
+    //       Class:  DataFID
36
+    //      Method:  DataFID
37
+    // Description:  constructor (locked)
38
+    //--------------------------------------------------------------------------------------
39
+    DataFID::DataFID (const ctor_key&) : MerlinObject( ) {
40
+
41
+    }  // -----  end of method DataFID::DataFID  (constructor)  -----
42
+
43
+    //--------------------------------------------------------------------------------------
44
+    //       Class:  DataFID
45
+    //      Method:  DataFID
46
+    // Description:  DeSerializing constructor (locked)
47
+    //--------------------------------------------------------------------------------------
48
+    DataFID::DataFID (const YAML::Node& node, const ctor_key&) : MerlinObject(node) {
49
+
50
+    }  // -----  end of method DataFID::DataFID  (constructor)  -----
51
+
52
+    //--------------------------------------------------------------------------------------
53
+    //       Class:  DataFID
54
+    //      Method:  NewSP()
55
+    // Description:  public constructor returing a shared_ptr
56
+    //--------------------------------------------------------------------------------------
57
+    std::shared_ptr< DataFID >  DataFID::NewSP() {
58
+        return std::make_shared< DataFID >( ctor_key() );
59
+    }
60
+
61
+    //--------------------------------------------------------------------------------------
62
+    //       Class:  DataFID
63
+    //      Method:  ~DataFID
64
+    // Description:  destructor (protected)
65
+    //--------------------------------------------------------------------------------------
66
+    DataFID::~DataFID () {
67
+
68
+    }  // -----  end of method DataFID::~DataFID  (destructor)  -----
69
+
70
+    //--------------------------------------------------------------------------------------
71
+    //       Class:  DataFID
72
+    //      Method:  Serialize
73
+    //--------------------------------------------------------------------------------------
74
+    YAML::Node  DataFID::Serialize (  ) const {
75
+        YAML::Node node = MerlinObject::Serialize();
76
+        node.SetTag( GetName() );
77
+        // FILL IN CLASS SPECIFICS HERE
78
+        return node;
79
+    }		// -----  end of method DataFID::Serialize  -----
80
+
81
+    //--------------------------------------------------------------------------------------
82
+    //       Class:  DataFID
83
+    //      Method:  DeSerialize
84
+    //--------------------------------------------------------------------------------------
85
+    std::shared_ptr<DataFID> DataFID::DeSerialize ( const YAML::Node& node  ) {
86
+        if (node.Tag() !=  "DataFID" ) {
87
+            throw  DeSerializeTypeMismatch( "DataFID", node.Tag());
88
+        }
89
+        return std::make_shared< DataFID > ( node, ctor_key() );
90
+    }		// -----  end of method DataFID::DeSerialize  -----
91
+
92
+} // ----  end of namespace Lemma  ----
93
+
94
+/* vim: set tabstop=4 expandtab: */
95
+/* vim: set filetype=cpp: */
96
+
97
+

+ 123
- 0
src/ForwardFID.cpp View File

@@ -0,0 +1,123 @@
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 09:03:03 AM
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 "ForwardFID.h"
21
+
22
+namespace Lemma {
23
+
24
+    // ====================  FRIEND METHODS  =====================
25
+
26
+    std::ostream &operator << (std::ostream &stream, const ForwardFID &ob) {
27
+        stream << ob.Serialize()  << "\n---\n"; // End of doc ---
28
+        return stream;
29
+    }
30
+
31
+    // ====================  LIFECYCLE     =======================
32
+
33
+    //--------------------------------------------------------------------------------------
34
+    //       Class:  ForwardFID
35
+    //      Method:  ForwardFID
36
+    // Description:  constructor (locked)
37
+    //--------------------------------------------------------------------------------------
38
+    ForwardFID::ForwardFID (const ctor_key&) : MerlinObject( ) {
39
+
40
+    }  // -----  end of method ForwardFID::ForwardFID  (constructor)  -----
41
+
42
+    //--------------------------------------------------------------------------------------
43
+    //       Class:  ForwardFID
44
+    //      Method:  ForwardFID
45
+    // Description:  DeSerializing constructor (locked)
46
+    //--------------------------------------------------------------------------------------
47
+    ForwardFID::ForwardFID (const YAML::Node& node, const ctor_key&) : MerlinObject(node) {
48
+
49
+    }  // -----  end of method ForwardFID::ForwardFID  (constructor)  -----
50
+
51
+    //--------------------------------------------------------------------------------------
52
+    //       Class:  ForwardFID
53
+    //      Method:  NewSP()
54
+    // Description:  public constructor returing a shared_ptr
55
+    //--------------------------------------------------------------------------------------
56
+    std::shared_ptr< ForwardFID >  ForwardFID::NewSP() {
57
+        return std::make_shared< ForwardFID >( ctor_key() );
58
+    }
59
+
60
+    //--------------------------------------------------------------------------------------
61
+    //       Class:  ForwardFID
62
+    //      Method:  ~ForwardFID
63
+    // Description:  destructor (protected)
64
+    //--------------------------------------------------------------------------------------
65
+    ForwardFID::~ForwardFID () {
66
+
67
+    }  // -----  end of method ForwardFID::~ForwardFID  (destructor)  -----
68
+
69
+    //--------------------------------------------------------------------------------------
70
+    //       Class:  ForwardFID
71
+    //      Method:  Serialize
72
+    //--------------------------------------------------------------------------------------
73
+    YAML::Node  ForwardFID::Serialize (  ) const {
74
+        YAML::Node node = MerlinObject::Serialize();
75
+        node.SetTag( GetName() );
76
+        // FILL IN CLASS SPECIFICS HERE
77
+        if (Kernel != nullptr) {
78
+            node["Kernel"] = Kernel->Serialize();
79
+        }
80
+        node["WindowEdges"] = WindowEdges;
81
+        node["WindowCentres"] = WindowCentres;
82
+        node["RDP"] = RDP;
83
+        return node;
84
+    }		// -----  end of method ForwardFID::Serialize  -----
85
+
86
+    //--------------------------------------------------------------------------------------
87
+    //       Class:  ForwardFID
88
+    //      Method:  DeSerialize
89
+    //--------------------------------------------------------------------------------------
90
+    std::shared_ptr<ForwardFID> ForwardFID::DeSerialize ( const YAML::Node& node  ) {
91
+        if (node.Tag() !=  "ForwardFID" ) {
92
+            throw  DeSerializeTypeMismatch( "ForwardFID", node.Tag());
93
+        }
94
+        return std::make_shared< ForwardFID > ( node, ctor_key() );
95
+    }		// -----  end of method ForwardFID::DeSerialize  -----
96
+
97
+
98
+    //--------------------------------------------------------------------------------------
99
+    //       Class:  ForwardFID
100
+    //      Method:  SetWindowEdges
101
+    //--------------------------------------------------------------------------------------
102
+    void ForwardFID::SetWindowEdges ( const VectorXr& Edges ) {
103
+        WindowEdges = Edges;
104
+        return ;
105
+    }		// -----  end of method ForwardFID::SetWindowEdges  -----
106
+
107
+
108
+    //--------------------------------------------------------------------------------------
109
+    //       Class:  ForwardFID
110
+    //      Method:  ForwardModel
111
+    //--------------------------------------------------------------------------------------
112
+    std::shared_ptr<DataFID> ForwardFID::ForwardModel (  ) {
113
+        auto FID = DataFID::NewSP();
114
+        return FID;
115
+    }		// -----  end of method ForwardFID::ForwardModel  -----
116
+
117
+
118
+} // ----  end of namespace Lemma  ----
119
+
120
+/* vim: set tabstop=4 expandtab: */
121
+/* vim: set filetype=cpp: */
122
+
123
+

Loading…
Cancel
Save