2 #include "matplotlibcpp.h"
16 #include <ShObjIdl_core.h>
29 main(
int argc,
char * argv[]) {
33 char buffer[MAX_PATH];
34 GetModuleFileNameA(NULL, buffer, MAX_PATH);
35 std::string::size_type pos = std::string(buffer).find_last_of(
"\\/");
36 _chdir(std::string(buffer).substr(0, pos).c_str());
39 wchar_t bufferW[MAX_PATH];
40 GetModuleFileNameW(NULL, bufferW, MAX_PATH);
41 std::string::size_type posW = std::wstring(bufferW).find_last_of(L
"\\/");
42 std::wstring exePathW = std::wstring(bufferW).substr(0, posW);
46 std::string filePath =
"Netlists/Diode Test.netlist";
49 std::cout <<
"Using netlist: " << filePath;
56 HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED |
57 COINIT_DISABLE_OLE1DDE);
59 IFileOpenDialog * pFileOpen;
60 IShellItem * defaultFolder;
63 hr = CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_ALL,
65 reinterpret_cast<void **
>(&pFileOpen));
66 std::wstring defaultNetlistPath = exePathW + L
"\\Netlists";
67 SHCreateItemFromParsingName(defaultNetlistPath.c_str(), NULL,
69 reinterpret_cast<void **
>(&defaultFolder));
70 pFileOpen->SetDefaultFolder(defaultFolder);
71 pFileOpen->SetFolder(defaultFolder);
75 hr = pFileOpen->Show(NULL);
80 hr = pFileOpen->GetResult(&pItem);
83 hr = pItem->GetDisplayName(SIGDN_FILESYSPATH, &pszFilePath);
88 WideCharToMultiByte(CP_UTF8, 0, pszFilePath, -1, buffer,
89 MAX_PATH, NULL, NULL);
90 filePath = std::string(buffer);
91 CoTaskMemFree(pszFilePath);
100 std::cout <<
"Using netlist: " << filePath;
102 std::cout <<
"No path given. Defaulting to using netlist: " << filePath;
105 std::cout << std::endl;
int main(int argc, char *argv[])
main function to launch the circuit simulator
The main class to hold all of the relevant simulation data.
void simulate()
Where a lot of the magic starts. This is what runs the simulation.