Nektar++
Loading...
Searching...
No Matches
model.h
Go to the documentation of this file.
1<?
2#
3# model.h
4# A pype template for Nektar simulation
5#
6# Required variables
7# ---------------------------
8# model A model
9# protocol A pacing protocol
10# ---------------------------
11#
12# This file is derived from Myokit.
13# See http://myokit.org for copyright, sharing, and licensing details.
14#
15# Get model name
16model_name = name if name is not None else model.name();
17?>
18///////////////////////////////////////////////////////////////////////////////
19//
20// File: <?= model_name ?>.h
21//
22// For more information, please see: http://www.nektar.info
23//
24// The MIT License
25//
26// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
27// Department of Aeronautics, Imperial College London (UK), and Scientific
28// Computing and Imaging Institute, University of Utah (USA).
29//
30// Permission is hereby granted, free of charge, to any person obtaining a
31// copy of this software and associated documentation files (the "Software"),
32// to deal in the Software without restriction, including without limitation
33// the rights to use, copy, modify, merge, publish, distribute, sublicense,
34// and/or sell copies of the Software, and to permit persons to whom the
35// Software is furnished to do so, subject to the following conditions:
36//
37// The above copyright notice and this permission notice shall be included
38// in all copies or substantial portions of the Software.
39//
40// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
41// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
42// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
43// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
44// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
45// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
46// DEALINGS IN THE SOFTWARE.
47//
48// Description: <?= model_name ?> cell model.
49// Generated from CellML on <?= myokit.date() ?>
50//
51///////////////////////////////////////////////////////////////////////////////
52
53#ifndef NEKTAR_SOLVERS_CARDIACEPSOLVER_CELLMODELS_<?= model_name.upper() ?>_H_
54#define NEKTAR_SOLVERS_CARDIACEPSOLVER_CELLMODELS_<?= model_name.upper() ?>_H_
55
57
58namespace Nektar
59{
60
61class <?= model_name ?> : public CellModel
62{
63
64public:
65 /// Creates an instance of this class
66 static CellModelSharedPtr create(
69 {
70 return MemoryManager<<?= model_name ?>>::AllocateSharedPtr(pSession, pField);
71 }
72
73 /// Name of class
74 static std::string className;
75
76 /// Constructor
78 const MultiRegions::ExpListSharedPtr& pField);
79
80 /// Destructor
81 ~<?= model_name ?>() override;
82
83protected:
84 /// Computes the reaction terms $f(u,v)$ and $g(u,v)$.
85 void v_Update(
86 const Array<OneD, const Array<OneD, NekDouble> > &inarray,
87 Array<OneD, Array<OneD, NekDouble> > &outarray,
88 const NekDouble time) override;
89
90 /// Prints a summary of the model parameters.
91 void v_GenerateSummary(SummaryList& s) override;
92
93 /// Set initial conditions for the cell model
94 void v_SetInitialConditions() override;
95
96 /// Returns the name of a variable for a given index
97 std::string v_GetCellVarName(size_t idx) override;
98
99private:
100 /// Non-state variables
101<?
102for var in model.variables(state=False, deep=True):
103 if var not in tau_vars and var not in inf_vars:
104 print(tab + 'NekDouble ' + v(var) + '; // ' + str(var.unit()))
105?>
106<?
107if variants:
108 print(tab + 'enum Variants {')
109 for name in variants.keys():
110 print(2*tab + 'e' + name + ',')
111 print(tab + '};')
112 print(tab + 'enum Variants model_variant;')
113 print('')
114 print(tab + 'static std::string lookupIds[];')
115 print(tab + 'static std::string def;')
116?>};
117
118} // namespace Nektar
119
120#endif
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::vector< std::pair< std::string, std::string > > SummaryList
Definition Misc.h:46
std::shared_ptr< CellModel > CellModelSharedPtr
A shared pointer to an EquationSystem object.
Definition CellModel.h:55
model_name
Definition convert.py:36
STL namespace.