43{
47 std::string vCellModel;
49 std::vector<StimulusSharedPtr> vStimulus;
54 unsigned int nSteps;
55
56
58 vSession->InitSession();
59
60 try
61 {
62
64 3, 0, 0.0, 0.0, 0.0);
66 vPoint.get());
67
68
69 vSession->LoadSolverInfo("CELLMODEL", vCellModel, "");
70 ASSERTL0(vCellModel !=
"",
"Cell Model not specified.");
71
72 vCell =
74 vCell->Initialise();
75
76
78
79
82 vDeltaT = vSession->GetParameter("TimeStep");
83 vTime = 0.0;
84 nSteps = vSession->GetParameter("NumSteps");
85
87 vSession->GetFunction("InitialConditions", "u");
88 vSol[0][0] = e->Evaluate(0.0, 0.0, 0.0, 0.0);
89
90 cout << "#";
91 for (unsigned int i = 0; i < vCell->GetNumCellVariables(); ++i)
92 {
93 cout << " " << vCell->GetCellVarName(i);
94 }
95 cout << endl;
96
97
98 for (unsigned int i = 0; i < nSteps; ++i)
99 {
100
101 vCell->TimeIntegrate(vSol, vWsp, vTime);
102
103
104 for (unsigned int i = 0; i < vStimulus.size(); ++i)
105 {
106 vStimulus[i]->Update(vWsp, vTime);
107 }
108
109
110 Vmath::Svtvp(1, vDeltaT, vWsp[0], 1, vSol[0], 1, vSol[0], 1);
111
112
113 vTime += vDeltaT;
114
115
116 cout << vTime << " " << vSol[0][0];
117 for (unsigned int j = 0; j < vCell->GetNumCellVariables(); ++j)
118 {
119 cout << " " << vCell->GetCellSolution(j)[0];
120 }
121 cout << endl;
122 }
123
124 for (unsigned int i = 0; i < vCell->GetNumCellVariables(); ++i)
125 {
126 cout << "# " << vCell->GetCellVarName(i) << " "
127 << vCell->GetCellSolution(i)[0] << endl;
128 }
129 }
130 catch (...)
131 {
132 cerr << "An error occured" << endl;
133 }
134
135 return 0;
136}
#define ASSERTL0(condition, msg)
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[])
Creates an instance of the SessionReader class.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
static std::unique_ptr< DataType, UniquePtrDeleter > AllocateUniquePtr(const Args &...args)
static std::vector< StimulusSharedPtr > LoadStimuli(const LibUtilities::SessionReaderSharedPtr &pSession, const MultiRegions::ExpListSharedPtr &pField)
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Equation > EquationSharedPtr
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
unique_ptr_objpool< PointGeom > PointGeomUniquePtr
CellModelFactory & GetCellModelFactory()
std::shared_ptr< CellModel > CellModelSharedPtr
A shared pointer to an EquationSystem object.
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Svtvp (scalar times vector plus vector): z = alpha*x + y.