Browse Source
Removal of the "unsopported" folder.
Removal of the "unsopported" folder.
It used to contain a unused sensitivity analysis that has not been touched for the last 15 to 20 yeras. We are not a museum. If somebody wants to reactivate this code, of course it is available within the older ngspice releases.pre-master-46
16 changed files with 1 additions and 1099 deletions
-
6configure.ac
-
10src/Makefile.am
-
23src/unsupported/Makefile.am
-
46src/unsupported/cktsenac.c
-
36src/unsupported/cktsenup.c
-
191src/unsupported/cktsncom.c
-
85src/unsupported/cktsndct.c
-
67src/unsupported/cktsnld.c
-
30src/unsupported/cktsnprt.c
-
50src/unsupported/cktsnset.c
-
5src/unsupported/readme
-
73src/unsupported/sen2dest.c
-
96src/unsupported/sen2setp.c
-
29src/unsupported/snaskq.c
-
67src/unsupported/snstart.c
-
286src/unsupported/spiced.c
@ -1,23 +0,0 @@ |
|||||
## Process this file with automake to produce Makefile.in
|
|
||||
|
|
||||
EXTRA_DIST = readme spiced.c |
|
||||
|
|
||||
noinst_LTLIBRARIES = libunsupported.la |
|
||||
|
|
||||
libunsupported_la_SOURCES = \
|
|
||||
cktsenac.c \
|
|
||||
cktsenup.c \
|
|
||||
cktsncom.c \
|
|
||||
cktsndct.c \
|
|
||||
cktsnset.c \
|
|
||||
cktsnld.c \
|
|
||||
cktsnprt.c \
|
|
||||
sen2dest.c \
|
|
||||
sen2setp.c \
|
|
||||
snaskq.c \
|
|
||||
snstart.c |
|
||||
|
|
||||
|
|
||||
AM_CPPFLAGS = @AM_CPPFLAGS@ -I$(top_srcdir)/src/include |
|
||||
AM_CFLAGS = $(STATIC) |
|
||||
MAINTAINERCLEANFILES = Makefile.in |
|
||||
@ -1,46 +0,0 @@ |
|||||
/********** |
|
||||
Copyright 1990 Regents of the University of California. All rights reserved. |
|
||||
Author: 1985 Thomas L. Quarles |
|
||||
**********/ |
|
||||
|
|
||||
#include "ngspice/ngspice.h" |
|
||||
#include <stdio.h> |
|
||||
#include "ngspice/smpdefs.h" |
|
||||
#include "ngspice/cktdefs.h" |
|
||||
#include "ngspice/devdefs.h" |
|
||||
#include "ngspice/sperror.h" |
|
||||
#include "ngspice/trandefs.h" |
|
||||
#include "ngspice/suffix.h" |
|
||||
|
|
||||
|
|
||||
/* CKTsenAC(ckt) |
|
||||
* this is a routine for AC sensitivity calculations |
|
||||
*/ |
|
||||
|
|
||||
int |
|
||||
CKTsenAC(CKTcircuit *ckt) |
|
||||
{ |
|
||||
int error; |
|
||||
|
|
||||
#ifdef SENSDEBUG |
|
||||
printf("CKTsenAC\n"); |
|
||||
#endif |
|
||||
|
|
||||
error = CKTsenLoad(ckt); |
|
||||
if (error) |
|
||||
return error; |
|
||||
|
|
||||
#ifdef SENSDEBUG |
|
||||
printf("after CKTsenLoad\n"); |
|
||||
#endif |
|
||||
|
|
||||
error = CKTsenComp(ckt); |
|
||||
if (error) |
|
||||
return error; |
|
||||
|
|
||||
#ifdef SENSDEBUG |
|
||||
printf("after CKTsenComp\n"); |
|
||||
#endif |
|
||||
|
|
||||
return OK; |
|
||||
} |
|
||||
@ -1,36 +0,0 @@ |
|||||
/********** |
|
||||
Copyright 1990 Regents of the University of California. All rights reserved. |
|
||||
Author: 1985 Thomas L. Quarles |
|
||||
**********/ |
|
||||
|
|
||||
/* CKTsenUpdate(ckt) |
|
||||
* this is a driver program to iterate through all the various |
|
||||
* sensitivity update functions provided for the circuit elements |
|
||||
* in the given circuit |
|
||||
*/ |
|
||||
|
|
||||
#include "ngspice/ngspice.h" |
|
||||
#include <stdio.h> |
|
||||
#include "ngspice/smpdefs.h" |
|
||||
#include "ngspice/cktdefs.h" |
|
||||
#include "ngspice/devdefs.h" |
|
||||
#include "ngspice/sperror.h" |
|
||||
#include "ngspice/trandefs.h" |
|
||||
#include "ngspice/suffix.h" |
|
||||
|
|
||||
|
|
||||
int |
|
||||
CKTsenUpdate(CKTcircuit *ckt) |
|
||||
{ |
|
||||
int i; |
|
||||
int error; |
|
||||
|
|
||||
for (i = 0; i < DEVmaxnum; i++) |
|
||||
if (DEVices[i] && DEVices[i]->DEVsenUpdate && ckt->CKThead[i]) { |
|
||||
error = DEVices[i]->DEVsenUpdate (ckt->CKThead[i], ckt); |
|
||||
if (error) |
|
||||
return error; |
|
||||
} |
|
||||
|
|
||||
return OK; |
|
||||
} |
|
||||
@ -1,191 +0,0 @@ |
|||||
/********** |
|
||||
Copyright 1990 Regents of the University of California. All rights reserved. |
|
||||
Author: 1985 Thomas L. Quarles |
|
||||
**********/ |
|
||||
|
|
||||
/* CKTsenComp(ckt) |
|
||||
* this is a program to solve the sensitivity equation |
|
||||
* of the given circuit |
|
||||
*/ |
|
||||
|
|
||||
#include "ngspice/ngspice.h" |
|
||||
#include <stdio.h> |
|
||||
#include "ngspice/smpdefs.h" |
|
||||
#include "ngspice/cktdefs.h" |
|
||||
#include "ngspice/devdefs.h" |
|
||||
#include "ngspice/sperror.h" |
|
||||
#include "ngspice/trandefs.h" |
|
||||
#include "ngspice/suffix.h" |
|
||||
|
|
||||
// #include "../maths/sparse/spdefs.h" |
|
||||
// |
|
||||
// this include file from `sparse' is incompatible |
|
||||
// with the rest of ngspice |
|
||||
// so we can unfortunatly not include here |
|
||||
// instead we cheat a bit and |
|
||||
// introduce the opaque struct MatrixElement here |
|
||||
// (only the first struct members which are of importance to us) |
|
||||
|
|
||||
struct MatrixElement |
|
||||
{ |
|
||||
double Real; |
|
||||
double Imag; |
|
||||
// ... |
|
||||
}; |
|
||||
|
|
||||
|
|
||||
int |
|
||||
CKTsenComp(CKTcircuit *ckt) |
|
||||
{ |
|
||||
int size; |
|
||||
int row; |
|
||||
int col; |
|
||||
SENstruct *info; |
|
||||
|
|
||||
#ifdef SENSDEBUG |
|
||||
char *rowe; |
|
||||
SMPelement *elt; |
|
||||
#endif |
|
||||
|
|
||||
#ifdef SENSDEBUG |
|
||||
printf("CKTsenComp\n"); |
|
||||
#endif |
|
||||
|
|
||||
size = SMPmatSize(ckt->CKTmatrix); |
|
||||
info = ckt->CKTsenInfo; |
|
||||
|
|
||||
if ((info->SENmode == DCSEN) || (info->SENmode == TRANSEN)) { |
|
||||
|
|
||||
/* loop throgh all the columns of RHS |
|
||||
matrix - each column corresponding to a design |
|
||||
parameter */ |
|
||||
|
|
||||
for (col = 1; col <= info->SENparms; col++) { |
|
||||
|
|
||||
for (row = 1; row <= size; row++) { |
|
||||
ckt->CKTsenRhs[row] = info->SEN_RHS[row][col]; |
|
||||
} |
|
||||
|
|
||||
/* solve for the sensitivity values */ |
|
||||
SMPsolve(ckt->CKTmatrix, ckt->CKTsenRhs, ckt->CKTrhsSpare); |
|
||||
|
|
||||
/* store the sensitivity values */ |
|
||||
for (row = 1; row <= size; row++) { |
|
||||
info->SEN_Sap[row][col] = ckt->CKTsenRhs[row]; |
|
||||
info->SEN_RHS[row][col] = ckt->CKTsenRhs[row]; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
#ifdef SENSDEBUG |
|
||||
printf("\n"); |
|
||||
printf("Sensitivity matrix :\n"); |
|
||||
|
|
||||
for (row = 1; row <= size; row++) { |
|
||||
rowe = CKTnodName(ckt, row); |
|
||||
// if (strcmp("4", rowe) == 0) { |
|
||||
for (col = 1; col <= info->SENparms; col++) { |
|
||||
printf("\t"); |
|
||||
printf("Sap(%s,%d) = %.5e\t", rowe, col, |
|
||||
info->SEN_Sap[row][col]); |
|
||||
} |
|
||||
printf("\n\n"); |
|
||||
// } |
|
||||
} |
|
||||
|
|
||||
printf(" RHS matrix :\n"); |
|
||||
for (row = 1; row <= size; row++) { |
|
||||
for (col = 1; col <= info->SENparms; col++) { |
|
||||
printf(" "); |
|
||||
printf("RHS(%d,%d) = %.7e ", row, col, |
|
||||
info->SEN_RHS[row][col]); |
|
||||
} |
|
||||
printf("\n"); |
|
||||
} |
|
||||
|
|
||||
printf(" Jacobian matrix :\n"); |
|
||||
for (row = 1; row <= size; row++) { |
|
||||
for (col = 1; col <= size; col++) { |
|
||||
elt = SMPfindElt(ckt->CKTmatrix, row , col , 0); |
|
||||
if (elt) |
|
||||
printf("%.7e ", elt->Real); |
|
||||
else |
|
||||
printf("0.0000000e+00 "); |
|
||||
} |
|
||||
printf("\n"); |
|
||||
} |
|
||||
#endif |
|
||||
|
|
||||
} |
|
||||
|
|
||||
if (info->SENmode == ACSEN) { |
|
||||
|
|
||||
/* loop throgh all the columns of RHS |
|
||||
matrix - each column corresponding to a design |
|
||||
parameter */ |
|
||||
|
|
||||
for (col = 1; col <= info->SENparms; col++) { |
|
||||
|
|
||||
for (row = 1; row <= size; row++) { |
|
||||
ckt->CKTsenRhs[row] = info->SEN_RHS[row][col]; |
|
||||
ckt->CKTseniRhs[row] = info->SEN_iRHS[row][col]; |
|
||||
} |
|
||||
|
|
||||
/* solve for the sensitivity values ( both real and imag parts)*/ |
|
||||
SMPcSolve(ckt->CKTmatrix, ckt->CKTsenRhs, ckt->CKTseniRhs, |
|
||||
ckt->CKTrhsSpare, ckt->CKTirhsSpare); |
|
||||
|
|
||||
/* store the sensitivity values ( both real and imag parts)*/ |
|
||||
for (row = 1; row <= size; row++) { |
|
||||
info->SEN_RHS[row][col] = ckt->CKTsenRhs[row]; |
|
||||
info->SEN_iRHS[row][col] = ckt->CKTseniRhs[row]; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
#ifdef SENSDEBUG |
|
||||
printf("\n"); |
|
||||
printf("CKTomega = %.7e rad/sec\t\n", ckt->CKTomega); |
|
||||
printf("Sensitivity matrix :\n"); |
|
||||
for (row = 1; row <= size; row++) { |
|
||||
rowe = CKTnodName(ckt, row); |
|
||||
for (col = 1; col <= info->SENparms; col++) { |
|
||||
printf("\t"); |
|
||||
printf("RHS(%s,%d) = %.5e", rowe, col, |
|
||||
info->SEN_RHS[row][col]); |
|
||||
printf(" + j %.5e\t", info->SEN_iRHS[row][col]); |
|
||||
printf("\n\n"); |
|
||||
} |
|
||||
printf("\n"); |
|
||||
} |
|
||||
|
|
||||
printf("CKTomega = %.7e rad/sec\t\n", ckt->CKTomega); |
|
||||
printf(" RHS matrix :\n"); |
|
||||
for (row = 1; row <= size; row++) { |
|
||||
for (col = 1; col <= info->SENparms; col++) { |
|
||||
printf(" "); |
|
||||
printf("RHS(%d,%d) = %.7e ", row, col, |
|
||||
info->SEN_RHS[row][col]); |
|
||||
printf("+j %.7e ", info->SEN_iRHS[row][col]); |
|
||||
} |
|
||||
printf("\n"); |
|
||||
} |
|
||||
|
|
||||
printf(" Jacobian matrix for AC :\n"); |
|
||||
for (row = 1; row <= size; row++) { |
|
||||
for (col = 1; col <= size; col++) { |
|
||||
elt = SMPfindElt(ckt->CKTmatrix, row , col , 0); |
|
||||
if (elt) { |
|
||||
printf("%.7e ", elt->Real); |
|
||||
printf("+j%.7e\t", elt->Imag); |
|
||||
} else{ |
|
||||
printf("0.0000000e+00 "); |
|
||||
printf("+j0.0000000e+00\t"); |
|
||||
} |
|
||||
} |
|
||||
printf("\n\n"); |
|
||||
} |
|
||||
#endif |
|
||||
|
|
||||
} |
|
||||
|
|
||||
return OK; |
|
||||
} |
|
||||
@ -1,85 +0,0 @@ |
|||||
/********** |
|
||||
Copyright 1990 Regents of the University of California. All rights reserved. |
|
||||
Author: 1985 Thomas L. Quarles |
|
||||
**********/ |
|
||||
|
|
||||
/* |
|
||||
* This routine performs the DC and Transient sensitivity |
|
||||
* calculations |
|
||||
*/ |
|
||||
|
|
||||
#include "ngspice/ngspice.h" |
|
||||
#include <stdio.h> |
|
||||
#include "ngspice/smpdefs.h" |
|
||||
#include "ngspice/cktdefs.h" |
|
||||
#include "ngspice/devdefs.h" |
|
||||
#include "ngspice/sperror.h" |
|
||||
#include "ngspice/trandefs.h" |
|
||||
#include "ngspice/suffix.h" |
|
||||
|
|
||||
|
|
||||
int |
|
||||
CKTsenDCtran(CKTcircuit *ckt) |
|
||||
{ |
|
||||
int error; |
|
||||
|
|
||||
#ifdef SENSDEBUG |
|
||||
printf("time = %.7e\n", ckt->CKTtime); |
|
||||
printf("CKTsenDCtran\n"); |
|
||||
#endif |
|
||||
|
|
||||
if (ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) && |
|
||||
(ckt->CKTmode & MODEINITTRAN)) |
|
||||
{ |
|
||||
error = CKTsenLoad(ckt); |
|
||||
if (error) |
|
||||
return error; |
|
||||
|
|
||||
#ifdef SENSDEBUG |
|
||||
printf("after inittran senload\n"); |
|
||||
#endif |
|
||||
error = CKTsenUpdate(ckt); |
|
||||
if (error) |
|
||||
return error; |
|
||||
|
|
||||
#ifdef SENSDEBUG |
|
||||
printf("after inittran senupdate\n"); |
|
||||
#endif |
|
||||
|
|
||||
} |
|
||||
|
|
||||
if (ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) && |
|
||||
!(ckt->CKTmode & MODETRANOP)) |
|
||||
{ |
|
||||
ckt->CKTmode = (ckt->CKTmode & (~INITF)) | MODEINITFLOAT; |
|
||||
} |
|
||||
|
|
||||
error = CKTsenLoad(ckt); |
|
||||
if (error) |
|
||||
return error; |
|
||||
|
|
||||
#ifdef SENSDEBUG |
|
||||
printf("after CKTsenLoad\n"); |
|
||||
#endif |
|
||||
|
|
||||
error = CKTsenComp(ckt); |
|
||||
if (error) |
|
||||
return error; |
|
||||
|
|
||||
#ifdef SENSDEBUG |
|
||||
printf("after CKTsenComp\n"); |
|
||||
#endif |
|
||||
|
|
||||
if (ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN)) { |
|
||||
error = CKTsenUpdate(ckt); |
|
||||
if (error) |
|
||||
return error; |
|
||||
|
|
||||
#ifdef SENSDEBUG |
|
||||
printf("after CKTsenUpdate\n"); |
|
||||
#endif |
|
||||
|
|
||||
} |
|
||||
|
|
||||
return OK; |
|
||||
} |
|
||||
@ -1,67 +0,0 @@ |
|||||
/********** |
|
||||
Copyright 1990 Regents of the University of California. All rights reserved. |
|
||||
Author: 1985 Thomas L. Quarles |
|
||||
**********/ |
|
||||
|
|
||||
/* |
|
||||
* CKTsenLoad(ckt) |
|
||||
* this is a driver program to iterate through all the various |
|
||||
* sensitivity load functions provided for the circuit elements |
|
||||
* in the given circuit |
|
||||
*/ |
|
||||
|
|
||||
#include "ngspice/ngspice.h" |
|
||||
#include <stdio.h> |
|
||||
#include "ngspice/smpdefs.h" |
|
||||
#include "ngspice/cktdefs.h" |
|
||||
#include "ngspice/devdefs.h" |
|
||||
#include "ngspice/sperror.h" |
|
||||
#include "ngspice/trandefs.h" |
|
||||
#include "ngspice/suffix.h" |
|
||||
|
|
||||
|
|
||||
int |
|
||||
CKTsenLoad(CKTcircuit *ckt) |
|
||||
{ |
|
||||
int i; |
|
||||
int size,row,col; |
|
||||
int error; |
|
||||
|
|
||||
size = SMPmatSize(ckt->CKTmatrix); |
|
||||
|
|
||||
#ifdef SENSDEBUG |
|
||||
printf("CKTsenLoad\n"); |
|
||||
#endif |
|
||||
|
|
||||
if ((ckt->CKTsenInfo->SENmode == DCSEN) || |
|
||||
(ckt->CKTsenInfo->SENmode == TRANSEN)) |
|
||||
{ |
|
||||
for (col = 0; col <= ckt->CKTsenInfo->SENparms; col++) |
|
||||
for (row = 0; row <= size; row++) |
|
||||
ckt->CKTsenInfo->SEN_RHS[row][col] = 0; |
|
||||
|
|
||||
for (i = 0; i < DEVmaxnum; i++) |
|
||||
if (DEVices[i] && DEVices[i]->DEVsenLoad && ckt->CKThead[i]) { |
|
||||
error = DEVices[i]->DEVsenLoad (ckt->CKThead[i], ckt); |
|
||||
if (error) |
|
||||
return error; |
|
||||
} |
|
||||
|
|
||||
} else { |
|
||||
|
|
||||
for (col = 0; col <= ckt->CKTsenInfo->SENparms; col++) |
|
||||
for (row = 0; row <= size; row++) { |
|
||||
ckt->CKTsenInfo->SEN_RHS[row][col] = 0; |
|
||||
ckt->CKTsenInfo->SEN_iRHS[row][col] = 0; |
|
||||
} |
|
||||
|
|
||||
for (i = 0; i < DEVmaxnum; i++) |
|
||||
if (DEVices[i] && DEVices[i]->DEVsenAcLoad && ckt->CKThead[i]) { |
|
||||
error = DEVices[i]->DEVsenAcLoad (ckt->CKThead[i], ckt); |
|
||||
if (error) |
|
||||
return error; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
return OK; |
|
||||
} |
|
||||
@ -1,30 +0,0 @@ |
|||||
/********** |
|
||||
Copyright 1990 Regents of the University of California. All rights reserved. |
|
||||
Author: 1985 Thomas L. Quarles |
|
||||
**********/ |
|
||||
|
|
||||
#include "ngspice/ngspice.h" |
|
||||
#include <stdio.h> |
|
||||
#include "ngspice/smpdefs.h" |
|
||||
#include "ngspice/cktdefs.h" |
|
||||
#include "ngspice/devdefs.h" |
|
||||
#include "ngspice/sperror.h" |
|
||||
#include "ngspice/trandefs.h" |
|
||||
#include "ngspice/suffix.h" |
|
||||
|
|
||||
|
|
||||
/* CKTsenPrint(ckt) |
|
||||
* this is a driver program to iterate through all the |
|
||||
* various sensitivity print functions provided for |
|
||||
* the circuit elements in the given circuit |
|
||||
*/ |
|
||||
|
|
||||
void |
|
||||
CKTsenPrint(CKTcircuit *ckt) |
|
||||
{ |
|
||||
int i; |
|
||||
|
|
||||
for (i = 0; i < DEVmaxnum; i++) |
|
||||
if (DEVices[i] && DEVices[i]->DEVsenPrint && ckt->CKThead[i]) |
|
||||
DEVices[i]->DEVsenPrint (ckt->CKThead[i], ckt); |
|
||||
} |
|
||||
@ -1,50 +0,0 @@ |
|||||
/********** |
|
||||
Copyright 1990 Regents of the University of California. All rights reserved. |
|
||||
Author: 1985 Thomas L. Quarles |
|
||||
**********/ |
|
||||
|
|
||||
|
|
||||
/* |
|
||||
* CKTsenSetup(ckt) |
|
||||
* this is a driver program to iterate through all the various |
|
||||
* sensitivity setup functions provided for the circuit elements |
|
||||
* in the given circuit |
|
||||
*/ |
|
||||
|
|
||||
#include "ngspice/ngspice.h" |
|
||||
#include <stdio.h> |
|
||||
#include "ngspice/smpdefs.h" |
|
||||
#include "ngspice/cktdefs.h" |
|
||||
#include "ngspice/devdefs.h" |
|
||||
#include "ngspice/sperror.h" |
|
||||
#include "ngspice/trandefs.h" |
|
||||
#include "ngspice/suffix.h" |
|
||||
|
|
||||
|
|
||||
int |
|
||||
CKTsenSetup(CKTcircuit *ckt) |
|
||||
{ |
|
||||
int i; |
|
||||
int error; |
|
||||
SENstruct *info; |
|
||||
|
|
||||
#ifdef SENSDEBUG |
|
||||
printf("CKTsenSetup\n"); |
|
||||
#endif |
|
||||
|
|
||||
info = ckt->CKTsenInfo; |
|
||||
info->SENparms = 0; |
|
||||
|
|
||||
for (i = 0; i < DEVmaxnum; i++) |
|
||||
if (DEVices[i] && DEVices[i]->DEVsenSetup && ckt->CKThead[i]) { |
|
||||
error = DEVices[i]->DEVsenSetup (info, ckt->CKThead[i]); |
|
||||
if (error) |
|
||||
return error; |
|
||||
} |
|
||||
|
|
||||
#ifdef SENSDEBUG |
|
||||
printf("CKTsenSetup end\n"); |
|
||||
#endif |
|
||||
|
|
||||
return OK; |
|
||||
} |
|
||||
@ -1,5 +0,0 @@ |
|||||
|
|
||||
This directory contains code for an old, unsupported sensitivity analysis. |
|
||||
It is not used in the current distribution and will be removed in the |
|
||||
future. |
|
||||
|
|
||||
@ -1,73 +0,0 @@ |
|||||
/********** |
|
||||
Copyright 1990 Regents of the University of California. All rights reserved. |
|
||||
Author: 1985 Thomas L. Quarles |
|
||||
**********/ |
|
||||
|
|
||||
/* SENdestroy(ckt) |
|
||||
* this is a driver program to iterate through all the various |
|
||||
* destroy functions provided for the circuit elements in the |
|
||||
* given circuit |
|
||||
*/ |
|
||||
|
|
||||
#include "ngspice/ngspice.h" |
|
||||
#include <stdio.h> |
|
||||
#include "ngspice/cktdefs.h" |
|
||||
#include "ngspice/devdefs.h" |
|
||||
#include "ngspice/ifsim.h" |
|
||||
#include "ngspice/sperror.h" |
|
||||
#include "ngspice/suffix.h" |
|
||||
|
|
||||
void |
|
||||
SENdestroy(SENstruct *info) |
|
||||
{ |
|
||||
int i; |
|
||||
int size; |
|
||||
|
|
||||
size = info->SENsize; |
|
||||
|
|
||||
#ifdef SENSDEBUG |
|
||||
printf("size = %d\n", size); |
|
||||
printf("freeing sensitivity structure in SENdestroy\n"); |
|
||||
#endif |
|
||||
|
|
||||
/* |
|
||||
if (info->SENdevices) FREE(info->SENdevices); |
|
||||
if (info->SENparmNames) FREE(info->SENparmNames); |
|
||||
*/ |
|
||||
|
|
||||
if (info->SEN_Sap) { |
|
||||
|
|
||||
#ifdef SENSDEBUG |
|
||||
printf("freeing SEN_Sap in SENdestroy\n"); |
|
||||
#endif |
|
||||
|
|
||||
for (i = 0; i <= size; i++) |
|
||||
if (info->SEN_Sap[i]) |
|
||||
FREE(info->SEN_Sap[i]); |
|
||||
FREE(info->SEN_Sap); |
|
||||
} |
|
||||
|
|
||||
if (info->SEN_RHS) { |
|
||||
for (i = 0; i <= size; i++) |
|
||||
if (info->SEN_RHS[i]) |
|
||||
FREE(info->SEN_RHS[i]); |
|
||||
FREE(info->SEN_RHS); |
|
||||
} |
|
||||
|
|
||||
if (info->SEN_iRHS) { |
|
||||
for (i = 0; i <= size; i++) |
|
||||
if (info->SEN_iRHS[i]) |
|
||||
FREE(info->SEN_iRHS[i]); |
|
||||
FREE(info->SEN_Sap); |
|
||||
} |
|
||||
|
|
||||
/* |
|
||||
FREE(info); |
|
||||
*/ |
|
||||
|
|
||||
#ifdef SENSDEBUG |
|
||||
printf("SENdestroy end\n"); |
|
||||
#endif |
|
||||
|
|
||||
return; |
|
||||
} |
|
||||
@ -1,96 +0,0 @@ |
|||||
/********** |
|
||||
Copyright 1990 Regents of the University of California. All rights reserved. |
|
||||
Author: 1985 Thomas L. Quarles |
|
||||
**********/ |
|
||||
|
|
||||
#include "ngspice/ngspice.h" |
|
||||
#include <stdio.h> |
|
||||
#include "ngspice/ifsim.h" |
|
||||
#include "ngspice/iferrmsg.h" |
|
||||
#include "ngspice/sen2defs.h" |
|
||||
#include "ngspice/cktdefs.h" |
|
||||
#include "ngspice/suffix.h" |
|
||||
#include "../spicelib/analysis/analysis.h" |
|
||||
|
|
||||
|
|
||||
int |
|
||||
SENsetParm(CKTcircuit *ckt, JOB *anal, int which, IFvalue *value) |
|
||||
{ |
|
||||
SENstruct *job = (SENstruct *) anal; |
|
||||
|
|
||||
NG_IGNORE(ckt); |
|
||||
|
|
||||
switch(which) { |
|
||||
|
|
||||
case SEN_DC: |
|
||||
if (value->iValue) |
|
||||
job->SENmode |= DCSEN; |
|
||||
break; |
|
||||
|
|
||||
case SEN_AC: |
|
||||
if (value->iValue) |
|
||||
job->SENmode |= ACSEN; |
|
||||
break; |
|
||||
|
|
||||
case SEN_TRAN: |
|
||||
if (value->iValue) |
|
||||
job->SENmode |= TRANSEN; |
|
||||
break; |
|
||||
|
|
||||
case SEN_DEV: |
|
||||
job->SENnumVal += 1; |
|
||||
if (!job->SENdevices) { |
|
||||
job->SENdevices = TMALLOC(char *, job->SENnumVal); |
|
||||
if (job->SENdevices == NULL) |
|
||||
return E_NOMEM; |
|
||||
job->SENparmNames = TMALLOC(char *, job->SENnumVal); |
|
||||
if (job->SENparmNames == NULL) |
|
||||
return E_NOMEM; |
|
||||
} else { |
|
||||
job->SENdevices = TREALLOC(char *, job->SENdevices, job->SENnumVal); |
|
||||
if (job->SENdevices == NULL) |
|
||||
return E_NOMEM; |
|
||||
job->SENparmNames = TREALLOC(char *, job->SENparmNames, job->SENnumVal); |
|
||||
if (job->SENparmNames == NULL) |
|
||||
return E_NOMEM; |
|
||||
} |
|
||||
job->SENdevices [job->SENnumVal - 1] = value->sValue; |
|
||||
break; |
|
||||
|
|
||||
case SEN_PARM: |
|
||||
job->SENparmNames [job->SENnumVal - 1] = value->sValue; |
|
||||
break; |
|
||||
|
|
||||
default: |
|
||||
return E_BADPARM; |
|
||||
} |
|
||||
|
|
||||
return OK; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
static IFparm SENparms[] = { |
|
||||
{ "dc", SEN_DC, IF_SET|IF_FLAG, "sensitivity in DC analysis" }, |
|
||||
{ "op", SEN_DC, IF_SET|IF_FLAG, "sensitivity in DCop analysis" }, |
|
||||
{ "ac", SEN_AC, IF_SET|IF_FLAG, "sensitivity in AC analysis" }, |
|
||||
{ "tran", SEN_TRAN, IF_SET|IF_FLAG, "sensitivity in transient analysis"}, |
|
||||
{ "dev", SEN_DEV, IF_SET|IF_INSTANCE, "instance with design param." }, |
|
||||
{ "parm", SEN_PARM, IF_SET|IF_STRING, "name of design parameter" }, |
|
||||
}; |
|
||||
|
|
||||
SPICEanalysis SEN2info = { |
|
||||
{ |
|
||||
"SENS2", |
|
||||
"Sensitivity analysis", |
|
||||
|
|
||||
NUMELEMS(SENparms), |
|
||||
SENparms |
|
||||
}, |
|
||||
sizeof(SENstruct), |
|
||||
NODOMAIN, |
|
||||
0, |
|
||||
SENsetParm, |
|
||||
SENaskQuest, |
|
||||
NULL, |
|
||||
SENstartup |
|
||||
}; |
|
||||
@ -1,29 +0,0 @@ |
|||||
/********** |
|
||||
Copyright 1990 Regents of the University of California. All rights reserved. |
|
||||
Author: 1985 Thomas L. Quarles |
|
||||
**********/ |
|
||||
|
|
||||
#include "ngspice/ngspice.h" |
|
||||
#include <stdio.h> |
|
||||
#include "ngspice/ifsim.h" |
|
||||
#include "ngspice/iferrmsg.h" |
|
||||
#include "ngspice/sen2defs.h" |
|
||||
#include "ngspice/cktdefs.h" |
|
||||
#include "ngspice/suffix.h" |
|
||||
|
|
||||
|
|
||||
int |
|
||||
SENaskQuest(CKTcircuit *ckt, JOB *anal, int which, IFvalue *value) |
|
||||
{ |
|
||||
NG_IGNORE(ckt); |
|
||||
NG_IGNORE(anal); |
|
||||
NG_IGNORE(value); |
|
||||
|
|
||||
switch(which) { |
|
||||
|
|
||||
default: |
|
||||
break; |
|
||||
} |
|
||||
|
|
||||
return E_BADPARM; |
|
||||
} |
|
||||
@ -1,67 +0,0 @@ |
|||||
/********** |
|
||||
Copyright 1990 Regents of the University of California. All rights reserved. |
|
||||
Author: 1985 Thomas L. Quarles |
|
||||
**********/ |
|
||||
|
|
||||
#include "ngspice/ngspice.h" |
|
||||
#include <stdio.h> |
|
||||
#include "ngspice/ifsim.h" |
|
||||
#include "ngspice/cktdefs.h" |
|
||||
#include "ngspice/const.h" |
|
||||
#include "ngspice/sperror.h" |
|
||||
#include "ngspice/suffix.h" |
|
||||
|
|
||||
/* This is a routine to initialize the sensitivity |
|
||||
* data structure |
|
||||
*/ |
|
||||
|
|
||||
int |
|
||||
SENstartup(CKTcircuit *ckt, int restart) |
|
||||
{ |
|
||||
int i; |
|
||||
int err; |
|
||||
IFvalue parmtemp; |
|
||||
int type; |
|
||||
GENinstance *fast; |
|
||||
|
|
||||
if (restart) { |
|
||||
fprintf(stdout, "Sensitivity-2 analysis: unsupported code\n"); |
|
||||
} |
|
||||
|
|
||||
#ifdef SENSDEBUG |
|
||||
printf("SENstartup\n"); |
|
||||
#endif |
|
||||
|
|
||||
ckt->CKTsenInfo->SENstatus = NORMAL; |
|
||||
ckt->CKTsenInfo->SENpertfac = 1e-4; |
|
||||
ckt->CKTsenInfo->SENinitflag = ON; /* allocate memory in NIsenReinit */ |
|
||||
|
|
||||
parmtemp.rValue = 1.0; |
|
||||
|
|
||||
for (i = 0; i < ckt->CKTsenInfo->SENnumVal; i++) { |
|
||||
|
|
||||
fast = CKTfndDev(ckt, ckt->CKTsenInfo->SENdevices[i]); |
|
||||
if (!fast) |
|
||||
return E_NODEV; |
|
||||
|
|
||||
type = fast->GENmodPtr->GENmodType; |
|
||||
|
|
||||
#ifdef SENSDEBUG |
|
||||
printf("SENstartup Instance: %s Design parameter: %s\n", ckt->CKTsenInfo->SENdevices[i], |
|
||||
ckt->CKTsenInfo->SENparmNames[i]); |
|
||||
#endif |
|
||||
err = CKTpName( |
|
||||
ckt->CKTsenInfo->SENparmNames[i], |
|
||||
&parmtemp, ckt, type, |
|
||||
ckt->CKTsenInfo->SENdevices[i], |
|
||||
&fast); |
|
||||
if (err != OK) |
|
||||
return err; |
|
||||
} |
|
||||
|
|
||||
#ifdef SENSDEBUG |
|
||||
printf("SENstartup end\n"); |
|
||||
#endif |
|
||||
|
|
||||
return OK; |
|
||||
} |
|
||||
@ -1,286 +0,0 @@ |
|||||
/********** |
|
||||
Copyright 1990 Regents of the University of California. All rights reserved. |
|
||||
Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group |
|
||||
**********/ |
|
||||
|
|
||||
/* |
|
||||
* Do remote spice jobs. The first line transmitted will be of the |
|
||||
* format: "user host program". The program field may be left out, |
|
||||
* in which case it defaults to SPICE_PATH. The program is then |
|
||||
* executed, with the single argument "-S". The remote host should |
|
||||
* wait for a response from spiced before sending any data -- so |
|
||||
* far the only response sent is "ok". |
|
||||
* Eventually we will want to deal with load-balancing |
|
||||
* of spice jobs. |
|
||||
*/ |
|
||||
|
|
||||
#include "spice.h" |
|
||||
#include <stdio.h> |
|
||||
#include "strext.h" |
|
||||
#include <errno.h> |
|
||||
#include <sys/types.h> |
|
||||
|
|
||||
#ifdef HAS_BSDSOCKETS |
|
||||
#include <sys/socket.h> |
|
||||
#include <netinet/in.h> |
|
||||
#include <netdb.h> |
|
||||
|
|
||||
#ifdef HAS_BSDRUSAGE |
|
||||
#include <sys/time.h> |
|
||||
#include <sys/resource.h> |
|
||||
#else |
|
||||
|
|
||||
#ifdef HAS_SYSVRUSAGE |
|
||||
#include <time.h> |
|
||||
#include <fcntl.h> |
|
||||
#endif |
|
||||
#endif |
|
||||
|
|
||||
#include <sys/ioctl.h> |
|
||||
#include <sys/file.h> |
|
||||
|
|
||||
/* Better have #ifdef HAS_UNIX_SIGS XXX */ |
|
||||
#include <signal.h> |
|
||||
/* Better have #ifdef HAS_WAIT XXX */ |
|
||||
#include <sys/wait.h> |
|
||||
|
|
||||
#include "ngspice/suffix.h" |
|
||||
|
|
||||
#define MAXJOBS 2 |
|
||||
|
|
||||
int nrunning = 0; |
|
||||
int maxjobs = MAXJOBS; |
|
||||
|
|
||||
extern int errno; |
|
||||
extern char *sys_errlist[]; |
|
||||
extern char **environ; |
|
||||
|
|
||||
/* ARGSUSED */ |
|
||||
void |
|
||||
main(ac, av) |
|
||||
char **av; |
|
||||
{ |
|
||||
int s, inetd = 0; |
|
||||
struct servent *sp; |
|
||||
struct protoent *pp; |
|
||||
struct sockaddr_in from, sin; |
|
||||
int g, i, len = sizeof (struct sockaddr_in); |
|
||||
void dostuff(); |
|
||||
int sigchild(); |
|
||||
FILE *fp; |
|
||||
char *datestring(); |
|
||||
|
|
||||
/* Process arguments. */ |
|
||||
|
|
||||
ivars(NULL); |
|
||||
|
|
||||
av++; |
|
||||
while (*av) { |
|
||||
if (!strcmp(*av, "-i")) |
|
||||
inetd++; |
|
||||
else |
|
||||
maxjobs = atoi(av[1]); |
|
||||
av++; |
|
||||
} |
|
||||
|
|
||||
if (inetd == 0) { |
|
||||
/* Find out who we are. */ |
|
||||
sp = getservbyname("spice", "tcp"); |
|
||||
if (sp == NULL) { |
|
||||
fprintf(stderr, "Error: spice/tcp: unknown service\n"); |
|
||||
exit(1); |
|
||||
} |
|
||||
pp = getprotobyname("tcp"); |
|
||||
if (pp == NULL) { |
|
||||
fprintf(stderr, "Error: tcp: unknown protocol\n"); |
|
||||
exit(1); |
|
||||
} |
|
||||
|
|
||||
/* Create the socket. */ |
|
||||
s = socket(AF_INET, SOCK_STREAM, pp->p_proto); |
|
||||
if (s < 0) { |
|
||||
perror("spiced: socket"); |
|
||||
exit(1); |
|
||||
} |
|
||||
sin.sin_port = sp->s_port; |
|
||||
if (bind(s, (struct sockaddr *) &sin, sizeof |
|
||||
(struct sockaddr_in)) < 0) { |
|
||||
perror("spiced: bind"); |
|
||||
exit(1); |
|
||||
} |
|
||||
|
|
||||
#ifndef DEBUG |
|
||||
/* Disconnect from the controlling terminal. */ |
|
||||
if (fork()) |
|
||||
exit(0); |
|
||||
for (i = 0; i < 10; i++) |
|
||||
if (i != s) |
|
||||
(void) close(i); |
|
||||
(void) open("/", O_RDONLY); |
|
||||
(void) dup2(0, 1); |
|
||||
(void) dup2(0, 2); |
|
||||
i = open("/dev/tty", O_RDWR); |
|
||||
if (i > 0) { |
|
||||
(void) ioctl(i, TIOCNOTTY, NULL); |
|
||||
(void) close(i); |
|
||||
} |
|
||||
|
|
||||
#endif |
|
||||
|
|
||||
#ifdef SIGCHLD |
|
||||
(void) signal(SIGCHLD, sigchild); |
|
||||
#else |
|
||||
#ifdef SIGCLD |
|
||||
(void) signal(SIGCLD, sigchild); |
|
||||
#endif |
|
||||
#endif |
|
||||
fp = fopen(Spiced_Log, "a"); |
|
||||
fprintf(fp, "\n-- new daemon, pid = %d, date = %s\n\n", |
|
||||
getpid(), datestring()); |
|
||||
(void) fclose(fp); |
|
||||
|
|
||||
/* Start (void) listening for requests. */ |
|
||||
(void) listen(s, 5); |
|
||||
for (;;) { |
|
||||
g = accept(s, (struct sockaddr *) &from, &len); |
|
||||
if (g < 0) { |
|
||||
if (errno != EINTR) { |
|
||||
fp = fopen(Spiced_Log, "a"); |
|
||||
fprintf(fp, "\n>>> accept: %s\n\n", |
|
||||
sys_errlist[errno]); |
|
||||
exit(1); |
|
||||
} |
|
||||
continue; |
|
||||
} |
|
||||
if (!fork()) { |
|
||||
(void) close(s); |
|
||||
#ifdef SIGCHLD |
|
||||
(void) signal(SIGCHLD, SIG_IGN); |
|
||||
#else |
|
||||
#ifdef SIGCLD |
|
||||
(void) signal(SIGCLD, SIG_IGN); |
|
||||
#endif |
|
||||
#endif |
|
||||
dostuff(g); |
|
||||
} |
|
||||
nrunning++; |
|
||||
(void) close(g); |
|
||||
} |
|
||||
} else { |
|
||||
/* All this is already done for us. */ |
|
||||
dostuff(0); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
void |
|
||||
dostuff(s) |
|
||||
{ |
|
||||
FILE *fp; |
|
||||
char *datestring(); |
|
||||
char buf[BUFSIZ], user[16], host[32], program[128]; |
|
||||
char *argv[3], *t; |
|
||||
int i, rc; |
|
||||
#ifdef HAS_INTWAITSTATUS |
|
||||
int stats; |
|
||||
#else |
|
||||
union wait stats; |
|
||||
#endif |
|
||||
#ifdef HAS_BSDRUSAGE |
|
||||
struct rusage ru; |
|
||||
#endif |
|
||||
|
|
||||
/* Should do some sort of verification */ |
|
||||
i = read(s, buf, BUFSIZ); |
|
||||
if (i < 0) { |
|
||||
perror("spiced: read"); |
|
||||
exit(1); |
|
||||
} |
|
||||
i = sscanf(buf, "%s %s %s", user, host, program); |
|
||||
if (i < 2) { |
|
||||
fprintf(stderr, "Error: bad init line: %s\n", buf); |
|
||||
exit(1); |
|
||||
} |
|
||||
if (i == 2) |
|
||||
(void) strcpy(program, tilde_expand(Spice_Path)); |
|
||||
|
|
||||
if (nrunning > maxjobs - 1) { |
|
||||
/* Too many people. */ |
|
||||
(void) write(s, "toomany", 8); |
|
||||
fp = fopen(Spiced_Log, "a"); |
|
||||
fprintf(fp, "%s: %s@%s: turned down - %d jobs now\n", |
|
||||
datestring(), user, host, nrunning); |
|
||||
(void) fclose(fp); |
|
||||
exit(0); |
|
||||
} |
|
||||
(void) write(s, "ok", 3); |
|
||||
|
|
||||
if ((i = fork()) == 0) { |
|
||||
(void) dup2(s, 0); |
|
||||
(void) dup2(s, 1); |
|
||||
(void) dup2(s, 2); |
|
||||
argv[0] = program; |
|
||||
argv[1] = "-S"; |
|
||||
argv[2] = NULL; |
|
||||
(void) execve(program, argv, environ); |
|
||||
perror(program); |
|
||||
exit(1); |
|
||||
} |
|
||||
#ifdef HAS_BSDRUSAGE |
|
||||
/* Assume BSDRUSAGE -> wait3( ) XXX */ |
|
||||
if (wait3(&stats, 0, &ru) != i) { |
|
||||
perror("wait"); |
|
||||
exit(1); |
|
||||
} |
|
||||
#else |
|
||||
#ifdef HAS_WAIT |
|
||||
wait(&stats); |
|
||||
rc = 0; |
|
||||
rc = WEXITSTATUS(stats); |
|
||||
#endif |
|
||||
#endif |
|
||||
|
|
||||
/* Write a log entry. */ |
|
||||
#ifdef HAS_BSDRUSAGE |
|
||||
(void) sprintf(buf, "%d:%d.%6d", ru.ru_utime.tv_sec / 60, |
|
||||
ru.ru_utime.tv_sec % 60, ru.ru_utime.tv_usec); |
|
||||
for (t = buf; *t; t++) |
|
||||
; |
|
||||
for (t--; *t == '0'; *t-- = '\0') |
|
||||
; |
|
||||
#else |
|
||||
(void) strcpy(buf, "unknown"); |
|
||||
#endif |
|
||||
fp = fopen(Spiced_Log, "a"); |
|
||||
fprintf(fp, "%s: %s@%s: %s - \n\texit %d, time %s\n", |
|
||||
datestring(), user, host, program, rc, |
|
||||
buf); |
|
||||
(void) fclose(fp); |
|
||||
exit(0); |
|
||||
} |
|
||||
|
|
||||
/* Don't care what happens to the child */ |
|
||||
|
|
||||
int |
|
||||
sigchild() |
|
||||
{ |
|
||||
int pid; |
|
||||
FILE *fp; |
|
||||
|
|
||||
pid = wait(NULL); |
|
||||
if (pid == -1) { |
|
||||
fp = fopen(Spiced_Log, "a"); |
|
||||
fprintf(fp, "\n>>>spiced: wait: %s\n\n", sys_errlist[errno]); |
|
||||
(void) fclose(fp); |
|
||||
} else |
|
||||
nrunning--; |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
#else /* not HAS_BSDSOCKETS */ |
|
||||
main( ) |
|
||||
{ |
|
||||
fprintf(stderr, |
|
||||
"The program \"spiced\" is not available on this system.\n"); |
|
||||
exit(1); |
|
||||
} |
|
||||
#endif /* HAS_BSDSOCKETS */ |
|
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue