MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
InputVariable.cpp
Go to the documentation of this file.
1 // InputVariable.cpp ---
2 //
3 // Filename: InputVariable.cpp
4 // Description:
5 // Author: subha
6 // Maintainer:
7 // Created: Fri Jun 26 07:21:56 2015 (-0400)
8 // Version:
9 // Last-Updated: Thu Jul 23 08:54:24 2015 (-0400)
10 // By: subha
11 // Update #: 2
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 #ifdef USE_HDF5
49 #include "header.h"
50 #include "hdf5.h"
51 
52 #include "NSDFWriter.h"
53 #include "InputVariable.h"
54 
55 
56 const Cinfo * InputVariable::initCinfo()
57 {
58  static DestFinfo input("input",
59  "Handles input message, inserts into variable queue on owner.",
60  new EpFunc1< InputVariable, double > (&InputVariable::epSetValue));
61  static Finfo * inputVariableFinfos[] = {&input};
62 
63  static string doc[] = {
64  "Name", "InputVariable",
65  "Author", "Subhasis Ray",
66  "Description", "Variable for capturing incoming values and updating them in owner object."};
67 
68  static Dinfo< InputVariable > dinfo;
69 
70  static Cinfo inputVariableCinfo(
71  "InputVariable",
73  inputVariableFinfos,
74  sizeof(inputVariableFinfos)/sizeof(Finfo*),
75  &dinfo,
76  doc,
77  sizeof(doc)/sizeof(string),
78  true);
79  return &inputVariableCinfo;
80 }
81 
82 static const Cinfo *InputVariableCinfo = InputVariable::initCinfo();
83 
84 InputVariable::InputVariable(): owner_(0)
85 {
86  ;
87 }
88 
89 InputVariable::~InputVariable()
90 {
91  ;
92 }
93 
94 void InputVariable::setOwner( NSDFWriter * owner)
95 {
96  owner_ = owner;
97 }
98 
99 void InputVariable::epSetValue( const Eref& eref, double value)
100 {
101  if (owner_){
102  owner_->setInput(eref.fieldIndex(), value);
103  }
104 }
105 #endif
106 
107 //
108 // InputVariable.cpp ends here
uint32_t value
Definition: moosemodule.h:42
Definition: Dinfo.h:60
Definition: EpFunc.h:64
static char owner[]
Definition: mfield.cpp:405
unsigned int fieldIndex() const
Definition: Eref.h:61
Definition: Eref.h:26
static const Cinfo * initCinfo()
Definition: Variable.cpp:52
Definition: Cinfo.h:18
Definition: Finfo.h:12