Skip to content
Snippets Groups Projects
Commit 4d7e3603 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

- mark old GMSH_API as deprecated

- mark old python and java wrappers as deprecated
- more work on new API
parent a230efa2
No related branches found
No related tags found
No related merge requests found
...@@ -88,8 +88,8 @@ opt(TAUCS "Enable Taucs linear solver" ${DEFAULT}) ...@@ -88,8 +88,8 @@ opt(TAUCS "Enable Taucs linear solver" ${DEFAULT})
opt(TCMALLOC "Enable libtcmalloc, a fast malloc implementation but that does not release memory" OFF) opt(TCMALLOC "Enable libtcmalloc, a fast malloc implementation but that does not release memory" OFF)
opt(TETGEN "Enable Tetgen 3D initial mesh generator" ${DEFAULT}) opt(TETGEN "Enable Tetgen 3D initial mesh generator" ${DEFAULT})
opt(VORO3D "Enable Voro3D (for hex meshing, experimental)" ${DEFAULT}) opt(VORO3D "Enable Voro3D (for hex meshing, experimental)" ${DEFAULT})
opt(WRAP_JAVA "Enable generation of Java wrappers (experimental)" OFF) opt(WRAP_JAVA_DEPRECATED "Enable generation of Java wrappers (deprecated)" OFF)
opt(WRAP_PYTHON "Enable generation of Python wrappers" OFF) opt(WRAP_PYTHON_DEPRECATED "Enable generation of Python wrappers (deprecated)" OFF)
opt(ZIPPER "Enable Zip file compression/decompression" OFF) opt(ZIPPER "Enable Zip file compression/decompression" OFF)
set(GMSH_MAJOR_VERSION 3) set(GMSH_MAJOR_VERSION 3)
...@@ -102,6 +102,11 @@ set(GMSH_VERSION "${GMSH_VERSION}.${GMSH_PATCH_VERSION}${GMSH_EXTRA_VERSION}") ...@@ -102,6 +102,11 @@ set(GMSH_VERSION "${GMSH_VERSION}.${GMSH_PATCH_VERSION}${GMSH_EXTRA_VERSION}")
set(GMSH_SHORT_LICENSE "GNU General Public License") set(GMSH_SHORT_LICENSE "GNU General Public License")
set(GMSH_API set(GMSH_API
${CMAKE_CURRENT_BINARY_DIR}/Common/GmshConfig.h
${CMAKE_CURRENT_BINARY_DIR}/Common/GmshVersion.h
Common/GmshAPI.h)
set(GMSH_API_DEPRECATED
${CMAKE_CURRENT_BINARY_DIR}/Common/GmshConfig.h ${CMAKE_CURRENT_BINARY_DIR}/Common/GmshConfig.h
${CMAKE_CURRENT_BINARY_DIR}/Common/GmshVersion.h ${CMAKE_CURRENT_BINARY_DIR}/Common/GmshVersion.h
Common/Gmsh.h Common/Context.h Common/GmshDefines.h Common/GmshMessage.h Common/Gmsh.h Common/Context.h Common/GmshDefines.h Common/GmshMessage.h
...@@ -165,11 +170,6 @@ set(GMSH_API ...@@ -165,11 +170,6 @@ set(GMSH_API
contrib/MeshQualityOptimizer/MeshQualityOptimizer.h contrib/MeshQualityOptimizer/MeshQualityOptimizer.h
contrib/MathEx/mathex.h) contrib/MathEx/mathex.h)
get_property(IAMCHILD DIRECTORY PROPERTY PARENT_DIRECTORY)
if(IAMCHILD)
set(GMSH_API ${GMSH_API} PARENT_SCOPE)
endif(IAMCHILD)
if(${CMAKE_MAJOR_VERSION} GREATER 2) if(${CMAKE_MAJOR_VERSION} GREATER 2)
string(TIMESTAMP DATE "%Y%m%d") string(TIMESTAMP DATE "%Y%m%d")
else(${CMAKE_MAJOR_VERSION} GREATER 2) else(${CMAKE_MAJOR_VERSION} GREATER 2)
...@@ -235,9 +235,9 @@ if(NOT APPLE) ...@@ -235,9 +235,9 @@ if(NOT APPLE)
endif(HAVE_64BIT_SIZE_T) endif(HAVE_64BIT_SIZE_T)
endif(NOT APPLE) endif(NOT APPLE)
if(ENABLE_WRAP_PYTHON AND NOT ENABLE_BUILD_SHARED) if(ENABLE_WRAP_PYTHON_DEPRECATED AND NOT ENABLE_BUILD_SHARED)
set(ENABLE_BUILD_DYNAMIC ON) set(ENABLE_BUILD_DYNAMIC ON)
endif(ENABLE_WRAP_PYTHON AND NOT ENABLE_BUILD_SHARED) endif(ENABLE_WRAP_PYTHON_DEPRECATED AND NOT ENABLE_BUILD_SHARED)
if(MSVC) if(MSVC)
# remove annoying warning about bool/int cast performance # remove annoying warning about bool/int cast performance
...@@ -1247,7 +1247,7 @@ if(ENABLE_ZIPPER) ...@@ -1247,7 +1247,7 @@ if(ENABLE_ZIPPER)
endif(HAVE_LIBZ) endif(HAVE_LIBZ)
endif(ENABLE_ZIPPER) endif(ENABLE_ZIPPER)
if(ENABLE_WRAP_PYTHON) if(ENABLE_WRAP_PYTHON_DEPRECATED)
find_package(SWIG) find_package(SWIG)
find_package(PythonLibs) find_package(PythonLibs)
find_package(PythonInterp)# ${PYTHONLIBS_VERSION_STRING} EXACT) find_package(PythonInterp)# ${PYTHONLIBS_VERSION_STRING} EXACT)
...@@ -1261,7 +1261,7 @@ if(ENABLE_WRAP_PYTHON) ...@@ -1261,7 +1261,7 @@ if(ENABLE_WRAP_PYTHON)
mark_as_advanced(CLEAR PYTHON_LIBRARY PYTHON_INCLUDE_DIR) mark_as_advanced(CLEAR PYTHON_LIBRARY PYTHON_INCLUDE_DIR)
endif(SWIG_MAJOR_VERSION EQUAL 1) endif(SWIG_MAJOR_VERSION EQUAL 1)
endif(SWIG_FOUND AND PYTHONLIBS_FOUND) endif(SWIG_FOUND AND PYTHONLIBS_FOUND)
endif(ENABLE_WRAP_PYTHON) endif(ENABLE_WRAP_PYTHON_DEPRECATED)
if(HAVE_PYTHON) if(HAVE_PYTHON)
if(ENABLE_NUMPY) if(ENABLE_NUMPY)
...@@ -1531,7 +1531,7 @@ endif(ENABLE_BUILD_ANDROID) ...@@ -1531,7 +1531,7 @@ endif(ENABLE_BUILD_ANDROID)
# shared library target # shared library target
if(ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC OR if(ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC OR
ENABLE_WRAP_PYTHON OR ENABLE_WRAP_JAVA) ENABLE_WRAP_PYTHON_DEPRECATED OR ENABLE_WRAP_JAVA_DEPRECATED)
add_library(shared SHARED ${GMSH_SRC}) add_library(shared SHARED ${GMSH_SRC})
set_target_properties(shared PROPERTIES OUTPUT_NAME Gmsh) set_target_properties(shared PROPERTIES OUTPUT_NAME Gmsh)
set_target_properties(shared PROPERTIES set_target_properties(shared PROPERTIES
...@@ -1546,7 +1546,7 @@ if(ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC OR ...@@ -1546,7 +1546,7 @@ if(ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC OR
endif(MSVC AND ENABLE_MSVC_STATIC_RUNTIME) endif(MSVC AND ENABLE_MSVC_STATIC_RUNTIME)
target_link_libraries(shared ${LINK_LIBRARIES}) target_link_libraries(shared ${LINK_LIBRARIES})
endif(ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC OR endif(ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC OR
ENABLE_WRAP_PYTHON OR ENABLE_WRAP_JAVA) ENABLE_WRAP_PYTHON_DEPRECATED OR ENABLE_WRAP_JAVA_DEPRECATED)
# binary targets # binary targets
if(HAVE_FLTK) if(HAVE_FLTK)
...@@ -1660,15 +1660,18 @@ if(WIN32 OR CYGWIN) ...@@ -1660,15 +1660,18 @@ if(WIN32 OR CYGWIN)
set(GMSH_LIB .) set(GMSH_LIB .)
set(GMSH_DOC .) set(GMSH_DOC .)
set(GMSH_MAN .) set(GMSH_MAN .)
set(GMSH_INC .)
else(ENABLE_OS_SPECIFIC_INSTALL) else(ENABLE_OS_SPECIFIC_INSTALL)
include(GNUInstallDirs) include(GNUInstallDirs)
set(GMSH_BIN ${CMAKE_INSTALL_BINDIR}) set(GMSH_BIN ${CMAKE_INSTALL_BINDIR})
set(GMSH_LIB ${CMAKE_INSTALL_LIBDIR}) set(GMSH_LIB ${CMAKE_INSTALL_LIBDIR})
set(GMSH_DOC ${CMAKE_INSTALL_DOCDIR}) set(GMSH_DOC ${CMAKE_INSTALL_DOCDIR})
set(GMSH_MAN ${CMAKE_INSTALL_MANDIR}/man1) set(GMSH_MAN ${CMAKE_INSTALL_MANDIR}/man1)
set(GMSH_INC ${CMAKE_INSTALL_INCLUDEDIR})
endif(ENABLE_OS_SPECIFIC_INSTALL) endif(ENABLE_OS_SPECIFIC_INSTALL)
if(CYGWIN) if(CYGWIN)
unix2dos(GMSH_API) unix2dos(GMSH_API)
unix2dos(GMSH_API_DEPREATED)
unix2dos(WELCOME_FILE) unix2dos(WELCOME_FILE)
unix2dos(LICENSE_FILE) unix2dos(LICENSE_FILE)
unix2dos(CREDITS_FILE) unix2dos(CREDITS_FILE)
...@@ -1686,12 +1689,14 @@ elseif(APPLE AND ENABLE_OS_SPECIFIC_INSTALL) ...@@ -1686,12 +1689,14 @@ elseif(APPLE AND ENABLE_OS_SPECIFIC_INSTALL)
set(GMSH_LIB ../MacOS) set(GMSH_LIB ../MacOS)
set(GMSH_DOC ../../..) set(GMSH_DOC ../../..)
set(GMSH_MAN ../../..) set(GMSH_MAN ../../..)
set(GMSH_INC ../MacOS)
else(WIN32 OR CYGWIN) else(WIN32 OR CYGWIN)
include(GNUInstallDirs) include(GNUInstallDirs)
set(GMSH_BIN ${CMAKE_INSTALL_BINDIR}) set(GMSH_BIN ${CMAKE_INSTALL_BINDIR})
set(GMSH_LIB ${CMAKE_INSTALL_LIBDIR}) set(GMSH_LIB ${CMAKE_INSTALL_LIBDIR})
set(GMSH_DOC ${CMAKE_INSTALL_DOCDIR}) set(GMSH_DOC ${CMAKE_INSTALL_DOCDIR})
set(GMSH_MAN ${CMAKE_INSTALL_MANDIR}/man1) set(GMSH_MAN ${CMAKE_INSTALL_MANDIR}/man1)
set(GMSH_INC ${CMAKE_INSTALL_INCLUDEDIR})
endif(WIN32 OR CYGWIN) endif(WIN32 OR CYGWIN)
# mark targets as optional so we can install them separately if needed # mark targets as optional so we can install them separately if needed
...@@ -1742,7 +1747,8 @@ if(ENABLE_ONELAB) ...@@ -1742,7 +1747,8 @@ if(ENABLE_ONELAB)
install(FILES ${ONELAB_PY} DESTINATION ${GMSH_BIN}) install(FILES ${ONELAB_PY} DESTINATION ${GMSH_BIN})
endif(ENABLE_ONELAB) endif(ENABLE_ONELAB)
if(ENABLE_BUILD_LIB OR ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC) if(ENABLE_BUILD_LIB OR ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC)
install(FILES ${GMSH_API} DESTINATION include/gmsh) install(FILES ${GMSH_API} DESTINATION ${GMSH_INC})
install(FILES ${GMSH_API_DEPRECATED} DESTINATION ${GMSH_INC}/gmsh)
endif(ENABLE_BUILD_LIB OR ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC) endif(ENABLE_BUILD_LIB OR ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC)
install(FILES ${WELCOME_FILE} DESTINATION ${GMSH_DOC} RENAME README.txt) install(FILES ${WELCOME_FILE} DESTINATION ${GMSH_DOC} RENAME README.txt)
install(FILES ${LICENSE_FILE} DESTINATION ${GMSH_DOC}) install(FILES ${LICENSE_FILE} DESTINATION ${GMSH_DOC})
...@@ -1762,6 +1768,11 @@ add_custom_target(get_headers ...@@ -1762,6 +1768,11 @@ add_custom_target(get_headers
COMMAND ${CMAKE_COMMAND} -E make_directory Headers/gmsh COMMAND ${CMAKE_COMMAND} -E make_directory Headers/gmsh
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
foreach(FILE ${GMSH_API}) foreach(FILE ${GMSH_API})
add_custom_command(TARGET get_headers POST_BUILD COMMAND ${CMAKE_COMMAND}
-E copy_if_different ${FILE} ${CMAKE_CURRENT_BINARY_DIR}/Headers/
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endforeach(FILE)
foreach(FILE ${GMSH_API_DEPRECATED})
add_custom_command(TARGET get_headers POST_BUILD COMMAND ${CMAKE_COMMAND} add_custom_command(TARGET get_headers POST_BUILD COMMAND ${CMAKE_COMMAND}
-E copy_if_different ${FILE} ${CMAKE_CURRENT_BINARY_DIR}/Headers/gmsh/ -E copy_if_different ${FILE} ${CMAKE_CURRENT_BINARY_DIR}/Headers/gmsh/
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
...@@ -1836,6 +1847,11 @@ if(APPLE AND ENABLE_BUILD_LIB) ...@@ -1836,6 +1847,11 @@ if(APPLE AND ENABLE_BUILD_LIB)
${FILE} ${CMAKE_CURRENT_BINARY_DIR}/Gmsh.framework/Headers/ ${FILE} ${CMAKE_CURRENT_BINARY_DIR}/Gmsh.framework/Headers/
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endforeach(FILE) endforeach(FILE)
foreach(FILE ${GMSH_API_DEPRECATED})
add_custom_command(TARGET framework POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy
${FILE} ${CMAKE_CURRENT_BINARY_DIR}/Gmsh.framework/Headers/
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endforeach(FILE)
endif(APPLE AND ENABLE_BUILD_LIB) endif(APPLE AND ENABLE_BUILD_LIB)
set(CPACK_PACKAGE_VENDOR "Christophe Geuzaine and Jean-Francois Remacle") set(CPACK_PACKAGE_VENDOR "Christophe Geuzaine and Jean-Francois Remacle")
...@@ -1902,12 +1918,12 @@ if(HAVE_PYTHON) ...@@ -1902,12 +1918,12 @@ if(HAVE_PYTHON)
add_subdirectory(wrappers/gmshpy) add_subdirectory(wrappers/gmshpy)
endif(HAVE_PYTHON) endif(HAVE_PYTHON)
if(ENABLE_WRAP_JAVA) if(ENABLE_WRAP_JAVA_DEPRECATED)
if(NOT HAVE_BLAS OR NOT HAVE_LAPACK) if(NOT HAVE_BLAS OR NOT HAVE_LAPACK)
message(WARNING "Java wrapping samples will not work without BLAS and LAPACK") message(WARNING "Java wrapping samples will not work without BLAS and LAPACK")
endif(NOT HAVE_BLAS OR NOT HAVE_LAPACK) endif(NOT HAVE_BLAS OR NOT HAVE_LAPACK)
add_subdirectory(wrappers/java) add_subdirectory(wrappers/java)
endif(ENABLE_WRAP_JAVA) endif(ENABLE_WRAP_JAVA_DEPRECATED)
include(CPack) include(CPack)
......
/* Gmsh - Copyright (C) 1997-2017 C. Geuzaine, J.-F. Remacle // Gmsh - Copyright (C) 1997-2017 C. Geuzaine, J.-F. Remacle
* //
* See the LICENSE.txt file for license information. Please report all // See the LICENSE.txt file for license information. Please report all
* bugs and problems to the public mailing list <gmsh@onelab.info>. // bugs and problems to the public mailing list <gmsh@onelab.info>.
*/
/*
This is the embryo of what will become the Gmsh API.
Don't use it, it's not ready :-) We plan to release a first version in Gmsh
3.1, and something more complete in Gmsh 4.0.
Your input is welcome: please contribute your ideas on
http://gitlab.onelab.info/gmsh/gmsh/issues/188
*/
#include "Gmsh.h" #include "Gmsh.h"
#include "GmshAPI.h"
#include "GModel.h"
#include "GModelIO_GEO.h"
#include "GModelIO_OCC.h"
// Gmsh
extern "C"
{
/* Gmsh */
int gmshInitialize(int argc, char **argv) int gmshInitialize(int argc, char **argv)
{ {
return !GmshInitialize(argc, argv); return !GmshInitialize(argc, argv);
...@@ -29,90 +21,97 @@ extern "C" ...@@ -29,90 +21,97 @@ extern "C"
return !GmshFinalize(); return !GmshFinalize();
} }
int gmshOpen(const char *fileName) int gmshOpen(const std::string &fileName)
{ {
return !GmshOpenProject(fileName); return !GmshOpenProject(fileName);
} }
int gmshMerge(const char *fileName) int gmshMerge(const std::string &fileName)
{ {
return !GmshMergeFile(fileName); return !GmshMergeFile(fileName);
} }
int gmshExport(const char *fileName) int gmshExport(const std::string &fileName)
{ {
return 1; return !GmshWriteFile(fileName);
} }
int gmshClear() int gmshClear()
{ {
return 1; return !GmshClearProject();
} }
/* Gmsh Options */ // GmshOption
int gmshOptionsSetNumber(const char *name, double value)
{
return 1;
}
int gmshOptionsGetNumber(const char *name, double *value) static void splitOptionName(const std::string &fullName, std::string &category,
std::string &name, int &index)
{ {
return 1; std::string::size_type d = fullName.find_first_of('.');
category = fullName.substr(0, d);
std::string::size_type b1 = fullName.find_first_of('[');
std::string::size_type b2 = fullName.find_last_of(']');
if(b1 != std::string::npos && b2 != std::string::npos){
std::string id = fullName.substr(b1, b2 - b1);
name = fullName.substr(d, b1 - d);
} }
else{
/* Gmsh Model */ index = 0;
int gmshModelCreate(const char *name) name = fullName.substr(d);
{
return 1;
} }
Msg::Debug("Decoded option name '%s' . '%s' '[%d]'", category.c_str(),
int gmshModelSetCurrent(const char *name) name.c_str(), index);
{
return 1;
} }
int gmshModelDestroy() int gmshOptionSetNumber(const std::string &name, double value)
{ {
return 1; std::string c, n;
int i;
splitOptionName(name, c, n, i);
return !GmshSetOption(c, n, value, i);
} }
int gmshModelMesh(int dim) int gmshOptionGetNumber(const std::string &name, double &value)
{ {
return 1; std::string c, n;
int i;
splitOptionName(name, c, n, i);
return !GmshGetOption(c, n, value, i);
} }
int gmshModelAddEmbeddedVertex(int tag, int inDim, int inTag) int gmshOptionSetString(const std::string &name, const std::string &value)
{ {
return 1; std::string c, n;
int i;
splitOptionName(name, c, n, i);
return !GmshSetOption(c, n, value, i);
} }
/* Gmsh Model Geo Internals */ int gmshOptionGetString(const std::string &name, std::string &value)
int gmshModelGeoAddPoint(int *tag, double x, double y, double z, double lc)
{ {
return 1; std::string c, n;
int i;
splitOptionName(name, c, n, i);
return !GmshGetOption(c, n, value, i);
} }
int gmshModelGeoAddLine(int *tag, int startVertexTag, int endVertexTag) // GmshModel
{
return 1;
}
int gmshModelGeoSynchronize() int gmshModelCreate(const std::string &name)
{ {
return 1; return 0;
} }
/* Gmsh Model OCC Internals */ int gmshModelSetCurrent(const std::string &name)
int gmshModelOCCAddPoint(int *tag, double x, double y, double z, double lc)
{ {
return 1; return 0;
} }
int gmshModelOCCSynchronize() int gmshModelDestroy()
{ {
return 1; return 0;
} }
int gmshModelMesh(int dim)
{
return 0;
} }
/* Gmsh - Copyright (C) 1997-2017 C. Geuzaine, J.-F. Remacle // Gmsh - Copyright (C) 1997-2017 C. Geuzaine, J.-F. Remacle
* //
* See the LICENSE.txt file for license information. Please report all // See the LICENSE.txt file for license information. Please report all
* bugs and problems to the public mailing list <gmsh@onelab.info>. // bugs and problems to the public mailing list <gmsh@onelab.info>.
*/
/* #ifndef _GMSH_API_H_
This is the embryo of what will become the Gmsh API. #define _GMSH_API_H_
Don't use it, it's not ready :-) We plan to release a first version in Gmsh // This is the embryo of what will become the Gmsh API.
3.1, and something more complete in Gmsh 4.0. //
// Don't use it yet, it's not ready :-) We plan to release a first version in
// Gmsh 3.1, and something more complete in Gmsh 4.0.
//
// Your input is welcome: please contribute your ideas on
// https://gitlab.onelab.info/gmsh/gmsh/issues/188
//
// By design, the API is purely functional, and only uses elementary C++ types
// from the standard library. This design should not and will not change.
Your input is welcome: please contribute your ideas on // All functions return 0 on successful completion.
http://gitlab.onelab.info/gmsh/gmsh/issues/188
*/
#ifndef _GMSH_API_H_ #include <vector>
#define _GMSH_API_H_ #include <string>
#if defined(WIN32) #if defined(WIN32)
#define GMSH_API __declspec(dllexport) int #define GMSH_API __declspec(dllexport) int
...@@ -23,48 +28,119 @@ ...@@ -23,48 +28,119 @@
#define GMSH_API int #define GMSH_API int
#endif #endif
typedef struct gmshEntity{ int dim, tag; }; // Gmsh
typedef struct gmshIntVector{ int n; int *v; };
typedef struct gmshDoubleVector{ int n; double *v; };
typedef struct gmshEntityVector{ int n; gmshEntity *v; };
/* all functions return 0 on successful completion */
extern "C"
{
/* Gmsh */
GMSH_API gmshInitialize(int argc, char **argv); GMSH_API gmshInitialize(int argc, char **argv);
GMSH_API gmshFinalize(); GMSH_API gmshFinalize();
GMSH_API gmshOpen(const char *fileName); GMSH_API gmshOpen(const std::string &fileName);
GMSH_API gmshMerge(const char *fileName); GMSH_API gmshMerge(const std::string &fileName);
GMSH_API gmshExport(const char *fileName); GMSH_API gmshExport(const std::string &fileName);
GMSH_API gmshClear(); GMSH_API gmshClear();
/* Gmsh Options */ // GmshOption
GMSH_API gmshOptionsSetNumber(const char *name, double value); GMSH_API gmshOptionSetNumber(const std::string &name, double value);
GMSH_API gmshOptionsGetNumber(const char *name, double *value); GMSH_API gmshOptionGetNumber(const std::string &name, double &value);
GMSH_API gmshOptionSetString(const std::string &name, const std::string &value);
GMSH_API gmshOptionGetString(const std::string &name, std::string &value);
/* Gmsh Model */ // GmshModel
GMSH_API gmshModelCreate(const char *name); GMSH_API gmshModelCreate(const std::string &name);
GMSH_API gmshModelSetCurrent(const char *name); GMSH_API gmshModelSetCurrent(const std::string &name);
GMSH_API gmshModelDestroy(); GMSH_API gmshModelDestroy();
GMSH_API gmshModelMesh(int dim); GMSH_API gmshModelMesh(int dim);
GMSH_API gmshModelGetElementaryTags(int dim, std::vector<int> &tags);
GMSH_API gmshModelGetPhysicalTags(int dim, std::vector<int> &tags);
GMSH_API gmshModelSetPhysicalGroup(int dim, int tag, const std::vector<int> &tags);
GMSH_API gmshModelGetPhysicalGroup(int dim, int tag, std::vector<int> &tags);
GMSH_API gmshModelSetPhysicalName(int dim, int tag, const std::string &name);
GMSH_API gmshModelGetPhysicalName(int dim, int tag, std::string &name);
GMSH_API gmshModelGetVertexCoordinates(int tag, double &x, std::vector<double> &coord);
GMSH_API gmshModelGetMeshVertices(int dim, int tag, std::vector<int> &vertexTags,
std::vector<double> &coords,
std::vector<double> &parametricCoords);
GMSH_API gmshModelGetMeshElements(int dim, int tag, std::vector<int> &types,
std::vector<std::vector<int> > &elementTags,
std::vector<std::vector<int> > &vertexTags);
GMSH_API gmshModelGetBoundaryTags(const std::vector<std::pair<int, int> > &inDimTags,
std::vector<std::pair<int, int> > &outDimTags,
bool combined, bool oriented, bool recursive);
GMSH_API gmshModelSetMeshSize(int dim, int tag, double size);
GMSH_API gmshModelSetCompoundMesh(int dim, const std::vector<int> &tags);
GMSH_API gmshModelSetTransfiniteLine(int tag, int nPoints, int type, double coef);
GMSH_API gmshModelSetTransfiniteSurface(int tag, int arrangement,
const std::vector<int> &cornerTags);
GMSH_API gmshModelSetTransfiniteVolume(int tag, const std::vector<int> &cornerTags);
GMSH_API gmshModelSetRecombine(int dim, int tag, double angle);
GMSH_API gmshModelSetSmoothing(int tag, int val);
GMSH_API gmshModelSetReverseMesh(int dim, int tag);
GMSH_API gmshModelAddEmbeddedVertex(int tag, int inDim, int inTag); GMSH_API gmshModelAddEmbeddedVertex(int tag, int inDim, int inTag);
/* Gmsh Model Geo Internals */ // GmshModelGeo
GMSH_API gmshModelGeoAddVertex(int *tag, double x, double y, double z, double lc); GMSH_API gmshModelGeoAddVertex(int &tag, double x, double y, double z, double lc);
GMSH_API gmshModelGeoAddLine(int *tag, int startVertexTag, int endVertexTag); GMSH_API gmshModelGeoAddLine(int &tag, int startTag, int endTag);
GMSH_API gmshModelGeoAddPolyLine(int *tag, const gmshIntVector *vertexTags); GMSH_API gmshModelGeoAddCircleArc(int &tag, int startTag, int centerTag, int EndTag,
GMSH_API gmshModelGeoExtrude(const gmshEntityVector *in, double dx, double dy, double nx=0., double ny=0., double nz=0.);
double dz, gmshEntityVector *out); GMSH_API gmshModelGeoAddEllipseArc(int &tag, int startTag, int centerTag, int majorTag,
int endTag, double nx=0., double ny=0., double nz=0.);
GMSH_API gmshModelGeoAddSpline(int &tag, const std::vector<int> &vertexTags);
GMSH_API gmshModelGeoAddBSpline(int &tag, const std::vector<int> &vertexTags);
GMSH_API gmshModelGeoAddBezier(int &tag, const std::vector<int> &vertexTags);
GMSH_API gmshModelGeoAddNurbs(int &tag, const std::vector<int> &vertexTags,
const std::vector<double> &knots);
GMSH_API gmshModelGeoAddLineLoop(int &tag, const std::vector<int> &edgeTags);
GMSH_API gmshModelGeoAddPlaneSurface(int &tag, const std::vector<int> &wireTags);
GMSH_API gmshModelGeoAddDiscreteSurface(int &tag);
GMSH_API gmshModelGeoAddSurfaceFilling(int &tag, const std::vector<int> &wireTags,
int sphereCenterTag=-1);
GMSH_API gmshModelGeoAddSurfaceLoop(int &tag, const std::vector<int> &faceTags);
GMSH_API gmshModelGeoAddVolume(int &tag, const std::vector<int> &shellTags);
GMSH_API gmshModelGeoExtrude(const std::vector<std::pair<int, int> > &inDimTags,
double dx, double dy, double dz,
std::vector<std::pair<int, int> > &outDimTags,
const std::vector<int> &numElements,
const std::vector<double> &heights, bool recombine);
GMSH_API gmshModelGeoRevolve(const std::vector<std::pair<int, int> > &inDimTags,
double x, double y, double z,
double ax, double ay, double az, double angle,
std::vector<std::pair<int, int> > &outDimTags,
const std::vector<int> &numElements,
const std::vector<double> &heights, bool recombine);
GMSH_API gmshModelGeoTwist(const std::vector<std::pair<int, int> > &inDimTags,
double x, double y, double z,
double dx, double dy, double dz,
double ax, double ay, double az, double angle,
std::vector<std::pair<int, int> > &outDimTags,
const std::vector<int> &numElements,
const std::vector<double> &heights, bool recombine);
GMSH_API gmshModelGeoTranslate(const std::vector<std::pair<int, int> > &dimTags,
double dx, double dy, double dz);
GMSH_API gmshModelGeoRotate(const std::vector<std::pair<int, int> > &dimTags,
double x, double y, double z, double ax, double ay, double az,
double angle);
GMSH_API gmshModelGeoDilate(const std::vector<std::pair<int, int> > &dimTags,
double x, double y, double z,
double a, double b, double c);
GMSH_API gmshModelGeoSymmetry(const std::vector<std::pair<int, int> > &dimTags,
double a, double b, double c, double d);
GMSH_API gmshModelGeoCopy(const std::vector<std::pair<int, int> > &inDimTags,
std::vector<std::pair<int, int> > &outDimTags);
GMSH_API gmshModelGeoRemove(const std::vector<std::pair<int, int> > &dimTags,
bool recursive=false);
GMSH_API gmshModelGeoRemoveAllDuplicates();
GMSH_API gmshModelGeoSynchronize(); GMSH_API gmshModelGeoSynchronize();
/* Gmsh Model OCC Internals */ // GmshModelOCC
GMSH_API gmshModelOCCAddVertex(int *tag, double x, double y, double z, double lc); GMSH_API gmshModelOCCAddVertex(int &tag, double x, double y, double z, double lc);
GMSH_API gmshModelOCCAddLine(int *tag, int startVertexTag, int endVertexTag); GMSH_API gmshModelOCCAddLine(int &tag, int startVertexTag, int endVertexTag);
GMSH_API gmshModelOCCExtrude(const gmshEntityVector *in, double dx, double dy, GMSH_API gmshModelOCCExtrude(const std::vector<std::pair<int, int> > &inDimTag,
double dz, gmshEntityVector *out); double dx, double dy, double dz,
std::vector<std::pair<int, int> > &outDimTags);
GMSH_API gmshModelOCCRemoveAllDuplicates();
GMSH_API gmshModelOCCSynchronize(); GMSH_API gmshModelOCCSynchronize();
}
// GmshSolver
// GmshPost
// GmshPlugin
#endif #endif
...@@ -39,6 +39,11 @@ Background image file in JPEG, PNG or PDF format@* ...@@ -39,6 +39,11 @@ Background image file in JPEG, PNG or PDF format@*
Default value: @code{""}@* Default value: @code{""}@*
Saved in: @code{General.OptionsFileName} Saved in: @code{General.OptionsFileName}
@item General.BuildOptions
Gmsh build options (read-only)@*
Default value: @code{" 64Bit Ann Bamg Bfgs Blas(VecLib) Blossom C++11 Chaco DIntegration Dlopen Fltk GMP Gmm Jpeg(Fltk) Kbipack Lapack(VecLib) MathEx Mesh Metis Mmg3d Mpeg NativeFileChooser Netgen ONELAB ONELABMetamodel OpenCASCADE OpenGL OptHom PETSc Parser Plugins Png(Fltk) Post SLEPc Solver Taucs TetGen/BR Tetgen1.5 Voro3D Zlib"}@*
Saved in: @code{-}
@item General.DefaultFileName @item General.DefaultFileName
Default project file name@* Default project file name@*
Default value: @code{"untitled.geo"}@* Default value: @code{"untitled.geo"}@*
...@@ -154,6 +159,11 @@ Temporary file used by the geometry module@* ...@@ -154,6 +159,11 @@ Temporary file used by the geometry module@*
Default value: @code{".gmsh-tmp"}@* Default value: @code{".gmsh-tmp"}@*
Saved in: @code{General.SessionFileName} Saved in: @code{General.SessionFileName}
@item General.Version
Gmsh version (read-only)@*
Default value: @code{"3.0.7"}@*
Saved in: @code{-}
@item General.WatchFilePattern @item General.WatchFilePattern
Pattern of files to merge as they become available@* Pattern of files to merge as they become available@*
Default value: @code{""}@* Default value: @code{""}@*
......
...@@ -366,14 +366,6 @@ Numeric options: ...@@ -366,14 +366,6 @@ Numeric options:
Default value: @code{-1} Default value: @code{-1}
@end table @end table
@item Plugin(DuplicateBoundaries)
Plugin(DuplicateBoundaries) is not documented yet.
Numeric options:
@table @code
@item Dummy
Default value: @code{1}
@end table
@item Plugin(Eigenvalues) @item Plugin(Eigenvalues)
Plugin(Eigenvalues) computes the three real eigenvalues of each tensor in the view `View'.@* Plugin(Eigenvalues) computes the three real eigenvalues of each tensor in the view `View'.@*
@* @*
...@@ -443,9 +435,7 @@ Plugin(FaultZone) convert all the embedded lines of an existing surfacic mesh to ...@@ -443,9 +435,7 @@ Plugin(FaultZone) convert all the embedded lines of an existing surfacic mesh to
@* @*
`Thickness' is the thickness of the flat quadrangles. Set a value different to zero can be helpful to check the connectivity. @* `Thickness' is the thickness of the flat quadrangles. Set a value different to zero can be helpful to check the connectivity. @*
@* @*
`Prefix' is the prefix of the name of physicals containing the new embedded. `Prefix' is the prefix of the name of physicals containing the new embedded. All physicals containing embedded lines are replaced by physicals containing the corresponding joint elements.
All physicals containing embedded lines are replaced by physicals containing
the corresponding joint elements.
String options: String options:
@table @code @table @code
@item Prefix @item Prefix
......
#include <stdio.h> #include <stdio.h>
#include "Gmsh.h" #include "GmshAPI.h"
#include "GModel.h"
#include "MElement.h"
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
GmshInitialize(argc, argv); gmshInitialize(argc, argv);
GmshSetOption("Mesh", "Algorithm", 5.); gmshSetOption("Mesh", "Algorithm", 5.);
GModel *m = new GModel(); GModel *m = new GModel();
m->readGEO("../../tutorial/t5.geo"); m->readGEO("../../tutorial/t5.geo");
//GmshMergeFile("../../tutorial/t5.geo"); // will also set the bbox //GmshMergeFile("../../tutorial/t5.geo"); // will also set the bbox
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment