allow geometry scaling by option `scale'

This commit is contained in:
dwarning 2013-09-16 19:46:11 +02:00 committed by rlar
parent 88d108f139
commit 06c891933c
3 changed files with 24 additions and 6 deletions

View File

@ -11,16 +11,22 @@ Modified: September 2003 Paolo Nenzi
#include "capdefs.h"
#include "ngspice/sperror.h"
#include "ngspice/suffix.h"
#include "ngspice/fteext.h"
/* ARGSUSED */
int
CAPparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
{
double scale;
CAPinstance *here = (CAPinstance*)inst;
NG_IGNORE(select);
if (!cp_getvar("scale", CP_REAL, &scale))
scale = 1;
switch(param) {
case CAP_CAP:
here->CAPcapac = value->rValue;
@ -41,11 +47,11 @@ CAPparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
here->CAPdtempGiven = TRUE;
break;
case CAP_WIDTH:
here->CAPwidth = value->rValue;
here->CAPwidth = value->rValue * scale;
here->CAPwidthGiven = TRUE;
break;
case CAP_LENGTH:
here->CAPlength = value->rValue;
here->CAPlength = value->rValue * scale;
here->CAPlengthGiven = TRUE;
break;
case CAP_M:

View File

@ -12,16 +12,22 @@ Modified by Paolo Nenzi 2003 and Dietmar Warning 2012
#include "diodefs.h"
#include "ngspice/sperror.h"
#include "ngspice/suffix.h"
#include "ngspice/fteext.h"
/* ARGSUSED */
int
DIOparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
{
double scale;
DIOinstance *here = (DIOinstance*)inst;
NG_IGNORE(select);
if (!cp_getvar("scale", CP_REAL, &scale))
scale = 1;
switch(param) {
case DIO_AREA:
here->DIOarea = value->rValue;
@ -32,11 +38,11 @@ DIOparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
here->DIOpjGiven = TRUE;
break;
case DIO_W:
here->DIOw = value->rValue;
here->DIOw = value->rValue * scale;
here->DIOwGiven = TRUE;
break;
case DIO_L:
here->DIOl = value->rValue;
here->DIOl = value->rValue * scale;
here->DIOlGiven = TRUE;
break;
case DIO_M:

View File

@ -10,14 +10,20 @@ Modified: Apr 2000 - Paolo Nenzi
#include "resdefs.h"
#include "ngspice/sperror.h"
#include "ngspice/missing_math.h"
#include "ngspice/fteext.h"
int
RESparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
{
double scale;
RESinstance *here = (RESinstance *)inst;
NG_IGNORE(select);
if (!cp_getvar("scale", CP_REAL, &scale))
scale = 1;
switch(param) {
case RES_TEMP:
here->REStemp = value->rValue + CONSTCtoK;
@ -38,11 +44,11 @@ RESparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
here->RESacresGiven = TRUE;
break;
case RES_WIDTH:
here->RESwidth = value->rValue;
here->RESwidth = value->rValue * scale;
here->RESwidthGiven = TRUE;
break;
case RES_LENGTH:
here->RESlength = value->rValue;
here->RESlength = value->rValue * scale;
here->RESlengthGiven = TRUE;
break;
case RES_SCALE: