KiCad PCB EDA Suite
spice_settings.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2021 CERN
5 *
6 * @author Wayne Stambaugh <[email protected]>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 3
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * https://www.gnu.org/licenses/gpl-3.0.html
21 * or you may search the http://www.gnu.org website for the version 3 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
26#include "spice_settings.h"
27#include <settings/parameters.h>
28
29
31
32
34 const std::string& aPath ) :
35 NESTED_SETTINGS( "simulator", spiceSettingsSchemaVersion, aParent, aPath ),
36 m_fixPassiveVals( false ),
37 m_fixIncludePaths( true )
38{
39 m_params.emplace_back( new PARAM<wxString>( "workbook_filename", &m_workbookFilename, "" ) );
40 m_params.emplace_back( new PARAM<bool>( "fix_passive_vals", &m_fixPassiveVals, false ) );
41 m_params.emplace_back( new PARAM<bool>( "fix_include_paths", &m_fixIncludePaths, true ) );
42}
43
44
46{
50}
51
52
54 JSON_SETTINGS* aParent, const std::string& aPath ) :
55 SPICE_SIMULATOR_SETTINGS( aParent, aPath ),
56 m_modelMode( NGSPICE_MODEL_MODE::USER_CONFIG )
57{
58 m_params.emplace_back( new PARAM_ENUM<NGSPICE_MODEL_MODE>( "model_mode", &m_modelMode,
62}
63
64
66{
67 const NGSPICE_SIMULATOR_SETTINGS* settings =
68 dynamic_cast<const NGSPICE_SIMULATOR_SETTINGS*>( &aRhs );
69
70 wxCHECK( settings, false );
71
72 return ( *static_cast<const SPICE_SIMULATOR_SETTINGS*>( this ) ) == aRhs
73 && m_modelMode == settings->m_modelMode;
74}
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)
NESTED_SETTINGS is a JSON_SETTINGS that lives inside a JSON_SETTINGS.
Container for Ngspice simulator settings.
NGSPICE_MODEL_MODE m_modelMode
bool operator==(const SPICE_SIMULATOR_SETTINGS &aRhs) const override
NGSPICE_SIMULATOR_SETTINGS(JSON_SETTINGS *aParent, const std::string &aPath)
Stores an enum as an integer.
Definition: parameters.h:217
Storage for simulator specific settings.
SPICE_SIMULATOR_SETTINGS(JSON_SETTINGS *aParent, const std::string &aPath)
virtual bool operator==(const SPICE_SIMULATOR_SETTINGS &aRhs) const =0
const int spiceSettingsSchemaVersion
NGSPICE_MODEL_MODE
Ngspice simulator model compatibility modes.