If true, FasterCap was able to quit. If false, FasterCap couldn't quit (possibly because there's a simulaton on going; try to stop it before quitting).
21 |
22 |
19 |
20 | FasterCap can be launched through COM Automation. This is a propietary MS technology implemented under Windows. COM Automation is not available under Linux.
21 |
FasterCap's Automation interface allows a remote application to fully control FasterCap, either showing the GUI or as a GUI-less solver engine.
22 |
For details about the Automation interface, please see the relevant Automation section.
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/hlp/Automation/GetSolveMemoryMethod.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
The method returns a 1-dimensional safe-array encapsulated in a variant data. The array contains the names of the conductors to which the capacitance matrix rows / columns refer.
21 |
Notes:
22 | The array dimensions can be queried from the safe array itself, see the 'safe array' topic in the MS Automation documentation.
23 |
24 |
Parameters
25 |
None
26 |
27 |
Remarks
28 |
Gets conductor names for the rows / columns of the capacitance matrix.
29 |
30 |
28 | It could take some time before FasterCap actually stops, depending on the operation currently under execution. You can poll FasterCap status checking the IsRunning property or you can set a callback upon FasterCap end of operation using the SetEndCallback method.
29 |
30 |
The method returns a 2-dimensional safe-array encapsulated in a variant data. The array contains the capacitance matrix as calculated by FasterCap, in Farads. The first dimension of the array is the row index, the second is the column index.
21 |
Notes:
22 | The array dimensions can be queried from the safe array itself, see the 'safe array' topic in the MS Automation documentation.
23 |
24 |
Parameters
25 |
None
26 |
27 |
Remarks
28 |
Gets the capacitance values calculated by FasterCap, result of the simulation.
29 |
30 |
True if FasterCap was able to start a simulation, false otherwise.
21 |
Notes:
22 | A reason why FasterCap could not be able to start a simulation is that a simulation is already running. You can try to stop FasterCap before retrying and / or poll FasterCap status.
23 |
24 |
Parameters
25 |
26 | commandLine
27 |
A string containing a FasterCap command line, as would be given from a shell console.
The method returns a 2-dimensional safe-array encapsulated in a variant data. The array contains the imaginary part of the complex capacitance matrix as calculated by FasterCap (i.e. the conductance divided by 2*pi*f, where pi is pi greek and f is the frequency of interest). The first dimension of the array is the row index, the second is the column index.
21 |
Notes:
22 | The array dimensions can be queried from the safe array itself, see the 'safe array' topic in the MS Automation documentation.
23 |
24 |
Parameters
25 |
None
26 |
27 |
Remarks
28 |
Gets the conductance values calculated by FasterCap, result of the simulation.
29 |
30 |
Syntax: N <oldcondname> <newcondname>
21 |
22 |
23 |
The 'N' element at the beginning of a line renames a conductor. More specifically, it associates all the panels previously assigned to the conductor named <oldcondname> to the conductor named <newcondname>.
24 |
25 |
This input file fragments specifies a cubic conductor whose name is '1'. The conductor is then renamed to a more user-friendly name mycube.
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/hlp/Automation/SetEndCallbackMethod.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
True if a callback function was set. False if the callback function is reset to default (no callback).
21 |
22 |
Parameters
23 |
24 | callback
25 |
Pointer to the client's automation object exposing the callback function. If NULL is passed as argument, the callback will be removed.
26 |
27 | cbName
28 |
Name of the callback function.
29 |
The callback function must have the following prototype:
30 |
void cbName()
31 |
32 |
Remarks
33 |
Call this function to set a callback upon FasterCap simulation end. That is, when FasterCap has finished the simulation and results are available, the cbName function will be called to notify the client.
34 |
35 |
See Also
36 |
FasterCap Automation Overview | IsRunning Property | SetLogCallback Method
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/test.h:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | * *
3 | * Copyright (c) 2017 *
4 | * FastFieldSolvers S.R.L. http://www.fastfieldsolvers.com *
5 | * *
6 | * This program is free software; you can redistribute it and/or modify *
7 | * it under the terms of the GNU Lesser General Public License (LGPL) *
8 | * as published by the Free Software Foundation; either version 2 of *
9 | * the License, or (at your option) any later version. *
10 | * for detail see the LICENCE text file. *
11 | * *
12 | * This program is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Library General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Library General Public *
18 | * License along with this program; if not, write to the Free Software *
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
20 | * USA *
21 | * *
22 | ***************************************************************************/
23 |
24 |
25 | #ifndef TEST_INCLUDED_H
26 | #define TEST_INCLUDED_H
27 |
28 | void test_pot2D();
29 |
30 | #endif //TEST_INCLUDED_H
31 |
--------------------------------------------------------------------------------
/hlp/Output/Output_ch02.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
The header provides basic informations about the simulation that is going to be run.
21 |
22 |
23 |
24 | Running FasterCap version 5.0.2
25 | Copyright 2013 FastFieldSolvers S.r.l. http://www.fastfieldsolvers.com, All Rights reserved
26 | Starting capacitance extraction with the following parameters:
27 | Input file: C:\Documents and Settings\All Users\Documents\FastFieldSolvers\FasterCap\cubes.lst
28 | Auto calculation with max error: 0.01
29 | Remark: Auto option overrides all other Manual settings
30 |
31 | Solution scheme (-g): Collocation, GMRES tolerance (-t): 0.005
32 | Out-of-core free memory to link memory condition (-f): 5
33 | Potential interaction coefficient to mesh refinement ratio (-d): 1
34 | Mesh curvature (-mc): 3
35 | Number of input panels to solver engine: 24
36 |
37 |
38 |
39 |
In particular, besides the version and copyright information, you have:
40 |
41 |
42 |
The input file name (root file), including the full path
43 |
The total number of input panels, as found in the input files structure
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/Solver/SphereGen.h:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | * *
3 | * Copyright (c) 2017 *
4 | * FastFieldSolvers S.R.L. http://www.fastfieldsolvers.com *
5 | * *
6 | * This program is free software; you can redistribute it and/or modify *
7 | * it under the terms of the GNU Lesser General Public License (LGPL) *
8 | * as published by the Free Software Foundation; either version 2 of *
9 | * the License, or (at your option) any later version. *
10 | * for detail see the LICENCE text file. *
11 | * *
12 | * This program is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Library General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Library General Public *
18 | * License along with this program; if not, write to the Free Software *
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
20 | * USA *
21 | * *
22 | ***************************************************************************/
23 |
24 |
25 | // SphereGen.h
26 | //
27 |
28 | #include "SolverGlobal.h"
29 |
30 | int gensphere(double sradius, long depth, FILE *sfp);
31 |
--------------------------------------------------------------------------------
/hlp/InputFile/2D/InputFile_2D_ch07.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | FasterCap Input Files
11 |
12 |
13 |
14 |
15 |
16 |
FasterCap 2D Input Files
17 |
18 |
Name definitions ('N' statement)
19 |
20 |
Syntax: N <oldcondname> <newcondname>
21 |
22 |
23 |
The 'N' element at the beginning of a line renames a conductor. More specifically, it associates all the segments previously assigned to the conductor named <oldcondname> to the conductor named <newcondname>.
24 |
25 |
Example:
26 |
27 |
28 |
29 | S circle 0.1 0 0.098768907 0.015642989
30 | S circle 0.098768907 0.015642989 0.095105938 0.030900818
31 | S circle 0.095105938 0.030900818 0.089101283 0.045397812
32 | S circle 0.089101283 0.045397812 0.080902789 0.058777026
33 | S circle 0.080902789 0.058777026 0.070712316 0.07070904
34 | S circle 0.070712316 0.07070904 0.058780774 0.080900066
35 | S circle 0.058780774 0.080900066 0.045401939 0.08909918
36 | S circle 0.045401939 0.08909918 0.030905224 0.095104506
37 | S circle 0.030905224 0.095104506 0.015647565 0.098768182
38 | S circle 0.015647565 0.098768182 4.63268E-06 0.1
39 | N circle coax_outer_shell
40 |
41 |
42 |
This input file fragments specifies a conductor whose name is 'circle'. The conductor is then renamed to a more user-friendly name coax_outer_shell.
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/stdafx.h:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | * *
3 | * Copyright (c) 2017 *
4 | * FastFieldSolvers S.R.L. http://www.fastfieldsolvers.com *
5 | * *
6 | * This program is free software; you can redistribute it and/or modify *
7 | * it under the terms of the GNU Lesser General Public License (LGPL) *
8 | * as published by the Free Software Foundation; either version 2 of *
9 | * the License, or (at your option) any later version. *
10 | * for detail see the LICENCE text file. *
11 | * *
12 | * This program is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Library General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Library General Public *
18 | * License along with this program; if not, write to the Free Software *
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
20 | * USA *
21 | * *
22 | ***************************************************************************/
23 |
24 |
25 | // stdafx.h : dummy include file for compatibility with MS Visual Studio precompiled
26 | // headers (#included in VS .cpp files)
27 |
28 | #if !defined(AFX_STDAFX_H_MULTIPLATFORM)
29 | #define AFX_STDAFX_H_MULTIPLATFORM
30 |
31 | #endif
32 |
33 |
34 |
--------------------------------------------------------------------------------
/hlp/InputFile/2D/InputFile_2D_ch05.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
The 'S' element at the beginning of a line defines a straight segment. If the segment belongs to a conductor surface, the <condname> parameter is used to associate the segment to a parent conductor named <condname>. If the segment belongs to a dielectric surface, the <condname> parameter is ignored.
24 | The (x1, y1), (x2, y2) 2D points specify the coordinates of the two end points of the segment.
25 |
26 |
Example 1:
27 |
28 |
29 |
30 | S circle 0.1 0 0.098768907 0.015642989
31 |
32 |
33 |
This input file fragments specifies a segment of the surface of a conductor, whose name is circle.
34 |
35 |
Example 2:
36 |
37 |
38 |
39 | S inner_shell 0.098768907 0.015642989 0.095105938 0.030900818
40 | S outer_shell 0.095105938 0.030900818 0.089101283 0.045397812
41 | S inner_shell 0.089101283 0.045397812 0.080902789 0.058777026
42 |
43 |
44 |
45 |
This input file fragments specifies two segments of the surface of a conductor, whose name is inner_shell, and one segment of the surface of a second conductor, whose name is outer_shell.
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/hlp/Automation/FasterCapAutomationOverview.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
16 |
17 | FasterCap provides a MS Windows Automation interface which allows a remote application to fully control FasterCap.
18 |
19 |
For example, a Visual Basic script inside an MS Windows Excel sheet can launch FasterCap in background, make it perform some simulation, then retrieve the results and show them in some cells - and all without even showing up the FasterCap window!
20 |
21 |
The Automation Object
22 |
23 | FasterCap can be controlled by any Automation-capable application. The automation object which must be created to control FasterCap is named FasterCap.Document. This name is defined in the Windows Registry at installation time or, if removed from the Registry, any time FasterCap is run.
24 |
25 |
Automation References
26 |
27 | Automation is quite a complex topic in itself and will not be described here. We suggest to the unexperienced User to read Microsoft documentation on Automation. In particular, the following sources could be useful and can be found, for instance, on Microsoft web site:
28 |
29 |
30 |
"Locating resources to study automation", Microsoft Knowledge Base Article KB152023
31 |
32 |
"Building OLE Automation Service Components in Visual Basic and Visual C++", David George, Microsoft Corporation, October 2, 1995
33 |
34 |
"Inside OLE 2nd Edition", Kraig Brockschmidt, Microsoft Press, 1995
35 |
19 |
20 | FasterCap supports also the option to specify all input data in a single file. This avoids the need for a possibly large number of different input files.
21 |
The format is as follows:
22 |
23 |
(main input file)
24 | End
25 | File <first_sub-file>
26 | (contents of <first_sub-file>)
27 | End
28 | File <second_sub-file>
29 | (contents of <second_sub-file>)
30 | End
31 |
32 |
33 |
In this way, all references to external files can be replaced by internal references; for instance, if you write
34 |
35 | C first_sub-file 1.0 0.0 0.0 0.0
36 |
37 |
38 | FasterCap will not try to access the file 'first_sub-file' from the file system, but will take the data from the 'File' section as per the above definition.
39 |
40 |
FasterCap allows hierarchical definitions, i.e. 'first_sub-file' can contain references to 'second_sub-file'. If the referenced files are not found internally, FasterCap assumes that they reside on the file system, and will look for them accordingly.
41 |
42 |
The characters following 'E' in 'End' and following 'F' in 'File' are optional. Like the other statements, 'E' and 'F' are case-insensitive, and must be the first character of the line in which they are defined.
43 | Moreover, the 'End' statement in itself is optional, and is included only for input file readibility.
44 |
45 |
You can find some examples of single input files in the 'Samples' directory, for both 3D and 2D models.
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/wx_pch.h:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | * *
3 | * Copyright (c) 2017 *
4 | * FastFieldSolvers S.R.L. http://www.fastfieldsolvers.com *
5 | * *
6 | * This program is free software; you can redistribute it and/or modify *
7 | * it under the terms of the GNU Lesser General Public License (LGPL) *
8 | * as published by the Free Software Foundation; either version 2 of *
9 | * the License, or (at your option) any later version. *
10 | * for detail see the LICENCE text file. *
11 | * *
12 | * This program is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Library General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Library General Public *
18 | * License along with this program; if not, write to the Free Software *
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
20 | * USA *
21 | * *
22 | ***************************************************************************/
23 |
24 |
25 | // Purpose: Header to create Pre-Compiled Header (PCH)
26 |
27 | #ifndef WX_PCH_H_INCLUDED
28 | #define WX_PCH_H_INCLUDED
29 |
30 | // basic wxWidgets headers
31 | #include
32 |
33 | #ifdef __BORLANDC__
34 | #pragma hdrstop
35 | #endif
36 |
37 | #ifndef WX_PRECOMP
38 | #include
39 | #endif
40 |
41 | #ifdef WX_PRECOMP
42 | // put here all your rarely-changing header files
43 | #endif // WX_PRECOMP
44 |
45 | #endif // WX_PCH_H_INCLUDED
46 |
--------------------------------------------------------------------------------
/hlp/Automation/SetLogCallbackMethod.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | SetLogCallback Method Reference
10 |
11 |
12 |
13 |
14 |
15 |
True if a callback function was set. False if the callback function is reset to default (no callback).
21 |
22 |
Parameters
23 |
24 | callback
25 |
Pointer to the client's automation object exposing the callback function. If NULL is passed as argument, the callback will be removed.
26 |
27 | cbName
28 |
Name of the callback function.
29 |
The callback function must have the following prototype:
30 |
void cbName(BSTRlogString, long color)
31 |
logString
32 |
The string containing the log text passed back to the client.
33 |
color
34 |
The color of the string. The color will be black (red 255, green 255, blue 255) for normal messages and red (red 255, green 0, blue 0) for error messages.
35 |
36 |
Remarks
37 |
Call this function to set a callback upon FasterCap log output. That is, when FasterCap has something to log (everything that would normally be visible in FasterCap's console window), the cbName function will be called to notify the client and provide him the output string. This function is especially useful if FasterCap's console window is hidden.
38 |
39 |
FC_NORMAL_END: no error, normal end
38 | FC_GENERIC_ERROR: catchall for generic error
39 | FC_COMMAND_LINE_ERROR: command line usage error
40 | FC_CANNOT_OPEN_FILE: cannot open input file(s)
41 | FC_OUT_OF_MEMORY: out of memory
42 | FC_FILE_ERROR: generic file error
43 | FC_CANNOT_GO_OOC: cannot go out-of-core (probably disk full)
44 | FC_EXCEPTION_ERROR: unknown exception caught
45 | FC_USER_BREAK: user-requested break
46 |
47 |
Parameters
48 |
None
49 |
50 |
Remarks
51 |
Returns the reason why FasterCap stopped execution. The reason could be normal end, user break or errors.
52 |
53 |
See Also
54 |
FasterCap Automation Overview
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/FasterCapConsole.h:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | * *
3 | * Copyright (c) 2017 *
4 | * FastFieldSolvers S.R.L. http://www.fastfieldsolvers.com *
5 | * *
6 | * This program is free software; you can redistribute it and/or modify *
7 | * it under the terms of the GNU Lesser General Public License (LGPL) *
8 | * as published by the Free Software Foundation; either version 2 of *
9 | * the License, or (at your option) any later version. *
10 | * for detail see the LICENCE text file. *
11 | * *
12 | * This program is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Library General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Library General Public *
18 | * License along with this program; if not, write to the Free Software *
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
20 | * USA *
21 | * *
22 | ***************************************************************************/
23 |
24 |
25 | #ifndef FASTERCAPCONSOLE_H
26 | #define FASTERCAPCONSOLE_H
27 |
28 | #include "FasterCapGlobal.h"
29 | #include "Solver/SolverGlobal.h"
30 |
31 | class FasterCapConsole
32 | {
33 | public:
34 | #ifdef FCG_HEADLESS
35 | int main(int& argc, char **argv, char bOption='\0');
36 | #else
37 | int main(int& argc, wxChar **argv, char bOption='\0');
38 | #endif // FCG_HEADLESS int main(int& argc, wxChar **argv, char bOption = '\0');
39 | bool ParseCmdLine(const char *commandStr, CAutoRefGlobalVars &globalVars, wxString &errMsg);
40 |
41 | protected:
42 | int getSubstring(const char *buffer, char *substr, int *skip);
43 |
44 | private:
45 | };
46 |
47 | #endif // FASTERCAPCONSOLE_H
48 |
--------------------------------------------------------------------------------
/hlp/Automation/AutomationExamples.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
16 |
17 | Altough Automation is a complex topic, using FasterCap via Automation is simple enough. To get you started, we have created some example scripts which can be used to learn how to control FasterCap and as a base to build more complex applications. In spite of their short length, these examples are quite comprehensive and the source code is well commented.
18 |
19 |
You can find the example files in a sub-directory in FasterCap's installation directory.
20 |
21 |
FasterCapClient Sample Program
22 | This is the most complete example, which shows the use of all FasterCap methods and properties. To compile this example, you must have MS Visual Basic 6.0 (or newer) installed.
23 | For your convenience, we provided also the executable file that you can directly run, provided that you have Visual Basic 6.0 DLL installed.
24 |
25 |
fastercap_drive.xls Sample Program
26 | This is a Visual Basic for Applications example. To run this example, you must have MS Excel 2000 (or newer) installed. With minor modifications, marked with proper comments in the Visual Basic source code embedded in the spreadsheet, you can also run the same example using LibreOffice Calc.
27 |
Remark: for the script to work, you must answer 'yes' at the prompt which asks you if you want to enable the macros, when you load the file into Excel or Calc.
28 |
Remark: the files sphere0.txt, sphere1.txt, sphere2.txt, sphere3.txt are used by this script and must reside in the same directory of fastercap_drive.xls for the script to work.
29 |
30 |
fastercap_drive.vbs Sample Program
31 | This is a Visual Basic Script example. The best way to launch this script is from a DOS shell, typing "cscript fastercap_drive.vbs", in the directory where fastercap_drive.vbs resides.
32 | You can also double-click on the file name, but in this case all the log messages will appear in separate pop-up message boxes.
33 |
Remark: the files sphere0.txt, sphere1.txt, sphere2.txt, sphere3.txt are used by this script and must reside in the same directory of fastercap_drive.vbs for the script to work.
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/IFasterCap.idl:
--------------------------------------------------------------------------------
1 | // IDL file for FasterCap
2 | //
3 | // {F99B4BC5-434E-4d11-8656-AE0AC816E586} = Type library's GUID
4 | // {4ACA654C-C56C-47d5-86F4-7B721F06E056} = FasterCap object's GUID
5 | // {80FDCF45-7F79-4409-8195-4FF9BB4BD5A3} = FasterCap VTable's GUID
6 |
7 | [uuid(F99B4BC5-434E-4d11-8656-AE0AC816E586), version(1.0), helpstring("FasterCap COM server")]
8 | library IFasterCap
9 | {
10 | importlib("STDOLE2.TLB");
11 |
12 | [uuid(80FDCF45-7F79-4409-8195-4FF9BB4BD5A3), dual, oleautomation, hidden, nonextensible]
13 | interface IFasterCapVTbl : IDispatch
14 | {
15 | [helpstring("Check if FasterCap is running")]
16 | [id(1)] HRESULT IsRunning([out, retval] VARIANT_BOOL *);
17 | [helpstring("Show FasterCap window (hidden by default via Automation")]
18 | [id(2)] HRESULT ShowWindow();
19 | [helpstring("Quit FasterCap")]
20 | [id(3)] HRESULT Quit([out, retval] VARIANT_BOOL *);
21 | [helpstring("Get a SafeArray containing the capacitance matrix")]
22 | [id(4)] HRESULT GetCapacitance([out, retval] VARIANT *);
23 | [helpstring("Get a SafeArray containing the conductance matrix")]
24 | [id(5)] HRESULT GetConductance([out, retval] VARIANT *);
25 | [helpstring("Get a SafeArray containing the conductor names")]
26 | [id(6)] HRESULT GetCondNames([out, retval] VARIANT *);
27 | [helpstring("Run FasterCap with the provided command line")]
28 | [id(7)] HRESULT Run([in] BSTR, [out, retval] VARIANT_BOOL *);
29 | [helpstring("Stop FasterCap execution")]
30 | [id(8)] HRESULT Stop();
31 | [helpstring("Get FasterCap's execution time for last solve")]
32 | [id(9)] HRESULT GetSolveTime([out, retval] float *);
33 | [helpstring("Get FasterCap's max memory allocated during for last solve")]
34 | [id(10)] HRESULT GetSolveMemory([out, retval] long *);
35 | [helpstring("Get the total number of refined panels")]
36 | [id(11)] HRESULT GetPanelsNum([out, retval] long *);
37 | [helpstring("Get the total number of links between panels")]
38 | [id(12)] HRESULT GetLinksNum([out, retval] long *);
39 | [helpstring("Get FasterCap return status")]
40 | [id(13)] HRESULT GetReturnStatus([out, retval] short *);
41 | [helpstring("Set FasterCap Automation callback to signal end of execution")]
42 | [id(14)] HRESULT SetEndCallback([in] LPDISPATCH, [in] BSTR, [out, retval] VARIANT_BOOL *);
43 | [helpstring("Set FasterCap Automation callback to signal log messages")]
44 | [id(15)] HRESULT SetLogCallback([in] LPDISPATCH, [in] BSTR, [out, retval] VARIANT_BOOL *);
45 | };
46 |
47 | [uuid(4ACA654C-C56C-47d5-86F4-7B721F06E056), helpstring("FasterCap document"), appobject]
48 | coclass IFasterCap
49 | {
50 | [default] interface IFasterCapVTbl;
51 | }
52 | }
53 |
54 |
--------------------------------------------------------------------------------
/registry3264.h:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | * *
3 | * Copyright (c) 2017 *
4 | * FastFieldSolvers S.R.L. http://www.fastfieldsolvers.com *
5 | * *
6 | * This program is free software; you can redistribute it and/or modify *
7 | * it under the terms of the GNU Lesser General Public License (LGPL) *
8 | * as published by the Free Software Foundation; either version 2 of *
9 | * the License, or (at your option) any later version. *
10 | * for detail see the LICENCE text file. *
11 | * *
12 | * This program is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Library General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Library General Public *
18 | * License along with this program; if not, write to the Free Software *
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
20 | * USA *
21 | * *
22 | ***************************************************************************/
23 |
24 | // Purpose: class derived from wxWidgets wxRegKey to manage 64 bits vs. 32 bits keys
25 |
26 | #include "wx_pch.h"
27 |
28 | // valid only for MS Win
29 | #ifdef __WXMSW__
30 |
31 | #include
32 |
33 | #define KEY_REGKEY3264_DEFAULT (0)
34 |
35 | class wxRegKey3264 : public wxRegKey
36 | {
37 | public:
38 | wxRegKey3264(const wxString& strKey, REGSAM mode = KEY_REGKEY3264_DEFAULT);
39 | wxRegKey3264(const wxRegKey3264& keyParent, const wxString& strKey, REGSAM mode = KEY_REGKEY3264_DEFAULT);
40 | wxRegKey3264() : key3264access(KEY_REGKEY3264_DEFAULT) {}
41 | bool Open(AccessMode mode = Write);
42 | bool Create(bool bOkIfExists = true);
43 | bool Exists() const;
44 | bool HasSubKey(const wxChar *szKey) const;
45 | void SetKey32bits();
46 |
47 | protected:
48 | bool KeyExists(WXHKEY hRootKey, const wxChar *szKey);
49 |
50 | REGSAM key3264access;
51 | };
52 |
53 | #endif //__WXMSW__
54 |
--------------------------------------------------------------------------------
/LicenseBox.h:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | * *
3 | * Copyright (c) 2017 *
4 | * FastFieldSolvers S.R.L. http://www.fastfieldsolvers.com *
5 | * *
6 | * This program is free software; you can redistribute it and/or modify *
7 | * it under the terms of the GNU Lesser General Public License (LGPL) *
8 | * as published by the Free Software Foundation; either version 2 of *
9 | * the License, or (at your option) any later version. *
10 | * for detail see the LICENCE text file. *
11 | * *
12 | * This program is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Library General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Library General Public *
18 | * License along with this program; if not, write to the Free Software *
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
20 | * USA *
21 | * *
22 | ***************************************************************************/
23 |
24 |
25 | #ifndef LICENSEBOX_H
26 | #define LICENSEBOX_H
27 |
28 | #ifndef WX_PRECOMP
29 | //(*HeadersPCH(LicenseBox)
30 | #include
31 | #include
32 | #include
33 | #include
34 | #include
35 | //*)
36 | #endif
37 | //(*Headers(LicenseBox)
38 | //*)
39 |
40 | class LicenseBox: public wxDialog
41 | {
42 | public:
43 |
44 | LicenseBox(wxWindow* parent,wxWindowID id=wxID_ANY);
45 | virtual ~LicenseBox();
46 |
47 | //(*Declarations(LicenseBox)
48 | wxStaticText* StaticText_Header2;
49 | wxStaticText* StaticText_Header3;
50 | wxPanel* Panel1;
51 | wxStaticText* StaticText_Header1;
52 | wxTextCtrl* TextCtrl_License;
53 | //*)
54 |
55 | protected:
56 |
57 | //(*Identifiers(LicenseBox)
58 | static const long ID_STATICTEXT_HEADER1;
59 | static const long ID_STATICTEXT_HEADER2;
60 | static const long ID_STATICTEXT_HEADER3;
61 | static const long ID_TEXTCTRL_LICENSE;
62 | static const long ID_PANEL1;
63 | //*)
64 |
65 | private:
66 |
67 | //(*Handlers(LicenseBox)
68 | //*)
69 |
70 | DECLARE_EVENT_TABLE()
71 | };
72 |
73 | #endif
74 |
--------------------------------------------------------------------------------
/hlp/InputFile/InputFile_main.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | FasterCap Input Files
11 |
12 |
13 |
14 |
15 |
16 |
FasterCap Input Files
17 |
18 |
Input File Syntax
19 |
20 | This chapter provides reference information about the FasterCap input file syntax
21 |
FasterCap supports 3D or 2D capacitance extraction. The input file syntax is as similar as possible for the two cases.
22 |
23 |
3D Syntax
24 |
25 |
The input files specify the geometry of the conductors and of the dielectrics through a description of their surfaces, modeled as quadrilateral or triangular panels.
26 |
The input file syntax for FasterCap is 100% compatible with the FastCap2 "generic file format". It also introduces some enhancements, mainly the support of complex permittivity values and of hierarchical models.
27 |
28 |
For more information about the input file syntax:
29 |
30 |
The input files specify the geometry of the conductors and of the dielectrics through a description of their contours, modeled as straight segments.
44 |
The input file syntax is similar to the 3D FasterCap syntax, but adapted to the 2D case.
45 |
46 |
For more information about the input file syntax:
47 |
48 |
The 'T' element at the beginning of a line defines a triangular panel. If the triangular panel belongs to a conductor surface, the <condname> parameter is used to associate the panel to a parent conductor named <condname>. If the triangular panel belongs to a dielectric surface, the <condname> parameter is ignored.
24 | The (x1, y1, z1), (x2, y2, z2), (x3, y3, z3) 3D points specify the coordinates of the three corners of the panel; the coordinates must be entered in clockwise or counterclockwise order starting from any one corner.
25 | In case the panel is part of a dielectric interface, you can use the optional coordinates (xref, yref, zref) to specify a reference point; see 3D Dielectric definitions ('D' statement) for more details about dielectric interfaces.
26 |
27 |
This input file fragments specifies two face of the surface of a conducting pyramid, whose name is onepyramid, and one face of the surface of a second conducting pyramid, whose name is otherpyramid.
47 |
48 |
The 'Q' element at the beginning of a line defines a quadrilateral panel. If the quadrilateral panel belongs to a conductor surface, the <condname> parameter is used to associate the panel to a parent conductor named <condname>. If the quadrilateral panel belongs to a dielectric surface, the <condname> parameter is ignored.
24 | The (x1, y1, z1), (x2, y2, z2), (x3, y3, z3), (x4, y4, z4) 3D points specify the coordinates of the four corners of the panel; the coordinates must be entered in clockwise or counterclockwise order starting from any one corner.
25 | In case the panel is part of a dielectric interface, you can use the optional coordinates (xref, yref, zref) to specify a reference point; see 3D Dielectric definitions ('D' statement) for more details about dielectric interfaces.
26 |
27 |
This input file fragments specifies two face of the surface of a conducting cube, whose name is onecube, and one face of the surface of a second conducting cube, whose name is othercube.
47 |
48 |
This input file fragments specifies a face of the surface of a dielectric cube, whose name is mycube, with a panel-specific dielectric reference point at (0,0,2).
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/hlp/InputFile/2D/InputFile_2D_ch03.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
The 'C' element at the beginning of a line defines a conductor. The geometry of the conductor surface is further specified in the file <file>. The conductor is assumed embedded in an homogeneous dielectric medium with relative permettivity <outperm>. The relative permittivity <outperm> can be complex valued, in the format ere-jeim, where ere is the real part of the complex permittivity value, and eim is the imaginary part. The conductor can be translated with respect to the coordinates defined in <file> by an offset (xoffset, yoffset), thus allowing to reuse the same geometric definitions multiple times.
24 | The optional + argument is used to merge the current conductor with the next one, thus treating them a single conductor. With this option, panels with the same conductor name in different files will belong to the same conductor (see panels definitions for more information about conducor naming).
25 |
26 |
Example 1:
27 |
28 |
29 | C circle_0.2_fine.txt 1.0 0.0 0.0
30 |
31 |
32 |
This input file fragments specifies a conductor whose geometry is defined in the file circle_0.1_fine.txt, embedded in a dielectric with permettivity equal to one (e.g. air), and translated to the position (0.0, 0.0).
33 |
34 |
Example 2:
35 |
36 |
37 | C microstrip_top_0.03.txt 1.0 -0.025 0.01 +
38 | C microstrip_bottom_0.03.txt 2.0 -0.025 0.01
39 |
40 |
41 |
This input file fragments specifies a conductor made of two parts in contact with two dielectric materials with different relative permittivities. It is considered a single conductor since the first statement ends by +, thus collating the two elements; i.e. the two parts are considered short-circuited together.
42 |
43 |
Example 3:
44 |
45 |
46 | C circle_0.005.txt 4.0-j3.016e6 0.0 0.02
47 |
48 |
49 |
This input file fragments specifies a conductor whose geometry is defined in the file circle_0.005.txt, embedded in a dielectric with complex relative permettivity equal to 4.0-j3.016e6 (e.g. with real part equal to 4.0 and imaginary part equal to 3.016e6), and translated to the position (0.0, 0.02).
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/hlp/InputFile/3D/InputFile_3D_ch03.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
The 'C' element at the beginning of a line defines a conductor. The geometry of the conductor surface is further specified in the file <file>. The conductor is assumed embedded in an homogeneous dielectric medium with relative permettivity <outperm>. The relative permittivity <outperm> can be complex valued, in the format ere-jeim, where ere is the real part of the complex permittivity value, and eim is the imaginary part. The conductor can be translated with respect to the coordinates defined in <file> by an offset (xoffset, yoffset, zoffset), thus allowing to reuse the same geometric definitions multiple times.
24 | The optional + argument is used to merge the current conductor with the next one, thus treating them a single conductor. With this option, panels with the same conductor name in different files will belong to the same conductor (see panels definitions for more information about conducor naming).
25 |
26 |
Example 1:
27 |
28 |
29 | C cube.txt 1.000000 2.0 0.0 0.0
30 |
31 |
32 |
This input file fragments specifies a conductor whose geometry is defined in the file cube.txt, embedded in a dielectric with permettivity equal to one (e.g. air), and translated to the position (2.0, 0.0, 0.0).
33 |
34 |
Example 2:
35 |
36 |
37 | C cube.txt 1.000000 0.0 0.0 0.0 +
38 | C cube.txt 1.000000 2.0 0.0 0.0
39 |
40 |
41 |
This input file fragments specifies a conductor made of two cubes in free air. It is considered a single conductor since the first statement ends by +, thus collating the two elements; i.e. the two cubes are considered short-circuited together.
42 |
43 |
Example 3:
44 |
45 |
46 | C cube.txt 3.0-j0.02 2.0 0.0 0.0
47 |
48 |
49 |
This input file fragments specifies a conductor whose geometry is defined in the file cube.txt, embedded in a dielectric with complex permettivity equal to 3.0-j0.02 (e.g. with real part equal to 3.0 and imaginary part equal to 0.02), and translated to the position (2.0, 0.0, 0.0).
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/wxsmith/LicenseBox.wxs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
73 |
74 |
--------------------------------------------------------------------------------
/Solver/AutoElement.cpp:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | * *
3 | * Copyright (c) 2017 *
4 | * FastFieldSolvers S.R.L. http://www.fastfieldsolvers.com *
5 | * *
6 | * This program is free software; you can redistribute it and/or modify *
7 | * it under the terms of the GNU Lesser General Public License (LGPL) *
8 | * as published by the Free Software Foundation; either version 2 of *
9 | * the License, or (at your option) any later version. *
10 | * for detail see the LICENCE text file. *
11 | * *
12 | * This program is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Library General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Library General Public *
18 | * License along with this program; if not, write to the Free Software *
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
20 | * USA *
21 | * *
22 | ***************************************************************************/
23 |
24 |
25 | // 2D segments & 3D patch base class, to be used in AutoRefine
26 | // E. Di Lorenzo, 2013/02/05
27 |
28 | #include "AutoElement.h"
29 |
30 | // link with FasterCap main frame
31 | #include "../FasterCapGlobal.h"
32 |
33 | CAutoElement::CAutoElement()
34 | {
35 | unsigned char i;
36 |
37 | // initialize panel structure
38 |
39 | m_ucType = AUTOPANEL_IS_LEAF;
40 |
41 | for(i=0; iInitElementsTree();
68 | m_pRight->InitElementsTree();
69 | }
70 | }
71 |
72 | void CAutoElement::DeleteElementsTree()
73 | {
74 | // visit the tree
75 |
76 | if (IsLeaf() != true) {
77 | // scan the subtree, only after delete panel
78 | m_pLeft->DeleteElementsTree();
79 | m_pRight->DeleteElementsTree();
80 | }
81 |
82 | // then delete panel
83 | delete this;
84 | }
85 |
86 |
--------------------------------------------------------------------------------
/Solver/MultiplyHierarchical.h:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | * *
3 | * Copyright (c) 2017 *
4 | * FastFieldSolvers S.R.L. http://www.fastfieldsolvers.com *
5 | * *
6 | * This program is free software; you can redistribute it and/or modify *
7 | * it under the terms of the GNU Lesser General Public License (LGPL) *
8 | * as published by the Free Software Foundation; either version 2 of *
9 | * the License, or (at your option) any later version. *
10 | * for detail see the LICENCE text file. *
11 | * *
12 | * This program is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Library General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Library General Public *
18 | * License along with this program; if not, write to the Free Software *
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
20 | * USA *
21 | * *
22 | ***************************************************************************/
23 |
24 |
25 | // MultiplyHierarchical.h : hierarchical multiplication class header file
26 | //
27 |
28 | #if !defined(AFX_MULTIPLYHIERARCHICAL_H__ENRI1945_5487_55D2_9284_04F014CF5600__INCLUDED_)
29 | #define AFX_MULTIPLYHIERARCHICAL_H__ENRI1945_5487_55D2_9284_04F014CF5600__INCLUDED_
30 |
31 | #include "SolverGlobal.h"
32 |
33 | #include "Autorefine.h"
34 |
35 | // includes for LinALg
36 | #include "LinAlgebra/Vect.h"
37 |
38 | #define MULTHIER_MAX_RECURS_DEPTH 128
39 |
40 |
41 | class CMultHier : public CAutoRefine
42 | {
43 |
44 | public:
45 | CMultHier();
46 | ~CMultHier();
47 | int AllocateMemory();
48 | void DeallocateMemory();
49 | int MultiplyMatByVec_fast(CLin_Vector *v, CLin_Vector *q);
50 | void CopyChargesToVec(CLin_Vector *q);
51 | void CopyVecToCharges(CLin_Vector *q);
52 | void InitFlatLinks();
53 |
54 | unsigned long m_ulFirstCondElemIndex;
55 |
56 | protected:
57 | void ComputePanelCharges_fast();
58 | int ComputePanelPotentials_2fast();
59 | void ComputeLeafPotentials_fast();
60 | void CopyPanelCharges();
61 | void CopyCharges(CAutoElement* panel);
62 | void CopyVecCharges();
63 | void CopyVec(CAutoElement* panel);
64 |
65 | CLin_Range m_clsChargeVect, m_clsPotVect;
66 | long m_dIndex;
67 | CAutoElement *m_clsRecursVec[MULTHIER_MAX_RECURS_DEPTH];
68 |
69 | };
70 |
71 | #endif //!defined(AFX_MULTIPLYHIERARCHICAL_H__ENRI1945_5487_55D2_9284_04F014CF5600__INCLUDED_)
72 |
--------------------------------------------------------------------------------
/hlp/InputFile/2D/InputFile_2D_ch04.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | FasterCap Input Files
11 |
12 |
13 |
14 |
15 |
16 |
The 'D' element at the beginning of a line defines a dielectric. The geometry of the dielectric contour is further specified in the file <file>. The dielectric contour is intended as the interface between two regions with relative permettivities <outperm> and <inperm>. The relative permittivities <outperm> and <inperm> can be complex valued, in the format eRe-jeIm, where eRe is the real part of the complex permittivity value, and eIm is the imaginary part. The dielectric can be translated with respect to the coordinates defined in <file> by an offset (xoffset, yoffset), thus allowing to reuse the same geometric definitions multiple times. The reference point (xref, yref) and the optional - argument are used to specify which side of the dielectric interface has which permittivity. More specifically, the reference point is assumed to lie on the <outperm> side of all the segments in <file>. The optional - argument indicates that (xref, yref) instead lies on the <inperm> side. The reference point is not translated, i.e. the offset only applies to the elements specified in <file>.
24 |
Remark: it is the user's responsibility to make sure that the reference point is on the same side of the dielectric interface for all panels. That is, each panel is evaluated as stand-alone with respect to the reference point, to define its <outperm> and <inperm> sides. There is no concept of a external and internal side of a surface specified by a group of panels, even if specified in the same file with the same conductor names, since FasterCap maintains no topological information.
25 |
26 |
This input file fragments specifies a dielectric interface whose geometry is defined in the file circle_0.15_fine.txt. The interior of the circle is filled with a material with relative permittivity equal to 2.0, since the reference point is centered on the origin and the optional - argument is specified; while the dielectric medium ouside the circle has a relative permittivity equal to 1.0.
33 |
34 |
This input file fragments specifies a dielectric interface whose geometry is defined in the file circle_0.15_fine.txt. The interface is between air (relative permittivity equal to 1.0) and a lossy dielectric with complex relative permettivity equal to 3.0-j0.02 (e.g. with real part equal to 3.0 and imaginary part equal to 0.02).
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/hlp/InputFile/3D/InputFile_3D_ch02.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
The input file is a sequential list of materials definitions (conductor 'C' statements and dielectric 'D' statements) and of geometric panel descriptions (triangular patch 'T' and quadrilateral patch 'Q').
21 | Moreover, comments are allowed ('*' elements) as well as naming definitions ('N' elements)
22 |
23 |
Definitions can be nested in a hierarchical fashion to be able to re-use the geometric descriptions and to ease the construction of the models.
24 | Panel geometric definitions ('Q' and 'T' elements) in the root file are assumed by default to belong to conductors embedded in a dielectric medium with unit permittivity.
25 |
26 |
All input files begins with a comment line. For compatibility and to ease possible file merging, you are recommended to start the line with a '*' character; anyway this is not mandatory, and the first line of any input file is simply ignored.
27 |
28 |
Remark: since FasterCap is able to automatically refine the geometry, it is best working with an input mesh as coarse as possible. This is a main difference with FastCap2, that needs a carefully pre-refined input mesh in order to produce accurate results.
29 |
30 |
An input file example is shown here below.
31 |
32 |
File cubes.txt:
33 |
34 |
35 | * Array of two cubes, in air
36 | *
37 | * conductor | dielectric | offset
38 | * file name | constant | in space
39 | *
40 | C cube.txt 1.000000 0.0 0.0 0.0
41 | C cube.txt 1.000000 2.0 0.0 0.0
42 |
43 |
44 |
The above input file references hierarchically the file cube.txt. This file contains a geometric description of a unit cube, as shown here below.
45 |
46 |
The 'D' element at the beginning of a line defines a dielectric. The geometry of the dielectric surface is further specified in the file <file>. The dielectric surface is intended as the interface between two regions with relative permettivities <outperm> and <inperm>. The relative permittivities <outperm> and <inperm> can be complex valued, in the format eRe-jeIm, where eRe is the real part of the complex permittivity value, and eIm is the imaginary part.
24 | The dielectric can be translated with respect to the coordinates defined in <file> by an offset (xoffset, yoffset, zoffset), thus allowing to reuse the same geometric definitions multiple times.
25 | The reference point (xref, yref, zref) and the optional - argument are used to specify which side of the dielectric interface has which permittivity. More specifically, the reference point is assumed to lie on the <outperm> side of all the panels in <file>. The optional - argument indicates that (xref, yref, zref) instead lies on the <inperm> side. The reference point is not translated, i.e. the offset only applies to the elements specified in <file>.
26 |
27 |
Remark: it is the user's responsibility to make sure that the reference point is on the same side of the dielectric interface for all panels. That is, each panel is evaluated as stand-alone with respect to the reference point, to define its <outperm> and <inperm> sides. There is no concept of a external and internal side of a surface specified by a group of panels, even if specified in the same file with the same conductor names, since FasterCap maintains no topological information.
28 |
29 |
For complex shaped surfaces, FasterCap supports also the option to specify the reference point panel by panel, see 3D Triangular panel definitions ('T' statement) and 3D Quadrilateral panel definitions ('Q' statement) for details about the syntax.
30 | You can also mix the two type of panel definitions, i.e. panels without and panels with a per-panel reference point specification. In this case, panels without a reference point specified per panel will use the reference point specified for the whole dielectric interface in the 'D' statement.
31 |
32 |
This input file fragments specifies a dielectric interface whose geometry is defined in the file sphere.txt. The interior of the sphere is filled with a material with relative permittivity equal 2.0, since the reference point is centered on the origin and the optional - argument is specified; while the dielectric medium ouside the sphere has a relative permittivity equal to 1.0.
39 |
40 |
This input file fragments specifies a dielectric interface whose geometry is defined in the file sphere.txt. The interface is between air (relative permittivity equal to 1.0) and a lossy dielectric with complex relative permettivity equal to 3.0-j0.02 (e.g. with real part equal to 3.0 and imaginary part equal to 0.02).
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/FasterCapApp.h:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | * *
3 | * Copyright (c) 2017 *
4 | * FastFieldSolvers S.R.L. http://www.fastfieldsolvers.com *
5 | * *
6 | * This program is free software; you can redistribute it and/or modify *
7 | * it under the terms of the GNU Lesser General Public License (LGPL) *
8 | * as published by the Free Software Foundation; either version 2 of *
9 | * the License, or (at your option) any later version. *
10 | * for detail see the LICENCE text file. *
11 | * *
12 | * This program is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Library General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Library General Public *
18 | * License along with this program; if not, write to the Free Software *
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
20 | * USA *
21 | * *
22 | ***************************************************************************/
23 |
24 |
25 | #ifndef FASTERCAPAPP_H
26 | #define FASTERCAPAPP_H
27 |
28 | #include
29 | #include "FasterCapMain.h"
30 |
31 | // generic help system
32 | #include
33 | // MS help system
34 | #if wxUSE_MS_HTML_HELP
35 | # include
36 | #endif
37 | #include
38 |
39 | // This class is used in conjunction with FasterCapApp to enable
40 | // a pure console mode.
41 | // The new AppTraits is needed to be sure that the log target is the console
42 | // and not the wxLogGui
43 | class MixAppTraits : public wxGUIAppTraits
44 | {
45 | public:
46 | MixAppTraits(bool is_console);
47 | wxLog *CreateLogTarget();
48 |
49 | protected:
50 | bool m_bIsConsole;
51 | };
52 |
53 | // FasterCapApp enables also a pure console mode that can be used
54 | // GUI-less without even
55 | // initializing any GUI related stuff, so it can be used in
56 | // a remote console without exported DISPLAY in Linux
57 | // This is not an issue in Win as in this case the console
58 | // is always opened at start-up and the windows created only
59 | // on demand.
60 | // Similar to what shown at
61 | // http://compgroups.net/comp.soft-sys.wxwindows/hybrid-gui-console-app/2686190
62 | class FasterCapApp : public wxApp
63 | {
64 | public:
65 | inline FasterCapFrame *GetFasterCapFrame() {
66 | return m_pFasterCapFrame;
67 | }
68 | void DisplayHelp();
69 | bool IsFirstUse();
70 | void SetNotFirstUse();
71 | wxString GetBasePath();
72 | wxString GetSamplePath();
73 | wxString GetLicenseTextPath();
74 |
75 | int m_iRetStatus;
76 |
77 | protected:
78 | // overrides
79 | bool Initialize(int& argc, wxChar **argv);
80 | void CleanUp();
81 | MixAppTraits *CreateTraits();
82 | // virtuals
83 | virtual bool OnInit();
84 | virtual int OnRun();
85 | // virtual void OnIdle(wxIdleEvent& event);
86 | virtual int OnExit();
87 |
88 | FasterCapFrame *m_pFasterCapFrame;
89 | long m_lIsFirstUse;
90 | wxString m_strBasePath;
91 | wxString m_strFasterCapPath;
92 | wxString m_strSamplePath;
93 | wxString m_strLicenseTextPath;
94 | #if wxUSE_MS_HTML_HELP
95 | // MS help support
96 | wxCHMHelpController *m_pHelp;
97 | #else
98 | // generic help support
99 | wxHtmlHelpController *m_pHelp;
100 | #endif
101 | bool m_bIsHelp;
102 |
103 | // DECLARE_EVENT_TABLE()
104 | };
105 | #endif // FASTERCAPAPP_H
106 |
--------------------------------------------------------------------------------
/Solver/SolverGlobal.cpp:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | * *
3 | * Copyright (c) 2017 *
4 | * FastFieldSolvers S.R.L. http://www.fastfieldsolvers.com *
5 | * *
6 | * This program is free software; you can redistribute it and/or modify *
7 | * it under the terms of the GNU Lesser General Public License (LGPL) *
8 | * as published by the Free Software Foundation; either version 2 of *
9 | * the License, or (at your option) any later version. *
10 | * for detail see the LICENCE text file. *
11 | * *
12 | * This program is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Library General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Library General Public *
18 | * License along with this program; if not, write to the Free Software *
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
20 | * USA *
21 | * *
22 | ***************************************************************************/
23 |
24 |
25 | // SolverGlobal.cpp : globals
26 | //
27 | // Enrico Di Lorenzo, 2012/10/03
28 |
29 | #include "SolverGlobal.h"
30 |
31 | // global, type of solver invoked
32 | unsigned char g_ucSolverType = SOLVERGLOBAL_3DSOLVER;
33 |
34 | // result matrices and conductor names
35 | CLin_Matrix g_clsCapMatrixRe, g_clsCapMatrixIm;
36 | StlStringList g_stlCondNames;
37 | // statistics:
38 | //
39 | // memory used (in the thread)
40 | CMemoryUsage g_clsMemUsageCopy, g_clsMemUsage;
41 | // time
42 | float g_fSolveTime;
43 | // panels & links
44 | long g_lPanelsNum;
45 | long g_lLinksNum;
46 |
47 |
48 | CAutoRefGlobalVars::CAutoRefGlobalVars()
49 | {
50 | Reset();
51 | }
52 |
53 | void CAutoRefGlobalVars::Reset()
54 | {
55 | m_sFileIn = "\0";
56 | // if not specified, precond type is JACOBI
57 | m_ucPrecondType = AUTOREFINE_PRECOND_JACOBI;
58 | m_dMaxHierPreDiscSide = 128;
59 | m_uiSuperPreDim = 128;
60 | m_uiBlockPreSize = 32;
61 | m_bDumpResidual = false;
62 | m_bDumpTimeMem = false;
63 | m_bVerboseOutput = false;
64 | m_dGmresTol = 0.01;
65 | m_dHierPreGmresTol = 0.5;
66 | m_bOutputGeo = false;
67 | m_bDumpInputGeo = false;
68 | m_cScheme = AUTOREFINE_COLLOCATION;
69 | m_bAuto = false;
70 | m_bAutoPrecond = false;
71 | m_dAutoMaxErr = 0.01;
72 | m_dMeshEps = 0.1;
73 | m_dEpsRatio = 1.0;
74 | m_dMeshCurvCoeff = 3.0;
75 | m_dOutOfCoreRatio = 5.0;
76 | m_bOutputCharge = false;
77 | m_bOutputCapMtx = false;
78 | // not used any more in 'Run' dialog, but calculated offline and used globally
79 | m_dMaxDiscSide = 0.1;
80 | m_dEps = 0.3 * m_dMaxDiscSide;
81 | // not used any more in 'Run' dialog, but must be kept because
82 | // trigger operations in the code (watch out: may be used as unsupported options
83 | // via automation!)
84 | m_bKeepCharge = false;
85 | m_bRefineCharge = false;
86 | m_bKeepMesh = false;
87 | // not used in the 'Run' dialog, but globally used
88 | m_ucHasCmplxPerm = AUTOREFINE_REAL_PERM;
89 | m_bWarnGivenPre = false;
90 | m_bWarnGivenThin = false;
91 | m_bWarnGivenSkew = false;
92 | m_bWarnGivenSelfPot = false;
93 | m_bWarnGivenNaN = false;
94 | }
95 |
96 | CMemoryUsage::CMemoryUsage()
97 | {
98 | Clear();
99 | }
100 |
101 | void CMemoryUsage::Clear()
102 | {
103 | m_ulPanelsMem = 0;
104 | m_ulLinksMem = 0;
105 | m_ulCondMem = 0;
106 | m_ulGmresMem = 0;
107 | m_ulPrecondMem = 0;
108 | m_ulChargesMem = 0;
109 | m_ulHierMem = 0;
110 | }
111 |
112 | unsigned long CMemoryUsage::GetTotal()
113 | {
114 | return (m_ulPanelsMem + m_ulChargesMem + m_ulLinksMem + m_ulCondMem + m_ulGmresMem + m_ulPrecondMem + m_ulHierMem);
115 | }
116 |
117 | unsigned long CMemoryUsage::GetTotalKB()
118 | {
119 | return GetTotal() / G_KILOBYTE;
120 | }
121 |
122 |
--------------------------------------------------------------------------------
/Solver/AutoElement.h:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | * *
3 | * Copyright (c) 2017 *
4 | * FastFieldSolvers S.R.L. http://www.fastfieldsolvers.com *
5 | * *
6 | * This program is free software; you can redistribute it and/or modify *
7 | * it under the terms of the GNU Lesser General Public License (LGPL) *
8 | * as published by the Free Software Foundation; either version 2 of *
9 | * the License, or (at your option) any later version. *
10 | * for detail see the LICENCE text file. *
11 | * *
12 | * This program is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Library General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Library General Public *
18 | * License along with this program; if not, write to the Free Software *
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
20 | * USA *
21 | * *
22 | ***************************************************************************/
23 |
24 |
25 | // AutoSegment.h : 2D segments & 3D patch base class definition
26 | // E. Di Lorenzo, 2013/02/05
27 |
28 | #if !defined(AFX_AUTOELEMENT_H__E89AAF21_5486_11D5_9282_04F014C10000__INCLUDED_)
29 | #define AFX_AUTOELEMENT_H__E89AAF21_5486_11D5_9282_04F014C10000__INCLUDED_
30 |
31 | #include "SolverGlobal.h"
32 |
33 | #include
34 | #include
35 |
36 | using namespace std;
37 |
38 | // constant used to identify the class of the derived classes
39 | // throught the virtual function GetClass()
40 | #define AUTOELEMENT_SEGMENT 1
41 | #define AUTOELEMENT_PANEL 2
42 | #define AUTOELEMENT_QPANEL 4
43 |
44 | // constants used in CAutoPanel type 'm_ucType'
45 | #define AUTOPANEL_IS_LEAF (unsigned char)1
46 | #define AUTOPANEL_IS_DIEL (unsigned char)2
47 | #define AUTOPANEL_OUTPERM_NORMAL_DIR (unsigned char)4
48 | #define AUTOPANEL_OUTPERM_ELEMENT_LEVEL (unsigned char)8
49 | #define AUTOPANEL_IS_SUPER_NODE (unsigned char)128
50 |
51 | // maximum number of hierarchies supported by the panel structure
52 | // (e.g. for hierarchical preconditioning)
53 | #define AUTOPANEL_MAX_NUM_OF_HIERARCHIES (unsigned char)2
54 |
55 | // maximum number of different dielectric constants for the mediums surrounding
56 | // the different surfaces belonging to a single conductor
57 | #define AUTOPANEL_MAX_DIEL_NUM 256
58 |
59 | // EPS used to avoid divisions by zero, and other use
60 | #define AUTOPANEL_EPS 1E-12
61 |
62 | // panel structure used by CAutoRefine
63 | class CAutoElement
64 | {
65 | public:
66 |
67 | CAutoElement();
68 | virtual ~CAutoElement() {}
69 |
70 | inline bool IsLeaf()
71 | {
72 | return (m_ucType & AUTOPANEL_IS_LEAF);
73 | }
74 |
75 | inline void SetNotLeaf()
76 | {
77 | m_ucType &= ~(AUTOPANEL_IS_LEAF);
78 | }
79 |
80 | inline double GetDimension()
81 | {
82 | return m_dDimension;
83 | }
84 |
85 | void InitElementsTree();
86 | void DeleteElementsTree();
87 |
88 | // virtual functions (pure virtual)
89 | virtual void ErrorPrintCoords() = 0;
90 | virtual unsigned char GetClass() = 0;
91 |
92 | unsigned char m_ucType;
93 | unsigned long m_ulLinkIndexStart[AUTOPANEL_MAX_NUM_OF_HIERARCHIES];
94 | unsigned long m_ulLinkIndexEnd[AUTOPANEL_MAX_NUM_OF_HIERARCHIES];
95 | unsigned long m_lNumOfChildren;
96 | CAutoElement *m_pLeft, *m_pRight;
97 | double m_dCharge, m_dPotential;
98 | long m_lIndex[AUTOPANEL_MAX_NUM_OF_HIERARCHIES];
99 | unsigned char m_ucDielIndex;
100 | double m_dDimension;
101 |
102 |
103 | #ifdef DEBUG_DUMP_BASIC
104 | int m_iLevel;
105 | CAutoPanel *m_pParent;
106 | CAutoConductor *m_pCond;
107 | #endif
108 |
109 | };
110 |
111 | #endif //!defined(AFX_AUTOELEMENT_H__E89AAF21_5486_11D5_9282_04F014C10000__INCLUDED_)
112 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # FasterCap
2 |
3 | ## Copyright
4 |
5 | Copyright (c) 2019
6 | FastFieldSolvers S.R.L. - http://www.fastfieldsolvers.com
7 |
8 | ## Description
9 |
10 | FasterCap is a powerful three- and two-dimensional capactiance extraction program.
11 |
12 | For pre-compiled binaries, support, consultancy and additional information please visit http://www.fastfieldsolvers.com/
13 | Access to the download pages is free, and you may access anonymously if you want.
14 |
15 | The source code is released under LGPL 2.1 or any later LGPL version, see the file LICENSE.txt for the details.
16 |
17 | ## Compiling
18 |
19 | FasterCap can be compiled for MS Windows and for *nix. For multiple platform compilation support, FasterCap uses CMake, plus Code::Blocks for the GUI version.
20 | The following software tools and complier chains are required. Used versions are indicated, higher version may work, but were not tested.
21 |
22 | ### MS Windows 64 bits
23 |
24 | - CMake 3.6.0
25 | - Code::Blocks, version 13.12
26 | - TDM-GCC 64 bits, version 4.8.1
27 | - wxWidgets, version 3.0
28 |
29 | #### Notes
30 |
31 | - Use a fresh TDM-GCC package, not the one shipped with Code::Blocks, as the latter is missing the TDM OpenMP package.
32 |
33 | - You need to pre-compile wxWidgets with TDM-GCC. Do not use pre-compiled versions, as the used compiler switch configurations may be very different when generating the binaries. Do NOT compile as monolithic, so .exe are smaller. Do two compiles, debug + release, using MSDOS makefiles and TDM-GCC (no need to use MSYS).
34 |
35 | - Run CMake until you configure all the required parameters (you need some knowledge of how CMake works). You may want to set the switch FASTFIELDSOLVERS_HEADLESS as ON for a DOS-only version ("headless") of the software, however under Windows this is useless; just run FasterCap in shell-only mode with the appropriate -b switch (see FasterCap documentation)
36 |
37 | ### Linux 64 bits
38 |
39 | - CMake 2.8.12
40 | - Code::Blocks, version 13.12
41 | - GCC, version 4.8.1
42 | - wxWidgets (wxGTK), version 3.0
43 |
44 | #### Notes
45 |
46 | - Run CMake until you configure all the required parameters (you need some knowledge of how CMake works), then generate a CodeBlock project. You may want to set the switch FASTFIELDSOLVERS_HEADLESS as ON for a shell-only version ("headless") of the software, or you can keep this OFF and just run FasterCap in shell-only mode with the appropriate -b switch (see FasterCap documentation)
47 |
48 | Example (using a GUI-less CMake):
49 |
50 | Move to the build directory you choose (different from the source files directory) and type the following command, where "../FasterCap" is the path to the base directory containing the FasterCap source code:
51 |
52 | `cmake -G"CodeBlocks - Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ../FasterCap`
53 |
54 | Then you can open Code::Blocks, open the FasterCap.cbp project file created by CMake under the build diretory, and compile it.
55 |
56 | ### Linux 64 bits headless
57 |
58 | - CMake 3.5.1
59 | - GCC, version 4.8.1 or higher (higher version tested: on 5.4.0)
60 | - wxWidgets, version 3.0.2 or higher (higher version tested: 3.0.2)
61 |
62 | #### Notes
63 |
64 | - Run CMake until you configure all the required parameters (you need some knowledge of how CMake works). You **must** set the switch FASTFIELDSOLVERS_HEADLESS as ON, as in a headless Linux distro you have no drivers at all for video.
65 |
66 | Example:
67 |
68 | Move to the build directory you choose (different from the source files directory) and type the following command, where "../FasterCap" is the path to the base directory containing the FasterCap source code:
69 |
70 | `cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DFASTFIELDSOLVERS_HEADLESS=ON ../FasterCap`
71 |
72 | Then you can launch the build process with:
73 |
74 | `make`
75 |
76 | Remark: at run time you will see the an "Assert failure" message. This is a wxWidgets issue, see ["debug message when running without session manager"](http://trac.wxwidgets.org/ticket/16024).
77 | The assert is harmless, and it is fixed starting from wxWidgets 3.1.1
78 |
79 | ## Additional packages
80 |
81 | FasterCap also requires two additional source code packages, that are available through the same official repositories you can access from http://www.fastfieldsolvers.com/ or directly from GitHub.
82 |
83 | The packages are:
84 |
85 | - LinAlgebra
86 | - Geometry
87 |
88 | Both package directories, with the above names, must be at the same hierarchy level in the folder structure of the FasterCap source code directory, and are handled by CMake.
89 |
90 | ## Additional information
91 |
92 | For any additional information please visit [FastFieldSolvers](https://www.fastfieldsolvers.com/), write on the [FastFieldSolvers Forum](https://www.fastfieldsolvers.com/forum) or [contact us](https://www.fastfieldsolvers.com/contact.htm).
93 |
94 |
--------------------------------------------------------------------------------
/FasterCapGlobal.h:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | * *
3 | * Copyright (c) 2017 *
4 | * FastFieldSolvers S.R.L. http://www.fastfieldsolvers.com *
5 | * *
6 | * This program is free software; you can redistribute it and/or modify *
7 | * it under the terms of the GNU Lesser General Public License (LGPL) *
8 | * as published by the Free Software Foundation; either version 2 of *
9 | * the License, or (at your option) any later version. *
10 | * for detail see the LICENCE text file. *
11 | * *
12 | * This program is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Library General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Library General Public *
18 | * License along with this program; if not, write to the Free Software *
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
20 | * USA *
21 | * *
22 | ***************************************************************************/
23 |
24 |
25 | // CPP header file containing function prototypes linking
26 | // FasterCap with the GUI I/O window.
27 | // Actual function bodies, when needed, are in FasterCapMain.cpp
28 |
29 | #ifndef FASTERCAPGLOBAL_H
30 | #define FASTERCAPGLOBAL_H
31 |
32 | #include
33 | #include
34 |
35 | #include
36 |
37 | // debug defines
38 | //#define DEBUG_REGISTER_TYPELIB
39 | //#define DEBUG_TEST_POT
40 | //#define DEBUG_LOG_ENABLE
41 |
42 | //#define DEBUG_DUMP_BASIC
43 | //#define DEBUG_DUMP_POT
44 | //#define DEBUG_DUMP_UNCOMP_POT
45 | //#define DEBUG_DUMP_OTHER
46 |
47 | // define headless
48 | //#define FCG_HEADLESS
49 |
50 | // version and copyright header messages
51 | #define FCG_LIC_STD_HEADER1 "FasterCap License"
52 | #define FCG_HEADER_VERSION "FasterCap version 6.0.7"
53 | #define FCG_HEADER_COPYRIGHT "Copyright 2019 FastFieldSolvers S.R.L."
54 | #define FCG_HEADER_WEBSITE "http://www.fastfieldsolvers.com, All Rights reserved"
55 | // license text file name
56 | #define FCG_LICENSE_TEXT_FILE_NAME "LICENCE.txt"
57 |
58 | // must include global definitions for CMemoryUsage class definition
59 | // and FC return code defines, etc.
60 | #include "Solver/SolverGlobal.h"
61 |
62 | #ifndef FCG_HEADLESS
63 | // must include for App pointer global visibility
64 | #include "FasterCapApp.h"
65 | #endif // !FCG_HEADLESS
66 |
67 | // Needed for CLin_Matrix
68 | #include "LinAlgebra/Mtx.h"
69 |
70 | #define MAX_TITLE_LENGHT 64
71 |
72 | // color IDs for OutputText() in FasterCapMain.cpp
73 | #define FCW_BLACK 1
74 | #define FCW_RED 2
75 |
76 | // temp buffer for LogMsg() and ErrMsg()
77 | #define FCM_LOG_BUF_SIZE 1024
78 |
79 |
80 | #ifndef FCG_HEADLESS
81 | // global, exported variables & functions
82 |
83 | class Globals {
84 |
85 | public:
86 | inline static FasterCapApp *GetApp() {
87 | return m_pApp;
88 | }
89 | inline static void SetApp(FasterCapApp *fca) {
90 | m_pApp = fca;
91 | }
92 |
93 |
94 | protected:
95 | static FasterCapApp *m_pApp;
96 | };
97 |
98 | // this function is used for system messages (console stdout or
99 | // GUI MessageBox according to 'FasterCapApp' being a pure console
100 | // or a GUI)
101 | void SysMsg(wxString message, wxString caption="Message", long style = wxOK|wxCENTRE);
102 |
103 | #endif //FCG_HEADLESS
104 |
105 |
106 | // interrupt FasterCap worker thread
107 | extern volatile bool g_bFCContinue;
108 |
109 | // later
110 | //extern char g_sTitle[64];
111 | extern CLin_Matrix g_clsCapMatrixRe, g_clsCapMatrixIm;
112 | extern StlStringList g_stlCondNames;
113 | extern CMemoryUsage g_clsMemUsageCopy, g_clsMemUsage;
114 | extern float g_fSolveTime;
115 | extern long g_lPanelsNum;
116 | extern long g_lLinksNum;
117 | extern bool g_bIsConsole;
118 |
119 | // this function collects all log messages
120 | int LogMsg(const char *fmt,...);
121 | // this function collects all error messages
122 | int ErrMsg(const char *fmt,...);
123 | // this function collects all debug messages (for console only)
124 | int DebugMsg(const char *fmt,...);
125 |
126 |
127 |
128 | #endif //FASTERCAPGLOBAL_H
129 |
130 |
--------------------------------------------------------------------------------
/hlp/Run/Run_ch02.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | Running FasterCap
11 |
12 |
13 |
14 |
15 |
16 |
Running FasterCap
17 |
18 |
Launching FasterCap from the shell
19 |
20 | FasterCap can be launched in GUI-less mode from a System shell (e.g. a DOS shell under MS Windows, a KSH under Linux, etc.).
21 |
22 |
To enter the GUI-less text mode, you need to pass the additional command option '-b' ('batch' mode) when launching FasterCap from the System shell.
23 |
29 | Please note that the command options can be passed in arbitrary order. Please note also that the default option for the GUI-less mode is not Automatic, as it is instead in the GUI mode; so you need to specify the -a option with the relevant tolerance to trigger the Automatic solution mode.
30 |
For a list of valid running command options, please see the explaination in the Run Menu dialog box paragraph. The command options are indicated together with the relevant settings descriptions. Example: 'Stop when relative error is lower than (-a)' indicates that the relevant parameter to control this setting when launched from a System shell is '-a'
31 |
You can also get a list of the valid command options with a short description when launching FasterCap from a System shell with the '-?' parameter (or with any invalid unsupported parameter).
32 |
The return codes can be checked under Linux with the following command:
92 |
93 | echo $?
94 |
95 | and under MS Windows with the command:
96 |
97 | echo %ERRORLEVEL%
98 |
99 |
100 |
101 |
102 |
--------------------------------------------------------------------------------
/AutomationHelper.h:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | * *
3 | * Copyright (c) 2017 *
4 | * FastFieldSolvers S.R.L. http://www.fastfieldsolvers.com *
5 | * *
6 | * This program is free software; you can redistribute it and/or modify *
7 | * it under the terms of the GNU Lesser General Public License (LGPL) *
8 | * as published by the Free Software Foundation; either version 2 of *
9 | * the License, or (at your option) any later version. *
10 | * for detail see the LICENCE text file. *
11 | * *
12 | * This program is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Library General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Library General Public *
18 | * License along with this program; if not, write to the Free Software *
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
20 | * USA *
21 | * *
22 | ***************************************************************************/
23 |
24 |
25 | // AutomationHelper.h : definition of MS Win Automation helper functions
26 | // Enrico Di Lorenzo 2013/03/14
27 |
28 | // These classes are wrappers for Automation variables.
29 | // The main ideas are taken from MS Win SDK 2003, files
30 | // afxdisp.h, afxole.inl, olevar.cpp
31 | // but here the classes are re-implemented from scratch
32 |
33 | #ifndef AUTOMATIONHELPER_DEFS
34 | #define AUTOMATIONHELPER_DEFS
35 |
36 | // definition of wxVariantData needed by the oleutils.h include
37 | #include
38 | // for COM Automation
39 | #include
40 | #include
41 | #include
42 | #include
43 |
44 | // for wxASSERT
45 | #include
46 |
47 | #define ASSERT wxASSERT
48 |
49 |
50 | ///////////////////////////////////
51 | // AutoBSTR class (BSTR wrapper)
52 | ///////////////////////////////////
53 |
54 | class AutoBSTR
55 | {
56 | public:
57 | AutoBSTR();
58 | ~AutoBSTR();
59 |
60 | void Clear();
61 |
62 | const AutoBSTR& operator=(const BSTR& BSTRsrc);
63 | const AutoBSTR& operator=(const char *textSrc);
64 | operator BSTR();
65 | operator LPBSTR();
66 |
67 | private:
68 | BSTR m_clsBSTR;
69 | };
70 |
71 | inline AutoBSTR::AutoBSTR() { m_clsBSTR = NULL; }
72 | inline AutoBSTR::~AutoBSTR() { if(m_clsBSTR != NULL) {SysFreeString(m_clsBSTR);} }
73 | inline void AutoBSTR::Clear() { if(m_clsBSTR != NULL) {SysFreeString(m_clsBSTR);} }
74 | inline AutoBSTR::operator BSTR() { return m_clsBSTR; }
75 | inline AutoBSTR::operator LPBSTR() { return &m_clsBSTR; }
76 |
77 |
78 | ///////////////////////////////////
79 | // AutoVariant class (VARIANT wrapper)
80 | ///////////////////////////////////
81 |
82 | class AutoVariant : public VARIANT
83 | {
84 | public:
85 | AutoVariant();
86 | ~AutoVariant();
87 |
88 | void Clear();
89 | void Attach(VARIANT& varSrc);
90 | VARIANT Detach();
91 |
92 | const AutoVariant& operator=(const VARIANT& varSrc);
93 | const AutoVariant& operator=(const AutoVariant& varSrc);
94 | const AutoVariant& operator=(const char* pCharSrc);
95 | const AutoVariant& operator=(double dblSrc);
96 | operator LPVARIANT();
97 | };
98 |
99 | inline AutoVariant::AutoVariant() { VariantInit(this); }
100 | inline AutoVariant::~AutoVariant() { VariantClear(this); }
101 | inline void AutoVariant::Clear() { VariantClear(this); }
102 | inline AutoVariant::operator LPVARIANT() { return this; }
103 |
104 |
105 | ///////////////////////////////////
106 | // AutoSafeArray class (SAFEARRAY wrapper)
107 | ///////////////////////////////////
108 |
109 | class AutoSafeArray : public VARIANT
110 | {
111 | public:
112 | AutoSafeArray();
113 | ~AutoSafeArray();
114 |
115 | void Clear();
116 | void Create(VARTYPE vtSrc, DWORD dwDims, DWORD* rgElements);
117 | void Create(VARTYPE vtSrc, DWORD dwDims, SAFEARRAYBOUND* rgsabounds);
118 | void PutElement(long* rgIndices, void* pvData);
119 | DWORD GetElemSize();
120 |
121 | operator LPVARIANT();
122 | };
123 |
124 | // helper function
125 | void SafeArrayInit(AutoSafeArray* psa);
126 |
127 | inline AutoSafeArray::AutoSafeArray() { SafeArrayInit(this); vt = VT_EMPTY; }
128 | inline AutoSafeArray::~AutoSafeArray() { Clear(); }
129 | inline void AutoSafeArray::Clear() { VariantClear(this); }
130 | inline DWORD AutoSafeArray::GetElemSize() { return SafeArrayGetElemsize(parray); }
131 | inline AutoSafeArray::operator LPVARIANT() { return this; }
132 |
133 |
134 |
135 | #endif // AUTOMATIONHELPER_DEFS
136 |
--------------------------------------------------------------------------------
/RunDialog.h:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | * *
3 | * Copyright (c) 2017 *
4 | * FastFieldSolvers S.R.L. http://www.fastfieldsolvers.com *
5 | * *
6 | * This program is free software; you can redistribute it and/or modify *
7 | * it under the terms of the GNU Lesser General Public License (LGPL) *
8 | * as published by the Free Software Foundation; either version 2 of *
9 | * the License, or (at your option) any later version. *
10 | * for detail see the LICENCE text file. *
11 | * *
12 | * This program is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Library General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Library General Public *
18 | * License along with this program; if not, write to the Free Software *
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
20 | * USA *
21 | * *
22 | ***************************************************************************/
23 |
24 |
25 | #ifndef RUNDIALOG_H
26 | #define RUNDIALOG_H
27 |
28 | #ifndef WX_PRECOMP
29 | //(*HeadersPCH(RunDialog)
30 | #include
31 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 | #include
37 | //*)
38 | #endif
39 | //(*Headers(RunDialog)
40 | //*)
41 |
42 | // for CAutoRefGlobalVars
43 | #include "Solver/SolverGlobal.h"
44 |
45 | class RunDialog: public wxDialog
46 | {
47 | public:
48 |
49 | RunDialog(wxWindow* parent,wxWindowID id=wxID_ANY);
50 | virtual ~RunDialog();
51 |
52 | CAutoRefGlobalVars GetGlobalVars();
53 | void SetGlobalVarsFileIn(std::string fileIn);
54 |
55 | //(*Declarations(RunDialog)
56 | wxTextCtrl* TextCtrl_EPS_Ratio;
57 | wxCheckBox* CheckBox_AutoSettings;
58 | wxCheckBox* CheckBox_Dump_Residual;
59 | wxTextCtrl* TextCtrl_Dim_Precond_Two_Levels;
60 | wxTextCtrl* TextCtrl_Autorefine_Out_of_Core;
61 | wxTextCtrl* TextCtrl_Curvature;
62 | wxTextCtrl* TextCtrl_Automatic_Error;
63 | wxStaticText* StaticText2;
64 | wxStaticText* StaticText6;
65 | wxTextCtrl* TextCtrl_MeshEps;
66 | wxCheckBox* CheckBox_GalerkinScheme;
67 | wxStaticText* StaticText8;
68 | wxPanel* Panel1;
69 | wxStaticText* StaticText1;
70 | wxCheckBox* CheckBox_Output_Geometry;
71 | wxStaticText* StaticText3;
72 | wxCheckBox* CheckBox_Output_Charge;
73 | wxCheckBox* CheckBox_Dump_Time_Mem;
74 | wxTextCtrl* TextCtrl_InputFileName;
75 | wxStaticText* StaticText5;
76 | wxTextCtrl* TextCtrl_GmresTol;
77 | wxStaticText* StaticText7;
78 | wxCheckBox* CheckBox_Dump_Geometry;
79 | wxCheckBox* CheckBox_Precond_Jacobi;
80 | wxCheckBox* CheckBox_Verbose_Output;
81 | wxButton* Button_BrowseInputFile;
82 | wxCheckBox* CheckBox_Auto_Precond;
83 | wxCheckBox* CheckBox_Precond_TwoLevels;
84 | wxStaticText* StaticText4;
85 | wxCheckBox* CheckBox_Output_Capacitance;
86 | //*)
87 |
88 | wxString m_strSamplePath;
89 |
90 | protected:
91 |
92 | //(*Identifiers(RunDialog)
93 | static const long ID_STATICTEXT1;
94 | static const long ID_INPUT_FILE_NAME;
95 | static const long ID_BROWSE_INPUT_FILE;
96 | static const long ID_AUTO_SETTINGS;
97 | static const long ID_STATICTEXT2;
98 | static const long ID_AUTOMATIC_ERROR;
99 | static const long ID_AUTO_PRECOND;
100 | static const long ID_STATICTEXT7;
101 | static const long ID_MESH_EPS;
102 | static const long ID_STATICTEXT8;
103 | static const long ID_GMRES_TOL;
104 | static const long ID_STATICTEXT3;
105 | static const long ID_EPS_RATIO;
106 | static const long ID_STATICTEXT4;
107 | static const long ID_CURVATURE;
108 | static const long ID_STATICTEXT5;
109 | static const long ID_AUTOREFINE_OUT_OF_CORE;
110 | static const long ID_GALERKIN_SCHEME;
111 | static const long ID_PRECOND_JACOBI;
112 | static const long ID_PRECOND_TWO_LEVELS;
113 | static const long ID_STATICTEXT6;
114 | static const long ID_DIM_PRECOND_TWO_LEVELS;
115 | static const long ID_OUTPUT_GEOMETRY;
116 | static const long ID_DUMP_GEOMETRY;
117 | static const long ID_OUTPUT_CHARGE;
118 | static const long ID_DUMP_RESIDUAL;
119 | static const long ID_DUMP_TIME_MEM;
120 | static const long ID_VERBOSE_OUTPUT;
121 | static const long ID_OUTPUT_CAPACITANCE;
122 | static const long ID_PANEL1;
123 | //*)
124 |
125 | private:
126 |
127 | //(*Handlers(RunDialog)
128 | void OnButton_BrowseInputFileClick(wxCommandEvent& event);
129 | void OnCheckBox_Dump_GeometryClick(wxCommandEvent& event);
130 | //*)
131 |
132 | // Implementation
133 | protected:
134 | void OnReset(wxCommandEvent& event);
135 | void CopyVarsToDialog();
136 | void CopyDialogToVars();
137 | void Reset();
138 |
139 | CAutoRefGlobalVars m_clsGlobalVars;
140 |
141 | DECLARE_EVENT_TABLE()
142 | };
143 |
144 | #endif
145 |
--------------------------------------------------------------------------------
/registry3264.cpp:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | * *
3 | * Copyright (c) 2017 *
4 | * FastFieldSolvers S.R.L. http://www.fastfieldsolvers.com *
5 | * *
6 | * This program is free software; you can redistribute it and/or modify *
7 | * it under the terms of the GNU Lesser General Public License (LGPL) *
8 | * as published by the Free Software Foundation; either version 2 of *
9 | * the License, or (at your option) any later version. *
10 | * for detail see the LICENCE text file. *
11 | * *
12 | * This program is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Library General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Library General Public *
18 | * License along with this program; if not, write to the Free Software *
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
20 | * USA *
21 | * *
22 | ***************************************************************************/
23 |
24 | // class derived from wxWidgets wxRegKey to manage 64 bits vs. 32 bits keys
25 |
26 | #include "wx_pch.h"
27 |
28 | // valid only for MS Win
29 | #ifdef __WXMSW__
30 |
31 | #include "registry3264.h"
32 |
33 | wxRegKey3264::wxRegKey3264(const wxString& strKey, REGSAM mode)
34 | {
35 | key3264access = mode;
36 | ::wxRegKey(strKey);
37 | }
38 |
39 | // parent is a normal regkey
40 | wxRegKey3264::wxRegKey3264(const wxRegKey3264& keyParent, const wxString& strKey, REGSAM mode)
41 | {
42 | key3264access = mode;
43 | ::wxRegKey(keyParent, strKey);
44 | }
45 |
46 | void wxRegKey3264::SetKey32bits()
47 | {
48 | key3264access = KEY_WOW64_32KEY;
49 | }
50 |
51 | // opens key (it's not an error to call Open() on an already opened key)
52 | bool wxRegKey3264::Open(AccessMode mode)
53 | {
54 | REGSAM mode3264;
55 |
56 | if ( IsOpened() )
57 | {
58 | if ( mode <= m_mode )
59 | return true;
60 |
61 | // we had been opened in read mode but now must be reopened in write
62 | Close();
63 | }
64 |
65 | HKEY tmpKey;
66 |
67 | mode3264 = (Read ? KEY_READ : KEY_ALL_ACCESS) | key3264access;
68 |
69 | m_dwLastError = ::RegOpenKeyEx
70 | (
71 | (HKEY) m_hRootKey,
72 | m_strKey,
73 | RESERVED,
74 | mode3264,
75 | &tmpKey
76 | );
77 |
78 | if ( m_dwLastError != ERROR_SUCCESS )
79 | {
80 | wxLogSysError(m_dwLastError, _("Can't open registry key '%s'"),
81 | (const char*)GetName());
82 | return false;
83 | }
84 |
85 | m_hKey = (WXHKEY) tmpKey;
86 | m_mode = mode;
87 |
88 | return true;
89 | }
90 |
91 | // returns true if the key exists
92 | bool wxRegKey3264::Exists() const
93 | {
94 | // opened key has to exist, try to open it if not done yet
95 | return IsOpened() ? true : KeyExists(m_hRootKey, m_strKey);
96 | }
97 |
98 | // returns true if given subkey exists
99 | bool wxRegKey3264::HasSubKey(const wxChar *szKey) const
100 | {
101 | // this function should be silent, so suppress possible messages from Open()
102 | wxLogNull nolog;
103 |
104 | if ( !CONST_CAST Open(Read) )
105 | return false;
106 |
107 | return KeyExists(m_hKey, szKey);
108 | }
109 |
110 | // creates key, failing if it exists and !bOkIfExists
111 | bool wxRegKey3264::Create(bool bOkIfExists)
112 | {
113 | // check for existence only if asked (i.e. order is important!)
114 | if ( !bOkIfExists && Exists() )
115 | return false;
116 |
117 | if ( IsOpened() )
118 | return true;
119 |
120 | HKEY tmpKey;
121 |
122 | DWORD disposition;
123 | m_dwLastError = RegCreateKeyEx((HKEY) m_hRootKey, m_strKey,
124 | NULL, // reserved
125 | NULL, // class string
126 | 0,
127 | KEY_READ | KEY_WRITE | key3264access,
128 | NULL,
129 | &tmpKey,
130 | &disposition);
131 |
132 | if ( m_dwLastError != ERROR_SUCCESS ) {
133 | wxLogSysError(m_dwLastError, _("Can't create registry key '%s'"),
134 | (const char*)GetName());
135 | return false;
136 | }
137 | else
138 | {
139 | m_hKey = (WXHKEY) tmpKey;
140 | return true;
141 | }
142 | }
143 |
144 | bool wxRegKey3264::KeyExists(WXHKEY hRootKey, const wxChar *szKey)
145 | {
146 | // don't close this key itself for the case of empty szKey!
147 | if ( wxIsEmpty(szKey) )
148 | return true;
149 |
150 | HKEY hkeyDummy;
151 | if ( ::RegOpenKeyEx
152 | (
153 | (HKEY)hRootKey,
154 | szKey,
155 | RESERVED,
156 | KEY_READ | key3264access, // we might not have enough rights for rw access
157 | &hkeyDummy
158 | ) == ERROR_SUCCESS )
159 | {
160 | ::RegCloseKey(hkeyDummy);
161 |
162 | return true;
163 | }
164 |
165 | return false;
166 | }
167 |
168 | #endif
169 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # minimum version is 3.0 to be able to handle Eigen library
2 | cmake_minimum_required (VERSION 2.8)
3 | project (FasterCap)
4 |
5 | # main project specific settings
6 | #
7 | # option to compile as headless, or with GUI
8 | set(FASTFIELDSOLVERS_HEADLESS OFF CACHE BOOL "Compile as headless (i.e. no GUI)")
9 |
10 | #
11 | # Global Compiler and Linker Settings
12 | #
13 |
14 | #
15 | # using only GCC, therefore configuring build only for GCC
16 | #
17 | # .cmake files are script files; not using here any script
18 | #include(cMake/custom_include.cmake)
19 | #configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
20 | #
21 | # if headless, pass on the "#define FCG_HEADLESS"
22 | if(${FASTFIELDSOLVERS_HEADLESS} MATCHES ON)
23 | add_definitions("-DFCG_HEADLESS -DwxUSE_GUI=0")
24 | else()
25 | add_definitions("-DwxUSE_GUI=1")
26 | endif()
27 | #
28 | # pass to gcc the argument -DHAVE_CONFIG_H . This defines the pre-processor token HAVE_CONFIG_H
29 | # exactly as if you had #define HAVE_CONFIG_H right at the start of each of your source files.
30 | # HAVE_CONFIG_H is a pre-defined macro in the build-system that generates a config.h
31 | # so that code knows whether it needs to #include config.h
32 | #add_definitions(-DHAVE_CONFIG_H)
33 | #
34 | # List of options to pass to the compiler (note this is a CMake list. Do not enclose in ")
35 | set(FASTFIELDSOLVERS_COMPILE_OPTIONS ${FASTFIELDSOLVERS_COMPILE_OPTIONS} -Wextra -Wall -fopenmp)
36 | # -fopenmp: use OpenMP pragmas
37 | # -lm: link the math library
38 | # -lstdc++: link the standard c++ library (needed for headless)
39 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fopenmp -lm -lstdc++")
40 | # -s: strip all symbols from the executable
41 | set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -s")
42 |
43 | # wxWidgets usage
44 | # See CMake docs "FindwxWidgets"
45 | # In general, for *nix CMake already generates the 'wx-confg' options that are needed
46 | # for compiling and linking with wxWidgets. However, if anything special is needed,
47 | # it must be tweaked into "wxWidgets_CONFIG_OPTIONS".
48 | # In this case, we pass the options `wx-config --version=3.0 --static=no --debug`,
49 | # but '--debug' is only needed in the debug build. Therefore, we use a CMake generator-expression
50 | # to define the flag "--debug" only in case of debug build (this is nested: the first clause
51 | # $ generates 1 or 0 if CONFIG is Debug or not. Then we use the conditional
52 | # expression $, so if the previous evaluates to 1, here the string is "--debug",
53 | # otherwise nothing.
54 | set(wxWidgets_CONFIG_OPTIONS --version=3.0 --static=no $<$:--debug>)
55 | # these flags are BUILD_TYPE dependent
56 | # -D__WXDEBUG__: define that wxWidgets are in debug version
57 | #set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D__WXDEBUG__")
58 | if(${FASTFIELDSOLVERS_HEADLESS} MATCHES ON)
59 | # we only need the 'base' wxWidget package for headless compile
60 | find_package(wxWidgets COMPONENTS base)
61 | else()
62 | # probably not all required. Note however that order is important.
63 | #find_package(wxWidgets COMPONENTS html xrc net core base msw png jpeg tiff zlib kernel32 user32 gdi32 winspool comdlg32 advapi32 shell32 ole32 oleaut32 uuid comctl32 sock32 odbc32 iphlpapi)
64 | find_package(wxWidgets COMPONENTS core base html)
65 | endif()
66 | # Configuration to use
67 | # (e.g., msw, mswd, mswu, mswunivud, etc.)
68 | # wxWidgets_CONFIGURATION
69 | # general include (needed for wxWidgets in CMake), see CMake docs "FindwxWidgets"
70 | include(${wxWidgets_USE_FILE})
71 | # add to WXWIDGETS_LIBS the wxWidgets libraries
72 | # we'll subsequently link WXWIDGETS_LIBS with 'target_link_libraries'
73 | set(WXWIDGETS_LIBS ${WXWIDGETS_LIBS} ${wxWidgets_LIBRARIES})
74 |
75 | # general include_directories, as LinAlgebra and Geometry
76 | # are one level under the base path, and they are included
77 | # in the sources as "#include "LinAlgebra/Mtx.h" etc.
78 | include_directories("..")
79 | # same as above for the main includes in the base path; could use ${CMAKE_SOURCE_DIR}
80 | include_directories(".")
81 |
82 | include_directories ("../LinAlgebra")
83 | add_subdirectory("../LinAlgebra" LinAlgebra)
84 | include_directories ("../Geometry")
85 | add_subdirectory("../Geometry" Geometry)
86 | set (EXTRA_LIBS ${EXTRA_LIBS} LinAlgebra Geometry)
87 |
88 | include_directories ("${PROJECT_SOURCE_DIR}/Solver")
89 | include("./Solver/CMakeLists.txt")
90 | # do not create a library, to speed up compilation in case of file modifications
91 | # (only obj to recompile and final linking, no need to re-create also the library)
92 | #add_subdirectory(Solver)
93 | #set (EXTRA_LIBS ${EXTRA_LIBS} Solver)
94 |
95 | set(FastFieldSolvers_Sources ${FastFieldSolvers_Sources}
96 | FasterCapConsole.cpp
97 | FasterCapConsole.h
98 | FasterCapGlobal.cpp
99 | FasterCapGlobal.h
100 | test.cpp
101 | test.h)
102 |
103 | # if running with a GUI
104 | if(${FASTFIELDSOLVERS_HEADLESS} MATCHES OFF)
105 | set(FastFieldSolvers_Sources ${FastFieldSolvers_Sources}
106 | AboutBox.cpp
107 | AboutBox.h
108 | FasterCapApp.cpp
109 | FasterCapApp.h
110 | FasterCapMain.cpp
111 | FasterCapMain.h
112 | LicenseBox.cpp
113 | LicenseBox.h
114 | RunDialog.cpp
115 | RunDialog.h
116 | resource.rc)
117 | # and if also running on Windows
118 | if(CMAKE_SYSTEM_NAME STREQUAL Windows)
119 | set(FastFieldSolvers_Sources ${FastFieldSolvers_Sources}
120 | AutomationHelper.cpp
121 | AutomationHelper.h)
122 | endif()
123 | endif()
124 |
125 | add_executable (FasterCap ${FastFieldSolvers_Sources} ${FasterCap_Sources})
126 | # Specify compile options to use when compiling a given target.
127 | target_compile_options(FasterCap PUBLIC ${FASTFIELDSOLVERS_COMPILE_OPTIONS})
128 | target_link_libraries(FasterCap ${EXTRA_LIBS} ${WXWIDGETS_LIBS} ${EIGEN_LIBS})
129 |
--------------------------------------------------------------------------------
/FasterCapGlobal.cpp:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | * *
3 | * Copyright (c) 2017 *
4 | * FastFieldSolvers S.R.L. http://www.fastfieldsolvers.com *
5 | * *
6 | * This program is free software; you can redistribute it and/or modify *
7 | * it under the terms of the GNU Lesser General Public License (LGPL) *
8 | * as published by the Free Software Foundation; either version 2 of *
9 | * the License, or (at your option) any later version. *
10 | * for detail see the LICENCE text file. *
11 | * *
12 | * This program is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Library General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Library General Public *
18 | * License along with this program; if not, write to the Free Software *
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
20 | * USA *
21 | * *
22 | ***************************************************************************/
23 |
24 |
25 | #include "FasterCapGlobal.h"
26 |
27 | #ifndef FCG_HEADLESS
28 | #include
29 | #endif // !FCG_HEADLESS
30 |
31 | // signals FasterCap to abort simulation and start waiting again for commands
32 | volatile bool g_bFCContinue = true;
33 |
34 | #ifdef DEBUG_LOG_ENABLE
35 |
36 | int DebugMsg(const char *fmt,...)
37 | {
38 | int ret = 0;
39 |
40 | wxString msg;
41 | va_list arg_ptr;
42 | wxDateTime currtime;
43 |
44 | va_start(arg_ptr, fmt);
45 |
46 | ret = msg.PrintfV(fmt, arg_ptr);
47 |
48 | va_end(arg_ptr);
49 |
50 | // if PrintfV() returns error
51 | if(ret < 0) {
52 | msg = wxT("Error: DebugMsg() is not able to print the message\n");
53 | }
54 |
55 | // add timestamp
56 | currtime.SetToCurrent();
57 | msg = currtime.FormatISODate() + wxT("@") + currtime.FormatISOTime() + wxT(" ") + msg;
58 |
59 | std::cout << msg;
60 | std::cout.flush();
61 |
62 | return ret;
63 | }
64 |
65 | #else //not DEBUG_LOG_ENABLE
66 |
67 | int DebugMsg(const char *,...)
68 | {
69 |
70 | return 0;
71 | }
72 |
73 | #endif //DEBUG_LOG_ENABLE
74 |
75 |
76 | #ifndef FCG_HEADLESS
77 |
78 | // Static data members must be initialized at file scope, even if private.
79 | FasterCapApp *Globals::m_pApp = NULL;
80 |
81 | // remark: cannot be used before initializing 'g_bIsConsole'
82 | // also, in console mode 'style' is ignored
83 | void SysMsg(wxString message, wxString caption, long style)
84 | {
85 | if(g_bIsConsole == true) {
86 | std::cout << caption << " : " << message << std::endl;
87 | }
88 | else {
89 | wxMessageBox(message, caption, style);
90 | }
91 | }
92 |
93 | // in case of GUI, the LogMsg(), ErrMsg() functions etc. are implemented in FasterCapApp.cpp
94 |
95 | #else // if FCG_HEADLESS
96 |
97 | // ----------------------------------------------------------------------------
98 | // global functions for printing messages to the console window
99 | // ----------------------------------------------------------------------------
100 |
101 | int LogMsg(const char *fmt,...)
102 | {
103 | wxString msg;
104 | int ret;
105 | va_list arg_ptr;
106 | char buf[FCM_LOG_BUF_SIZE];
107 |
108 | // The reason for using vsnprintf() instead of wxString::Format() or
109 | // wxString::PrintfV() is that, since we passed variable args,
110 | // then the proper casting is 'gone' beecause it's too late to do anything about
111 | // the arguments when they're already in va_list form
112 | // so wxString::PrintfV() expects strings in Unicode in a Unicode build,
113 | // or in UTF-8 in a non-unicode build, i.e. build-depending.
114 | // Since our LogMsg / ErrMsg is used with UTF-8 parameters in many cases
115 | // (i.e. passing a buffer of char), this does not work (interprets
116 | // the content of the buffer as Unicode). So we use vsnprintf()
117 | // that is always UTF-8 (viceversa, vswprintf() is always Unicode).
118 | // Note: the wx vararg functions (in this case wxString::Format)
119 | // accept any kind of strings. But this works only because they're not vararg
120 | // functions any longer, in fact, but rather pseudo-variadic templates.
121 | // (as per wxWidgets explanation in a forum thread)
122 |
123 | va_start(arg_ptr, fmt);
124 | ret = vsnprintf(buf, FCM_LOG_BUF_SIZE, fmt, arg_ptr);
125 | va_end(arg_ptr);
126 |
127 | msg = buf;
128 |
129 | // if PrintfV() returns error
130 | if(ret < 0) {
131 | msg = wxT("Error: LogMsg() is not able to print the message\n");
132 | }
133 |
134 | std::cout << msg;
135 |
136 | return ret;
137 | }
138 |
139 | int ErrMsg(const char *fmt,...)
140 | {
141 | wxString msg;
142 | int ret;
143 | va_list arg_ptr;
144 | char buf[FCM_LOG_BUF_SIZE];
145 |
146 | va_start(arg_ptr, fmt);
147 | ret = vsnprintf(buf, FCM_LOG_BUF_SIZE, fmt, arg_ptr);
148 | va_end(arg_ptr);
149 |
150 | msg = buf;
151 |
152 | // if PrintfV() returns error
153 | if(ret < 0) {
154 | msg = wxT("Error: ErrMsg() is not able to print the message\n");
155 | }
156 |
157 | std::cout << msg;
158 |
159 | return ret;
160 | }
161 |
162 |
163 | #endif // !FCG_HEADLESS
164 |
165 |
--------------------------------------------------------------------------------
/hlp/InputFile/2D/InputFile_2D_ch02.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | FasterCap Input Files
11 |
12 |
13 |
14 |
15 |
16 |
FasterCap 2D Input Files
17 |
18 |
Input File Structure
19 |
20 |
The input file is a sequential list of materials definitions (conductor 'C' statements and dielectric 'D' statements) and of geometric segment descriptions (straight segment 'S' statements).
21 | Moreover, comments are allowed ('*' elements) as well as naming definitions ('N' elements)
22 |
23 |
Definitions can be nested in a hierarchical fashion to be able to re-use the geometric descriptions and to ease the construction of the models.
24 | Segment geometric definitions ('S' elements) in the root file are assumed by default to belong to conductors embedded in a dielectric medium with unit permittivity.
25 |
26 |
All input files begins with a comment line. For compatibility and to ease possible file merging, you are recommended to start the line with a '*' character; anyway this is not mandatory, and the first line of any input file is always interpreted as a comment.
27 |
A 2D input file MUST contain in the first line of the root file the string "2D" or "2d". This string is used by FasterCap to switch to 2D solver mode. By default, FasterCap assumes to be in 3D solver mode, so 2D file definitions without the "2D" string will cause input parser errors.
28 |
29 |
Remark: since FasterCap is able to automatically refine the geometry, it is best working with an input mesh as coarse as possible.
30 |
31 |
An input file example is shown here below.
32 |
33 |
File coax_cable_coated_2d_fine.lst:
34 |
35 |
36 | * 2D - Coated coaxial cable, a=1 internal radius, b=1.5 diel interface, c=2 external radius
37 | * Analytic capacitance capacitance is C1*C2/(C1+C2) where
38 | * C1 = 2*pi*e0*er1/ln(b/a) = 274.4 pF/m, C2 = 2*pi*e0*er2/ln(c/b) = 193.4 pf/m
39 | * It follows C = 113.4 pF/m
40 | * Note that in this input file the discretization is finer (40 sections per circle)
41 | * so actual capacitance is closer to the theorical one
42 |
43 | C circle_0.1_fine.txt 2.0 0.0 0.0
44 | D circle_0.15_fine.txt 2.0 1.0 0.0 0.0 0.0 0.0
45 | C circle_0.2_fine.txt 1.0 0.0 0.0
46 |
47 |
48 |
The above input file references hierarchically the files circle_0.1_fine.txt, circle_0.15_fine.txt, and circle_0.2_fine.txt. These files contains a geometric description of a circular conductor with different diameters, as shown here below for the file circle_0.1_fine.txt.
49 |
50 |
File circle_0.1_fine.txt:
51 |
52 |
53 | 0 circle with diameter 0.1. centered at the origin
54 | *
55 | S circle 0.1 0 0.098768907 0.015642989
56 | S circle 0.098768907 0.015642989 0.095105938 0.030900818
57 | S circle 0.095105938 0.030900818 0.089101283 0.045397812
58 | S circle 0.089101283 0.045397812 0.080902789 0.058777026
59 | S circle 0.080902789 0.058777026 0.070712316 0.07070904
60 | S circle 0.070712316 0.07070904 0.058780774 0.080900066
61 | S circle 0.058780774 0.080900066 0.045401939 0.08909918
62 | S circle 0.045401939 0.08909918 0.030905224 0.095104506
63 | S circle 0.030905224 0.095104506 0.015647565 0.098768182
64 | S circle 0.015647565 0.098768182 4.63268E-06 0.1
65 | S circle 4.63268E-06 0.1 -0.015638413 0.098769631
66 | S circle -0.015638413 0.098769631 -0.030896412 0.095107369
67 | S circle -0.030896412 0.095107369 -0.045393684 0.089103386
68 | S circle -0.045393684 0.089103386 -0.058773278 0.080905511
69 | S circle -0.058773278 0.080905511 -0.070705764 0.070715592
70 | S circle -0.070705764 0.070715592 -0.080897342 0.058784522
71 | S circle -0.080897342 0.058784522 -0.089097077 0.045406067
72 | S circle -0.089097077 0.045406067 -0.095103074 0.03090963
73 | S circle -0.095103074 0.03090963 -0.098767457 0.01565214
74 | S circle -0.098767457 0.01565214 -0.1 9.26536E-06
75 | S circle -0.1 9.26536E-06 -0.098770355 -0.015633838
76 | S circle -0.098770355 -0.015633838 -0.095108801 -0.030892006
77 | S circle -0.095108801 -0.030892006 -0.089105489 -0.045389556
78 | S circle -0.089105489 -0.045389556 -0.080908234 -0.05876953
79 | S circle -0.080908234 -0.05876953 -0.070718867 -0.070702488
80 | S circle -0.070718867 -0.070702488 -0.058788269 -0.080894619
81 | S circle -0.058788269 -0.080894619 -0.045410195 -0.089094973
82 | S circle -0.045410195 -0.089094973 -0.030914036 -0.095101642
83 | S circle -0.030914036 -0.095101642 -0.015656716 -0.098766732
84 | S circle -0.015656716 -0.098766732 -1.3898E-05 -0.099999999
85 | S circle -1.3898E-05 -0.099999999 0.015629262 -0.09877108
86 | S circle 0.015629262 -0.09877108 0.0308876 -0.095110232
87 | S circle 0.0308876 -0.095110232 0.045385428 -0.089107592
88 | S circle 0.045385428 -0.089107592 0.058765782 -0.080910957
89 | S circle 0.058765782 -0.080910957 0.070699212 -0.070722142
90 | S circle 0.070699212 -0.070722142 0.080891895 -0.058792017
91 | S circle 0.080891895 -0.058792017 0.089092869 -0.045414322
92 | S circle 0.089092869 -0.045414322 0.09510021 -0.030918442
93 | S circle 0.09510021 -0.030918442 0.098766006 -0.015661291
94 | S circle 0.098766006 -0.015661291 0.099999998 -1.85307E-05
95 |
96 |
97 |
98 |
The following sections explain in detail the meaning of each statement.
99 |
100 |
101 |
102 |
103 |
104 |
--------------------------------------------------------------------------------
/Solver/AutoSegment.h:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | * *
3 | * Copyright (c) 2017 *
4 | * FastFieldSolvers S.R.L. http://www.fastfieldsolvers.com *
5 | * *
6 | * This program is free software; you can redistribute it and/or modify *
7 | * it under the terms of the GNU Lesser General Public License (LGPL) *
8 | * as published by the Free Software Foundation; either version 2 of *
9 | * the License, or (at your option) any later version. *
10 | * for detail see the LICENCE text file. *
11 | * *
12 | * This program is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Library General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Library General Public *
18 | * License along with this program; if not, write to the Free Software *
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
20 | * USA *
21 | * *
22 | ***************************************************************************/
23 |
24 |
25 | // AutoSegment.h : 2D segments definitions
26 | // E. Di Lorenzo, 2013/02/02
27 |
28 | #if !defined(AFX_AUTOSEGMENT_H__E89AAF21_5486_11D5_9282_04F014C10000__INCLUDED_)
29 | #define AFX_AUTOSEGMENT_H__E89AAF21_5486_11D5_9282_04F014C10000__INCLUDED_
30 |
31 | #include "SolverGlobal.h"
32 |
33 | #include
34 | #include
35 |
36 | // for base class
37 | #include "AutoElement.h"
38 |
39 | // includes for vector class
40 | #include "Geometry/Vector2D.h"
41 |
42 | // for common defines
43 | #include "AutoPanel.h"
44 |
45 | using namespace std;
46 |
47 | class CAutoConductor;
48 |
49 | // panel structure used by CAutoRefine
50 | class CAutoSegment : public CAutoElement
51 | {
52 | public:
53 | void CalcSegmentGeomPar();
54 | void MakeSuperSegment(CAutoSegment *leftSubPanel, CAutoSegment *rightSubPanel);
55 | int Subdivide();
56 | void Scale(double scale);
57 |
58 | //
59 | // virtual functions implementation
60 |
61 | void ErrorPrintCoords();
62 | unsigned char GetClass()
63 | {
64 | return AUTOELEMENT_SEGMENT;
65 | }
66 |
67 | //
68 | // inlines
69 |
70 | inline C2DVector_float& GetCentroid() {
71 | return m_clsCentroid;
72 | }
73 | inline CAutoSegment *GetLeftChild() {
74 | return (CAutoSegment*)m_pLeft;
75 | }
76 | inline CAutoSegment *GetRightChild() {
77 | return (CAutoSegment*)m_pRight;
78 | }
79 |
80 | // geometric normal (i.e. calculated from the segment vertexes) can be
81 | // different from the normal used for the dielectric calculations in two cases:
82 | // Case 1:
83 | // in case of super-panels. In particular, if a super panel is created
84 | // from two normal-opposite segments, dielectric normal is zero,
85 | // even if the geometric normal is the one of the actual segment
86 | // Case 2:
87 | // for diel normal in opposide direction w.r.t the geometric normal
88 | // (i.e. panel->m_ucType not flagged AUTOPANEL_OUTPERM_NORMAL_DIR)
89 | //
90 | // 'm_clsNormal' stores the gemetric normal for standard segments,
91 | // while for super segments it stores the averaged normal from sub-segments
92 | inline C2DVector GetGeoNormal()
93 | {
94 | C2DVector_float unitvector;
95 |
96 | if(m_ucType & AUTOPANEL_IS_SUPER_NODE) {
97 | // calculate on the fly
98 | CalculateNormal(unitvector);
99 | }
100 | else {
101 | unitvector = m_clsNormal;
102 | }
103 |
104 | return unitvector;
105 | }
106 |
107 | inline C2DVector GetDielNormal()
108 | {
109 | double modnormal;
110 | C2DVector unitvector;
111 |
112 | if(m_ucType & AUTOPANEL_IS_SUPER_NODE) {
113 | // must normalize since super panel normals are not unit vectors
114 | // TBC warning: could normalize all super panel normals
115 | // after the end of hierarchical super panel build pass, to avoid calculating every time
116 | modnormal = Mod(m_clsNormal);
117 | if(modnormal < AUTOPANEL_EPS) {
118 | unitvector = C2DVector(0,0);
119 | }
120 | else {
121 | unitvector = m_clsNormal / modnormal;
122 | }
123 | }
124 | else {
125 | unitvector = m_clsNormal;
126 | }
127 |
128 | if( (m_ucType & AUTOPANEL_OUTPERM_NORMAL_DIR) != AUTOPANEL_OUTPERM_NORMAL_DIR ) {
129 | unitvector.Invert();
130 | }
131 |
132 | return unitvector;
133 | }
134 |
135 | inline double GetLength()
136 | {
137 | return m_dDimension;
138 | }
139 |
140 | /*
141 | // for saving memory of CAutoPanel class structure
142 |
143 | inline C3DVector GetCentroid() {
144 |
145 | if( (m_ucType & AUTOPANEL_IS_SUPER_NODE) == AUTOPANEL_IS_SUPER_NODE) {
146 | // if super panel, compute centroid from bbox
147 | return (m_clsVertex[0] + m_clsVertex[1]) / 2.0;
148 | }
149 | else {
150 | return (m_clsVertex[0] + m_clsVertex[1] + m_clsVertex[2]) / 3.0;
151 | }
152 | }
153 | */
154 |
155 | C2DVector_float m_clsVertex[2];
156 | C2DVector_float m_clsNormal, m_clsCentroid;
157 |
158 | protected:
159 |
160 | double CalculateNormal(C2DVector_float &normal);
161 |
162 | };
163 |
164 | typedef std::deque StlAutoSegmentDeque;
165 |
166 |
167 | #endif //!defined(AFX_AUTOSEGMENT_H__E89AAF21_5486_11D5_9282_04F014C10000__INCLUDED_)
168 |
--------------------------------------------------------------------------------
/hlp/WelcometoFasterCap.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Welcome to FasterCap
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
FasterCap User Guide
18 |
19 |
20 |
21 |
22 |
23 |
24 |
Welcome to FasterCap !
25 |
26 |
FasterCap is a powerful three-dimensional capactiance extraction program.
27 |
Build upon state-of-the-art technology, FasterCap improves the capabilities of the premium 'golden reference' FastCap software, while preserving the accuracy for which FastCap is renowed. FasterCap is faster, requires less memory, and provides additional capabilities with respect to FastCap.
28 |
29 |
Features include:
30 |
31 |
32 |
3D and 2D solver capabilities
33 |
FasterCap is able to handle 3D models as well as native 2D models for faster simulation where only the cross-section of the structure is of interest (e.g. transmission lines)
34 |
35 |
Support of lossy dielectric mediums
36 |
Specifying complex permittivity values, you can simulate the presence of lossy dielectrics
37 |
38 |
Linear solution time with respect to the number of panels N.
39 |
The time needed to compute the self and mutual capacitances between the input set of conductors increases only linearly with the overall number of panels N. This feature is guaranteed by the O(N) complexity of the underlying algoritm, no matter the shape, orientation and size of the input geometries
40 |
41 |
Support for arbitraty shaped dielectric interfaces
42 |
FasterCap supports Dielectric regions composed of any number of constant-permittivity regions of any shape and size
43 |
44 |
Support for triangular and quadrilateral input elements
45 |
FasterCap supports the definition of the input geometry using either triangular or quadrilateral input elements, for maximum flexibility.
46 |
47 |
Full Automation support, for solver control by remote programs
48 |
Full automation support allows to fully control FasterCap from other programs, either in foreground or in background, using a standard interface. Thanks to this capability, FasterCap can be used as an embedded engine in your application, in a fast and smart way.
49 |
50 |
Automatic mesh refinement
51 |
FasterCap can automatically refine the input geometry mesh until result convergence is reached, within a preset error threshold. Therefore, the user is free from the burden to provide more and more refined version of the input geometry to reach the requested accuracy of the results.
52 |
53 |
Handling of very large models, with improved speed and reduced memory requirements
54 |
FasterCap is able handle very large, non-homogeneous geometries, easily breaking the barrier of one million panels in the mesh. This is thanks to the capability to achieve the solution in a shorter time and with smaller memory requirements with respect to FastCap.
55 |
56 |
Out-of-core capability
57 |
Memory requirement, more than solution time, is the bottleneck of modern field simulations, limiting the maximum addressable system dimension. To overcame the RAM memory limits, imposed by the cost / GB, FasterCap is able to go out-of-core, that is, to resort to the much larger storage capacity of the hard disk. Using smart algorithms for streamlining the data structure organization on the hard disk, FasterCap is able to efficiently make use of the mass memory support to run huge simulations in a convenient time tradeoff.
58 |
59 |
Speed-independency from non-uniform geometries in space
60 |
Thanks to the underlying data structures not requiring a uniform 3D partition of the model building box, as in most tree codes, the geometry can be highly non-uniform in space (the 'teapot in stadium' problem), without hampering the speed, the accuracy or the memory required to handle the model.
61 |
62 |
Multi-core parallel execution
63 |
FasterCap leverages multi-core parallel execution capabilities of modern machines to run time-critical funcitons over multiple processor, for maximum speed gain.
64 |
65 |
Hierarchical input files support
66 |
FasterCap extends the flexibility of the FastCap input files, to handle hierarchical input files. This capability allows to overcome the limit of two levels of hierarchy imposed by FastCap. You can therefore define your geometry in a very structured way, with maximum reuse of the different items definition.
67 |
68 |
Charge density output for visualization in FastModel
69 |
The charge densities calculated for the set of conductors at each capacitance matrix column sweep can be output to a file, that can be loaded into FastModel for easy visualization.
70 |
71 |
Input file syntax compatible with FastCap
72 |
FasterCap is 100% compatible with FastCap generic file format, thus preserving your existing import/export interfaces.
73 |
74 |
Refined model output in FastCap compatible format
75 |
FasterCap optionally can dump in FastCap-compatible file a copy of the final refined mesh, thus enabling you to use FasterCap as a tool to refine the input geometry, and to run the same simulation in FastCap. This allows a straightforward benchmarking between the two solvers.
76 |
77 |
78 |
79 |
80 |
81 |
82 |
Visit our web site FastFieldSolvers for new releases, support, customization and many other services!
83 |
84 |
85 |
Copyright FastFieldSolvers S.R.L. 2014 - All rights reserved
86 |
87 |
88 |
--------------------------------------------------------------------------------
/AboutBox.cpp:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | * *
3 | * Copyright (c) 2017 *
4 | * FastFieldSolvers S.R.L. http://www.fastfieldsolvers.com *
5 | * *
6 | * This program is free software; you can redistribute it and/or modify *
7 | * it under the terms of the GNU Lesser General Public License (LGPL) *
8 | * as published by the Free Software Foundation; either version 2 of *
9 | * the License, or (at your option) any later version. *
10 | * for detail see the LICENCE text file. *
11 | * *
12 | * This program is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Library General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Library General Public *
18 | * License along with this program; if not, write to the Free Software *
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
20 | * USA *
21 | * *
22 | ***************************************************************************/
23 |
24 | #include "wx_pch.h"
25 | #include "AboutBox.h"
26 |
27 | #ifndef WX_PRECOMP
28 | //(*InternalHeadersPCH(AboutBox)
29 | #include
30 | #include
31 | //*)
32 | #endif
33 | //(*InternalHeaders(AboutBox)
34 | //*)
35 |
36 | #include "FasterCapGlobal.h"
37 |
38 | #include "LicenseBox.h"
39 |
40 | // include the big application icon
41 | #include "res/FasterCap_32x32.xpm"
42 |
43 | //(*IdInit(AboutBox)
44 | const long AboutBox::ID_STATICBITMAP1 = wxNewId();
45 | const long AboutBox::ID_ABOUTBOX_VERSION = wxNewId();
46 | const long AboutBox::ID_ABOUTBOX_COPYRIGHT = wxNewId();
47 | const long AboutBox::ID_ABOUTBOX_WEBSITE = wxNewId();
48 | const long AboutBox::ID_ABOUTBOX_SHOWLICENSE = wxNewId();
49 | const long AboutBox::ID_PANEL1 = wxNewId();
50 | //*)
51 |
52 | BEGIN_EVENT_TABLE(AboutBox,wxDialog)
53 | //(*EventTable(AboutBox)
54 | //*)
55 | END_EVENT_TABLE()
56 |
57 | AboutBox::AboutBox(wxWindow* parent,wxWindowID ,const wxPoint& ,const wxSize& )
58 | {
59 | //(*Initialize(AboutBox)
60 | wxBoxSizer* BoxSizer2;
61 | wxBoxSizer* BoxSizer1;
62 | wxFlexGridSizer* FlexGridSizer1;
63 | wxBoxSizer* BoxSizer3;
64 | wxStdDialogButtonSizer* StdDialogButtonSizer1;
65 |
66 | Create(parent, wxID_ANY, _("About"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY"));
67 | BoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
68 | Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
69 | FlexGridSizer1 = new wxFlexGridSizer(2, 2, 0, 0);
70 | StaticBitmap1 = new wxStaticBitmap(Panel1, ID_STATICBITMAP1, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER, _T("ID_STATICBITMAP1"));
71 | FlexGridSizer1->Add(StaticBitmap1, 1, wxALL|wxALIGN_TOP|wxALIGN_CENTER_HORIZONTAL, 5);
72 | BoxSizer2 = new wxBoxSizer(wxVERTICAL);
73 | StaticText_Version = new wxStaticText(Panel1, ID_ABOUTBOX_VERSION, _("FasterCap Version X.X.X"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_ABOUTBOX_VERSION"));
74 | BoxSizer2->Add(StaticText_Version, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
75 | StaticText_Copyright = new wxStaticText(Panel1, ID_ABOUTBOX_COPYRIGHT, _("Copyright (C) 2018 FastFieldSolvers S.R.L."), wxDefaultPosition, wxDefaultSize, 0, _T("ID_ABOUTBOX_COPYRIGHT"));
76 | BoxSizer2->Add(StaticText_Copyright, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
77 | StaticText_WebSite = new wxStaticText(Panel1, ID_ABOUTBOX_WEBSITE, _("http://www.fastfieldsolvers.com"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_ABOUTBOX_WEBSITE"));
78 | BoxSizer2->Add(StaticText_WebSite, 1, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
79 | FlexGridSizer1->Add(BoxSizer2, 1, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
80 | FlexGridSizer1->Add(-1,-1,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
81 | BoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
82 | Button_ShowLicense = new wxButton(Panel1, ID_ABOUTBOX_SHOWLICENSE, _("Show License"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_ABOUTBOX_SHOWLICENSE"));
83 | BoxSizer3->Add(Button_ShowLicense, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
84 | StdDialogButtonSizer1 = new wxStdDialogButtonSizer();
85 | StdDialogButtonSizer1->AddButton(new wxButton(Panel1, wxID_OK, wxEmptyString));
86 | StdDialogButtonSizer1->Realize();
87 | BoxSizer3->Add(StdDialogButtonSizer1, 1, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
88 | FlexGridSizer1->Add(BoxSizer3, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
89 | Panel1->SetSizer(FlexGridSizer1);
90 | FlexGridSizer1->Fit(Panel1);
91 | FlexGridSizer1->SetSizeHints(Panel1);
92 | BoxSizer1->Add(Panel1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
93 | SetSizer(BoxSizer1);
94 | BoxSizer1->Fit(this);
95 | BoxSizer1->SetSizeHints(this);
96 |
97 | Connect(ID_ABOUTBOX_SHOWLICENSE,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&AboutBox::OnButton_ShowLicenseClick);
98 | //*)
99 |
100 | // update with correct global values
101 | StaticText_Version->SetLabel(wxT(FCG_HEADER_VERSION));
102 | StaticText_Copyright->SetLabel(wxT(FCG_HEADER_COPYRIGHT));
103 | StaticText_WebSite->SetLabel(wxT(FCG_HEADER_WEBSITE));
104 | StaticBitmap1->SetBitmap(wxBitmap(FasterCap_32x32_xpm));
105 | //
106 | // and rearrange the dimension, since the static texts / images etc. can be smaller or larger
107 | //
108 | FlexGridSizer1->Fit(Panel1);
109 | // can/must call SetSizeHints() because 'Panel1' is derived from wxWindow,
110 | // while the other object in the hierarchy (e.g. BoxSizer) etc. derive from wxObject only
111 | FlexGridSizer1->SetSizeHints(Panel1);
112 | BoxSizer1->Fit(this);
113 | BoxSizer1->SetSizeHints(this);
114 | }
115 |
116 | AboutBox::~AboutBox()
117 | {
118 | //(*Destroy(AboutBox)
119 | //*)
120 | }
121 |
122 | void AboutBox::OnButton_ShowLicenseClick(wxCommandEvent& )
123 | {
124 | LicenseBox licenseDlg(this);
125 | licenseDlg.ShowModal();
126 | }
127 |
--------------------------------------------------------------------------------
/LicenseBox.cpp:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | * *
3 | * Copyright (c) 2017 *
4 | * FastFieldSolvers S.R.L. http://www.fastfieldsolvers.com *
5 | * *
6 | * This program is free software; you can redistribute it and/or modify *
7 | * it under the terms of the GNU Lesser General Public License (LGPL) *
8 | * as published by the Free Software Foundation; either version 2 of *
9 | * the License, or (at your option) any later version. *
10 | * for detail see the LICENCE text file. *
11 | * *
12 | * This program is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Library General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Library General Public *
18 | * License along with this program; if not, write to the Free Software *
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
20 | * USA *
21 | * *
22 | ***************************************************************************/
23 |
24 |
25 | #include "wx_pch.h"
26 | #include "LicenseBox.h"
27 |
28 | #ifndef WX_PRECOMP
29 | //(*InternalHeadersPCH(LicenseBox)
30 | #include
31 | #include
32 | //*)
33 | #endif
34 |
35 | #include
36 | #include
37 |
38 | // for #defines
39 | #include "FasterCapGlobal.h"
40 |
41 | //(*InternalHeaders(LicenseBox)
42 | #include
43 | //*)
44 |
45 | //(*IdInit(LicenseBox)
46 | const long LicenseBox::ID_STATICTEXT_HEADER1 = wxNewId();
47 | const long LicenseBox::ID_STATICTEXT_HEADER2 = wxNewId();
48 | const long LicenseBox::ID_STATICTEXT_HEADER3 = wxNewId();
49 | const long LicenseBox::ID_TEXTCTRL_LICENSE = wxNewId();
50 | const long LicenseBox::ID_PANEL1 = wxNewId();
51 | //*)
52 |
53 | BEGIN_EVENT_TABLE(LicenseBox,wxDialog)
54 | //(*EventTable(LicenseBox)
55 | //*)
56 | END_EVENT_TABLE()
57 |
58 | LicenseBox::LicenseBox(wxWindow* parent,wxWindowID )
59 | {
60 | wxTextFile file;
61 | wxFileName fileName;
62 | unsigned int i;
63 |
64 | //(*Initialize(LicenseBox)
65 | wxBoxSizer* BoxSizer2;
66 | wxBoxSizer* BoxSizer1;
67 | wxFlexGridSizer* FlexGridSizer1;
68 | wxStdDialogButtonSizer* StdDialogButtonSizer1;
69 |
70 | Create(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY"));
71 | BoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
72 | Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
73 | FlexGridSizer1 = new wxFlexGridSizer(3, 1, 0, 0);
74 | BoxSizer2 = new wxBoxSizer(wxVERTICAL);
75 | StaticText_Header1 = new wxStaticText(Panel1, ID_STATICTEXT_HEADER1, _("FasterCap Demo License"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT_HEADER1"));
76 | BoxSizer2->Add(StaticText_Header1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
77 | StaticText_Header2 = new wxStaticText(Panel1, ID_STATICTEXT_HEADER2, _("Please contact FastFieldSolvers S.r.l. if you wish to purchase a commercial license"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT_HEADER2"));
78 | BoxSizer2->Add(StaticText_Header2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
79 | StaticText_Header3 = new wxStaticText(Panel1, ID_STATICTEXT_HEADER3, _("http://www.fastfieldsolvers.com"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT_HEADER3"));
80 | BoxSizer2->Add(StaticText_Header3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
81 | FlexGridSizer1->Add(BoxSizer2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
82 | TextCtrl_License = new wxTextCtrl(Panel1, ID_TEXTCTRL_LICENSE, _("License"), wxDefaultPosition, wxSize(400,300), wxTE_AUTO_SCROLL|wxTE_MULTILINE|wxTE_WORDWRAP, wxDefaultValidator, _T("ID_TEXTCTRL_LICENSE"));
83 | FlexGridSizer1->Add(TextCtrl_License, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
84 | StdDialogButtonSizer1 = new wxStdDialogButtonSizer();
85 | StdDialogButtonSizer1->AddButton(new wxButton(Panel1, wxID_OK, _("I accept")));
86 | StdDialogButtonSizer1->Realize();
87 | FlexGridSizer1->Add(StdDialogButtonSizer1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
88 | Panel1->SetSizer(FlexGridSizer1);
89 | FlexGridSizer1->Fit(Panel1);
90 | FlexGridSizer1->SetSizeHints(Panel1);
91 | BoxSizer1->Add(Panel1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
92 | SetSizer(BoxSizer1);
93 | BoxSizer1->Fit(this);
94 | BoxSizer1->SetSizeHints(this);
95 | //*)
96 |
97 | StaticText_Header1->SetLabel(wxT(FCG_LIC_STD_HEADER1));
98 | StaticText_Header2->SetLabel(wxT(FCG_HEADER_COPYRIGHT));
99 | StaticText_Header3->SetLabel(wxT(FCG_HEADER_WEBSITE));
100 |
101 | // load license text
102 |
103 | TextCtrl_License->Clear();
104 |
105 | if ( file.Open((Globals::GetApp())->GetLicenseTextPath()) ) {
106 | for (i = 0; i < file.GetLineCount(); i++) {
107 | TextCtrl_License->AppendText(file[i]);
108 | TextCtrl_License->AppendText(wxT("\n"));
109 | }
110 | file.Close();
111 | }
112 | else {
113 | TextCtrl_License->SetDefaultStyle(wxTextAttr(*wxRED));
114 | TextCtrl_License->AppendText("ERROR - License text cannot be read\n");
115 | TextCtrl_License->AppendText("You are NOT authorized to use the software\n");
116 | }
117 |
118 | //
119 | // and rearrange the dimension, since the static texts / images etc. can be smaller or larger
120 | //
121 | FlexGridSizer1->Fit(Panel1);
122 | // can/must call SetSizeHints() because 'Panel1' is derived from wxWindow,
123 | // while the other object in the hierarchy (e.g. BoxSizer) etc. derive from wxObject only
124 | FlexGridSizer1->SetSizeHints(Panel1);
125 | BoxSizer1->Fit(this);
126 | BoxSizer1->SetSizeHints(this);
127 |
128 | // go to beginning of text, first by unselecting all the text, then moving to first pos
129 | // remark: must use SetFocus() before, or it does not unselect the text (selecting when
130 | // getting focus is standard wxWidgets behavior, must explicitly unselect)
131 | TextCtrl_License->SetFocus();
132 | TextCtrl_License->ShowPosition(0);
133 | TextCtrl_License->SetSelection(0, 0);
134 | }
135 |
136 | LicenseBox::~LicenseBox()
137 | {
138 | //(*Destroy(LicenseBox)
139 | //*)
140 | }
141 |
142 |
--------------------------------------------------------------------------------