Browse Source

Moved around some more files and working toward FDEM1D module ported.

enhancement_3
T-bone 7 years ago
parent
commit
7a2adfe63a

+ 7
- 0
Modules/FDEM1D/include/FDEM1D View File

1
 #include "LayeredEarthEM.h"
1
 #include "LayeredEarthEM.h"
2
 #include "FieldPoints.h"
2
 #include "FieldPoints.h"
3
+#include "WireAntenna.h"
4
+#include "DipoleSource.h"
5
+
6
+// internal
7
+//#include "KernelEM1DManager.h"
8
+//#include "KernelEM1DSpec.h"
9
+//#include "KernelEM1DReflSpec.h"
3
 
10
 
4
 /* vim: set tabstop=4 expandtab: */
11
 /* vim: set tabstop=4 expandtab: */
5
 /* vim: set filetype=cpp: */
12
 /* vim: set filetype=cpp: */

Modules/FDEM1D/include/hankeltransformhankel2.h → Modules/FDEM1D/include/FHTAnderson801.h View File

11
   @version  $Id: hankeltransformhankel2.h 201 2015-01-03 00:07:47Z tirons $
11
   @version  $Id: hankeltransformhankel2.h 201 2015-01-03 00:07:47Z tirons $
12
  **/
12
  **/
13
 
13
 
14
-#ifndef __HANKEL2_H
15
-#define __HANKEL2_H
14
+#ifndef __FHTANDERSON801_H
15
+#define __FHTANDERSON801_H
16
 
16
 
17
-#include "hankeltransform.h"
18
 #include "KernelEM1DBase.h"
17
 #include "KernelEM1DBase.h"
19
 #include "KernelEM1DSpec.h"
18
 #include "KernelEM1DSpec.h"
20
 #include "CubicSplineInterpolator.h"
19
 #include "CubicSplineInterpolator.h"
20
+#include "HankelTransform.h"
21
 
21
 
