From 67c75dad2f8bfe5ef2e2d0128d7b8e1497c6b6fc Mon Sep 17 00:00:00 2001 From: Uwe Date: Sun, 26 Mar 2023 09:12:46 +0200 Subject: [PATCH] [FEM] Elmer: add missing deformation info - also some formatting changes done by clang --- src/Base/FileInfo.cpp | 44 +++++++++++++-------------- src/Mod/Fem/femsolver/elmer/solver.py | 4 ++- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/Base/FileInfo.cpp b/src/Base/FileInfo.cpp index 1e0bc29d5b..943b81d825 100644 --- a/src/Base/FileInfo.cpp +++ b/src/Base/FileInfo.cpp @@ -241,12 +241,12 @@ std::string FileInfo::filePath () const return FileName; } -std::string FileInfo::fileName () const +std::string FileInfo::fileName() const { return FileName.substr(FileName.find_last_of('/')+1); } -std::string FileInfo::dirPath () const +std::string FileInfo::dirPath() const { std::size_t last_pos; std::string retval; @@ -256,7 +256,7 @@ std::string FileInfo::dirPath () const } else { #ifdef FC_OS_WIN32 - wchar_t buf[MAX_PATH+1]; + wchar_t buf[MAX_PATH + 1]; GetCurrentDirectoryW(MAX_PATH, buf); retval = std::string(ConvertFromWideString(std::wstring(buf))); #else @@ -268,7 +268,7 @@ std::string FileInfo::dirPath () const return retval; } -std::string FileInfo::fileNamePure () const +std::string FileInfo::fileNamePure() const { std::string temp = fileName(); std::string::size_type pos = temp.find_last_of('.'); @@ -291,7 +291,7 @@ std::wstring FileInfo::toStdWString() const #endif } -std::string FileInfo::extension () const +std::string FileInfo::extension() const { std::string::size_type pos = FileName.find_last_of('.'); if (pos == std::string::npos) @@ -299,7 +299,7 @@ std::string FileInfo::extension () const return FileName.substr(pos+1); } -std::string FileInfo::completeExtension () const +std::string FileInfo::completeExtension() const { std::string::size_type pos = FileName.find_first_of('.'); if (pos == std::string::npos) @@ -307,46 +307,46 @@ std::string FileInfo::completeExtension () const return FileName.substr(pos+1); } -bool FileInfo::hasExtension (const char* Ext) const +bool FileInfo::hasExtension(const char* Ext) const { #if defined (FC_OS_WIN32) - return _stricmp(Ext,extension().c_str()) == 0; + return _stricmp(Ext, extension().c_str()) == 0; #elif defined (FC_OS_LINUX) || defined(FC_OS_CYGWIN) || defined(FC_OS_MACOSX) || defined(FC_OS_BSD) return strcasecmp(Ext,extension().c_str()) == 0; #endif } -bool FileInfo::exists () const +bool FileInfo::exists() const { #if defined (FC_OS_WIN32) std::wstring wstr = toStdWString(); - return _waccess(wstr.c_str(),F_OK) == 0; + return _waccess(wstr.c_str(), F_OK) == 0; #elif defined (FC_OS_LINUX) || defined(FC_OS_CYGWIN) || defined(FC_OS_MACOSX) || defined(FC_OS_BSD) - return access(FileName.c_str(),F_OK) == 0; + return access(FileName.c_str(), F_OK) == 0; #endif } -bool FileInfo::isReadable () const +bool FileInfo::isReadable() const { #if defined (FC_OS_WIN32) std::wstring wstr = toStdWString(); - return _waccess(wstr.c_str(),R_OK) == 0; + return _waccess(wstr.c_str(), R_OK) == 0; #elif defined (FC_OS_LINUX) || defined(FC_OS_CYGWIN) || defined(FC_OS_MACOSX) || defined(FC_OS_BSD) - return access(FileName.c_str(),R_OK) == 0; + return access(FileName.c_str(), R_OK) == 0; #endif } -bool FileInfo::isWritable () const +bool FileInfo::isWritable() const { #if defined (FC_OS_WIN32) std::wstring wstr = toStdWString(); - return _waccess(wstr.c_str(),W_OK) == 0; + return _waccess(wstr.c_str(), W_OK) == 0; #elif defined (FC_OS_LINUX) || defined(FC_OS_CYGWIN) || defined(FC_OS_MACOSX) || defined(FC_OS_BSD) - return access(FileName.c_str(),W_OK) == 0; + return access(FileName.c_str(), W_OK) == 0; #endif } -bool FileInfo::setPermissions (Permissions perms) +bool FileInfo::setPermissions(Permissions perms) { int mode = 0; @@ -359,13 +359,13 @@ bool FileInfo::setPermissions (Permissions perms) return false; #if defined (FC_OS_WIN32) std::wstring wstr = toStdWString(); - return _wchmod(wstr.c_str(),mode) == 0; + return _wchmod(wstr.c_str(), mode) == 0; #elif defined (FC_OS_LINUX) || defined(FC_OS_CYGWIN) || defined(FC_OS_MACOSX) || defined(FC_OS_BSD) - return chmod(FileName.c_str(),mode) == 0; + return chmod(FileName.c_str(), mode) == 0; #endif } -bool FileInfo::isFile () const +bool FileInfo::isFile() const { #ifdef FC_OS_WIN32 if (exists()) { @@ -391,7 +391,7 @@ bool FileInfo::isFile () const return true; } -bool FileInfo::isDir () const +bool FileInfo::isDir() const { if (exists()) { // if we can chdir then it must be a directory, otherwise we assume it diff --git a/src/Mod/Fem/femsolver/elmer/solver.py b/src/Mod/Fem/femsolver/elmer/solver.py index eb25241238..10725c7d3a 100644 --- a/src/Mod/Fem/femsolver/elmer/solver.py +++ b/src/Mod/Fem/femsolver/elmer/solver.py @@ -34,6 +34,7 @@ import os import FreeCAD from . import tasks +from .equations import deformation from .equations import elasticity from .equations import electricforce from .equations import electrostatic @@ -67,12 +68,13 @@ class Proxy(solverbase.Proxy): Type = "Fem::SolverElmer" _EQUATIONS = { - "Heat": heat, + "Deformation": deformation, "Elasticity": elasticity, "Electrostatic": electrostatic, "Flux": flux, "Electricforce": electricforce, "Flow": flow, + "Heat": heat, "Magnetodynamic": magnetodynamic, "Magnetodynamic2D": magnetodynamic2D, }