45 #include <Xyce_config.h>
52 #include <N_UTL_Expression.h>
124 Nmax_chopGiven(false),
139 bool bsuccess =
true;
155 ParameterMap::const_iterator p_i =
getParameterMap().find(std::string(
"FUNCTION"));
158 ExtendedString tmp = getValue<std::string, DopeInfo>(*
this, p);
159 setValue<std::string, DopeInfo>(*
this, p,
static_cast<std::string
>(tmp.toLower()));
163 ParameterMap::const_iterator p_i =
getParameterMap().find(std::string(
"TYPE"));
166 ExtendedString tmp = getValue<std::string, DopeInfo>(*
this, p);
167 setValue<std::string, DopeInfo>(*
this, p,
static_cast<std::string
>(tmp.toLower()));
180 std::vector<double> & CVec,
181 std::vector<double> & CdonorVec,
182 std::vector<double> & CacceptorVec,
183 std::vector<double> & xVec,
187 int NX (CVec.size());
191 if (
type ==
"ptype" ||
type ==
"acceptor")
195 else if (
type ==
"ntype" ||
type ==
"donor")
206 if (xVec[i] >
xmax || xVec[i] <
xmin)
212 CVec[i] += sign*
Nmax;
214 if (
type ==
"ptype" ||
type ==
"acceptor")
216 CacceptorVec[i] +=
Nmax;
218 else if (
type ==
"ntype" ||
type ==
"donor")
220 CdonorVec[i] +=
Nmax;
226 double deltaX = fabs(
xwidth);
228 double ax = log(
Nmax/
Nmin)/(deltaX*deltaX);
231 double scalarX = 1.0;
234 if (
given(
"XLOC") &&
given(
"XWIDTH") && deltaX != 0.0)
236 abs_dx = fabs(xVec[i]-
xloc);
241 scalarX *=
ngdep2(abs_dx, 0.0, ax, 1.0);
245 bool flatReg = (xVec[i] >
xloc);
249 scalarX *=
ngdep2(abs_dx, 0.0, ax, 1.0);
254 bool flatReg = (xVec[i] <
xloc);
258 scalarX *=
ngdep2(abs_dx, 0.0, ax, 1.0);
263 CVec[i] += sign*
Nmax*scalarX;
265 if (
type ==
"ptype" ||
type ==
"acceptor")
267 CacceptorVec[i] +=
Nmax*scalarX;
269 else if (
type ==
"ntype" ||
type ==
"donor")
271 CdonorVec[i] +=
Nmax*scalarX;
284 if (
flatX == 0) regOn =
true;
288 if (x >
xloc) regOn =
false;
294 if (x <
xloc) regOn =
false;
299 CVec[i] += (regOn)?(sign*
Nmax):(sign*
Nmin);
301 if (
type ==
"ptype" ||
type ==
"acceptor")
303 CacceptorVec[i] += (regOn)?(Nmax):(sign*
Nmin);
305 else if (
type ==
"ntype" ||
type ==
"donor")
307 CdonorVec[i] += (regOn)?(Nmax):(sign*
Nmin);
315 std::string msg =
"Dope Region : ";
317 msg +=
" has specified the expression specification, but not provided an expression.";
319 N_ERH_ErrorMgr::report ( N_ERH_ErrorMgr::DEV_FATAL,msg);
325 Xyce::dout() <<
"DopeInfo::setupInfo: exprString = " <<
exprString << std::endl;
327 Util::Expression expr;
332 double dopeValue(0.0);
334 expr.set_var(std::string(
"#X"), xVec[i]);
335 expr.evaluateFunction (dopeValue);
336 CVec[i] += sign*dopeValue;
338 if (
type ==
"ptype" ||
type ==
"acceptor")
340 CacceptorVec[i] += dopeValue;
342 else if (
type ==
"ntype" ||
type ==
"donor")
344 CdonorVec[i] += dopeValue;
353 std::string msg =
"Dope Region : ";
355 msg +=
" has specified the file specification, but not specified a file name.";
357 N_ERH_ErrorMgr::report ( N_ERH_ErrorMgr::DEV_FATAL,msg);
368 for (
int id=0;
id<dopeSize;++id)
379 double xtmp = xVec[i];
380 double dopeValue(0.0);
382 CVec[i] += sign*dopeValue;
384 if (
type ==
"ptype" ||
type ==
"acceptor")
386 CacceptorVec[i] += dopeValue;
388 else if (
type ==
"ntype" ||
type ==
"donor")
390 CdonorVec[i] += dopeValue;
397 std::string msg =
"Unrecognized Dope Region function type: ";
399 msg +=
" for region: ";
402 N_ERH_ErrorMgr::report ( N_ERH_ErrorMgr::DEV_FATAL,msg);
416 std::vector<double> & CVec,
417 std::vector<double> & CdonorVec,
418 std::vector<double> & CacceptorVec,
419 std::vector<double> & xVec,
420 std::vector<double> & yVec,
424 int numMeshPoints (CVec.size());
427 if (
type ==
"ptype" ||
type ==
"acceptor") sign = -1.0;
431 for (i=0;i<numMeshPoints;++i)
436 if (xVec[i] >
xmax || xVec[i] <
xmin)
444 if (yVec[i] >
ymax || yVec[i] <
ymin)
450 CVec[i] += sign*
Nmax;
451 if (
type ==
"ptype" ||
type ==
"acceptor")
453 CacceptorVec[i] +=
Nmax;
457 CdonorVec[i] +=
Nmax;
463 double deltaX = fabs(
xwidth);
464 double deltaY = fabs(
ywidth);
471 ax = log(
Nmax/
Nmin)/(deltaX*deltaX);
476 ay = log(
Nmax/
Nmin)/(deltaY*deltaY);
479 for (i=0;i<numMeshPoints;++i)
481 double scalarX = 1.0;
482 double scalarY = 1.0;
483 double abs_dx, abs_dy;
485 if (
given(
"XLOC") &&
given(
"XWIDTH") && deltaX != 0.0)
487 abs_dx = fabs(xVec[i]-
xloc);
492 scalarX *=
ngdep2(abs_dx, 0.0, ax, 1.0);
496 bool flatReg = (xVec[i] >
xloc);
500 scalarX *=
ngdep2(abs_dx, 0.0, ax, 1.0);
505 bool flatReg = (xVec[i] <
xloc);
509 scalarX *=
ngdep2(abs_dx, 0.0, ax, 1.0);
514 if (
given(
"YLOC") &&
given(
"YWIDTH") && deltaY != 0.0)
516 abs_dy = fabs(yVec[i]-
yloc);
520 scalarY *=
ngdep2(0.0, abs_dy, 1.0, ay);
524 bool flatReg = (yVec[i] >
yloc);
528 scalarY *=
ngdep2(0.0, abs_dy, 1.0, ay);
533 bool flatReg = (yVec[i] <
yloc);
537 scalarY *=
ngdep2(0.0, abs_dy, 1.0, ay);
542 CVec[i] += sign*
Nmax*scalarX*scalarY;
544 if (
type ==
"ptype" ||
type ==
"acceptor")
546 CacceptorVec[i] +=
Nmax*scalarX*scalarY;
550 CdonorVec[i] +=
Nmax*scalarX*scalarY;
556 for (i=0;i<numMeshPoints;++i)
565 if (
flatY == 0) regOnY =
true;
569 if(y >
yloc) regOnY =
false;
575 if (y <
yloc) regOnY =
false;
582 if (
flatX == 0) regOnX =
true;
586 if(x >
xloc) regOnX =
false;
592 if (x <
xloc) regOnX =
false;
596 bool regOn = (regOnX && regOnY);
598 CVec[i] += (regOn)?(sign*
Nmax):(sign*
Nmin);
599 if (
type ==
"ptype" ||
type ==
"acceptor")
601 CacceptorVec[i] += (regOn)?(Nmax):(sign*
Nmin);
605 CdonorVec[i] += (regOn)?(Nmax):(sign*
Nmin);
611 std::string msg =
"Unrecognized Dope Region function type: ";
613 msg +=
" for region: ";
616 N_ERH_ErrorMgr::report ( N_ERH_ErrorMgr::DEV_FATAL,msg);
637 double D = 2.0 * sqrt(Dt);
639 return 0.5 * (
erf((Wh + x)/D) +
erf((Wh - x)/D));
687 double xprime = fabs(x) - (0.5 *
W);
688 return ((xprime <= 0.0) ? 1.0 : exp(-ax*xprime*xprime))*
689 ((y > 0.0) ? 0.0 : exp(-ay*y*y));
729 double retVal = exp(-ax*x*x)* exp(-ay*y*y);
743 double t1 = 1.0 / (1.0 + 0.3275911 * fabs(x));
748 double result = 1.0 - (0.254829592*t1 - 0.284496736*t2 + 1.421413741*t3 -
749 1.453152027*t4 + 1.061405429*t5) * exp(-x*x);
750 return (x < 0.0) ? -result : result;
762 std::string & filename,
763 std::vector<double> & xloc,
764 std::vector<double> & nvec,
765 std::vector<double> & y2,
775 input.open( filename.c_str(), std::ios::in );
778 bool endOfFile = input.eof();
781 endOfFile = input.eof();
791 endOfFile = input.eof();
800 xloc.push_back(x_loc);
801 nvec.push_back(value);
804 y2.resize(xloc.size(),0.0);
805 devSupport.
spline (xloc, nvec, y2);
809 std::string msg =
"Error: Cannot open doping file: " + filename;
810 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, msg);
823 std::string & filename,
824 std::vector<double> & xloc,
825 std::vector<double> & nvec,
826 std::vector<double> & y2_n,
827 std::vector<double> & pvec,
828 std::vector<double> & y2_p,
841 input.open( filename.c_str(), std::ios::in );
844 bool endOfFile = input.eof();
847 endOfFile = input.eof();
857 endOfFile = input.eof();
866 endOfFile = input.eof();
876 xloc.push_back(x_loc);
877 nvec.push_back(value1);
878 pvec.push_back(value2);
883 y2_n.resize(xloc.size(),0.0);
884 y2_p.resize(xloc.size(),0.0);
885 devSupport.
spline (xloc, nvec, y2_n);
886 devSupport.
spline (xloc, pvec, y2_p);
890 std::string msg =
"Error: Cannot open doping file: " + filename;
891 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, msg);
std::vector< double > dopeVec
static double ngdep(double x, double y, double W, double ax, double ay)
static ParametricData< DopeInfo > & getParametricData()
static double ngdep2(double x, double y, double ax, double ay)
static double nsdep(double x, double W, double Dt)
Pure virtual class to augment a linear system.
static void readDopingFile(std::string &filename, std::vector< double > &xloc, std::vector< double > &nvec, std::vector< double > &y2, DeviceSupport &devSup)
const T & value(const ParameterBase &entity, const Descriptor &descriptor)
Returns the value of the parameter for the entity.
void splint(std::vector< double > &xa, std::vector< double > &ya, std::vector< double > &y2a, double x_position, double &y_spline)
void spline(std::vector< double > &x, std::vector< double > &y, std::vector< double > &y2)
bool given(const std::string ¶meter_name) const
given returns true if the value was specified in the netlist (not defaulted).
std::vector< double > xlocVec
void setupInfo(std::vector< double > &CVec, std::vector< double > &CdonorVec, std::vector< double > &CacceptorVec, std::vector< double > &xVec, DeviceSupport &devSup)
std::vector< double > y2Vec
void setupInfo2d(std::vector< double > &CVec, std::vector< double > &CdonorVec, std::vector< double > &CacceptorVec, std::vector< double > &xVec, std::vector< double > &yVec, DeviceSupport &devSup)
Class Descriptor describes the parameters stored in the ParametricData parameter map.
static double erf(double x)
bool processParam(Param &ndParam, std::string ¶m, DevicePDEInstance &di)
ParametricData()
Constructs the parameter data map.
std::vector< double > splintDopeVec
Manages parameter binding for class C.
void processParams()
processParams post processes the parameters that have been set in the object of the derived class...
CompositeParam is the base class for classes that wish to only manage the processing of parameter dat...
const ParameterMap & getParameterMap() const
getParameterMap returns the parameter map which describes the parameters.