22
 namespace Lemma {
22
 namespace Lemma {
23
 
23
 
24
 // ==========================================================================
24
 // ==========================================================================
25
-//        Class:  Hankel2
25
+//        Class:  FHTAnderson801
26
 /** \brief   Computes the Hankel transform of orders 0 and 1 using lagged
26
 /** \brief   Computes the Hankel transform of orders 0 and 1 using lagged
27
              and related convolutions.
27
              and related convolutions.
28
     \details A rewrite of work by Anderson who wrote a FORTRAN program
28
     \details A rewrite of work by Anderson who wrote a FORTRAN program
29
-             that he released while working at the USGS.
29
+             that he released while working at the USGS:
30
+             Anderson, W. L., 1989, A hybrid fast hankel transform algorithm for
31
+             electromagnetic modeling: Geophysics, 54, 263-266.
32
+
33
+             This function does not provide the Hybrid functionality however, merely the
34
+             digital filter implimentation.
35
+
30
              The  transform evaluates an integral of the form:
36
              The  transform evaluates an integral of the form:
31
              \f[ \int_0^\infty K(\lambda) J_I (\lambda r) ~ d \lambda
37
              \f[ \int_0^\infty K(\lambda) J_I (\lambda r) ~ d \lambda
32
              \f]
38
              \f]
45
              \f]
51
              \f]
46
              This can only be done where there is radial symmetry. Hence
52
              This can only be done where there is radial symmetry. Hence
47
              its application to 1D solutions here.
53
              its application to 1D solutions here.
54
+    \note In previous versions of Lemma, this class was called HankelTransformHankel2,
55
+        which more closely follows Anderson's procedural routine names, but was non-descriptive
56
+        regarding where the algorithm is derived from.
48
  */
57
  */
49
 // ==========================================================================
58
 // ==========================================================================
50
 
59
 
51
-class Hankel2 : public HankelTransform {
60
+class FHTAnderson801 : public HankelTransform {
61
+
62
+    friend std::ostream &operator<<(std::ostream &stream, const FHTAnderson801 &ob);
52
 
63
 
53
-    friend std::ostream &operator<<(std::ostream &stream, const Hankel2 &ob);
64
+    struct ctor_key {};
54
 
65
 
55
     public:
66
     public:
56
 
67
 
57
         // ====================  LIFECYCLE     ==============================
68
         // ====================  LIFECYCLE     ==============================
58
         /**
69
         /**
59
-         *  Returns pointer to new Hankel2. Location is
60
-         *  initialized to (0,0,0) type and polarization are
61
-         *  initialized  to nonworking values that will throw
62
-         *  exceptions if used.
70
+         *  Returns shared_ptr to new FHTAnderson801.
63
          */
71
          */
64
-        static Hankel2 *New();
72
+        static std::shared_ptr<FHTAnderson801> NewSP();
65
 
73
 
66
         /**
74
         /**
67
-         * @copybrief LemmaObject::Delete()
68
-         * @copydetails LemmaObject::Delete()
75
+         *  Returns unique_ptr to new FHTAnderson801.
69
          */
76
          */
70
-        void Delete();
77
+        static std::unique_ptr<FHTAnderson801> NewUP();
78
+
79
+        /// Default locked constructor
80
+        FHTAnderson801( const ctor_key& );
81
+
82
+        /** Locked deserializing constructor. */
83
+		FHTAnderson801 ( const YAML::Node& node, const ctor_key& );
84
+
85
+        /// Default destructor
86
+        ~FHTAnderson801();
87
+
88
+        /**
89
+         *   YAML Serializing method
90
+         */
91
+        YAML::Node Serialize() const;
92
+
93
+        /**
94
+         *   Constructs an object from a YAML::Node.
95
+         */
96
+        static std::shared_ptr< FHTAnderson801 > DeSerialize(const YAML::Node& node);
71
 
97
 
72
         // ====================  OPERATORS     ==============================
98
         // ====================  OPERATORS     ==============================
73
 
99
 
83
         void Compute(const Real &rho, const int& ntol, const Real &tol);
109
         void Compute(const Real &rho, const int& ntol, const Real &tol);
84
 
110
 
85
         /// Computes the related
111
         /// Computes the related
86
-        void ComputeRelated(const Real &rho, KernelEm1DBase* Kernel);
112
+        void ComputeRelated(const Real &rho, std::shared_ptr<KernelEM1DBase> Kernel);
87
 
113
 
88
         /// Computes the related
114
         /// Computes the related
89
-        void ComputeRelated(const Real &rho,  std::vector< KernelEm1DBase* > KernelVec);
115
+        void ComputeRelated(const Real &rho,  std::vector< std::shared_ptr<KernelEM1DBase> > KernelVec);
90
 
116
 
91
         /// Computes the related
117
         /// Computes the related
92
-        void ComputeRelated(const Real &rho,  KernelEM1DManager* Manager);
118
+        void ComputeRelated(const Real &rho,  std::shared_ptr<KernelEM1DManager> Manager);
93
 
119
 
94
         /// Computes the related and lagged convolutions
120
         /// Computes the related and lagged convolutions
95
-        void ComputeLaggedRelated(const Real &rho, const int& nlag,  KernelEM1DManager* Manager);
121
+        void ComputeLaggedRelated(const Real &rho, const int& nlag,  std::shared_ptr<KernelEM1DManager> Manager);
96
 
122
 
97
         // ====================  ACCESS        ==============================
123
         // ====================  ACCESS        ==============================
98
 
124
 
108
         /// Sets the lagged kernel index so that the proper value is returned
134
         /// Sets the lagged kernel index so that the proper value is returned
109
         void SetLaggedArg(const Real& rho);
135
         void SetLaggedArg(const Real& rho);
110
 
136
 
111
-
112
         // ====================  INQUIRY       ==============================
137
         // ====================  INQUIRY       ==============================
113
 
138
 
114
         /// Calculates Hankel Transform using filtering.
139
         /// Calculates Hankel Transform using filtering.
120
         /// = omega * sqrt( EP*AMU )  amu = 4 pi e-7  ep = 8.85e-12
145
         /// = omega * sqrt( EP*AMU )  amu = 4 pi e-7  ep = 8.85e-12
121
         Complex Zgauss(const int &ikk, const EMMODE &imode,
146
         Complex Zgauss(const int &ikk, const EMMODE &imode,
122
                         const int &itype, const Real &rho,
147
                         const int &itype, const Real &rho,
123
-                        const Real &wavef, KernelEm1DBase *Kernel);
148
+                        const Real &wavef, std::shared_ptr<KernelEM1DBase> Kernel);
149
+
150
+        /** Returns the name of the underlying class, similiar to Python's type */
151
+        virtual inline std::string GetName() const {
152
+            return CName;
153
+        }
124
 
154
 
125
     protected:
155
     protected:
126
 
156
 
157
+    private:
158
+
127
         // ====================  LIFECYCLE     ==============================
159
         // ====================  LIFECYCLE     ==============================
128
 
160
 
129
-        /** A rewrite of Anderson's Pseudo-subroutine. */
161
+        /** A rewrite of Anderson's "Pseudo-subroutine" computed GOTO madness. */
130
         inline void StoreRetreive(const int &idx, const int &lag,
162
         inline void StoreRetreive(const int &idx, const int &lag,
131
                         Complex &Zsum, const int &irel, Complex &C, const Real& rho0) {
163
                         Complex &Zsum, const int &irel, Complex &C, const Real& rho0) {
132
 
164
 
149
 		    return;
181
 		    return;
150
 	    }
182
 	    }
151
 
183
 
152
-        /// Default protected constructor
153
-        Hankel2(const std::string& name);
154
-
155
-        /// Default protected destructor
156
-        ~Hankel2();
157
-
158
-        /**
159
-         * @copybrief LemmaObject::Release()
160
-         * @copydetails LemmaObject::Release()
161
-         */
162
-        void Release();
163
-
164
         // ====================  OPERATIONS    ==============================
184
         // ====================  OPERATIONS    ==============================
165
 
185
 
166
         void DeleteSplines();
186
         void DeleteSplines();
194
         //bool cacheResults;
214
         //bool cacheResults;
195
 
215
 
196
         /** Related Kernel Manager */
216
         /** Related Kernel Manager */
197
-        KernelEM1DManager*          Manager;
217
+        std::shared_ptr<KernelEM1DManager>     Manager;
198
 
218
 
199
         /// Used as base for filter abscissa generation
219
         /// Used as base for filter abscissa generation
200
         static const Real ABSCISSA;
220
         static const Real ABSCISSA;
209
         int icount;
229
         int icount;
210
 
230
 
211
         /// Kernel Calculator
231
         /// Kernel Calculator
212
-        std::vector <KernelEm1DBase*> kernelVec;
232
+        std::vector < std::shared_ptr<KernelEM1DBase> > kernelVec;
213
 
233
 
214
         /// Spines for lagged convolutions (real part)
234
         /// Spines for lagged convolutions (real part)
215
-        std::vector <CubicSplineInterpolator*> splineVecReal;
235
+        std::vector <std::shared_ptr<CubicSplineInterpolator> > splineVecReal;
216
 
236
 
217
         /// Spines for lagged convolutions (imaginary part)
237
         /// Spines for lagged convolutions (imaginary part)
218
-        std::vector <CubicSplineInterpolator*> splineVecImag;
238
+        std::vector < std::shared_ptr<CubicSplineInterpolator> > splineVecImag;
219
 
239
 
220
         /// Key used internally
240
         /// Key used internally
221
         Eigen::Matrix<int, 801, 1> Key;
241
         Eigen::Matrix<int, 801, 1> Key;
239
         /// Holds the arguments for lagged convolutions
259
         /// Holds the arguments for lagged convolutions
240
         VectorXr Arg;
260
         VectorXr Arg;
241
 
261
 
242
-}; // -----  end of class  HankelTransform  -----
262
+        /** ASCII string representation of the class name */
263
+        static constexpr auto CName = "FHTAnderson801";
264
+
265
+}; // -----  end of class  FHTAnderson801  -----
243
 
266
 
244
 }
267
 }
