Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open feat 240319 #182

Merged
merged 5 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 21 additions & 20 deletions DyssolInstallers/Scripts/Main.iss
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppPublisherURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={commonpf}\{#MyAppName}
DefaultDirName={autopf}\{#MyAppName}
DefaultGroupName={#MyAppName}
UninstallDisplayIcon={app}\{#MyAppExeName}
AppContact={#MyAppContact}
Expand All @@ -66,7 +66,8 @@ AllowNoIcons=yes
ChangesAssociations=True
ShowLanguageDialog=auto
PrivilegesRequired=poweruser
UsedUserAreasWarning=no
PrivilegesRequiredOverridesAllowed=dialog
UsedUserAreasWarning=yes
#ifdef IsIncludeX64
#ifdef IsIncludeX32
ArchitecturesAllowed=x86 x64
Expand Down Expand Up @@ -108,38 +109,38 @@ Source: "..\Data\Licenses\*.txt"; DestDir: "{app}\Licenses"; Flags: ignoreversio

[Dirs]
Name: "{app}\Licenses"; Flags: uninsalwaysuninstall
Name: "{userappdata}\{#MyAppName}"; Flags: uninsalwaysuninstall
Name: "{userappdata}\{#MyAppName}\{code:DirCache}"; Flags: uninsalwaysuninstall
Name: "{userappdata}\{#MyAppName}\{code:DirCacheDebug}"; Flags: uninsalwaysuninstall
Name: "{autoappdata}\{#MyAppName}"; Flags: uninsalwaysuninstall
Name: "{autoappdata}\{#MyAppName}\{code:DirCache}"; Flags: uninsalwaysuninstall
Name: "{autoappdata}\{#MyAppName}\{code:DirCacheDebug}"; Flags: uninsalwaysuninstall

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
Name: "{group}\{cm:UninstallProgram, {#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{group}\{#MyAppName} Uninstall"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Registry]
Root: "HKLM"; Subkey: "Software\Classes\.dflw"; ValueType: string; ValueData: "DyssolFlowsheet"; Flags: uninsdeletevalue
Root: "HKLM"; Subkey: "Software\Classes\DyssolFlowsheet"; ValueType: string; ValueData: "Dyssol Flowsheet"; Flags: uninsdeletekey
Root: "HKLM"; Subkey: "Software\Classes\DyssolFlowsheet\DefaultIcon"; ValueType: string; ValueData: "{app}\{#MyAppExeName},0"
Root: "HKLM"; Subkey: "Software\Classes\DyssolFlowsheet\shell\open\command"; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""
Root: "HKLM"; Subkey: "Software\{#MyAppName}"; ValueType: string; ValueName: "key"; ValueData: "{code:VarRegKey}"; Flags: uninsdeletekey
Root: "HKA"; Subkey: "Software\Classes\.dflw"; ValueType: string; ValueData: "DyssolFlowsheet"; Flags: uninsdeletevalue
Root: "HKA"; Subkey: "Software\Classes\DyssolFlowsheet"; ValueType: string; ValueData: "Dyssol Flowsheet"; Flags: uninsdeletekey
Root: "HKA"; Subkey: "Software\Classes\DyssolFlowsheet\DefaultIcon"; ValueType: string; ValueData: "{app}\{#MyAppExeName},0"
Root: "HKA"; Subkey: "Software\Classes\DyssolFlowsheet\shell\open\command"; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" ""%1"""
Root: "HKA"; Subkey: "Software\{#MyAppName}"; ValueType: string; ValueName: "key"; ValueData: "{code:VarRegKey}"; Flags: uninsdeletekey

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

[UninstallDelete]
Type: dirifempty; Name: "{app}"
Type: filesandordirs; Name: "{userappdata}\{#MyAppName}\{code:DirCache}"
Type: filesandordirs; Name: "{userappdata}\{#MyAppName}\{code:DirCacheDebug}"
Type: filesandordirs; Name: "{autoappdata}\{#MyAppName}\{code:DirCache}"
Type: filesandordirs; Name: "{autoappdata}\{#MyAppName}\{code:DirCacheDebug}"

[INI]
Filename: "{userappdata}\{#MyAppName}\{code:FileConfigIni}"; Section: "General"; Key: "modelsFolders"; String: "{code:VarIniModelsFolders}"; Flags: createkeyifdoesntexist
Filename: "{userappdata}\{#MyAppName}\{code:FileConfigIni}"; Section: "General"; Key: "modelsFoldersActivity"; String: "{code:VarIniFoldersActivity}"; Flags: createkeyifdoesntexist
Filename: "{userappdata}\{#MyAppName}\{code:FileConfigIni}"; Section: "General"; Key: "materialsDBPath"; String: "{code:MakeRightSlashes|{app}\Materials.dmdb}"; Flags: createkeyifdoesntexist
Filename: "{userappdata}\{#MyAppName}\{code:FileConfigIni}"; Section: "General"; Key: "cachePath"; String: "{userappdata}\{#MyAppName}"; Flags: createkeyifdoesntexist
Filename: "{userappdata}\{#MyAppName}\{code:FileConfigIni}"; Section: "General"; Key: "loadLast"; String: "false"; Flags: createkeyifdoesntexist
Filename: "{autoappdata}\{#MyAppName}\{code:FileConfigIni}"; Section: "General"; Key: "modelsFolders"; String: "{code:VarIniModelsFolders}"; Flags: createkeyifdoesntexist
Filename: "{autoappdata}\{#MyAppName}\{code:FileConfigIni}"; Section: "General"; Key: "modelsFoldersActivity"; String: "{code:VarIniFoldersActivity}"; Flags: createkeyifdoesntexist
Filename: "{autoappdata}\{#MyAppName}\{code:FileConfigIni}"; Section: "General"; Key: "materialsDBPath"; String: "{code:MakeRightSlashes|{app}\Materials.dmdb}"; Flags: createkeyifdoesntexist
Filename: "{autoappdata}\{#MyAppName}\{code:FileConfigIni}"; Section: "General"; Key: "cachePath"; String: "{autoappdata}\{#MyAppName}"; Flags: createkeyifdoesntexist
Filename: "{autoappdata}\{#MyAppName}\{code:FileConfigIni}"; Section: "General"; Key: "loadLast"; String: "false"; Flags: createkeyifdoesntexist

[Code]
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
Expand All @@ -148,7 +149,7 @@ begin
begin
if MsgBox('Delete all configuration files?'+#13#10+'This includes a list of recently opened files, paths to models and materials database, etc.', mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES then
begin
DeleteFile(ExpandConstant('{userappdata}\{#MyAppName}\{code:FileConfigIni}'));
DeleteFile(ExpandConstant('{autoappdata}\{#MyAppName}\{code:FileConfigIni}'));
end;
end;
end;
Expand All @@ -159,7 +160,7 @@ var
newPaths: string;
iniPath: string;
begin
iniPath := ExpandConstant('{userappdata}') + '\' + '{#MyAppName}' + '\' + FileConfigIni('');
iniPath := ExpandConstant('{autoappdata}') + '\' + '{#MyAppName}' + '\' + FileConfigIni('');
oldPaths := GetIniString('General', 'modelsFolders', '', iniPath);
if oldPaths <> VarIniModelsFolders('') then
begin
Expand Down
7 changes: 7 additions & 0 deletions Materials.dmdb
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,13 @@ DyssolMaterialsDatabase 3
27 234 2 10 10000 1000 1e+09 1632.5 $ Density [kg/m<sup>3</sup>]; Constant
27 235 2 10 10000 1000 1e+09 4 $ Permittivity [F/m]; Constant

21 j9zAhr99xPsXYmADI7F5 $ Compound's unique key
22 Lactose $ Compound's name
26 121 0.342297 $ Molar mass [kg/mol]
27 207 2 10 10000 1000 1e+09 1220 $ Heat capacity [J/(kg·K)]; Constant
27 223 2 10 10000 1000 1e+09 0.5 $ Equilibrium moisture content [kg/kg]; Constant
27 234 2 10 10000 1000 1e+09 1525 $ Density [kg/m<sup>3</sup>]; Constant

31 4b3f8A1A71A315EFB4E5 4e3a9D257E6A9E4F03D1 $ Unique keys of interacting compounds
32 303 2 10 10000 1000 1e+09 0.072 $ Interface tension [N/m]; Constant

6 changes: 4 additions & 2 deletions ModelsAPI/BaseUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -987,13 +987,15 @@ std::vector<std::string> CBaseUnit::GetSymbolicGrid(EDistrTypes _distribution) c

std::vector<double> CBaseUnit::GetClassesSizes(EDistrTypes _distribution) const
{
if (m_grid.GetGridDimension(_distribution)->GridType() != EGridEntry::GRID_NUMERIC) return {};
const auto* dim = m_grid.GetGridDimension(_distribution);
if (!dim || dim->GridType() != EGridEntry::GRID_NUMERIC) return {};
return m_grid.GetGridDimensionNumeric(_distribution)->GetClassesSizes();
}

std::vector<double> CBaseUnit::GetClassesMeans(EDistrTypes _distribution) const
{
if (m_grid.GetGridDimension(_distribution)->GridType() != EGridEntry::GRID_NUMERIC) return {};
const auto* dim = m_grid.GetGridDimension(_distribution);
if (!dim || dim->GridType() != EGridEntry::GRID_NUMERIC) return {};
return m_grid.GetGridDimensionNumeric(_distribution)->GetClassesMeans();
}

Expand Down
2 changes: 1 addition & 1 deletion ModelsAPI/Matrix2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ CMatrix2D::d_vect_t CMatrix2D::GetRow(size_t _row) const
CMatrix2D::d_vect_t CMatrix2D::GetCol(size_t _col) const
{
if (_col >= m_cols) return {};
d_vect_t res(m_cols);
d_vect_t res(m_rows);
for (size_t i = 0; i < m_rows; ++i)
res[i] = m_data[i][_col];
return res;
Expand Down
25 changes: 25 additions & 0 deletions Utilities/DyssolUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,31 @@ std::vector<double> inline CreateGrid(EGridFunction _fun, size_t _classes, doubl
return res;
}

/**
* \brief Calculates mass of the sphere from its diameter and density.
* \param _d Diameter of the sphere
* \param _rho Density of the sphere
* \return Sphere Mass of the sphere
*/
inline double DiameterToMass(double _d, double _rho)
{
return MATH_PI / 6 * std::pow(_d, 3) * _rho;
}

/**
* \brief Calculates masses of the spheres from their diameters and densities.
* \param _d Diameters of the spheres
* \param _rho Density of the spheres
* \return Sphere Masses of the spheres
*/
inline std::vector<double> DiameterToMass(const std::vector<double>& _d, double _rho)
{
std::vector<double> res(_d.size());
for (size_t i = 0; i < _d.size(); ++i)
res[i] = DiameterToMass(_d[i], _rho);
return res;
}

// Calculates volume of the sphere from its diameter.
inline double DiameterToVolume(double _d)
{
Expand Down
Loading