|
@@ -20,25 +20,28 @@ namespace Lemma {
|
20
|
20
|
return stream;
|
21
|
21
|
}
|
22
|
22
|
|
23
|
|
- /*
|
24
|
|
- std::ostream &operator<<(std::ostream &stream, const
|
25
|
|
- RectilinearGrid &ob) {
|
26
|
|
- stream << *(LemmaObject*)(&ob);
|
27
|
|
- stream << "\tnx=" << ob.nx << "\tny=" << ob.ny << "\tnz=" << ob.nz << std::endl;
|
28
|
|
- stream << "\tox=" << ob.ox << "\toy=" << ob.oy << "\toz=" << ob.oz << std::endl;
|
29
|
|
- stream << "\tdx=" << ob.dx.transpose() << std::endl;
|
30
|
|
- stream << "\tdy=" << ob.dy.transpose() << std::endl;
|
31
|
|
- stream << "\tdz=" << ob.dz.transpose() << std::endl;
|
32
|
|
- return stream;
|
33
|
|
- }
|
34
|
|
- */
|
35
|
|
-
|
36
|
23
|
// ==================== LIFECYCLE =======================
|
37
|
24
|
|
38
|
25
|
RectilinearGrid::RectilinearGrid( ) : Grid( ), nx(0), ny(0), nz(0) {
|
39
|
26
|
|
40
|
27
|
}
|
41
|
28
|
|
|
29
|
+ RectilinearGrid::RectilinearGrid( const YAML::Node& node ) : Grid(node) {
|
|
30
|
+
|
|
31
|
+ nx = node["nx"].as<int>( );
|
|
32
|
+ ny = node["ny"].as<int>( );
|
|
33
|
+ nz = node["nz"].as<int>( );
|
|
34
|
+
|
|
35
|
+ ox = node["ox"].as<Real>( );
|
|
36
|
+ oy = node["oy"].as<Real>( );
|
|
37
|
+ oz = node["oz"].as<Real>( );
|
|
38
|
+
|
|
39
|
+ dx = node["dx"].as< VectorXr >();
|
|
40
|
+ dy = node["dy"].as< VectorXr >();
|
|
41
|
+ dz = node["dz"].as< VectorXr >();
|
|
42
|
+
|
|
43
|
+ }
|
|
44
|
+
|
42
|
45
|
RectilinearGrid::~RectilinearGrid() {
|
43
|
46
|
|
44
|
47
|
}
|
|
@@ -48,6 +51,39 @@ namespace Lemma {
|
48
|
51
|
return sp;
|
49
|
52
|
}
|
50
|
53
|
|
|
54
|
+ YAML::Node RectilinearGrid::Serialize() const {
|
|
55
|
+ YAML::Node node = Grid::Serialize();
|
|
56
|
+
|
|
57
|
+ node["nx"] = nx;
|
|
58
|
+ node["ny"] = ny;
|
|
59
|
+ node["nz"] = nz;
|
|
60
|
+
|
|
61
|
+ node["ox"] = ox;
|
|
62
|
+ node["oy"] = oy;
|
|
63
|
+ node["oz"] = oz;
|
|
64
|
+
|
|
65
|
+ node["dx"] = dx;
|
|
66
|
+ node["dy"] = dy;
|
|
67
|
+ node["dz"] = dz;
|
|
68
|
+
|
|
69
|
+ node.SetTag( this->GetName() );
|
|
70
|
+ return node;
|
|
71
|
+ }
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+ //--------------------------------------------------------------------------------------
|
|
75
|
+ // Class: RectilinearGrid
|
|
76
|
+ // Method: DeSerialize
|
|
77
|
+ //--------------------------------------------------------------------------------------
|
|
78
|
+ std::shared_ptr<RectilinearGrid> RectilinearGrid::DeSerialize ( const YAML::Node& node ) {
|
|
79
|
+ if (node.Tag() != "RectilinearGrid") {
|
|
80
|
+ throw DeSerializeTypeMismatch( "RectilinearGrid", node.Tag());
|
|
81
|
+ }
|
|
82
|
+ std::shared_ptr<RectilinearGrid> Object(new RectilinearGrid(node), LemmaObjectDeleter() );
|
|
83
|
+ return Object ;
|
|
84
|
+ }
|
|
85
|
+
|
|
86
|
+
|
51
|
87
|
// ==================== OPERATIONS =======================
|
52
|
88
|
|
53
|
89
|
void RectilinearGrid::SetDimensions (const int &inx, const int &iny,
|