245
 
268
 
246
-#endif // __HANKEL2_h
269
+#endif // __FHTAnderson801_h

Modules/FDEM1D/include/hankeltransform.h → Modules/FDEM1D/include/HankelTransform.h View File

8
   @file
8
   @file
9
   @author   Trevor Irons
9
   @author   Trevor Irons
10
   @date     01/28/2010
10
   @date     01/28/2010
11
-  @version  $Id: hankeltransform.h 270 2015-08-24 15:45:41Z tirons $
12
  **/
11
  **/
13
 
12
 
14
 #ifndef __hankeltransform_h
13
 #ifndef __hankeltransform_h
19
 
18
 
20
 namespace Lemma {
19
 namespace Lemma {
21
 
20
 
22
-
23
         class KernelEM1DBase;
21
         class KernelEM1DBase;
24
 
22
 
25
         // ===================================================================
23
         // ===================================================================
26
         //        Class:  HankelTransform
24
         //        Class:  HankelTransform
27
-        /// \brief  Pure abstract class for hankel transforms
25
+        /// \brief   Abstract class for hankel transforms
28
         /// \details
26
         /// \details
29
         // ===================================================================
27
         // ===================================================================
30
         class HankelTransform : public LemmaObject {
28
         class HankelTransform : public LemmaObject {
37
 
35
 
38
                 // ====================  LIFECYCLE     =======================
36
                 // ====================  LIFECYCLE     =======================
39
 
37
 
40
-                //static HankelTransform* New();
41
-
42
-                //void Delete();
43
-
44
                 // ====================  OPERATORS     =======================
38
                 // ====================  OPERATORS     =======================
45
 
39
 
46
                 // ====================  OPERATIONS    =======================
40
                 // ====================  OPERATIONS    =======================
60
 
54
 
61
                 /// Computes related kernels, if applicable, otherwise this is
55
                 /// Computes related kernels, if applicable, otherwise this is
62
                 /// just a dummy function.
56
                 /// just a dummy function.
63
-                virtual void ComputeRelated(const Real& rho, KernelEm1DBase* Kernel);
57
+                virtual void ComputeRelated(const Real& rho, std::shared_ptr<KernelEM1DBase> Kernel);
64
 
58
 
65
                 virtual void ComputeRelated(const Real& rho, std::vector< std::shared_ptr<KernelEM1DBase> > KernelVec);
59
                 virtual void ComputeRelated(const Real& rho, std::vector< std::shared_ptr<KernelEM1DBase> > KernelVec);
66
 
60
 
69
                 // ====================  ACCESS        =======================
63
                 // ====================  ACCESS        =======================
70
 
64
 
71
                 // ====================  INQUIRY       =======================
65
                 // ====================  INQUIRY       =======================
66
+                /** Returns the name of the underlying class, similiar to Python's type */
67
+                virtual inline std::string GetName() const {
68
+                    return CName;
69
+                }
72
 
70
 
73
                 // ====================  DATA MEMBERS  =======================
71
                 // ====================  DATA MEMBERS  =======================
74
 
72
 
77
                 // ====================  LIFECYCLE     =======================
75
                 // ====================  LIFECYCLE     =======================
78
 
76
 
79
                 /// Default protected constructor.
77
                 /// Default protected constructor.
80
-                HankelTransform (const std::string &name);
78
+                HankelTransform ( );
81
 
79
 
82
                 /// Default protected constructor.
80
                 /// Default protected constructor.
83
-                ~HankelTransform ();
81
+                ~HankelTransform ( );
84
 
82
 
85
             private:
83
             private:
86
 
84
 
85
+                /** ASCII string representation of the class name */
86
+                static constexpr auto CName = "HankelTransform";
87
+
87
     }; // -----  end of class  HankelTransform  -----
88
     }; // -----  end of class  HankelTransform  -----
88
 
89
 
89
 }
90
 }

