MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Variable.cpp
Go to the documentation of this file.
1 // Variable.cpp ---
2 //
3 // Filename: Variable.cpp
4 // Description:
5 // Author: Subhasis Ray
6 // Maintainer:
7 // Created: Fri May 30 19:56:06 2014 (+0530)
8 // Version:
9 // Last-Updated:
10 // By:
11 // Update #: 0
12 // URL:
13 // Keywords:
14 // Compatibility:
15 //
16 //
17 
18 // Commentary:
19 //
20 //
21 //
22 //
23 
24 // Change log:
25 //
26 //
27 //
28 //
29 // This program is free software; you can redistribute it and/or
30 // modify it under the terms of the GNU General Public License as
31 // published by the Free Software Foundation; either version 3, or
32 // (at your option) any later version.
33 //
34 // This program is distributed in the hope that it will be useful,
35 // but WITHOUT ANY WARRANTY; without even the implied warranty of
36 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
37 // General Public License for more details.
38 //
39 // You should have received a copy of the GNU General Public License
40 // along with this program; see the file COPYING. If not, write to
41 // the Free Software Foundation, Inc., 51 Franklin Street, Fifth
42 // Floor, Boston, MA 02110-1301, USA.
43 //
44 //
45 
46 // Code:
47 
48 #include "header.h"
49 #include "Variable.h"
50 #include "Function.h"
51 
53 {
55  "value",
56  "Variable value",
59  static DestFinfo input(
60  "input",
61  "Handles incoming variable value.",
63 
64  static Finfo * variableFinfos[] = {
65  &value,
66  &input
67  };
68  static string doc[] = {
69  "Name", "Variable",
70  "Author", "Subhasis Ray",
71  "Description", "Variable for storing double values. This is used in Function class."
72  };
73  static Dinfo< Variable > dinfo;
74  static Cinfo variableCinfo("Variable",
76  variableFinfos,
77  sizeof(variableFinfos) / sizeof(Finfo*),
78  &dinfo,
79  doc,
80  sizeof(doc) / sizeof(string),
81  true // is FieldElement, not to be created directly
82  );
83  return & variableCinfo;
84 }
85 
87 
88 // This imitates Synapse::addMsgCallback
89 // but does not seem to be used anywhere
90 // - Subha, Tue Sep 9 19:37:11 IST 2014
91 
92 void Variable::addMsgCallback(const Eref& e, const string& finfoName, ObjId msg, unsigned int msgLookup)
93 {
94  /*
95  if (finfoName == "input"){
96  ObjId pa = Neutral::parent(e);
97  Function * fn = reinterpret_cast< Function *>(pa.data());
98  unsigned int varNumber = fn->addVar();
99  SetGet2<unsigned int, unsigned int>::set(msg, "fieldIndex", msgLookup, varNumber);
100  }
101  */
102 }
103 
104 // // This imitates Synapse::dropMsgCallback
105 // void Variable::dropMsgCallback(
106 // const Eref& e, const string& finfoName,
107 // ObjId msg, unsigned int msgLookup )
108 // {
109 // if ( finfoName == "input" ) {
110 // ObjId pa = Neutral::parent( e );
111 // SynHandlerBase* sh =
112 // reinterpret_cast< Function* >( pa.data() );
113 // sh->dropVar( msgLookup );
114 // }
115 // }
116 
117 
118 //
119 // Variable.cpp ends here
Definition: Dinfo.h:60
Definition: EpFunc.h:64
static const Cinfo * variableCinfo
Definition: Variable.cpp:86
Definition: ObjId.h:20
void setValue(double v)
Definition: Variable.h:66
virtual void epSetValue(const Eref &e, double v)
Definition: Variable.h:71
double value
Definition: Variable.h:85
void addMsgCallback(const Eref &e, const string &finfoName, ObjId msg, unsigned int msgLookup)
Definition: Variable.cpp:92
double getValue() const
Definition: Variable.h:76
Definition: Eref.h:26
static const Cinfo * initCinfo()
Definition: Variable.cpp:52
static const Cinfo * initCinfo()
Definition: Neutral.cpp:16
Definition: Cinfo.h:18
Definition: Finfo.h:12