netxsimdg
Loading...
Searching...
No Matches
Dynamics.cpp
Go to the documentation of this file.
1
10
11#include "include/gridNames.hpp"
12
13#include <string>
14#include <vector>
15
16
17namespace Nextsim {
18
19static const std::vector<std::string> namedFields = { hiceName, ciceName, uName, vName };
20Dynamics::Dynamics()
21 : IDynamics()
22{
23 registerProtectedArray(ProtectedArray::ICE_U, &uice);
24 registerProtectedArray(ProtectedArray::ICE_V, &vice);
25}
26
27void Dynamics::setData(const ModelState::DataMap& ms)
28{
29 IDynamics::setData(ms);
30
31 kernel.initialisation();
32
33 uice = ms.at(uName);
34 vice = ms.at(vName);
35
36 // Set the data in the kernel arrays.
37 for (const auto& fieldName : namedFields) {
38 kernel.setData(fieldName, ms.at(fieldName));
39 }
40}
41
42
43
44void Dynamics::update(const TimestepTime& tst)
45{ std::cout << tst.start << std::endl;
46
47 kernel.setData(hiceName, hice.data());
48 kernel.setData(ciceName, cice.data());
49
50 //kernel.setData(uName, uice);
51 //kernel.setData(vName, vice);
52
53 kernel.update(tst);
54
55 hice.data() = kernel.getDG0Data(hiceName);
56 cice.data() = kernel.getDG0Data(ciceName);
57
58 //uice = kernel.getDG0Data(uName);
59 //vice = kernel.getDG0Data(vName);
60}
61
62}