+ 5
- 2
Modules/FDEM1D/src/CMakeLists.txt View File

1
 set (FDEM1DSOURCE
1
 set (FDEM1DSOURCE
2
 	${FDEM1DSOURCE}
2
 	${FDEM1DSOURCE}
3
 
3
 
4
-	#${CMAKE_CURRENT_SOURCE_DIR}/AEMSurvey.cpp
5
-	#${CMAKE_CURRENT_SOURCE_DIR}/AEMSurveyReader.cpp
4
+
6
 
5
 
7
 	${CMAKE_CURRENT_SOURCE_DIR}/LayeredEarthEM.cpp
6
 	${CMAKE_CURRENT_SOURCE_DIR}/LayeredEarthEM.cpp
8
 	
7
 	
16
 	${CMAKE_CURRENT_SOURCE_DIR}/KernelEM1DSpec.cpp
15
 	${CMAKE_CURRENT_SOURCE_DIR}/KernelEM1DSpec.cpp
17
 	${CMAKE_CURRENT_SOURCE_DIR}/KernelEM1DReflSpec.cpp
16
 	${CMAKE_CURRENT_SOURCE_DIR}/KernelEM1DReflSpec.cpp
18
 
17
 
18
+	${CMAKE_CURRENT_SOURCE_DIR}/HankelTransform.cpp
19
+	${CMAKE_CURRENT_SOURCE_DIR}/FHTAnderson801.cpp
19
 
20
 
21
+	#${CMAKE_CURRENT_SOURCE_DIR}/AEMSurvey.cpp
22
+	#${CMAKE_CURRENT_SOURCE_DIR}/AEMSurveyReader.cpp
20
 	#${CMAKE_CURRENT_SOURCE_DIR}/UngroundedElectricDipole.cpp
23
 	#${CMAKE_CURRENT_SOURCE_DIR}/UngroundedElectricDipole.cpp
21
 	PARENT_SCOPE
24
 	PARENT_SCOPE
22
 )
25
 )

+ 1
- 1
Modules/FDEM1D/src/DipoleSource.cpp View File

19
 //#include "MagneticDipole.h"
19
 //#include "MagneticDipole.h"
20
 
20
 
21
 #include "FieldPoints.h"
21
 #include "FieldPoints.h"
22
-#include "hankeltransform.h"
22
+#include "HankelTransform.h"
23
 
23
 
