|
@@ -35,7 +35,7 @@ namespace Lemma {
|
35
|
35
|
// Method: LayeredEarthEMReader
|
36
|
36
|
// Description: constructor (protected)
|
37
|
37
|
//--------------------------------------------------------------------------------------
|
38
|
|
- LayeredEarthEMReader::LayeredEarthEMReader ( const ctor_key& key ) : LemmaObject(),
|
|
38
|
+ LayeredEarthEMReader::LayeredEarthEMReader ( const ctor_key& key ) : LemmaObject( key ),
|
39
|
39
|
LayEarth(nullptr) {
|
40
|
40
|
|
41
|
41
|
} // ----- end of method LayeredEarthEMReader::LayeredEarthEMReader (constructor) -----
|
|
@@ -46,10 +46,8 @@ namespace Lemma {
|
46
|
46
|
// Method: New()
|
47
|
47
|
// Description: public constructor
|
48
|
48
|
//--------------------------------------------------------------------------------------
|
49
|
|
- LayeredEarthEMReader* LayeredEarthEMReader::New() {
|
50
|
|
- LayeredEarthEMReader* Obj = new LayeredEarthEMReader("LayeredEarthEMReader");
|
51
|
|
- Obj->AttachTo(Obj);
|
52
|
|
- return Obj;
|
|
49
|
+ std::shared_ptr<LayeredEarthEMReader> LayeredEarthEMReader::NewSP() {
|
|
50
|
+ return std::make_shared<LayeredEarthEMReader>( ctor_key() );
|
53
|
51
|
}
|
54
|
52
|
|
55
|
53
|
//--------------------------------------------------------------------------------------
|
|
@@ -58,33 +56,13 @@ namespace Lemma {
|
58
|
56
|
// Description: destructor (protected)
|
59
|
57
|
//--------------------------------------------------------------------------------------
|
60
|
58
|
LayeredEarthEMReader::~LayeredEarthEMReader () {
|
61
|
|
- if (LayEarth) LayEarth->Delete();
|
62
|
59
|
} // ----- end of method LayeredEarthEMReader::~LayeredEarthEMReader (destructor) -----
|
63
|
60
|
|
64
|
61
|
//--------------------------------------------------------------------------------------
|
65
|
62
|
// Class: LayeredEarthEMReader
|
66
|
|
- // Method: Delete
|
67
|
|
- // Description: public destructor
|
68
|
|
- //--------------------------------------------------------------------------------------
|
69
|
|
- void LayeredEarthEMReader::Delete() {
|
70
|
|
- this->DetachFrom(this);
|
71
|
|
- }
|
72
|
|
-
|
73
|
|
- //--------------------------------------------------------------------------------------
|
74
|
|
- // Class: LayeredEarthEMReader
|
75
|
|
- // Method: Release
|
76
|
|
- // Description: destructor (protected)
|
77
|
|
- //--------------------------------------------------------------------------------------
|
78
|
|
- void LayeredEarthEMReader::Release() {
|
79
|
|
- delete this;
|
80
|
|
- }
|
81
|
|
-
|
82
|
|
-
|
83
|
|
- //--------------------------------------------------------------------------------------
|
84
|
|
- // Class: LayeredEarthEMReader
|
85
|
63
|
// Method: GetLayeredEarth
|
86
|
64
|
//--------------------------------------------------------------------------------------
|
87
|
|
- LayeredEarthEM* LayeredEarthEMReader::GetLayeredEarth ( ) {
|
|
65
|
+ std::shared_ptr<LayeredEarthEM> LayeredEarthEMReader::GetLayeredEarth ( ) {
|
88
|
66
|
return LayEarth;
|
89
|
67
|
} // ----- end of method LayeredEarthEMReader::GetLayeredEarth -----
|
90
|
68
|
|
|
@@ -94,9 +72,9 @@ namespace Lemma {
|
94
|
72
|
// Method: ReadASCIIInputFile
|
95
|
73
|
//--------------------------------------------------------------------------------------
|
96
|
74
|
void LayeredEarthEMReader::ReadASCIIInputFile ( const std::string& name ) {
|
97
|
|
- if (LayEarth) LayEarth->Delete();
|
98
|
|
- ASCIIParser* Parser = ASCIIParser::New();
|
99
|
|
- LayEarth = LayeredEarthEM::New();
|
|
75
|
+
|
|
76
|
+ auto Parser = ASCIIParser::NewSP();
|
|
77
|
+ LayEarth = LayeredEarthEM::NewSP();
|
100
|
78
|
|
101
|
79
|
Parser->SetCommentString("//");
|
102
|
80
|
Parser->Open(name);
|
|
@@ -114,7 +92,6 @@ namespace Lemma {
|
114
|
92
|
sigma(nlay) = 1./Parser->ReadReals(1)[0];
|
115
|
93
|
LayEarth->SetLayerConductivity(sigma);
|
116
|
94
|
if (thick.size() > 0) LayEarth->SetLayerThickness(thick);
|
117
|
|
- Parser->Delete();
|
118
|
95
|
return ;
|
119
|
96
|
} // ----- end of method LayeredEarthEMReader::ReadASCIIInputFile -----
|
120
|
97
|
|