Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-2014 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.14 $
40 //
41 // Revision Date : $Date: 2014/02/24 23:49:18 $
42 //
43 // Current Owner : $Author: tvrusso $
44 //-------------------------------------------------------------------------
45 #include <Xyce_config.h>
46 
47 // ---------- Standard Includes ----------
48 #include <N_UTL_Misc.h>
49 
50 #ifdef HAVE_CMATH
51 #include <cmath>
52 #else
53 #include <math.h>
54 #endif
55 
56 #include <map>
57 #include <algorithm>
58 #include <string>
59 #include <iostream>
60 
61 // ---------- Xyce Includes ----------
62 #include <N_DEV_PDE_Electrode.h>
63 #include <N_UTL_Misc.h>
64 #include <N_ERH_ErrorMgr.h>
65 #include <N_DEV_DeviceOptions.h>
66 
67 namespace Xyce {
68 namespace Device {
69 
70 template<>
72 {
73  addPar("AREA", 0.0, &PDE_1DElectrode::area)
74  .setGivenMember(&PDE_1DElectrode::areaGiven);
75  addPar("LOCATION", 0.0, &PDE_1DElectrode::location);
76 
77  // Set up map for non-double precision variables:
78  addPar("SIDE", "left", &PDE_1DElectrode::side)
79  .setGivenMember(&PDE_1DElectrode::sideGiven);
80  addPar("NAME", "anode", &PDE_1DElectrode::nodeName);
81  addPar("BC", "dirichlet", &PDE_1DElectrode::bcName);
82  addPar("MATERIAL", "neutral", &PDE_1DElectrode::material);
83  addPar("OXIDEBNDRYFLAG", false, &PDE_1DElectrode::oxideBndryFlag);
84 }
85 
87  static ParametricData<PDE_1DElectrode> parMap;
88 
89  return parMap;
90 }
91 
92 template<>
94 {
95  // Set up map for double precision variables:
96  addPar("START", 0.0, &PDE_2DElectrode::start);
97  addPar("END", 0.0, &PDE_2DElectrode::end);
98  addPar("OXTHICK", 0.0, &PDE_2DElectrode::oxthick);
99  addPar("OXCHARGE", 0.0, &PDE_2DElectrode::oxcharge);
100 
101  // Set up map for non-double precision variables:
102  addPar("NAME", "anode", &PDE_2DElectrode::nodeName);
103  addPar("BC", "dirichlet", &PDE_2DElectrode::bcName);
104  addPar("SIDE", "top", &PDE_2DElectrode::side)
105  .setGivenMember(&PDE_2DElectrode::sideGiven);
106  addPar("MATERIAL", "neutral", &PDE_2DElectrode::material);
107  addPar("OXIDEBNDRYFLAG", false, &PDE_2DElectrode::oxideBndryFlag);
108 }
109 
111  static ParametricData<PDE_2DElectrode> parMap;
112 
113  return parMap;
114 }
115 
116 //-----------------------------------------------------------------------------
117 // Function : PDE_2DElectrode
118 // Purpose : constructor
119 //
120 // Special Notes :
121 // Creator : Dave Shirley, PSSI
122 // Creation Date : 05/07/05
123 //-----------------------------------------------------------------------------
125  : PDE_Electrode(getParametricData()),
126  iA (0),
127  iB (0),
128  uLabel (0),
129  start (0.0),
130  end (0.0),
131  startGiven (false),
132  endGiven (false),
133  side ("top"),
134  sideGiven (false)
135 {}
136 
137 //-----------------------------------------------------------------------------
138 // Function : PDE_2DElectrode:processParams
139 // Purpose : process raw parameter data
140 //
141 // Special Notes :
142 // Creator : Dave Shirley, PSSI
143 // Creation Date : 05/11/05
144 //-----------------------------------------------------------------------------
146 {
147  // lowercase the NAME parameter:
148  {
149  ParameterMap::const_iterator paramIter = getParameterMap().find(std::string("NAME"));
150  const Descriptor &param = *(*paramIter).second;
151 
152  ExtendedString tmp = getValue<std::string, PDE_2DElectrode>(*this, param);
153  setValue<std::string, PDE_2DElectrode>(*this, param, static_cast<std::string>(tmp.toLower()));
154  }
155 
156  // lowercase the SIDE parameter:
157  {
158  ParameterMap::const_iterator paramIter = getParameterMap().find(std::string("SIDE"));
159  const Descriptor &param = *(*paramIter).second;
160 
161  ExtendedString tmp = getValue<std::string, PDE_2DElectrode>(*this, param);
162  setValue<std::string, PDE_2DElectrode>(*this, param, static_cast<std::string>(tmp.toLower()));
163  }
164 
165  // lowercase the MATERIAL parameter:
166  {
167  ParameterMap::const_iterator paramIter = getParameterMap().find(std::string("MATERIAL"));
168  const Descriptor &param = *(*paramIter).second;
169 
170  ExtendedString tmp = getValue<std::string, PDE_2DElectrode>(*this, param);
171  setValue<std::string, PDE_2DElectrode>(*this, param, static_cast<std::string>(tmp.toLower()));
172  }
173 
174  // lowercase the BC parameter:
175  {
176  ParameterMap::const_iterator paramIter = getParameterMap().find(std::string("BC"));
177  const Descriptor &param = *(*paramIter).second;
178 
179  ExtendedString tmp = getValue<std::string, PDE_2DElectrode>(*this, param);
180  setValue<std::string, PDE_2DElectrode>(*this, param, static_cast<std::string>(tmp.toLower()));
181  }
182 }
183 
184 //-----------------------------------------------------------------------------
185 // Function : PDE_1DElectrode
186 // Purpose : constructor
187 //
188 // Special Notes :
189 // Creator : Dave Shirley, PSSI
190 // Creation Date : 05/07/05
191 //-----------------------------------------------------------------------------
193  : PDE_Electrode (getParametricData()),
194  area(1.0),
195  location(0.0),
196  side ("left"),
197  sideGiven (false)
198 {}
199 
200 //-----------------------------------------------------------------------------
201 // Function : PDE_1DElectrode:processParams
202 // Purpose : process raw parameter data
203 //
204 // Special Notes :
205 // Creator : Dave Shirley, PSSI
206 // Creation Date : 05/11/05
207 //-----------------------------------------------------------------------------
209 {
210  // lowercase the NAME parameter:
211  {
212  ParameterMap::const_iterator paramIter = getParameterMap().find(std::string("NAME"));
213  const Descriptor &param = *(*paramIter).second;
214 
215  ExtendedString tmp = getValue<std::string, PDE_1DElectrode>(*this, param);
216  setValue<std::string, PDE_1DElectrode>(*this, param, static_cast<std::string>(tmp.toLower()));
217  }
218 
219  // lowercase the SIDE parameter:
220  {
221  ParameterMap::const_iterator paramIter = getParameterMap().find(std::string("SIDE"));
222  const Descriptor &param = *(*paramIter).second;
223 
224  ExtendedString tmp = getValue<std::string, PDE_1DElectrode>(*this, param);
225  setValue<std::string, PDE_1DElectrode>(*this, param, static_cast<std::string>(tmp.toLower()));
226  }
227 
228  // lowercase the MATERIAL parameter:
229  {
230  ParameterMap::const_iterator paramIter = getParameterMap().find(std::string("MATERIAL"));
231  const Descriptor &param = *(*paramIter).second;
232 
233  ExtendedString tmp = getValue<std::string, PDE_1DElectrode>(*this, param);
234  setValue<std::string, PDE_1DElectrode>(*this, param, static_cast<std::string>(tmp.toLower()));
235  }
236 
237  // lowercase the BC parameter:
238  {
239  ParameterMap::const_iterator paramIter = getParameterMap().find(std::string("BC"));
240  const Descriptor &param = *(*paramIter).second;
241 
242  ExtendedString tmp = getValue<std::string, PDE_1DElectrode>(*this, param);
243  setValue<std::string, PDE_1DElectrode>(*this, param, static_cast<std::string>(tmp.toLower()));
244  }
245 }
246 
247 } // namespace Device
248 } // namespace Xyce