Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • gmsh/gmsh
  • lrp/gmsh
  • nschloe/gmsh
  • romin.tomasetti/gmsh
4 results
Show changes
Commits on Source (16706)
---
BasedOnStyle: None
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowAllArgumentsOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: true
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never
...
---
Checks: 'clang-diagnostic-*,clang-analyzer-*,modernize-use-auto,modernize-use-nullptr'
CheckOptions:
- key: modernize-use-auto.MinTypeNameLength
value: 40
...
*.geo gitlab-language=cpp
bin*/
lib*/
build*/
install/
contrib/mobile/frameworks_*
contrib/3M
contrib/Parasolid
*.db
doc/cookbook/book
doc/doxygen/html
.DS_Store
*~
*.so
*.so.*
*.mod
*#
*.pyc
## CLion directories
.idea
cmake-build-*
# VS Code directories
.vscode/
# Python virtual environment
venv/
.venv/
# Gmsh - Copyright (C) 1997-2024 C. Geuzaine, J.-F. Remacle
#
# See the LICENSE.txt file in the Gmsh root directory for license information.
# Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
variables:
EXTRA_OPTION: ""
.ssh_config: &ssh_config
before_script:
- echo "$SSH_TOKEN" > ~/.ssh/id_rsa
- echo "Host *" > ~/.ssh/config
- echo "StrictHostKeyChecking no" >> ~/.ssh/config
- chmod 700 ~/.ssh/id_rsa ~/.ssh/config
# ----------------------------------------------
# Continuous integration builds for all branches
# ----------------------------------------------
linux_ci:
image: onelab/ubuntu20.04
script:
- mkdir build
- cd build
- export CXXFLAGS=-Werror
- cmake ..
- make -j 8
- make doc
- ctest -j 8 --output-on-failure
- valgrind --leak-check=full --show-leak-kinds=definite,indirect --error-exitcode=0 ./gmsh ../tutorials/t5.geo -3
tags:
- linux64
- docker
except:
- tags
linux_compatibility_ci:
image: onelab/ubuntu20.04
script:
- mkdir build
- cd build
- cmake -DDEFAULT=0 ..
- make -j 8
- cmake -DENABLE_PARSER=1 ..
- make -j 8
- cmake -DENABLE_POST=1 ..
- make -j 8
- cmake -DENABLE_MESH=1 -DENABLE_BUILD_DYNAMIC=1 -DENABLE_PRIVATE_API=1 -DENABLE_EIGEN=0 -DENABLE_WRAP_PYTHON=1 -DENABLE_PETSC=1 ..
- make -j 8
tags:
- linux64
- docker
except:
- tags
windows_ci:
script:
- md build
- cd build
- c:\cygwin64\bin\bash -c "/usr/bin/cmake -DCMAKE_PREFIX_PATH='/usr/local/opencascade;/usr/local;/usr/x86_64-w64-mingw32/sys-root/mingw' -DCMAKE_C_COMPILER=/usr/bin/x86_64-w64-mingw32-gcc.exe -DCMAKE_CXX_COMPILER=/usr/bin/x86_64-w64-mingw32-g++.exe -DCMAKE_RC_COMPILER=/usr/bin/x86_64-w64-mingw32-windres.exe -DENABLE_OS_SPECIFIC_INSTALL=1 .. && ls"
- c:\cygwin64\bin\bash -c "/usr/bin/make -j 8"
- c:\cygwin64\bin\bash -c "/usr/bin/ctest -j 8 --output-on-failure && ls"
tags:
- windows64
- shared
except:
- tags
windows_msvc_ci:
script:
- md build
- cd build
- cmake -DENABLE_OPENMP=0 ..
- msbuild package.vcxproj
tags:
- windows64
- shared
except:
- tags
# ------------------------------------------
# Official Linux builds (master branch only)
# ------------------------------------------
.linux_official: &linux_official
only:
- master@gmsh/gmsh
<<: *ssh_config
script:
- mkdir build
- cd build
- cmake -DGMSH_HOST=gmsh.info -DENABLE_PETSC=1 -DPETSC_ARCH=real_mumps_seq -DPETSC_DIR=/petsc-3.14.4 ${EXTRA_OPTION} ..
- make package -j 8
- PKG=`ls gmsh-*.tar*`
- scp ${PKG} geuzaine@gmsh.info:.wwwgmsh/bin/Linux/${PKG/\.tar\.gz/\.tgz}
- ctest -j 8 --output-on-failure
tags:
- linux64
- docker
linux_official_snapshot:
image: onelab/debian.stretch.64bit
variables:
EXTRA_OPTION: "-DCMAKE_EXE_LINKER_FLAGS=-static-libstdc++"
<<: *linux_official
except:
- tags
linux_official_release:
image: onelab/debian.stretch.64bit
variables:
EXTRA_OPTION: "-DGMSH_RELEASE=1 -DCMAKE_EXE_LINKER_FLAGS=-static-libstdc++"
<<: *linux_official
only:
- /^gmsh_.*$/
linux-sdk_official_snapshot:
image: onelab/debian.stretch.64bit
variables:
EXTRA_OPTION: "-DENABLE_BUILD_DYNAMIC=1 -DINSTALL_SDK_README=1"
<<: *linux_official
except:
- tags
artifacts:
paths:
- build/_CPack_Packages/
- build/version.txt
expire_in: 1day
linux-sdk_official_release:
image: onelab/debian.stretch.64bit
variables:
EXTRA_OPTION: "-DGMSH_RELEASE=1 -DENABLE_BUILD_DYNAMIC=1 -DINSTALL_SDK_README=1"
<<: *linux_official
only:
- /^gmsh_.*$/
artifacts:
paths:
- build/_CPack_Packages/
- build/version.txt
expire_in: 1day
linux-nox-sdk_official_snapshot:
image: onelab/debian.stretch.64bit
variables:
EXTRA_OPTION: "-DGMSH_EXTRA_VERSION=-nox -DENABLE_FLTK=0 -DENABLE_OCC_CAF=0 -DENABLE_BUILD_DYNAMIC=1 -DINSTALL_SDK_README=1"
<<: *linux_official
except:
- tags
artifacts:
paths:
- build/_CPack_Packages/
expire_in: 1day
# --------------------------------------------
# Official Windows builds (master branch only)
# --------------------------------------------
.windows_official: &windows_official
only:
- master@gmsh/gmsh
script:
- md build
- cd build
- c:\cygwin64\bin\bash -c "/usr/bin/cmake -DGMSH_HOST=gmsh.info -DCMAKE_PREFIX_PATH='/usr/local;/usr/x86_64-w64-mingw32/sys-root/mingw' -DCMAKE_C_COMPILER=/usr/bin/x86_64-w64-mingw32-gcc.exe -DCMAKE_CXX_COMPILER=/usr/bin/x86_64-w64-mingw32-g++.exe -DCMAKE_Fortran_COMPILER=/usr/bin/x86_64-w64-mingw32-gfortran.exe -DCMAKE_RC_COMPILER=/usr/bin/x86_64-w64-mingw32-windres.exe -DENABLE_OS_SPECIFIC_INSTALL=1 -DENABLE_PETSC=1 -DPETSC_ARCH=real_mumps_seq -DPETSC_DIR=/home/geuzaine/src/petsc ${EXTRA_OPTION} .."
- c:\cygwin64\bin\bash -c "/usr/bin/make package -j 4"
- c:\cygwin64\bin\bash -c "/usr/bin/scp -o StrictHostKeyChecking=no -i /home/geuzaine/.ssh/id_rsa gmsh-*.zip geuzaine@gmsh.info:.wwwgmsh/bin/Windows/"
- c:\cygwin64\bin\bash -c "/usr/bin/ctest -j 4 --output-on-failure"
windows_official_snapshot:
<<: *windows_official
tags:
- windows64
- official
except:
- tags
windows_official_release:
variables:
EXTRA_OPTION: "-DGMSH_RELEASE=1"
<<: *windows_official
tags:
- windows64
- official
only:
- /^gmsh_.*$/
windows-sdk_official_snapshot:
variables:
EXTRA_OPTION: "-DENABLE_OS_SPECIFIC_INSTALL=0 -DENABLE_BUILD_DYNAMIC=1 -DINSTALL_SDK_README=1"
<<: *windows_official
tags:
- windows64
- official
except:
- tags
artifacts:
paths:
- build/_CPack_Packages/
expire_in: 1day
windows-sdk_official_release:
variables:
EXTRA_OPTION: "-DGMSH_RELEASE=1 -DENABLE_OS_SPECIFIC_INSTALL=0 -DENABLE_BUILD_DYNAMIC=1 -DINSTALL_SDK_README=1"
<<: *windows_official
tags:
- windows64
- official
only:
- /^gmsh_.*$/
artifacts:
paths:
- build/_CPack_Packages/
expire_in: 1day
# ------------------------------------------
# Official macOS builds (master branch only)
# ------------------------------------------
.macos_official: &macos_official
only:
- master@gmsh/gmsh
script:
- mkdir build
- cd build
- cmake -DGMSH_HOST=gmsh.info -DENABLE_CAIRO=0 -DENABLE_OS_SPECIFIC_INSTALL=1 -DENABLE_PETSC=1 -DPETSC_ARCH=real_mumps_seq -DPETSC_DIR=/Users/geuzaine/src/petsc ${EXTRA_OPTION} ..
- make package -j 4
- PKG=`ls gmsh-*.[dt][ma][gr]*`
- '[[ ${PKG} == *.dmg ]] && xcrun notarytool submit ${PKG} --key /Users/geuzaine/AuthKey_4R6P5NYF3T.p8 --key-id 4R6P5NYF3T --issuer 69a6de7c-0b3a-47e3-e053-5b8c7c11a4d1 --wait'
- '[[ ${PKG} == *.dmg ]] && xcrun stapler staple ${PKG}'
- scp ${PKG} geuzaine@gmsh.info:.wwwgmsh/bin/macOS/${PKG/\.tar\.gz/\.tgz}
- ctest -j 4 --output-on-failure
macosx_official_snapshot:
<<: *macos_official
tags:
- macos64
- official
except:
- tags
macosx_official_release:
variables:
EXTRA_OPTION: "-DGMSH_RELEASE=1"
<<: *macos_official
tags:
- macos64
- official
only:
- /^gmsh_.*$/
macosx-sdk_official_snapshot:
variables:
EXTRA_OPTION: "-DENABLE_OS_SPECIFIC_INSTALL=0 -DENABLE_BUILD_DYNAMIC=1 -DINSTALL_SDK_README=1"
<<: *macos_official
tags:
- macos64
- official
except:
- tags
artifacts:
paths:
- build/_CPack_Packages/
expire_in: 1day
macosx-sdk_official_release:
variables:
EXTRA_OPTION: "-DGMSH_RELEASE=1 -DENABLE_OS_SPECIFIC_INSTALL=0 -DENABLE_BUILD_DYNAMIC=1 -DINSTALL_SDK_README=1"
<<: *macos_official
tags:
- macos64
- official
only:
- /^gmsh_.*$/
artifacts:
paths:
- build/_CPack_Packages/
expire_in: 1day
macosarm_official_snapshot:
<<: *macos_official
tags:
- macos64arm
- official
except:
- tags
macosarm_official_release:
variables:
EXTRA_OPTION: "-DGMSH_RELEASE=1"
<<: *macos_official
tags:
- macos64arm
- official
only:
- /^gmsh_.*$/
macosarm-sdk_official_snapshot:
variables:
EXTRA_OPTION: "-DENABLE_OS_SPECIFIC_INSTALL=0 -DENABLE_BUILD_DYNAMIC=1 -DINSTALL_SDK_README=1"
<<: *macos_official
tags:
- macos64arm
- official
except:
- tags
artifacts:
paths:
- build/_CPack_Packages/
expire_in: 1day
macosarm-sdk_official_release:
variables:
EXTRA_OPTION: "-DGMSH_RELEASE=1 -DENABLE_OS_SPECIFIC_INSTALL=0 -DENABLE_BUILD_DYNAMIC=1 -DINSTALL_SDK_README=1"
<<: *macos_official
tags:
- macos64arm
- official
only:
- /^gmsh_.*$/
artifacts:
paths:
- build/_CPack_Packages/
expire_in: 1day
# ----------------------------------------------
# Official source snapshots (master branch only)
# ----------------------------------------------
.source_official: &source_official
only:
- master@gmsh/gmsh
<<: *ssh_config
script:
- mkdir build_src
- cd build_src
- cmake ${EXTRA_OPTION} ..
- make package_source
- PKG=`ls gmsh-*.tar*`
- scp ${PKG} geuzaine@gmsh.info:.wwwgmsh/src/${PKG/\.tar\.gz/\.tgz}
tags:
- linux64
- docker
source_official_snapshot:
image: onelab/ubuntu20.04
<<: *source_official
except:
- tags
source_official_release:
image: onelab/ubuntu20.04
variables:
EXTRA_OPTION: "-DGMSH_RELEASE=1"
<<: *source_official
only:
- /^gmsh_.*$/
# ----------------------------------------------
# Official documentation (master branch only)
# ----------------------------------------------
doc_official_snapshot:
stage: .post
image: onelab/ubuntu20.04
only:
- master@gmsh/gmsh
<<: *ssh_config
script:
- mkdir build_doc
- cd build_doc
- cmake ..
- make doc
- scp gmsh-*-doc.tgz geuzaine@gmsh.info:.wwwgmsh/doc.tgz
- ssh geuzaine@gmsh.info "cd .wwwgmsh/dev && tar zxvf ../doc.tgz"
tags:
- linux64
- docker
except:
- tags
doc_official_release:
stage: .post
image: onelab/ubuntu20.04
only:
- master@gmsh/gmsh
<<: *ssh_config
script:
- mkdir build_doc
- cd build_doc
- cmake -DGMSH_RELEASE=1 ..
- make doc
- scp gmsh-*-doc.tgz geuzaine@gmsh.info:.wwwgmsh/doc.tgz
- ssh geuzaine@gmsh.info "cd .wwwgmsh && tar zxvf doc.tgz"
- scp ../doc/gmsh.html geuzaine@gmsh.info:.wwwgmsh/
tags:
- linux64
- docker
only:
- /^gmsh_.*$/
# ----------------------------------------------
# Cookbook
# ----------------------------------------------
doc_cookbook:
stage: .post
image: onelab/ubuntu20.04
only:
- gmsh/gmsh
<<: *ssh_config
script:
- mdbook build doc/cookbook
- scp -r doc/cookbook/book geuzaine@gmsh.info:.wwwgmsh/doc/cookbook
tags:
- linux64
- docker
# ----------------------------------------------
# PyPi package
# ----------------------------------------------
pypi_official_snapshot:
stage: .post
image: onelab/ubuntu20.04
only:
- master@gmsh/gmsh
<<: *ssh_config
dependencies:
- linux-sdk_official_snapshot
- linux-nox-sdk_official_snapshot
- windows-sdk_official_snapshot
- macosx-sdk_official_snapshot
- macosarm-sdk_official_snapshot
script:
- cd build
- python3 ../utils/pypi/sdktowheel.py _CPack_Packages/Linux/TGZ/gmsh-git-Linux64-sdk/ manylinux_2_24_x86_64
- python3 ../utils/pypi/sdktowheel.py _CPack_Packages/Linux/TGZ/gmsh-nox-git-Linux64-sdk/ manylinux_2_24_x86_64
- python3 ../utils/pypi/sdktowheel.py _CPack_Packages/CYGWIN/ZIP/gmsh-git-Windows64-sdk/ win_amd64
- python3 ../utils/pypi/sdktowheel.py _CPack_Packages/Darwin/TGZ/gmsh-git-MacOSX-sdk/ macosx_10_15_x86_64
- python3 ../utils/pypi/sdktowheel.py _CPack_Packages/Darwin/TGZ/gmsh-git-MacOSARM-sdk/ macosx_12_0_arm64
- scp gmsh-*.dev1+nox*.whl geuzaine@gmsh.info:.wwwgmsh/python-packages-dev-nox/gmsh/
- scp gmsh-*.dev1-*.whl geuzaine@gmsh.info:.wwwgmsh/python-packages-dev/gmsh/
tags:
- linux64
- docker
except:
- tags
pypi_official_release:
stage: .post
image: onelab/ubuntu20.04
only:
- master@gmsh/gmsh
<<: *ssh_config
dependencies:
- linux-sdk_official_release
- windows-sdk_official_release
- macosx-sdk_official_release
- macosarm-sdk_official_release
script:
- echo "[distutils]" > ~/.pypirc
- echo "index-servers = pypi" >> ~/.pypirc
- echo "[pypi]" >> ~/.pypirc
- echo "username = __token__" >> ~/.pypirc
- echo "password = $PYPI_TOKEN" >> ~/.pypirc
- cd build
- VERSION=`cat version.txt`
- python3 ../utils/pypi/sdktowheel.py _CPack_Packages/Linux/TGZ/gmsh-${VERSION}-Linux64-sdk/ manylinux_2_24_x86_64
- python3 ../utils/pypi/sdktowheel.py _CPack_Packages/CYGWIN/ZIP/gmsh-${VERSION}-Windows64-sdk/ win_amd64
- python3 ../utils/pypi/sdktowheel.py _CPack_Packages/Darwin/TGZ/gmsh-${VERSION}-MacOSX-sdk/ macosx_10_15_x86_64
- python3 ../utils/pypi/sdktowheel.py _CPack_Packages/Darwin/TGZ/gmsh-${VERSION}-MacOSARM-sdk/ macosx_12_0_arm64
- scp gmsh*.whl geuzaine@gmsh.info:.wwwgmsh/python-packages/gmsh/
- twine upload gmsh*.whl
- ssh geuzaine@gmsh.info "cd .wwwgmsh/bin/Linux && rm -f gmsh-stable-Linux64* && ln -s gmsh-${VERSION}-Linux64.tgz gmsh-stable-Linux64.tgz && ln -s gmsh-${VERSION}-Linux64-sdk.tgz gmsh-stable-Linux64-sdk.tgz"
- ssh geuzaine@gmsh.info "cd .wwwgmsh/bin/Windows && rm -f gmsh-stable-Windows64* && ln -s gmsh-${VERSION}-Windows64.zip gmsh-stable-Windows64.zip && ln -s gmsh-${VERSION}-Windows64-sdk.zip gmsh-stable-Windows64-sdk.zip"
- ssh geuzaine@gmsh.info "cd .wwwgmsh/bin/macOS && rm -f gmsh-stable-MacOSX* && ln -s gmsh-${VERSION}-MacOSX.dmg gmsh-stable-MacOSX.dmg && ln -s gmsh-${VERSION}-MacOSX-sdk.tgz gmsh-stable-MacOSX-sdk.tgz"
- ssh geuzaine@gmsh.info "cd .wwwgmsh/bin/macOS && rm -f gmsh-stable-MacOSARM* && ln -s gmsh-${VERSION}-MacOSARM.dmg gmsh-stable-MacOSARM.dmg && ln -s gmsh-${VERSION}-MacOSARM-sdk.tgz gmsh-stable-MacOSARM-sdk.tgz"
- ssh geuzaine@gmsh.info "cd .wwwgmsh/src && rm -f gmsh-stable-source.tgz && ln -s gmsh-${VERSION}-source.tgz gmsh-stable-source.tgz"
tags:
- linux64
- docker
only:
- /^gmsh_.*$/
// $Id: Box.cpp,v 1.42 2008-01-20 11:20:58 geuzaine Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// Please report all bugs and problems to <gmsh@geuz.org>.
#include <signal.h>
#include "GModel.h"
#include "Message.h"
#include "OS.h"
#include "Numeric.h"
#include "Generator.h"
#include "Parser.h"
#include "Context.h"
#include "Options.h"
#include "OpenFile.h"
#include "CommandLine.h"
#include "CreateFile.h"
#include "ParUtil.h"
#include "PluginManager.h"
#include "Field.h"
#include "BackgroundMesh.h"
Context_T CTX;
// Print some help/info messages
void Info(int level, char *arg0)
{
switch (level) {
case 0:
if(ParUtil::Instance()->master()) {
fprintf(stderr, "%s\n", gmsh_progname);
fprintf(stderr, "%s\n", gmsh_copyright);
Print_Usage(arg0);
}
ParUtil::Instance()->Exit();
case 1:
if(ParUtil::Instance()->master())
fprintf(stderr, "%s\n", Get_GmshVersion());
ParUtil::Instance()->Exit();
case 2:
if(ParUtil::Instance()->master()) {
fprintf(stderr, "%s%s\n", gmsh_version, Get_GmshVersion());
fprintf(stderr, "%s\n", gmsh_os);
fprintf(stderr, "%s\n", gmsh_date);
fprintf(stderr, "%s\n", gmsh_host);
fprintf(stderr, "%s\n", gmsh_packager);
fprintf(stderr, "%s\n", gmsh_url);
fprintf(stderr, "%s\n", gmsh_email);
}
ParUtil::Instance()->Exit();
default:
break;
}
}
// Main routine for the batch (black box) version
int GMSHBOX(int argc, char *argv[])
{
ParUtil::Instance()->init(argc, argv);
new GModel;
InitSymbols();
Init_Options(0);
if(argc < 2)
Info(0, argv[0]);
Get_Options(argc, argv);
// FIXME: could not make this work on IRIX
#if !defined(__sgi__)
signal(SIGINT, Signal);
signal(SIGSEGV, Signal);
signal(SIGFPE, Signal);
#endif
CheckResources();
GMSH_PluginManager::instance()->registerDefaultPlugins();
check_gsl();
OpenProject(CTX.filename);
if(gmsh_yyerrorstate)
ParUtil::Instance()->Abort();
else {
for(int i = 1; i < List_Nbr(CTX.files); i++)
MergeFile(*(char**)List_Pointer(CTX.files, i));
if(CTX.bgm_filename) {
MergeFile(CTX.bgm_filename);
if(PView::list.size()){
Field *field = new PostViewField(PView::list.back());
BGMAddField(field);
fields.insert(field);
}
else{
fprintf(stderr, ERROR_STR "Invalid background mesh (no view)\n");
exit(1);
}
}
if(CTX.batch > 0) {
GenerateMesh(CTX.batch);
CreateOutputFile(CTX.output_filename, CTX.mesh.format);
}
else if(CTX.batch == -1)
CreateOutputFile(CTX.output_filename, FORMAT_GEO);
ParUtil::Instance()->Barrier(__LINE__, __FILE__);
return 1;
}
ParUtil::Instance()->Barrier(__LINE__, __FILE__);
return 1;
}
// Handle signals. We should not use Msg functions in these...
void Signal(int sig_num)
{
switch (sig_num) {
case SIGSEGV:
Msg(FATAL, "Segmentation violation (invalid memory reference)");
break;
case SIGFPE:
Msg(FATAL, "Floating point exception (division by zero?)");
break;
case SIGINT:
Msg(FATAL, "Interrupt (generated from terminal special char)");
break;
default:
Msg(FATAL, "Unknown signal");
break;
}
}
// General purpose message routine
void Msg(int level, const char *fmt, ...)
{
va_list args;
int abort = 0;
va_start(args, fmt);
switch (level) {
case PROGRESS:
case STATUS1N:
case STATUS2N:
break;
case DIRECT:
if(CTX.verbosity >= 2 && ParUtil::Instance()->master()) {
vfprintf(stdout, fmt, args);
fprintf(stdout, "\n");
}
break;
case FATAL:
case FATAL3: abort = 1;
case FATAL1:
case FATAL2:
fprintf(stderr, FATAL_STR);
fprintf(stderr, "[on processor %d] ", ParUtil::Instance()->rank());
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
break;
case GERROR:
case GERROR1:
case GERROR2:
case GERROR3:
fprintf(stderr, ERROR_STR);
fprintf(stderr, "[on processor %d] ", ParUtil::Instance()->rank());
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
break;
case WARNING:
case WARNING1:
case WARNING2:
case WARNING3:
if(CTX.verbosity >= 1) {
fprintf(stderr, WARNING_STR);
fprintf(stderr, "[on processor %d] ", ParUtil::Instance()->rank());
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
}
break;
case DEBUG:
case DEBUG1:
case DEBUG2:
case DEBUG3:
if(CTX.verbosity >= 4 && ParUtil::Instance()->master()) {
fprintf(stderr, DEBUG_STR);
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
}
break;
default:
if(CTX.verbosity >= 2 && ParUtil::Instance()->master()) {
fprintf(stderr, INFO_STR);
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
}
break;
}
va_end(args);
if(abort)
exit(1);
}
// interactive value dialog
double GetValue(const char *text, double defaultval)
{
if(CTX.nopopup)
return defaultval;
printf("%s (default=%.16g): ", text, defaultval);
char str[256];
fgets(str, sizeof(str), stdin);
if(!strlen(str) || !strcmp(str, "\n"))
return defaultval;
else
return atof(str);
}
bool GetBinaryAnswer(const char *question, const char *yes, const char *no,
bool defaultval)
{
if(CTX.nopopup || CTX.batch)
return defaultval;
char answ[256];
while(1){
printf("%s (%s/%s)",question,yes,no);
scanf("%s ",answ);
if (!strcmp(answ,yes))return true;
if (!strcmp(answ,no))return false;
}
}
extern int GMSHBOX(int argc, char *argv[]);
int main(int argc, char *argv[])
{
return GMSHBOX(argc, argv);
}
# $Id: Makefile,v 1.45 2008-02-07 21:29:38 geuzaine Exp $
#
# Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
#
# Please report all bugs and problems to <gmsh@geuz.org>.
include ../variables
LIB = ../lib/libGmshBox${LIBEXT}
INC = ${DASH}I../Common ${DASH}I../DataStr ${DASH}I../Geo ${DASH}I../Mesh\
${DASH}I../Post ${DASH}I../Graphics ${DASH}I../Numeric ${DASH}I../Parser\
${DASH}I../Fltk ${DASH}I../Plugin ${DASH}I../Parallel\
${DASH}I../contrib/ANN/include
CFLAGS = ${OPTIM} ${FLAGS} ${INC} ${SYSINCLUDE}
SRC = Box.cpp
OBJ = ${SRC:.cpp=${OBJEXT}}
.SUFFIXES: ${OBJEXT} .cpp
${LIB}: ${OBJ} Main${OBJEXT}
${AR} ${ARFLAGS}${LIB} ${OBJ}
${RANLIB} ${LIB}
.cpp${OBJEXT}:
${CXX} ${CFLAGS} ${DASH}c $<
clean:
rm -f *.o *.obj
depend:
(sed '/^# DO NOT DELETE THIS LINE/q' Makefile && \
${CXX} -MM ${CFLAGS} ${SRC} \
) >Makefile.new
cp Makefile Makefile.bak
cp Makefile.new Makefile
rm -f Makefile.new
# DO NOT DELETE THIS LINE
Box.o: Box.cpp ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h \
../Geo/Range.h ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h \
../Geo/SPoint3.h ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/GEdge.h \
../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h \
../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GEntity.h \
../Geo/GPoint.h ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/SPoint2.h \
../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \
../Geo/SBoundingBox3d.h ../Common/Message.h ../Common/OS.h \
../Numeric/Numeric.h ../Numeric/NumericEmbedded.h ../Mesh/Generator.h \
../Parser/Parser.h ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h \
../Common/Context.h ../Common/Options.h ../Post/ColorTable.h \
../Parser/OpenFile.h ../Common/CommandLine.h ../Parser/CreateFile.h \
../Parallel/ParUtil.h ../Plugin/PluginManager.h ../Plugin/Plugin.h \
../Post/PView.h ../Post/PViewData.h ../Post/PViewOptions.h \
../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
../Post/AdaptiveViews.h ../Common/GmshMatrix.h ../Mesh/Field.h \
../Geo/Geo.h ../Common/GmshDefines.h ../Geo/gmshSurface.h ../Geo/Pair.h \
../Geo/Range.h ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/SVector3.h \
../Geo/SBoundingBox3d.h ../Geo/SPoint2.h ../Geo/ExtrudeParams.h \
../Common/SmoothData.h ../Post/OctreePost.h ../Common/Octree.h \
../Common/OctreeInternals.h ../Mesh/BackgroundMesh.h
This diff is collapsed.
This diff is collapsed.
Gmsh is copyright (C) 1997-2024
Christophe Geuzaine
<cgeuzaine at uliege.be>
and
Jean-Francois Remacle
<jean-francois.remacle at uclouvain.be>
Code contributions to Gmsh have been provided by David Colignon (colormaps),
Emilie Marchandise (old compound geometrical entities), Gaetan Bricteux (Gauss
integration and levelsets), Jacques Lechelle (DIFFPACK export), Jonathan
Lambrechts (mesh size fields, solver, Python wrappers), Jozef Vesely (old Tetgen
integration), Koen Hillewaert (high order elements, generalized periodic
meshes), Laurent Stainier (eigenvalue solvers, tensor display and help with
macOS port), Marc Ume (original list and tree code), Mark van Doesburg (old
OpenCASCADE face connection), Matt Gundry (Plot3d export), Matti Pellikka (cell
complex and homology solver), Nicolas Tardieu (help with Netgen integration),
Pascale Noyret (MED mesh IO), Pierre Badel (root finding and minimization), Ruth
Sabariego (pyramids), Stephen Guzik (old CGNS IO, old partitioning code),
Bastien Gorissen (parallel remote post-processing), Eric Bechet (solver), Gilles
Marckmann (camera and stero mode, X3D export), Ashish Negi (Netgen CAD healing),
Trevor Strickler (hybrid structured mesh coupling with pyramids), Amaury Johnen
(Bezier code, high-order element validity), Benjamin Ruard (old Java wrappers),
Maxime Graulich (iOS/Android port), Francois Henrotte (ONELAB metamodels),
Sebastian Eiser (PGF export), Alexis Salzman (compressed IO), Hang Si (TetGen/BR
boundary recovery code), Fernando Lorenzo (Tochnog export), Larry Price (Gambit
export), Anthony Royer (new partitioning code, MSH4 IO), Darcy Beurle (code
cleanup and performance improvements), Celestin Marot (HXT/tetMesh),
Pierre-Alexandre Beaufort (HXT/reparam), Zhidong Han (LSDYNA export), Ismail
Badia (hierarchical basis functions), Jeremy Theler (X3D export), Thomas
Toulorge (high order mesh optimizer, new CGNS IO), Max Orok (binary PLY), Marek
Wojciechowski (PyPi packaging), Maxence Reberol (automatic transfinite, quad
meshing tools), Michael Ermakov (Gambit IO, Fortran API, TransfiniteTri,
boundary layer fans), Alex Krasner (X3D export), Giannis Nikiteas (Fortran API),
Paul Sharp (Radioss export), Marco Failla (2D fillet/offset and API
additions). See comments in the sources for more information. If we forgot to
list your contributions please send us an email!
Thanks to the following folks who have contributed by providing fresh ideas on
theoretical or programming topics, who have sent patches, requests for changes
or improvements, or who gave us access to exotic machines for testing Gmsh: Juan
Abanto, Olivier Adam, Guillaume Alleon, Laurent Champaney, Pascal Dupuis,
Patrick Dular, Philippe Geuzaine, Johan Gyselinck, Francois Henrotte, Benoit
Meys, Nicolas Moes, Osamu Nakamura, Chad Schmutzer, Jean-Luc Fl'ejou, Xavier
Dardenne, Christophe Prud'homme, Sebastien Clerc, Jose Miguel Pasini, Philippe
Lussou, Jacques Kools, Bayram Yenikaya, Peter Hornby, Krishna Mohan Gundu,
Christopher Stott, Timmy Schumacher, Carl Osterwisch, Bruno Frackowiak, Philip
Kelleners, Romuald Conty, Renaud Sizaire, Michel Benhamou, Tom De Vuyst, Kris
Van den Abeele, Simon Vun, Simon Corbin, Thomas De-Soza, Marcus Drosson, Antoine
Dechaume, Jose Paulo Moitinho de Almeida, Thomas Pinchard, Corrado Chisari, Axel
Hackbarth, Peter Wainwright, Jiri Hnidek, Thierry Thomas, Konstantinos Poulios,
Laurent Van Miegroet, Shahrokh Ghavamian, Geordie McBain, Jose Paulo Moitinho de
Almeida, Guillaume Demesy, Wendy Merks-Swolfs, Cosmin Stefan Deaconu, Nigel
Nunn, Serban Georgescu, Julien Troufflard, Michele Mocciola, Matthijs Sypkens
Smit, Sauli Ruuska, Romain Boman, Fredrik Ekre, Mark Burton, Max Orok, Paul
Cristini, Isuru Fernando, Jose Paulo Moitinho de Almeida, Sophie Le Bras,
Alberto Escrig, Samy Mukadi, Peter Johnston, Bruno de Sousa Alves, Stefan
Bruens, Luca Verzeroli, Tristan Seidlhofer, Ding Jiaming, Joost Gevaert, Marcus
Calhoun-Lopez, Michel Zou, Sir Sunsheep, Mariano Forti, Walter Steffe, Nico
Schloemer, Simon Tournier, Alexandru Dadalau, Thomas Ulrich, Matthias Diener,
Jamie Border, Kenneth Jansen, Steven Masfaraud, Sai Sumanth Moturu, Arie
Westland, Andreas Farley, Mahesh Madhav, Zoltan Csati, Thierry Hocquellet,
Christophe Bourcier, Mattéo Couplet, Giuseppe Musacchio, Romin Tomasetti, Lin Qi
Chen, Tim Furlan, Matthias Lang, Tim Gabriel, Julien Chapelat, Boris Martin,
Thomas Pirottin, Kazuyoshi Furutaka, Mariusz Wozniak, Christophe Friebel,
Thierry Thomas, Joonas Haapsaari, Jani V"alimaa, Erik Schaubelt, Louis Denis,
Francis Franklin, Florian Blachère, Aleksandr Artemyev.
Special thanks to Bill Spitzak, Michael Sweet, Matthias Melcher, Greg Ercolano
and others for the Fast Light Tool Kit on which Gmsh's GUI is based. See
http://www.fltk.org for more info on this excellent object-oriented,
cross-platform toolkit. Special thanks also to EDF for funding the original
OpenCASCADE and MED integration in 2006-2007. Gmsh development was also
financially supported by the PRACE project funded in part by the EU's Horizon
2020 Research and Innovation programme (2014-2020) under grant agreement 823767.
The TetGen/BR code (src/mesh/tetgenBR.{cpp,h}) is copyright (c) 2016 Hang Si,
Weierstrass Institute for Applied Analysis and Stochatics. It is relicensed
under the terms of LICENSE.txt for use in Gmsh thanks to a Software License
Agreement between Weierstrass Institute for Applied Analysis and Stochastics and
GMESH SPRL.
The AVL tree code (src/common/avl.{cpp,h}) and the YUV image code
(src/graphics/gl2yuv.{cpp,h}) are copyright (C) 1988-1993, 1995 The Regents of
the University of California. Permission to use, copy, modify, and distribute
this software and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in supporting
documentation, and that the name of the University of California not be used in
advertising or publicity pertaining to distribution of the software without
specific, written prior permission. The University of California makes no
representations about the suitability of this software for any purpose. It is
provided "as is" without express or implied warranty.
The picojson code (src/common/picojson.h) is Copyright 2009-2010 Cybozu Labs,
Inc., Copyright 2011-2014 Kazuho Oku, All rights reserved. Redistribution and
use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met: 1. Redistributions of source
code must retain the above copyright notice, this list of conditions and the
following disclaimer. 2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution. THIS
SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The nanoflann code (src/numeric/nanoflann.hpp) is Copyright 2008-2009 Marius
Muja, 2008-2009 David G. Lowe, 2011-2016 Jose Luis Blanco. Redistribution and
use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met: 1. Redistributions of source
code must retain the above copyright notice, this list of conditions and the
following disclaimer. 2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution. THIS
SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
The trackball code (src/graphics/Trackball.{cpp.h}) is copyright (C) 1993, 1994,
Silicon Graphics, Inc. ALL RIGHTS RESERVED. Permission to use, copy, modify, and
distribute this software for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that both the
copyright notice and this permission notice appear in supporting documentation,
and that the name of Silicon Graphics, Inc. not be used in advertising or
publicity pertaining to distribution of the software without specific, written
prior permission.
The GIF and PPM routines (src/graphics/gl2gif.cpp) are based on code copyright
(C) 1989, 1991, Jef Poskanzer. Permission to use, copy, modify, and distribute
this software and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in supporting
documentation. This software is provided "as is" without express or implied
warranty.
The colorbar widget (src/fltk/colorbarWindow.cpp) was inspired by code from the
Vis5d program for visualizing five dimensional gridded data sets, copyright (C)
1990-1995, Bill Hibbard, Brian Paul, Dave Santek, and Andre Battaiola.
The libOL code (src/common/libol1.{c,h}) is Copyright 2012-2018 - by Loïc
Maréchal / INRIA. This program is a free software. You can redistribute it
and/or modify it under the terms of the MIT License as published by the Open
Source Initiative.
The Fast & memory efficient hashtable based on robin hood hashing
(src/common/robin_hood.h) is Copyright (c) 2018-2020 Martin Ankerl and is
licensed under the MIT License.
In addition, this version of Gmsh may contain the following contributed,
optional codes in the contrib/ directory, each governed by their own license:
* contrib/ANN copyright (C) 1997-2010 University of Maryland and Sunil Arya and
David Mount;
* contrib/gmm copyright (C) 2002-2008 Yves Renard;
* contrib/hxt - Copyright (C) 2017-2020 - Universite catholique de Louvain;
* contrib/kbipack copyright (C) 2005 Saku Suuriniemi;
* contrib/MathEx based in part on the work of the SSCILIB Library, copyright (C)
2000-2003 Sadao Massago;
* contrib/metis written by George Karypis (karypis at cs.umn.edu), copyright (C)
1995-2013 Regents of the University of Minnesota;
* contrib/mpeg_encode copyright (c) 1995 The Regents of the University of
California;
* contrib/Netgen copyright (C) 1994-2004 Joachim Sch"oberl;
* contrib/bamg from Freefem++ copyright (C) Frederic Hecht;
* contrib/ALGLIB (C) Sergey Bochkanov (ALGLIB project);
* contrib/blossom copyright (C) 1995-1997 Bill Cook et al.;
* contrib/bamg from Freefem++ copyright (C) Frederic Hecht;
* contrib/tinyxml2 from Lee Thomason;
* contrib/voro++ from Voro++ Copyright (c) 2008, The Regents of the University
of California, through Lawrence Berkeley National Laboratory (subject to
receipt of any required approvals from the U.S. Dept. of Energy). All rights
reserved;
* contrib/zipper from MiniZip - Copyright (c) 1998-2010 - by Gilles Vollant -
version 1.1 64 bits from Mathias Svensson.
Check the configuration options to see which have been enabled.
This diff is collapsed.
This diff is collapsed.
#ifndef _COMMAND_LINE_H_
#define _COMMAND_LINE_H_
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// Please report all bugs and problems to <gmsh@geuz.org>.
extern char gmsh_progname[], gmsh_copyright[], gmsh_version[], gmsh_os[];
extern char gmsh_date[], gmsh_host[], gmsh_packager[], gmsh_url[];
extern char gmsh_email[], gmsh_gui[], gmsh_options[], gmsh_license[];
void Get_Options(int argc, char *argv[]);
void Print_Usage(char *name);
char *Get_BuildOptions();
int Get_GmshMajorVersion();
int Get_GmshMinorVersion();
int Get_GmshPatchVersion();
char *Get_GmshExtraVersion();
char *Get_GmshVersion();
char *Get_GmshBuildDate();
char *Get_GmshBuildHost();
char *Get_GmshPackager();
char *Get_GmshBuildOS();
char *Get_GmshShortLicense();
#endif
// $Id: Context.cpp,v 1.60 2008-01-19 22:05:59 geuzaine Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// Please report all bugs and problems to <gmsh@geuz.org>.
#include "Numeric.h"
#include "Context.h"
#include "DefaultOptions.h"
#include "Trackball.h"
void Context_T::buildRotationMatrix(void)
{
if(useTrackball) {
build_rotmatrix(rot, quaternion);
setEulerAnglesFromRotationMatrix();
}
else {
double x = r[0] * Pi / 180.;
double y = r[1] * Pi / 180.;
double z = r[2] * Pi / 180.;
double A = cos(x);
double B = sin(x);
double C = cos(y);
double D = sin(y);
double E = cos(z);
double F = sin(z);
double AD = A * D;
double BD = B * D;
rot[0] = C*E; rot[1] = BD*E+A*F; rot[2] =-AD*E+B*F; rot[3] = 0.;
rot[4] =-C*F; rot[5] =-BD*F+A*E; rot[6] = AD*F+B*E; rot[7] = 0.;
rot[8] = D; rot[9] =-B*C; rot[10] = A*C; rot[11] = 0.;
rot[12] = 0.; rot[13] = 0.; rot[14] = 0.; rot[15] = 1.;
setQuaternionFromEulerAngles();
}
}
void Context_T::addQuaternion(double p1x, double p1y, double p2x, double p2y)
{
double quat[4];
trackball(quat, p1x, p1y, p2x, p2y);
add_quats(quat, quaternion, quaternion);
}
void Context_T::addQuaternionFromAxisAndAngle(double axis[3], double angle)
{
double a = angle * Pi / 180.;
double quat[4];
axis_to_quat(axis, a, quat);
add_quats(quat, quaternion, quaternion);
}
void Context_T::setQuaternion(double q0, double q1, double q2, double q3)
{
quaternion[0] = q0;
quaternion[1] = q1;
quaternion[2] = q2;
quaternion[3] = q3;
}
void Context_T::setQuaternionFromEulerAngles()
{
double x = r[0] * Pi / 180.;
double y = r[1] * Pi / 180.;
double z = r[2] * Pi / 180.;
double xx[3] = {1.,0.,0.};
double yy[3] = {0.,1.,0.};
double zz[3] = {0.,0.,1.};
double q1[4], q2[4], q3[4], tmp[4];
axis_to_quat(xx, -x, q1);
axis_to_quat(yy, -y, q2);
axis_to_quat(zz, -z, q3);
add_quats(q1, q2, tmp);
add_quats(tmp, q3, quaternion);
}
void Context_T::setEulerAnglesFromRotationMatrix()
{
r[1] = asin(rot[8]); // Calculate Y-axis angle
double C = cos(r[1]);
r[1] *= 180. / Pi;
if(fabs(C) > 0.005){ // Gimball lock?
double tmpx = rot[10] / C; // No, so get X-axis angle
double tmpy = -rot[9] / C;
r[0] = atan2(tmpy, tmpx) * 180. / Pi;
tmpx = rot[0] / C; // Get Z-axis angle
tmpy = -rot[4] / C;
r[2] = atan2(tmpy, tmpx) * 180. / Pi;
}
else{ // Gimball lock has occurred
r[0] = 0.; // Set X-axis angle to zero
double tmpx = rot[5]; // And calculate Z-axis angle
double tmpy = rot[1];
r[2] = atan2(tmpy, tmpx) * 180. / Pi;
}
// return only positive angles in [0,360]
if(r[0] < 0.) r[0] += 360.;
if(r[1] < 0.) r[1] += 360.;
if(r[2] < 0.) r[2] += 360.;
}
This diff is collapsed.
This diff is collapsed.
#ifndef _GMSH_DEFINES_H_
#define _GMSH_DEFINES_H_
// IO file formats
#define FORMAT_MSH 1
#define FORMAT_UNV 2
#define FORMAT_GREF 3
#define FORMAT_XPM 4
#define FORMAT_PS 5
#define FORMAT_BMP 6
#define FORMAT_GIF 7
#define FORMAT_GEO 8
#define FORMAT_JPEG 9
#define FORMAT_AUTO 10
#define FORMAT_PPM 11
#define FORMAT_YUV 12
#define FORMAT_DMG 13
#define FORMAT_SMS 14
#define FORMAT_OPT 15
#define FORMAT_VTK 16
#define FORMAT_TEX 18
#define FORMAT_VRML 19
#define FORMAT_EPS 20
#define FORMAT_PNG 22
#define FORMAT_PDF 24
#define FORMAT_POS 26
#define FORMAT_STL 27
#define FORMAT_P3D 28
#define FORMAT_SVG 29
#define FORMAT_MESH 30
#define FORMAT_BDF 31
#define FORMAT_CGNS 32
#define FORMAT_MED 33
// Element types in .msh file format
#define MSH_LIN_2 1
#define MSH_TRI_3 2
#define MSH_QUA_4 3
#define MSH_TET_4 4
#define MSH_HEX_8 5
#define MSH_PRI_6 6
#define MSH_PYR_5 7
#define MSH_LIN_3 8
#define MSH_TRI_6 9
#define MSH_QUA_9 10
#define MSH_TET_10 11
#define MSH_HEX_27 12
#define MSH_PRI_18 13
#define MSH_PYR_14 14
#define MSH_PNT 15
#define MSH_QUA_8 16
#define MSH_HEX_20 17
#define MSH_PRI_15 18
#define MSH_PYR_13 19
#define MSH_TRI_9 20
#define MSH_TRI_10 21
#define MSH_TRI_12 22
#define MSH_TRI_15 23
#define MSH_TRI_15I 24
#define MSH_TRI_21 25
#define MSH_LIN_4 26
#define MSH_LIN_5 27
#define MSH_LIN_6 28
// Geometric entities
#define ENT_NONE 0
#define ENT_POINT (1<<0)
#define ENT_LINE (1<<1)
#define ENT_SURFACE (1<<2)
#define ENT_VOLUME (1<<3)
#define ENT_ALL (ENT_POINT | ENT_LINE | ENT_SURFACE | ENT_VOLUME)
// 2D mesh algorithms
#define ALGO_2D_MESHADAPT_DELAUNAY 1
#define ALGO_2D_ANISOTROPIC 2 // unused
#define ALGO_2D_TRIANGLE 3 // unused
#define ALGO_2D_MESHADAPT 4
#define ALGO_2D_DELAUNAY 5
// 3D mesh algorithms
#define ALGO_3D_TETGEN_DELAUNAY 1
#define ALGO_3D_NETGEN 4
#define ALGO_3D_TETGEN 5 // unused
#define TRANSFINI 1
#define LIBRE 2
#endif
This diff is collapsed.
#ifndef _GMSH_UI_H_
#define _GMSH_UI_H_
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// Please report all bugs and problems to <gmsh@geuz.org>.
#if defined(HAVE_FLTK)
# include <FL/Fl.H>
# if (FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION == 1)
# if (FL_PATCH_VERSION >= 6)
# define HAVE_FLTK_1_1_6_OR_ABOVE
# endif
# if (FL_PATCH_VERSION >= 5)
# define HAVE_FLTK_1_1_5_OR_ABOVE
# endif
# else
# error "Gmsh requires FLTK 1.1.x"
# endif
# include <FL/gl.h>
# if defined(__APPLE__)
# include <OpenGL/glu.h>
# else
# include <GL/glu.h>
# endif
# define GMSH_WINDOW_BOX FL_FLAT_BOX
#endif
// recent Cygwin releases define min/max macros!
#if defined(__CYGWIN__)
#undef min
#undef max
#endif
#endif