Xyce  6.1
N_DEV_PDE_Electrode.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // Copyright Notice
3 //
4 // Copyright 2002 Sandia Corporation. Under the terms
5 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
6 // Government retains certain rights in this software.
7 //
8 // Xyce(TM) Parallel Electrical Simulator
9 // Copyright (C) 2002-2015 Sandia Corporation
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //-----------------------------------------------------------------------------
24 
25 //-------------------------------------------------------------------------
26 // Filename : $RCSfile: N_DEV_PDE_Electrode.C,v $
27 //
28 // Purpose :
29 //
30 // Special Notes :
31 //
32 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
33 //
34 // Creation Date : 04/21/02
35 //
36 // Revision Information:
37 // ---------------------
38 //
39 // Revision Number: $Revision: 1.17 $
40 //
41 // Revision Date : $Date: 2015/04/08 19:18:25 $
42 //
43 // Current Owner : $Author: tvrusso $
44 //-------------------------------------------------------------------------
45 #include <Xyce_config.h>
46 
47 // ---------- Standard Includes ----------
48 #include <N_UTL_Math.h>
49 #include <map>
50 #include <algorithm>
51 #include <string>
52 #include <iostream>
53 
54 // ---------- Xyce Includes ----------
55 #include <N_DEV_PDE_Electrode.h>
56 #include <N_UTL_ExtendedString.h>
57 #include <N_ERH_ErrorMgr.h>
58 #include <N_DEV_DeviceOptions.h>
59 
60 namespace Xyce {
61 namespace Device {
62 
63 template<>
65 {
66  addPar("AREA", 0.0, &PDE_1DElectrode::area)
67  .setGivenMember(&PDE_1DElectrode::areaGiven);
68  addPar("LOCATION", 0.0, &PDE_1DElectrode::location);
69 
70  // Set up map for non-double precision variables:
71  addPar("SIDE", "left", &PDE_1DElectrode::side)
72  .setGivenMember(&PDE_1DElectrode::sideGiven);
73  addPar("NAME", "anode", &PDE_1DElectrode::nodeName);
74  addPar("BC", "dirichlet", &PDE_1DElectrode::bcName);
75  addPar("MATERIAL", "neutral", &PDE_1DElectrode::material);
76  addPar("OXIDEBNDRYFLAG", false, &PDE_1DElectrode::oxideBndryFlag);
77 }
78 
80  static ParametricData<PDE_1DElectrode> parMap;
81 
82  return parMap;
83 }
84 
85 template<>
87 {
88  // Set up map for double precision variables:
89  addPar("START", 0.0, &PDE_2DElectrode::start);
90  addPar("END", 0.0, &PDE_2DElectrode::end);
91  addPar("OXTHICK", 0.0, &PDE_2DElectrode::oxthick);
92  addPar("OXCHARGE", 0.0, &PDE_2DElectrode::oxcharge);
93 
94  // Set up map for non-double precision variables:
95  addPar("NAME", "anode", &PDE_2DElectrode::nodeName);
96  addPar("BC", "dirichlet", &PDE_2DElectrode::bcName);
97  addPar("SIDE", "top", &PDE_2DElectrode::side)
98  .setGivenMember(&PDE_2DElectrode::sideGiven);
99  addPar("MATERIAL", "neutral", &PDE_2DElectrode::material);
100  addPar("OXIDEBNDRYFLAG", false, &PDE_2DElectrode::oxideBndryFlag);
101 }
102 
104  static ParametricData<PDE_2DElectrode> parMap;
105 
106  return parMap;
107 }
108 
109 //-----------------------------------------------------------------------------
110 // Function : PDE_2DElectrode
111 // Purpose : constructor
112 //
113 // Special Notes :
114 // Creator : Dave Shirley, PSSI
115 // Creation Date : 05/07/05
116 //-----------------------------------------------------------------------------
118  : PDE_Electrode(getParametricData()),
119  iA (0),
120  iB (0),
121  uLabel (0),
122  start (0.0),
123  end (0.0),
124  startGiven (false),
125  endGiven (false),
126  side ("top"),
127  sideGiven (false)
128 {}
129 
130 //-----------------------------------------------------------------------------
131 // Function : PDE_2DElectrode:processParams
132 // Purpose : process raw parameter data
133 //
134 // Special Notes :
135 // Creator : Dave Shirley, PSSI
136 // Creation Date : 05/11/05
137 //-----------------------------------------------------------------------------
139 {
140  // lowercase the NAME parameter:
141  {
142  ParameterMap::const_iterator paramIter = getParameterMap().find(std::string("NAME"));
143  const Descriptor &param = *(*paramIter).second;
144 
145  ExtendedString tmp = getValue<std::string, PDE_2DElectrode>(*this, param);
146  setValue<std::string, PDE_2DElectrode>(*this, param, static_cast<std::string>(tmp.toLower()));
147  }
148 
149  // lowercase the SIDE parameter:
150  {
151  ParameterMap::const_iterator paramIter = getParameterMap().find(std::string("SIDE"));
152  const Descriptor &param = *(*paramIter).second;
153 
154  ExtendedString tmp = getValue<std::string, PDE_2DElectrode>(*this, param);
155  setValue<std::string, PDE_2DElectrode>(*this, param, static_cast<std::string>(tmp.toLower()));
156  }
157 
158  // lowercase the MATERIAL parameter:
159  {
160  ParameterMap::const_iterator paramIter = getParameterMap().find(std::string("MATERIAL"));
161  const Descriptor &param = *(*paramIter).second;
162 
163  ExtendedString tmp = getValue<std::string, PDE_2DElectrode>(*this, param);
164  setValue<std::string, PDE_2DElectrode>(*this, param, static_cast<std::string>(tmp.toLower()));
165  }
166 
167  // lowercase the BC parameter:
168  {
169  ParameterMap::const_iterator paramIter = getParameterMap().find(std::string("BC"));
170  const Descriptor &param = *(*paramIter).second;
171 
172  ExtendedString tmp = getValue<std::string, PDE_2DElectrode>(*this, param);
173  setValue<std::string, PDE_2DElectrode>(*this, param, static_cast<std::string>(tmp.toLower()));
174  }
175 }
176 
177 //-----------------------------------------------------------------------------
178 // Function : PDE_1DElectrode
179 // Purpose : constructor
180 //
181 // Special Notes :
182 // Creator : Dave Shirley, PSSI
183 // Creation Date : 05/07/05
184 //-----------------------------------------------------------------------------
186  : PDE_Electrode (getParametricData()),
187  area(1.0),
188  location(0.0),
189  side ("left"),
190  sideGiven (false)
191 {}
192 
193 //-----------------------------------------------------------------------------
194 // Function : PDE_1DElectrode:processParams
195 // Purpose : process raw parameter data
196 //
197 // Special Notes :
198 // Creator : Dave Shirley, PSSI
199 // Creation Date : 05/11/05
200 //-----------------------------------------------------------------------------
202 {
203  // lowercase the NAME parameter:
204  {
205  ParameterMap::const_iterator paramIter = getParameterMap().find(std::string("NAME"));
206  const Descriptor &param = *(*paramIter).second;
207 
208  ExtendedString tmp = getValue<std::string, PDE_1DElectrode>(*this, param);
209  setValue<std::string, PDE_1DElectrode>(*this, param, static_cast<std::string>(tmp.toLower()));
210  }
211 
212  // lowercase the SIDE parameter:
213  {
214  ParameterMap::const_iterator paramIter = getParameterMap().find(std::string("SIDE"));
215  const Descriptor &param = *(*paramIter).second;
216 
217  ExtendedString tmp = getValue<std::string, PDE_1DElectrode>(*this, param);
218  setValue<std::string, PDE_1DElectrode>(*this, param, static_cast<std::string>(tmp.toLower()));
219  }
220 
221  // lowercase the MATERIAL parameter:
222  {
223  ParameterMap::const_iterator paramIter = getParameterMap().find(std::string("MATERIAL"));
224  const Descriptor &param = *(*paramIter).second;
225 
226  ExtendedString tmp = getValue<std::string, PDE_1DElectrode>(*this, param);
227  setValue<std::string, PDE_1DElectrode>(*this, param, static_cast<std::string>(tmp.toLower()));
228  }
229 
230  // lowercase the BC parameter:
231  {
232  ParameterMap::const_iterator paramIter = getParameterMap().find(std::string("BC"));
233  const Descriptor &param = *(*paramIter).second;
234 
235  ExtendedString tmp = getValue<std::string, PDE_1DElectrode>(*this, param);
236  setValue<std::string, PDE_1DElectrode>(*this, param, static_cast<std::string>(tmp.toLower()));
237  }
238 }
239 
240 } // namespace Device
241 } // namespace Xyce
Pure virtual class to augment a linear system.
virtual void processParams()
processParams post processes the parameters that have been set in the object of the derived class...
static ParametricData< PDE_2DElectrode > & getParametricData()
static ParametricData< PDE_1DElectrode > & getParametricData()
Class Descriptor describes the parameters stored in the ParametricData parameter map.
Definition: N_DEV_Pars.h:546
ParametricData()
Constructs the parameter data map.
Definition: N_DEV_Pars.h:1392
Manages parameter binding for class C.
Definition: N_DEV_Pars.h:214
virtual void processParams()
processParams post processes the parameters that have been set in the object of the derived class...
const ParameterMap & getParameterMap() const
getParameterMap returns the parameter map which describes the parameters.