KiCad PCB EDA Suite
dialog_spice_model.cpp File Reference
#include "wildcards_and_files_ext.h"
#include "dialog_spice_model.h"
#include <sim/spice_value.h>
#include <confirm.h>
#include <project.h>
#include <wx/tokenzr.h>
#include <wx/wupdlock.h>
#include <cctype>

Go to the source code of this file.

Classes

struct  SPICE_MODEL_INFO
 

Functions

static bool empty (const wxTextCtrl *aCtrl)
 
static int wxCALLBACK comparePwlValues (wxIntPtr aItem1, wxIntPtr aItem2, wxIntPtr WXUNUSED(aSortData))
 
static int getModelTypeIdx (char aPrimitive)
 

Variables

static const std::vector< SPICE_MODEL_INFOmodelTypes
 

Function Documentation

static int wxCALLBACK comparePwlValues ( wxIntPtr  aItem1,
wxIntPtr  aItem2,
wxIntPtr   WXUNUSEDaSortData 
)
static

Definition at line 45 of file dialog_spice_model.cpp.

Referenced by DIALOG_SPICE_MODEL::addPwlValue().

46 {
47  float* t1 = reinterpret_cast<float*>( &aItem1 );
48  float* t2 = reinterpret_cast<float*>( &aItem2 );
49 
50  if( *t1 > *t2 )
51  return 1;
52 
53  if( *t1 < *t2 )
54  return -1;
55 
56  return 0;
57 }
static bool empty ( const wxTextCtrl *  aCtrl)
static

Definition at line 38 of file dialog_spice_model.cpp.

Referenced by DIALOG_SPICE_MODEL::generatePowerSource(), DIALOG_SPICE_MODEL::TransferDataFromWindow(), and DIALOG_SPICE_MODEL::TransferDataToWindow().

39 {
40  return aCtrl->GetValue().IsEmpty();
41 }
static int getModelTypeIdx ( char  aPrimitive)
static

Definition at line 81 of file dialog_spice_model.cpp.

References i, and SPICE_MODEL_INFO::type.

Referenced by DIALOG_SPICE_MODEL::onModelSelected(), and DIALOG_SPICE_MODEL::TransferDataToWindow().

82 {
83  const char prim = std::toupper( aPrimitive );
84 
85  for( size_t i = 0; i < modelTypes.size(); ++i )
86  {
87  if( modelTypes[i].type == prim )
88  return i;
89  }
90 
91  return -1;
92 }
size_t i
Definition: json11.cpp:597
static const std::vector< SPICE_MODEL_INFO > modelTypes

Variable Documentation

const std::vector<SPICE_MODEL_INFO> modelTypes
static
Initial value:
=
{
{ SP_DIODE, _( "Diode" ), { "d" } },
{ SP_BJT, _( "BJT" ), { "npn", "pnp" } },
{ SP_MOSFET, _( "MOSFET" ), { "nmos", "pmos", "vdmos" } },
{ SP_JFET, _( "JFET" ), { "njf", "pjf" } },
{ SP_SUBCKT, _( "Subcircuit" ), {} },
}

Definition at line 70 of file dialog_spice_model.cpp.