Selaa lähdekoodia

Cleaning up, more.

enhancement_3
Trevor Irons 8 vuotta sitten
vanhempi
commit
cdc19fe787

+ 4
- 4
CMakeLists.txt Näytä tiedosto

@@ -140,8 +140,8 @@ if ( LEMMA_VTK6_SUPPORT )
140 140
 	include(${VTK_USE_FILE}) 
141 141
 	add_compile_options(-DLEMMAUSEVTK) 
142 142
 	# Compile Matplot_vtk if VTK is present
143
-	add_subdirectory(Matplot_vtk)	
144
-	include_directories ("${PROJECT_SOURCE_DIR}/Matplot_vtk")
143
+	#add_subdirectory(Matplot_vtk)	
144
+	#include_directories ("${PROJECT_SOURCE_DIR}/Matplot_vtk")
145 145
 endif()
146 146
 
147 147
 option (LEMMA_VTK7_SUPPORT "VTK library for visualisation and grids" OFF)
@@ -154,8 +154,8 @@ if ( LEMMA_VTK7_SUPPORT )
154 154
 	include(${VTK_USE_FILE}) 
155 155
 	add_compile_options(-DLEMMAUSEVTK) 
156 156
 	# Compile Matplot_vtk if VTK is present
157
-	add_subdirectory(Matplot_vtk)	
158
-	include_directories ("${PROJECT_SOURCE_DIR}/Matplot_vtk")
157
+	#add_subdirectory(Matplot_vtk)	
158
+	#include_directories ("${PROJECT_SOURCE_DIR}/Matplot_vtk")
159 159
 endif()
160 160
 
161 161
 #####################

+ 1
- 1
Modules/LemmaCore/CMakeLists.txt Näytä tiedosto

@@ -20,7 +20,7 @@ endif()
20 20
 # Linking
21 21
 if ( LEMMA_VTK6_SUPPORT OR LEMMA_VTK7_SUPPORT ) 
22 22
 	target_link_libraries(lemmacore ${VTK_LIBRARIES})
23
-	target_link_libraries(lemmacore "matplot")
23
+#	target_link_libraries(lemmacore "matplot")
24 24
 endif()
25 25
 
26 26
 target_link_libraries(lemmacore "yaml-cpp")

+ 14
- 2
Modules/LemmaCore/examples/CubicSplineInterpolator.cpp Näytä tiedosto

@@ -22,14 +22,26 @@
22 22
 using namespace Lemma;
23 23
 
24 24
 int main() {
25
-    auto Spline = CubicSplineInterpolator::NewSP();
25
+    //auto Spline = CubicSplineInterpolator::NewSP();
26 26
     //auto Spline2 = CubicSplineInterpolator();
27 27
     auto Parser = ASCIIParser::NewSP();
28 28
     //ASCIIParser Parser2 = ASCIIParser();
29 29
     //    Parser2.SetCommentString( "#");
30 30
     //auto Parser3 = ASCIIParser(Parser2);
31
+//    auto Parser3 = *Parser;
32
+
33
+    //std::cout << Parser3;
34
+
35
+    //std::cout << *Parser << std::endl;
36
+    //YAML::Node node = Parser->Serialize();
37
+    //std::cout << node << std::endl;
38
+    //auto Obj2 = ASCIIParser::DeSerialize(Parser->Serialize());
39
+    //std::cout << *Obj2 << std::endl;
40
+
41
+
42
+//    std::cout << "string " << Parser->GetName() << "\t" << Obj2->GetName() << "\n";
43
+//         TS_ASSERT_EQUALS( Obj->GetName(), Obj2->GetName() );
31 44
 
32
-    std::cout << *Parser << std::endl;
33 45
     //std::cout << Parser2 << std::endl;
34 46
     //std::cout << Parser3 << std::endl;
35 47
 }

+ 5
- 5
Modules/LemmaCore/include/ASCIIParser.h Näytä tiedosto

@@ -34,17 +34,17 @@ class ASCIIParser : public LemmaObject {
34 34
     friend std::ostream &operator<<(std::ostream &stream,
35 35
             const ASCIIParser &ob);
36 36
 
37
-    struct ctor_cookie {};
37
+    struct ctor_key {};
38 38
 
39 39
     public:
40 40
 
41 41
     // ====================  LIFECYCLE     =======================
42 42
 
43 43
     /** Default constructor */
44
-    explicit ASCIIParser ( const ctor_cookie& );
44
+    explicit ASCIIParser ( const ctor_key& );
45 45
 
46 46
     /** Constructor using YAML::Node */
47
-    ASCIIParser ( const YAML::Node& node, const ctor_cookie& );
47
+    ASCIIParser ( const YAML::Node& node, const ctor_key& );
48 48
 
49 49
     /** Default  destructor */
50 50
     virtual ~ASCIIParser ();
@@ -132,11 +132,11 @@ class ASCIIParser : public LemmaObject {
132 132
 
133 133
     protected:
134 134
 
135
+    private:
136
+
135 137
     /** Copy constructor */
136 138
     ASCIIParser( const ASCIIParser& ) = delete;
137 139
 
138
-    private:
139
-
140 140
     // ====================  DATA MEMBERS  =========================
141 141
 
142 142
     /** ASCII string representation of the class name */

+ 6
- 3
Modules/LemmaCore/include/CubicSplineInterpolator.h Näytä tiedosto

@@ -62,17 +62,17 @@ class CubicSplineInterpolator : public LemmaObject {
62 62
     friend std::ostream &operator<<(std::ostream &stream,
63 63
             const CubicSplineInterpolator &ob);
64 64
 
65
-    struct ctor_cookie {};
65
+    struct ctor_key {};
66 66
 
67 67
     public:
68 68
 
69 69
     // ====================  LIFECYCLE     =======================
70 70
 
71 71
     /** Default constructor */
72
-    explicit CubicSplineInterpolator ( const ctor_cookie& );
72
+    explicit CubicSplineInterpolator ( const ctor_key& );
73 73
 
74 74
     /** DeSerializing constructor, usees factory DeSerialize  method*/
75
-    CubicSplineInterpolator ( const YAML::Node& node, const ctor_cookie& );
75
+    CubicSplineInterpolator ( const YAML::Node& node, const ctor_key& );
76 76
 
77 77
     /** Destructor use smart pointers to auto delete */
78 78
     virtual ~CubicSplineInterpolator ();
@@ -168,6 +168,9 @@ class CubicSplineInterpolator : public LemmaObject {
168 168
 
169 169
     private:
170 170
 
171
+    /** Copy */
172
+    CubicSplineInterpolator( const CubicSplineInterpolator& ) = delete;
173
+
171 174
     /** ASCII string representation of the class name */
172 175
     static constexpr auto CName = "CubicSplineInterpolator";
173 176
 

+ 2
- 0
Modules/LemmaCore/include/LemmaObject.h Näytä tiedosto

@@ -98,6 +98,8 @@ class LemmaObject {
98 98
         /** Protected DeSerializing constructor */
99 99
         LemmaObject (const YAML::Node& node);
100 100
 
101
+        LemmaObject( const LemmaObject& ) = delete;
102
+
101 103
         /** Protected default destructor. This is an abstract class and
102 104
          *  cannot be instantiated. Virtual is necessary so that if base class destructor is
103 105
          *  called, we get the right behaviour.

+ 4
- 25
Modules/LemmaCore/src/ASCIIParser.cpp Näytä tiedosto

@@ -35,7 +35,7 @@ namespace Lemma {
35 35
     //      Method:  ASCIIParser
36 36
     // Description:  constructor (protected)
37 37
     //--------------------------------------------------------------------------------------
38
-    ASCIIParser::ASCIIParser ( const ctor_cookie& ) : LemmaObject( ), input(),
38
+    ASCIIParser::ASCIIParser ( const ctor_key& ) : LemmaObject( ), input(),
39 39
             CommentString("//"), BufferSize(255) {
40 40
 
41 41
     }  // -----  end of method ASCIIParser::ASCIIParser  (constructor)  -----
@@ -47,9 +47,7 @@ namespace Lemma {
47 47
     // Description:  public smart pointer factory constructor
48 48
     //--------------------------------------------------------------------------------------
49 49
     std::shared_ptr< ASCIIParser > ASCIIParser::NewSP() {
50
-        //std::shared_ptr<ASCIIParser> sp(new  ASCIIParser( ), LemmaObjectDeleter() );
51
-        //return sp;
52
-        return  std::make_shared<ASCIIParser>( ctor_cookie() );
50
+        return  std::make_shared<ASCIIParser>( ctor_key() );
53 51
     }
54 52
 
55 53
     //--------------------------------------------------------------------------------------
@@ -72,8 +70,7 @@ namespace Lemma {
72 70
         if (node.Tag() != "ASCIIParser") {
73 71
             throw  DeSerializeTypeMismatch( "ASCIIParser", node.Tag());
74 72
         }
75
-        //std::shared_ptr<ASCIIParser> Object(new  ASCIIParser(node), LemmaObjectDeleter() );
76
-        return std::make_shared< ASCIIParser >( node, ctor_cookie() );
73
+        return std::make_shared< ASCIIParser >( node, ctor_key() ); //, ctor_key() );
77 74
     }		// -----  end of method ASCIIParser::DeSerialize  -----
78 75
 
79 76
     //--------------------------------------------------------------------------------------
@@ -85,24 +82,12 @@ namespace Lemma {
85 82
 
86 83
     }  // -----  end of method ASCIIParser::~ASCIIParser  (destructor)  -----
87 84
 
88
-/*
89
-    //--------------------------------------------------------------------------------------
90
-    //       Class:  ASCIIParser
91
-    //      Method:  ASCIIParser(ASCIIParser)
92
-    // Description:  copy
93
-    //--------------------------------------------------------------------------------------
94
-    ASCIIParser::ASCIIParser ( const ASCIIParser& cp ) {
95
-        //input = cp.input; // Problem line
96
-        CommentString = cp.CommentString;
97
-        BufferSize = cp.BufferSize;
98
-    }  // -----  end of method ASCIIParser::~ASCIIParser  (destructor)  -----
99
-*/
100 85
     //--------------------------------------------------------------------------------------
101 86
     //       Class:  ASCIIParser
102 87
     //      Method:  ASCIIParser
103 88
     // Description:  DeSerializing constructor (protected)
104 89
     //--------------------------------------------------------------------------------------
105
-    ASCIIParser::ASCIIParser (const YAML::Node& node, const ctor_cookie& ) : LemmaObject(node) {
90
+    ASCIIParser::ASCIIParser (const YAML::Node& node, const ctor_key&  key) : LemmaObject(node) {
106 91
         this->CommentString = node["CommentString"].as<std::string>();
107 92
         this->BufferSize = node["BufferSize"].as<int>();
108 93
     }  // -----  end of method ASCIIParser::ASCIIParser  (constructor)  -----
@@ -119,7 +104,6 @@ namespace Lemma {
119 104
         return ;
120 105
     }		// -----  end of method ASCIIParser::Open  -----
121 106
 
122
-
123 107
     //--------------------------------------------------------------------------------------
124 108
     //       Class:  ASCIIParser
125 109
     //      Method:  Close
@@ -129,7 +113,6 @@ namespace Lemma {
129 113
         return ;
130 114
     }		// -----  end of method ASCIIParser::Close  -----
131 115
 
132
-
133 116
     //--------------------------------------------------------------------------------------
134 117
     //       Class:  ASCIIParser
135 118
     //      Method:  ReadReals
@@ -171,7 +154,6 @@ namespace Lemma {
171 154
                 delete [] dump;
172 155
                 return vals;
173 156
             }
174
-
175 157
         }
176 158
         delete [] dump;
177 159
         return vals;
@@ -195,13 +177,11 @@ namespace Lemma {
195 177
                 delete [] dump;
196 178
                 return vals;
197 179
             }
198
-
199 180
         }
200 181
         delete [] dump;
201 182
         return vals;
202 183
     }		// -----  end of method ASCIIParser::ReadInts  -----
203 184
 
204
-
205 185
     //--------------------------------------------------------------------------------------
206 186
     //       Class:  ASCIIParser
207 187
     //      Method:  SetCommentString
@@ -235,7 +215,6 @@ namespace Lemma {
235 215
         return ;
236 216
     }		// -----  end of method ASCIIParser::JumpToLocation  -----
237 217
 
238
-
239 218
 }		// -----  end of Lemma  name  -----
240 219
 
241 220
 

+ 2
- 2
Modules/LemmaCore/src/CMakeLists.txt Näytä tiedosto

@@ -2,8 +2,8 @@ set (SOURCE
2 2
 	${SOURCE}
3 3
 	${CMAKE_CURRENT_SOURCE_DIR}/helper.cpp
4 4
 	${CMAKE_CURRENT_SOURCE_DIR}/LemmaObject.cpp
5
-	${CMAKE_CURRENT_SOURCE_DIR}/ASCIIParser.cpp                # fixed 
6
-	${CMAKE_CURRENT_SOURCE_DIR}/CubicSplineInterpolator.cpp    # fixed, cookie 
5
+	${CMAKE_CURRENT_SOURCE_DIR}/ASCIIParser.cpp                # fixed, key 
6
+	${CMAKE_CURRENT_SOURCE_DIR}/CubicSplineInterpolator.cpp    # fixed, key 
7 7
 	${CMAKE_CURRENT_SOURCE_DIR}/Data.cpp
8 8
 	${CMAKE_CURRENT_SOURCE_DIR}/DataReader.cpp
9 9
 	${CMAKE_CURRENT_SOURCE_DIR}/EarthModel.cpp

+ 5
- 5
Modules/LemmaCore/src/CubicSplineInterpolator.cpp Näytä tiedosto

@@ -40,7 +40,7 @@ namespace Lemma {
40 40
     //      Method:  CubicSplineInterpolator
41 41
     // Description:  constructor (protected)
42 42
     //--------------------------------------------------------------------------------------
43
-    CubicSplineInterpolator::CubicSplineInterpolator ( const ctor_cookie& ) : LemmaObject( ) {
43
+    CubicSplineInterpolator::CubicSplineInterpolator ( const ctor_key& ) : LemmaObject( ) {
44 44
 
45 45
     }  // -----  end of method CubicSplineInterpolator::CubicSplineInterpolator  (constructor)  -----
46 46
 
@@ -49,7 +49,7 @@ namespace Lemma {
49 49
     //      Method:  CubicSplineInterpolator
50 50
     // Description:  DeSerializing constructor (protected)
51 51
     //--------------------------------------------------------------------------------------
52
-    CubicSplineInterpolator::CubicSplineInterpolator (const YAML::Node& node, const ctor_cookie& ) : LemmaObject(node) {
52
+    CubicSplineInterpolator::CubicSplineInterpolator (const YAML::Node& node, const ctor_key& ) : LemmaObject(node) {
53 53
     }  // -----  end of method CubicSplineInterpolator::CubicSplineInterpolator  (constructor)  -----
54 54
 
55 55
     //--------------------------------------------------------------------------------------
@@ -58,9 +58,9 @@ namespace Lemma {
58 58
     // Description:  public constructor
59 59
     //--------------------------------------------------------------------------------------
60 60
     std::shared_ptr<CubicSplineInterpolator> CubicSplineInterpolator::NewSP() {
61
-        //std::shared_ptr<CubicSplineInterpolator> sp(new  CubicSplineInterpolator( CubicSplineInterpolator::ctor_cookie ), LemmaObjectDeleter() );
61
+        //std::shared_ptr<CubicSplineInterpolator> sp(new  CubicSplineInterpolator( CubicSplineInterpolator::ctor_key ), LemmaObjectDeleter() );
62 62
         //return sp;
63
-        return std::make_shared<CubicSplineInterpolator>( ctor_cookie() );
63
+        return std::make_shared<CubicSplineInterpolator>( ctor_key() );
64 64
     }
65 65
 
66 66
     //--------------------------------------------------------------------------------------
@@ -84,7 +84,7 @@ namespace Lemma {
84 84
         }
85 85
         //std::shared_ptr<CubicSplineInterpolator> Object(new  CubicSplineInterpolator(node), LemmaObjectDeleter() );
86 86
         //return Object ;
87
-        return std::make_shared<CubicSplineInterpolator>( node, ctor_cookie() );
87
+        return std::make_shared<CubicSplineInterpolator>( node, ctor_key() );
88 88
     }
89 89
 
90 90
     //--------------------------------------------------------------------------------------

+ 3
- 0
Modules/LemmaCore/testing/CMakeLists.txt Näytä tiedosto

@@ -9,4 +9,7 @@ target_link_libraries(unittest_GetNameCheck "lemmacore")
9 9
 
10 10
 CXXTEST_ADD_TEST(unittest_SerializeCheck SerializeCheck.cc ${CMAKE_CURRENT_SOURCE_DIR}/SerializeCheck.h)
11 11
 target_link_libraries(unittest_SerializeCheck "lemmacore")
12
+
13
+CXXTEST_ADD_TEST(unittest_CopyDisableCheck CopyDisableCheck.cc ${CMAKE_CURRENT_SOURCE_DIR}/CopyDisableCheck.h)
14
+target_link_libraries(unittest_CopyDisableCheck "lemmacore")
12 15
  

+ 78
- 0
Modules/LemmaCore/testing/CopyDisableCheck.h Näytä tiedosto

@@ -0,0 +1,78 @@
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      06/16/2016 09:12:46 PM
13
+ * @version   $Id$
14
+ * @author    Trevor Irons (ti)
15
+ * @email     tirons@egi.utah.edu
16
+ * @copyright Copyright (c) 2016, University of Utah
17
+ * @copyright Copyright (c) 2016, Trevor Irons & Lemma Software, LLC
18
+ */
19
+
20
+#include <cxxtest/TestSuite.h>
21
+#include <LemmaCore>
22
+
23
+using namespace Lemma;
24
+
25
+class MyTestSuite : public CxxTest::TestSuite
26
+{
27
+    public:
28
+
29
+    void testASCIIParser( void )
30
+    {
31
+        auto Obj = ASCIIParser::NewSP();
32
+        //TS_ASSERT_THROWS_ANYTHING( auto Obj2 = Obj );
33
+        auto Obj2 = ASCIIParser::DeSerialize(Obj->Serialize());
34
+        TS_ASSERT_EQUALS( Obj->GetName(), Obj2->GetName() );
35
+    }
36
+
37
+
38
+//     void testCubicSplineInterpolator(void)
39
+//     {
40
+//         auto Obj = CubicSplineInterpolator::NewSP();
41
+//         YAML::Node node = Obj->Serialize();
42
+//         auto Obj2 = CubicSplineInterpolator::DeSerialize(node);
43
+//         TS_ASSERT_EQUALS( Obj->GetName(), Obj2->GetName() );
44
+//     }
45
+
46
+// /*
47
+//     void testRectilinearGrid( void )
48
+//     {
49
+//         auto Obj = RectilinearGrid::NewSP();
50
+//         YAML::Node node = Obj->Serialize();
51
+//         auto Obj2 = RectilinearGrid::DeSerialize(node);
52
+//         TS_ASSERT_EQUALS( Obj->GetName(), Obj2->GetName() );
53
+//     }
54
+// */
55
+
56
+
57
+// /*
58
+//     void testRectilinearGridReader( void )
59
+//     {
60
+//         auto Obj = RectilinearGridReader::NewSP();
61
+//         TS_ASSERT_EQUALS( Obj->GetName(), std::string("RectilinearGridReader") );
62
+//     }
63
+//
64
+//     void testRectilinearGridVTKExporter( void )
65
+//     {
66
+//         auto Obj = RectilinearGridVTKExporter::NewSP();
67
+//         TS_ASSERT_EQUALS( Obj->GetName(), std::string("RectilinearGridVTKExporter") );
68
+//     }
69
+//
70
+//     void testWindowFilter( void )
71
+//     {
72
+//         auto Obj = WindowFilter::NewSP();
73
+//         TS_ASSERT_EQUALS( Obj->GetName(), std::string("WindowFilter") );
74
+//     }
75
+// */
76
+
77
+};
78
+

+ 7
- 7
Modules/LemmaCore/testing/SerializeCheck.h Näytä tiedosto

@@ -26,13 +26,13 @@ class MyTestSuite : public CxxTest::TestSuite
26 26
 {
27 27
     public:
28 28
 
29
-    void testASCIIParser( void )
30
-    {
31
-        auto Obj = ASCIIParser::NewSP();
32
-        YAML::Node node = Obj->Serialize();
33
-        auto Obj2 = ASCIIParser::DeSerialize(node);
34
-        TS_ASSERT_EQUALS( Obj->GetName(), Obj2->GetName() );
35
-    }
29
+//     void testASCIIParser( void )
30
+//     {
31
+//         auto Obj = ASCIIParser::NewSP();
32
+//         YAML::Node node = Obj->Serialize();
33
+//         auto Obj2 = ASCIIParser::DeSerialize(node);
34
+//         TS_ASSERT_EQUALS( Obj->GetName(), Obj2->GetName() );
35
+//     }
36 36
 
37 37
 
38 38
     void testCubicSplineInterpolator(void)

Loading…
Peruuta
Tallenna