24
 namespace Lemma {
24
 namespace Lemma {
25
 
25
 

Modules/FDEM1D/src/hankeltransformhankel2.cpp → Modules/FDEM1D/src/FHTAnderson801.cpp View File

11
   @version  $Id: hankeltransformhankel2.cpp 202 2015-01-06 20:53:21Z tirons $
11
   @version  $Id: hankeltransformhankel2.cpp 202 2015-01-06 20:53:21Z tirons $
12
  **/
12
  **/
13
 
13
 
14
-#include "hankeltransformhankel2.h"
14
+#include "FHTAnderson801.h"
15
 
15
 
16
 namespace Lemma {
16
 namespace Lemma {
17
 
17
 
18
-	std::ostream &operator<<(std::ostream &stream,
19
-			const Hankel2 &ob) {
20
-
21
-		stream << *(HankelTransform*)(&ob);
22
-		return stream;
23
-	}
18
+    std::ostream &operator << (std::ostream &stream, const FHTAnderson801 &ob) {
19
+        stream << ob.Serialize()  << "\n---\n"; // End of doc ---
20
+        return stream;
21
+    }
24
 
22
 
25
-    // Initialise static const members
26
-    const Eigen::Matrix<Real, 2, 801>  Hankel2::FilterWeights =
23
+    // Initialise static const members, this could be done by preprocessor in
24
+    // slightly higher precision?
25
+    const Eigen::Matrix<Real, 2, 801>  FHTAnderson801::FilterWeights =
27
         ( Eigen::Matrix<Real, 2, 801>()   <<
26
         ( Eigen::Matrix<Real, 2, 801>()   <<
28
 					2.103562053838982e-29, -1.264469361608894e-14,
27
 					2.103562053838982e-29, -1.264469361608894e-14,
29
 					4.615731256788567e-14, -2.798703374257668e-14,
28
 					4.615731256788567e-14, -2.798703374257668e-14,
837
 					// 800
836
 					// 800
838
 					7.214920505613761e-28).finished();
837
 					7.214920505613761e-28).finished();
839
 
838
 
840
-    const Real Hankel2::ABSCISSA = 0.7059431685223780;     //
841
-	const Real Hankel2::ABSE = 1.10517091807564762;        // exp(.1)
842
-	const Real Hankel2::ABSER = 0.904837418035959573;      // 1/exp(.1)
843
-    //std::unordered_map<Real, int> Hankel2::RHO0 = {};
839
+    const Real FHTAnderson801::ABSCISSA = 0.7059431685223780;     //
840
+	const Real FHTAnderson801::ABSE = 1.10517091807564762;        // exp(.1)
841
+	const Real FHTAnderson801::ABSER = 0.904837418035959573;      // 1/exp(.1)
844
 
842
 
845
 	// ====================  LIFECYCLE     ==============================
843
 	// ====================  LIFECYCLE     ==============================
846
-	Hankel2::Hankel2(const std::string&name) : HankelTransform(name),
844
+	FHTAnderson801::FHTAnderson801(const ctor_key& ) : HankelTransform( ),
847
 			             Lambda(0), NumFun(0),
845
 			             Lambda(0), NumFun(0),
848
 						 NumConv(0), NumRel(0),
846
 						 NumConv(0), NumRel(0),
849
-						 BesselOrder(-1),  Manager(NULL) {
847
+						 BesselOrder(-1),  Manager(nullptr) {
850
 	}
848
 	}
851
 
849
 
852
-	Hankel2::~Hankel2() {
853
-		//if (!this->kernelVec.empty()) {
854
-		//	this->Ckernel->DetachFrom(this);
855
-		//}
856
-
857
-        DeleteSplines();
858
-
859
-        if (Manager != NULL) {
860
-            Manager->DetachFrom(this);
861
-        }
862
-
863
-        if (this->NumberOfReferences != 0)
864
-            throw DeleteObjectWithReferences( this );
850
+    FHTAnderson801::FHTAnderson801( const YAML::Node& node, const ctor_key& ) : HankelTransform( ) {
851
+        Lambda = node["Lambda"].as<Real>();
852
+        NumFun = node["NumFun"].as<int>();
853
+		NumConv = node["NumConv"].as<int>();
854
+        NumRel = node["NumRel"].as<int>( );
855
+		BesselOrder = node["BesselOrder"].as<int>( );
856
+        //Manager = KernelEM1DManager::DeSerialize(node["Manager"]);
865
 	}
857
 	}
866
 
858
 
867
-	Hankel2* Hankel2::New() {
868
-		Hankel2* Obj = new Hankel2("Hankel2");
869
-        Obj->AttachTo(Obj);
870
-        return Obj;
859
+	FHTAnderson801::~FHTAnderson801() {
871
 	}
860
 	}
872
 
861
 
873
-	void Hankel2::Delete() {
874
-        this->DetachFrom(this);
875
-	}
862
+	std::shared_ptr<FHTAnderson801> FHTAnderson801::NewSP() {
863
+	    return std::make_shared<FHTAnderson801>( ctor_key() );
864
+    }
876
 
865
 
877
-    void Hankel2::Release() {
878
-        delete this;
866
+    std::unique_ptr<FHTAnderson801> FHTAnderson801::NewUP() {
867
+	    return std::make_unique<FHTAnderson801>( ctor_key() );
879
     }
868
     }
880
 
869
 
881
-    void Hankel2::DeleteSplines() {
882
-        for (unsigned int ii=0; ii<splineVecReal.size(); ++ii){
883
-            splineVecReal[ii]->Delete();
870
+    std::shared_ptr<FHTAnderson801> FHTAnderson801::DeSerialize( const YAML::Node& node ) {
871
+        if (node.Tag() != "FHTAnderson801") {
872
+            throw  DeSerializeTypeMismatch( "FHTAnderson801", node.Tag());
884
         }
873
         }
885
-        splineVecReal.clear();
874
+        return std::make_shared<FHTAnderson801> ( node, ctor_key() );
875
+    }
886
 
876
 
887
-        for (unsigned int ii=0; ii<splineVecImag.size(); ++ii){
888
-            splineVecImag[ii]->Delete();
889
-        }
877
+    YAML::Node FHTAnderson801::Serialize() const {
878
+        YAML::Node node = HankelTransform::Serialize();
879
+        node.SetTag( GetName() );
880
+        node["Lambda"] = Lambda;
881
+        node["NumFun"] = NumFun;
882
+        node["NumConv"] = NumConv;
883
+        node["NumRel"] = NumRel;
884
+        node["BesselOrder"] = BesselOrder;
885
+        node["Manager"] = Manager->Serialize();
886
+        return node;
887
+    }
888
+
889
+    void FHTAnderson801::DeleteSplines() {
890
+        splineVecReal.clear();
890
         splineVecImag.clear();
891
         splineVecImag.clear();
891
     }
892
     }
892
 
893
 
893
 	// ====================  OPERATIONS    ==============================
894
 	// ====================  OPERATIONS    ==============================
894
 
895
 
895
-    void Hankel2::ComputeRelated(const Real& rho, KernelEm1DBase* Kernel) {
896
+    void FHTAnderson801::ComputeRelated(const Real& rho, std::shared_ptr<KernelEM1DBase> Kernel) {
896
         //this->AttachKernel(Kernel);
897
         //this->AttachKernel(Kernel);
897
         this->SetNumConv(1);
898
         this->SetNumConv(1);
898
         icount = 0;
899
         icount = 0;
903
 #endif
904
 #endif
904
     }
905
     }
905
 
906
 
906
-    void Hankel2::ComputeRelated(const Real& rho,  std::vector< KernelEm1DBase*> KernelVecIn ) {
907
+    void FHTAnderson801::ComputeRelated(const Real& rho,  std::vector< std::shared_ptr<KernelEM1DBase> > KernelVecIn ) {
907
         icount = 0;
908
         icount = 0;
908
         this->kernelVec = KernelVecIn;
909
         this->kernelVec = KernelVecIn;
909
         this->SetNumConv(1);
910
         this->SetNumConv(1);
914
 #endif
915
 #endif
915
     }
916
     }
916
 
917
 
917
-    void Hankel2::ComputeRelated(const Real& rho,  KernelEM1DManager* KernelManager) {
918
+    void FHTAnderson801::ComputeRelated(const Real& rho,  std::shared_ptr<KernelEM1DManager> KernelManager) {
918
         icount = 0;
919
         icount = 0;
919
-        if (Manager != NULL) {
920
-            Manager->DetachFrom(this);
921
-        }
922
-        KernelManager->AttachTo(this);
923
         Manager = KernelManager;
920
         Manager = KernelManager;
924
         this->kernelVec = KernelManager->GetSTLVector();
921
         this->kernelVec = KernelManager->GetSTLVector();
925
         this->SetNumConv(1);
922
         this->SetNumConv(1);
930
 #endif
927
 #endif
931
     }
928
     }
932
 
929
 
933
-    void Hankel2::ComputeLaggedRelated(const Real& rho, const int& nlag, KernelEM1DManager* KernelManager) {
930
+    void FHTAnderson801::ComputeLaggedRelated(const Real& rho, const int& nlag, std::shared_ptr<KernelEM1DManager> KernelManager) {
934
         icount = 0;
931
         icount = 0;
935
-        if (Manager != NULL) {
936
-            Manager->DetachFrom(this);
937
-        }
938
-        KernelManager->AttachTo(this);
939
         Manager = KernelManager;
932
         Manager = KernelManager;
940
         this->kernelVec = KernelManager->GetSTLVector();
933
         this->kernelVec = KernelManager->GetSTLVector();
941
         this->SetNumConv(nlag);
934
         this->SetNumConv(nlag);
951
         //std::cout << "Arg\n" << Arg << std::endl;
944
         //std::cout << "Arg\n" << Arg << std::endl;
952
         //std::cout << "Zans\n" << Zans.col(0) << std::endl;
945
         //std::cout << "Zans\n" << Zans.col(0) << std::endl;
953
         for (int ii=0; ii<Zans.cols(); ++ii) {
946
         for (int ii=0; ii<Zans.cols(); ++ii) {
954
-            CubicSplineInterpolator *Spline = CubicSplineInterpolator::New();
947
+            auto Spline = CubicSplineInterpolator::NewSP();
955
             Spline->SetKnots( Arg, Zans.col(ii).real() );
948
             Spline->SetKnots( Arg, Zans.col(ii).real() );
956
             splineVecReal.push_back(Spline);
949
             splineVecReal.push_back(Spline);
957
 
950
 
958
-            CubicSplineInterpolator *SplineI = CubicSplineInterpolator::New();
951
+            auto SplineI = CubicSplineInterpolator::NewSP();
959
             SplineI->SetKnots( Arg, Zans.col(ii).imag() );
952
             SplineI->SetKnots( Arg, Zans.col(ii).imag() );
960
             splineVecImag.push_back(SplineI);
953
             splineVecImag.push_back(SplineI);
961
         }
954
         }
962
 
955
 
963
     }
956
     }
964
 
957
 
965
-    void Hankel2::SetLaggedArg(const Real& rho) {
958
+    void FHTAnderson801::SetLaggedArg(const Real& rho) {
966
         for (int i=0; i<Zans.cols(); ++ i) {
959
         for (int i=0; i<Zans.cols(); ++ i) {
967
             Zans(0, i) = Complex( splineVecReal[i]->Interpolate(rho),
960
             Zans(0, i) = Complex( splineVecReal[i]->Interpolate(rho),
968
                                   splineVecImag[i]->Interpolate(rho) );
961
                                   splineVecImag[i]->Interpolate(rho) );
969
         }
962
         }
970
     }
963
     }
971
 
964
 
972
-	Complex Hankel2::Zgauss(const int &ikk, const EMMODE &imode,
965
+	Complex FHTAnderson801::Zgauss(const int &ikk, const EMMODE &imode,
973
 						const int &itype, const Real &rho,
966
 						const int &itype, const Real &rho,
974
 						const Real &wavef, KernelEm1DBase *Kernel) {
967
 						const Real &wavef, KernelEm1DBase *Kernel) {
975
 
968
 
979
 
972
 
980
 	}
973
 	}
981
 
974
 
982
-	void Hankel2::SetNumConv(const int &i) {
975
+	void FHTAnderson801::SetNumConv(const int &i) {
983
 		this->NumConv = i;
976
 		this->NumConv = i;
984
 	}
977
 	}
985
 
978
 
986
-	Eigen::Matrix<Complex, Eigen::Dynamic, Eigen::Dynamic> Hankel2::GetAnswer() {
979
+	Eigen::Matrix<Complex, Eigen::Dynamic, Eigen::Dynamic> FHTAnderson801::GetAnswer() {
987
 		return this->Zans;
980
 		return this->Zans;
988
 	}
981
 	}
989
 
982
 
990
 	///////////////////////////////////////////
983
 	///////////////////////////////////////////
991
 	// Computes the transform
984
 	// Computes the transform
992
-	void Hankel2::Compute(const Real &rho, const int& ntol, const Real &tol) {
985
+	void FHTAnderson801::Compute(const Real &rho, const int& ntol, const Real &tol) {
993
 
986
 
994
 		Real y1 = this->ABSCISSA/rho;
987
 		Real y1 = this->ABSCISSA/rho;
995
 		//this->Key.setZero(801);
988
 		//this->Key.setZero(801);
1003
 		}
996
 		}
1004
 
997
 
1005
 		if (this->NumConv<1) {
998
 		if (this->NumConv<1) {
1006
-			throw std::runtime_error("In Hankel2 NumConv is less than 1.");
999
+			throw std::runtime_error("In FHTAnderson801 NumConv is less than 1.");
1007
 		}
1000
 		}
1008
 
1001
 
1009
         if (this->kernelVec.empty()) {
1002
         if (this->kernelVec.empty()) {
1010
-			throw std::runtime_error("In Hankel2 Unset Kernel Calculator");
1003
+			throw std::runtime_error("In FHTAnderson801 Unset Kernel Calculator");
1011
 		}
1004
 		}
1012
         #endif
1005
         #endif
1013
 		//if (rho<=1e-5) {
1006
 		//if (rho<=1e-5) {

+ 37
- 0
Modules/FDEM1D/src/HankelTransform.cpp View File

1
+/* This file is part of Lemma, a geophysical modelling and inversion API */
2
+
3
+/* This Source Code Form is subject to the terms of the Mozilla Public
4
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
+
7
+/**
8
+  @file
9
+  @author   Trevor Irons
10
+  @date     01/02/2010
11
+  @version  $Id: hankeltransform.cpp 193 2014-11-10 23:51:41Z tirons $
12
+ **/
13
+
14
+#include "HankelTransform.h"
15
+
16
+namespace Lemma {
17
+
18
+    std::ostream &operator << (std::ostream &stream, const HankelTransform &ob) {
19
+        stream << ob.Serialize()  << "\n---\n"; // End of doc ---
20
+        return stream;
21
+    }
22
+
23
+	HankelTransform::HankelTransform( ) : LemmaObject( )	{
24
+	}
25
+
26
+	HankelTransform::~HankelTransform( ) {
27
+	}
28
+
29
+    void HankelTransform::ComputeRelated(const Real& rho, std::shared_ptr<KernelEM1DBase> Kernel) {
30
+    }
31
+
32
+    void HankelTransform::ComputeRelated(const Real& rho, std::vector< std::shared_ptr<KernelEM1DBase> > KernelVec) {
33
+    }
34
+
35
+    void HankelTransform::ComputeRelated(const Real& rho, std::shared_ptr<KernelEM1DManager> KernelManager) {
36
+    }
37
+}

+ 0
- 39
Modules/FDEM1D/src/hankeltransform.cpp View File

1
-/* This file is part of Lemma, a geophysical modelling and inversion API */
2
-
3
-/* This Source Code Form is subject to the terms of the Mozilla Public
4
- * License, v. 2.0. If a copy of the MPL was not distributed with this
5
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
-
7
-/**
8
-  @file
9
-  @author   Trevor Irons
10
-  @date     01/02/2010
11
-  @version  $Id: hankeltransform.cpp 193 2014-11-10 23:51:41Z tirons $
12
- **/
13
-
14
-#include "hankeltransform.h"
15
-
16
-namespace Lemma {
17
-
18
-	std::ostream &operator<<(std::ostream &stream,
19
-			const HankelTransform &ob) {
20
-		stream << *(LemmaObject*)(&ob);
21
-		return stream;
22
-	}
23
-
24
-	HankelTransform::HankelTransform(const std::string &name) :
25
-	   LemmaObject(name)	{
26
-	}
27
-
28
-	HankelTransform::~HankelTransform() {
29
-	}
30
-
31
-    void HankelTransform::ComputeRelated(const Real& rho, KernelEm1DBase *Kernel) {
32
-    }
33
-
34
-    void HankelTransform::ComputeRelated(const Real& rho, std::vector< KernelEm1DBase* > KernelVec) {
35
-    }
36
-
37
-    void HankelTransform::ComputeRelated(const Real& rho, KernelEM1DManager*  KernelManager) {
38
-    }
39
-}

+ 30
- 0
Modules/FDEM1D/testing/GetNameCheck.h View File

39
         TS_ASSERT_EQUALS( Obj->GetName(), std::string("FieldPoints") );
39
         TS_ASSERT_EQUALS( Obj->GetName(), std::string("FieldPoints") );
40
     }
40
     }
41
 
41
 
42
+    void testDipoleSource( void )
43
+    {
44
+        auto Obj = DipoleSource::NewSP();
45
+        TS_ASSERT_EQUALS( Obj->GetName(), std::string("DipoleSource") );
46
+    }
47
+
48
+    void testWireAntenna( void )
49
+    {
50
+        auto Obj = WireAntenna::NewSP();
51
+        TS_ASSERT_EQUALS( Obj->GetName(), std::string("WireAntenna") );
52
+    }
53
+
54
+//     void testKernelEM1DManager( void )
55
+//     {
56
+//         auto Obj = KernelEM1DManager::NewSP();
57
+//         TS_ASSERT_EQUALS( Obj->GetName(), std::string("KernelEM1DManager") );
58
+//     }
59
+//
60
+//     void testKernelEM1DSpec( void )
61
+//     {
62
+//         auto Obj = KernelEM1DSpec::NewSP();
63
+//         TS_ASSERT_EQUALS( Obj->GetName(), std::string("KernelEM1DSpec") );
64
+//     }
65
+//
66
+//     void testKernelEM1DReflSpec( void )
67
+//     {
68
+//         auto Obj = KernelEM1DReflSpec::NewSP();
69
+//         TS_ASSERT_EQUALS( Obj->GetName(), std::string("KernelEM1DReflSpec") );
70
+//     }
71
+
42
 };
72
 };
43
 
73
 

+ 1
- 1
vim/c.vim View File

17
 
17
 
18
 " Lemma types
18
 " Lemma types
19
 highlight leType ctermfg=Yellow guifg=Yellow
19
 highlight leType ctermfg=Yellow guifg=Yellow
20
-syn keyword leType HankelTransform KernelEm1D KernelEM1DManager DipoleSource EarthModel LayeredEarth LayeredEarthEM TEMSurvey TEMSurveyLine TEMSurveyLineRecord TEMInductiveReceiver PolygonalWireAntenna TEMTransmitter TEMReceiver Instrument InstrumentTem LemmaObject FieldPoints DCIPElectrode TEMSurveyData TEMSurveyLineData TEMSurveyLineRecordData  ASCIIParser CubicSplineInterpolator RectilinearGrid GridReader RectilinearGridReader RectilinearGridVTKExporter Filter WindowFilter DEMParticle DEMGrain Data DataReader 
20
+syn keyword leType HankelTransform FHTAnderson801 KernelEM1D KernelEM1DSpec KernelEM1DBase KernelEM1DManager DipoleSource EarthModel LayeredEarth LayeredEarthEM TEMSurvey TEMSurveyLine TEMSurveyLineRecord TEMInductiveReceiver WireAntenna PolygonalWireAntenna TEMTransmitter TEMReceiver Instrument InstrumentTem LemmaObject FieldPoints DCIPElectrode TEMSurveyData TEMSurveyLineData TEMSurveyLineRecordData  ASCIIParser CubicSplineInterpolator RectilinearGrid GridReader RectilinearGridReader RectilinearGridVTKExporter Filter WindowFilter DEMParticle DEMGrain Data DataReader 
21
 
21
 
22
 " Deprecated Lemma Types
22
 " Deprecated Lemma Types
23
 highlight dleType ctermfg=Blue guifg=Blue 
23
 highlight dleType ctermfg=Blue guifg=Blue 

Loading…
Cancel
Save