Commit 0931e8b5 by Christophe Geuzaine

Merge branch 'julia_api' into 'master'

Julia api See merge request !115
parents e892a238 5056033f
Pipeline #1625 canceled with stage
in 37 minutes 57 seconds
......@@ -125,6 +125,7 @@ endif(ENABLE_PRIVATE_API)
set(ONELAB_PY contrib/onelab/python/onelab.py)
set(GMSH_PY api/gmsh.py)
set(GMSH_JL api/gmsh.jl)
if(${CMAKE_MAJOR_VERSION} GREATER 2)
string(TIMESTAMP DATE "%Y%m%d")
......@@ -1696,6 +1697,7 @@ endif(ENABLE_ONELAB)
if(ENABLE_BUILD_LIB OR ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC)
install(FILES ${GMSH_API} DESTINATION ${GMSH_INC})
install(FILES ${GMSH_PY} DESTINATION ${GMSH_LIB})
install(FILES ${GMSH_JL} DESTINATION ${GMSH_LIB})
if(ENABLE_PRIVATE_API)
install(FILES ${GMSH_PRIVATE_API} DESTINATION ${GMSH_INC}/gmsh)
endif(ENABLE_PRIVATE_API)
......
......@@ -423,7 +423,7 @@ GMSH_API void gmsh::model::removeEntities(const vectorpair &dimTags,
GMSH_API void gmsh::model::getType(const int dim,
const int tag,
std::string &type)
std::string &entityType)
{
if(!_isInitialized()){ throw -1; }
GEntity *ge = GModel::current()->getEntityByTag(dim, tag);
......@@ -431,7 +431,7 @@ GMSH_API void gmsh::model::getType(const int dim,
Msg::Error("%s does not exist", _getEntityName(dim, tag).c_str());
throw 2;
}
type = ge->getTypeString();
entityType = ge->getTypeString();
}
// gmsh::model::mesh
......@@ -953,7 +953,7 @@ static void _addElements(int dim, int tag, const std::vector<MElement*> &src,
GMSH_API void gmsh::model::mesh::setElements(const int dim,
const int tag,
const std::vector<int> &types,
const std::vector<int> &elementTypes,
const std::vector<std::vector<int> > &elementTags,
const std::vector<std::vector<int> > &nodeTags)
{
......@@ -963,18 +963,18 @@ GMSH_API void gmsh::model::mesh::setElements(const int dim,
Msg::Error("%s does not exist", _getEntityName(dim, tag).c_str());
throw 2;
}
if(types.size() != elementTags.size()){
if(elementTypes.size() != elementTags.size()){
Msg::Error("Wrong number of element tags");
throw 2;
}
if(types.size() != nodeTags.size()){
if(elementTypes.size() != nodeTags.size()){
Msg::Error("Wrong number of node tags");
throw 2;
}
// delete only elements; this will also delete the model mesh cache
ge->deleteMesh(true);
for(unsigned int i = 0; i < types.size(); i++){
int type = types[i];
for(unsigned int i = 0; i < elementTypes.size(); i++){
int type = elementTypes[i];
unsigned int numEle = elementTags[i].size();
unsigned int numVertPerEle = MElement::getInfoMSH(type);
if(!numEle) continue;
......@@ -1063,7 +1063,7 @@ GMSH_API void gmsh::model::mesh::getNode(const int nodeTag,
}
GMSH_API void gmsh::model::mesh::getElement(const int elementTag,
int &type,
int &elementType,
std::vector<int> &nodeTags)
{
if(!_isInitialized()){ throw -1; }
......@@ -1072,7 +1072,7 @@ GMSH_API void gmsh::model::mesh::getElement(const int elementTag,
Msg::Error("Unknown mesh element %d", elementTag);
throw 2;
}
type = e->getTypeForMSH();
elementType = e->getTypeForMSH();
nodeTags.clear();
for(int i = 0; i < e->getNumVertices(); i++){
MVertex *v = e->getVertex(i);
......@@ -1099,7 +1099,7 @@ GMSH_API void gmsh::model::mesh::setSize(const vectorpair &dimTags,
GMSH_API void gmsh::model::mesh::setTransfiniteCurve(const int tag,
const int numNodes,
const std::string &type,
const std::string &meshType,
const double coef)
{
if(!_isInitialized()){ throw -1; }
......@@ -1111,8 +1111,8 @@ GMSH_API void gmsh::model::mesh::setTransfiniteCurve(const int tag,
ge->meshAttributes.method = MESH_TRANSFINITE;
ge->meshAttributes.nbPointsTransfinite = numNodes;
ge->meshAttributes.typeTransfinite =
(type == "Progression" || type == "Power") ? 1 :
(type == "Bump") ? 2 :
(meshType == "Progression" || meshType == "Power") ? 1 :
(meshType == "Bump") ? 2 :
1;
ge->meshAttributes.coeffTransfinite = std::abs(coef);
// in .geo file we use a negative tag to do this trick; it's a bad idea
......@@ -1329,7 +1329,7 @@ GMSH_API void gmsh::model::mesh::setPeriodic(const int dim,
// gmsh::model::mesh::field
GMSH_API int gmsh::model::mesh::field::add(const std::string &type,
GMSH_API int gmsh::model::mesh::field::add(const std::string &fieldType,
const int tag)
{
if(!_isInitialized()){ throw -1; }
......@@ -1338,8 +1338,8 @@ GMSH_API int gmsh::model::mesh::field::add(const std::string &type,
if(outTag < 0){
outTag = GModel::current()->getFields()->newId();
}
if(!GModel::current()->getFields()->newField(outTag, type)){
Msg::Error("Cannot add Field %i of type '%s'", outTag, type.c_str());
if(!GModel::current()->getFields()->newField(outTag, fieldType)){
Msg::Error("Cannot add Field %i of type '%s'", outTag, fieldType.c_str());
throw 1;
}
#if defined(HAVE_FLTK)
......@@ -1813,13 +1813,13 @@ GMSH_API void gmsh::model::geo::synchronize()
GMSH_API void gmsh::model::geo::mesh::setTransfiniteCurve(const int tag,
const int nPoints,
const std::string &type,
const std::string &meshType,
const double coef)
{
if(!_isInitialized()){ throw -1; }
int t =
(type == "Progression" || type == "Power") ? 1 :
(type == "Bump") ? 2 :
(meshType == "Progression" || meshType == "Power") ? 1 :
(meshType == "Bump") ? 2 :
1;
double c = std::abs(coef);
// in .geo file we use a negative tag to do this trick; it's a bad idea
......
......@@ -3,6 +3,7 @@ This directory contains the Gmsh API:
- gmsh.h: the header defining the Gmsh C++ API
- gmshc.h: the header defining the Gmsh C API
- gmsh.py: the module defining the Gmsh Python API
- gmsh.jl: the module defining the Gmsh Julia API
These files are all automatically generated by the Python script 'gen.py'.
......
......@@ -11,12 +11,7 @@
// Do not edit it directly: it is automatically generated by `api/gen.py'.
//
// By design, the Gmsh C++ API is purely functional, and only uses elementary
// types from the standard library. A pure C as well as a Python API are also
// automatically generated by `api/gen.py': see `gmshc.h' and `gmsh.py'.
//
// See `demos/api' for examples on how to use the Gmsh API. In particular,
// `demos/api' contains C++ and Python versions of several of the `.geo'
// tutorials from `tutorials'.
// types from the standard library. See `demos/api' for examples.
#if defined(_MSC_VER)
#define _USE_MATH_DEFINES
......@@ -201,7 +196,7 @@ namespace gmsh { // Top-level functions
// Get the type of the entity of dimension `dim' and tag `tag'.
GMSH_API void getType(const int dim,
const int tag,
std::string & type);
std::string & entityType);
namespace mesh { // Per-model meshing functions
......@@ -373,7 +368,7 @@ namespace gmsh { // Top-level functions
// node tags of all the elements of the given type, concatenated.
GMSH_API void setElements(const int dim,
const int tag,
const std::vector<int> & types,
const std::vector<int> & elementTypes,
const std::vector<std::vector<int> > & elementTags,
const std::vector<std::vector<int> > & nodeTags);
......@@ -400,7 +395,7 @@ namespace gmsh { // Top-level functions
// maintain reasonnable performance (in this case the internal cache is based
// on a vector; otherwise it uses a map).
GMSH_API void getElement(const int elementTag,
int & type,
int & elementType,
std::vector<int> & nodeTags);
// Set a mesh size constraint on the geometrical entities `dimTags'.
......@@ -409,12 +404,12 @@ namespace gmsh { // Top-level functions
const double size);
// Set a transfinite meshing constraint on the curve `tag', with `numNodes'
// mesh nodes distributed according to `type' and `coef'. Currently supported
// types are "Progression" (geometrical progression with power `coef') and
// "Bump" (refinement toward both extremities of the curve).
// mesh nodes distributed according to `meshType' and `coef'. Currently
// supported types are "Progression" (geometrical progression with power
// `coef') and "Bump" (refinement toward both extremities of the curve).
GMSH_API void setTransfiniteCurve(const int tag,
const int numNodes,
const std::string & type = "Progression",
const std::string & meshType = "Progression",
const double coef = 1.);
// Set a transfinite meshing constraint on the surface `tag'. `arrangement'
......@@ -474,10 +469,10 @@ namespace gmsh { // Top-level functions
namespace field { // Per-model mesh size field functions
// Add a new mesh size field of type `type'. If `tag' is positive, assign
// the tag explcitly; otherwise a new tag is assigned automatically. Return
// the field tag.
GMSH_API int add(const std::string & type,
// Add a new mesh size field of type `fieldType'. If `tag' is positive,
// assign the tag explcitly; otherwise a new tag is assigned automatically.
// Return the field tag.
GMSH_API int add(const std::string & fieldType,
const int tag = -1);
// Remove the field with tag `tag'.
......@@ -737,12 +732,12 @@ namespace gmsh { // Top-level functions
const double size);
// Set a transfinite meshing constraint on the curve `tag', with `numNodes'
// mesh nodes distributed according to `type' and `coef'. Currently
// mesh nodes distributed according to `meshType' and `coef'. Currently
// supported types are "Progression" (geometrical progression with power
// `coef') and "Bump" (refinement toward both extreminties of the curve).
GMSH_API void setTransfiniteCurve(const int tag,
const int nPoints,
const std::string & type = "Progression",
const std::string & meshType = "Progression",
const double coef = 1.);
// Set a transfinite meshing constraint on the surface `tag'. `arrangement'
......@@ -1286,12 +1281,12 @@ namespace gmsh { // Top-level functions
double & time,
int & numComponents);
// Add list-based post-processing data to the view with tag `tag'. `type'
// Add list-based post-processing data to the view with tag `tag'. `dataType'
// identifies the data: "SP" for scalar points, "VP", for vector points, etc.
// `numEle' gives the number of elements in the data. `data' contains the data
// for the `numEle' elements.
GMSH_API void addListData(const int tag,
const std::string & type,
const std::string & dataType,
const int numEle,
const std::vector<double> & data);
......
......@@ -393,13 +393,13 @@ namespace gmsh { // Top-level functions
// Get the type of the entity of dimension `dim' and tag `tag'.
GMSH_API void getType(const int dim,
const int tag,
std::string & type)
std::string & entityType)
{
int ierr = 0;
char *api_type_;
gmshModelGetType(dim, tag, &api_type_, &ierr);
char *api_entityType_;
gmshModelGetType(dim, tag, &api_entityType_, &ierr);
if(ierr) throw ierr;
type = std::string(api_type_); gmshFree(api_type_);
entityType = std::string(api_entityType_); gmshFree(api_entityType_);
}
namespace mesh { // Per-model meshing functions
......@@ -713,17 +713,17 @@ namespace gmsh { // Top-level functions
// node tags of all the elements of the given type, concatenated.
GMSH_API void setElements(const int dim,
const int tag,
const std::vector<int> & types,
const std::vector<int> & elementTypes,
const std::vector<std::vector<int> > & elementTags,
const std::vector<std::vector<int> > & nodeTags)
{
int ierr = 0;
int *api_types_; size_t api_types_n_; vector2ptr(types, &api_types_, &api_types_n_);
int *api_elementTypes_; size_t api_elementTypes_n_; vector2ptr(elementTypes, &api_elementTypes_, &api_elementTypes_n_);
int **api_elementTags_; size_t *api_elementTags_n_, api_elementTags_nn_; vectorvector2ptrptr(elementTags, &api_elementTags_, &api_elementTags_n_, &api_elementTags_nn_);
int **api_nodeTags_; size_t *api_nodeTags_n_, api_nodeTags_nn_; vectorvector2ptrptr(nodeTags, &api_nodeTags_, &api_nodeTags_n_, &api_nodeTags_nn_);
gmshModelMeshSetElements(dim, tag, api_types_, api_types_n_, (const int **)api_elementTags_, api_elementTags_n_, api_elementTags_nn_, (const int **)api_nodeTags_, api_nodeTags_n_, api_nodeTags_nn_, &ierr);
gmshModelMeshSetElements(dim, tag, api_elementTypes_, api_elementTypes_n_, (const int **)api_elementTags_, api_elementTags_n_, api_elementTags_nn_, (const int **)api_nodeTags_, api_nodeTags_n_, api_nodeTags_nn_, &ierr);
if(ierr) throw ierr;
gmshFree(api_types_);
gmshFree(api_elementTypes_);
for(size_t i = 0; i < api_elementTags_nn_; ++i){ gmshFree(api_elementTags_[i]); } gmshFree(api_elementTags_); gmshFree(api_elementTags_n_);
for(size_t i = 0; i < api_nodeTags_nn_; ++i){ gmshFree(api_nodeTags_[i]); } gmshFree(api_nodeTags_); gmshFree(api_nodeTags_n_);
}
......@@ -765,12 +765,12 @@ namespace gmsh { // Top-level functions
// maintain reasonnable performance (in this case the internal cache is based
// on a vector; otherwise it uses a map).
GMSH_API void getElement(const int elementTag,
int & type,
int & elementType,
std::vector<int> & nodeTags)
{
int ierr = 0;
int *api_nodeTags_; size_t api_nodeTags_n_;
gmshModelMeshGetElement(elementTag, &type, &api_nodeTags_, &api_nodeTags_n_, &ierr);
gmshModelMeshGetElement(elementTag, &elementType, &api_nodeTags_, &api_nodeTags_n_, &ierr);
if(ierr) throw ierr;
nodeTags.assign(api_nodeTags_, api_nodeTags_ + api_nodeTags_n_); gmshFree(api_nodeTags_);
}
......@@ -788,16 +788,16 @@ namespace gmsh { // Top-level functions
}
// Set a transfinite meshing constraint on the curve `tag', with `numNodes'
// mesh nodes distributed according to `type' and `coef'. Currently supported
// types are "Progression" (geometrical progression with power `coef') and
// "Bump" (refinement toward both extremities of the curve).
// mesh nodes distributed according to `meshType' and `coef'. Currently
// supported types are "Progression" (geometrical progression with power
// `coef') and "Bump" (refinement toward both extremities of the curve).
GMSH_API void setTransfiniteCurve(const int tag,
const int numNodes,
const std::string & type = "Progression",
const std::string & meshType = "Progression",
const double coef = 1.)
{
int ierr = 0;
gmshModelMeshSetTransfiniteCurve(tag, numNodes, type.c_str(), coef, &ierr);
gmshModelMeshSetTransfiniteCurve(tag, numNodes, meshType.c_str(), coef, &ierr);
if(ierr) throw ierr;
}
......@@ -905,14 +905,14 @@ namespace gmsh { // Top-level functions
namespace field { // Per-model mesh size field functions
// Add a new mesh size field of type `type'. If `tag' is positive, assign
// the tag explcitly; otherwise a new tag is assigned automatically. Return
// the field tag.
GMSH_API int add(const std::string & type,
// Add a new mesh size field of type `fieldType'. If `tag' is positive,
// assign the tag explcitly; otherwise a new tag is assigned automatically.
// Return the field tag.
GMSH_API int add(const std::string & fieldType,
const int tag = -1)
{
int ierr = 0;
int result_api_ = gmshModelMeshFieldAdd(type.c_str(), tag, &ierr);
int result_api_ = gmshModelMeshFieldAdd(fieldType.c_str(), tag, &ierr);
if(ierr) throw ierr;
return result_api_;
}
......@@ -1394,16 +1394,16 @@ namespace gmsh { // Top-level functions
}
// Set a transfinite meshing constraint on the curve `tag', with `numNodes'
// mesh nodes distributed according to `type' and `coef'. Currently
// mesh nodes distributed according to `meshType' and `coef'. Currently
// supported types are "Progression" (geometrical progression with power
// `coef') and "Bump" (refinement toward both extreminties of the curve).
GMSH_API void setTransfiniteCurve(const int tag,
const int nPoints,
const std::string & type = "Progression",
const std::string & meshType = "Progression",
const double coef = 1.)
{
int ierr = 0;
gmshModelGeoMeshSetTransfiniteCurve(tag, nPoints, type.c_str(), coef, &ierr);
gmshModelGeoMeshSetTransfiniteCurve(tag, nPoints, meshType.c_str(), coef, &ierr);
if(ierr) throw ierr;
}
......@@ -2365,18 +2365,18 @@ namespace gmsh { // Top-level functions
data.resize(api_data_nn_); for(size_t i = 0; i < api_data_nn_; ++i){ data[i].assign(api_data_[i], api_data_[i] + api_data_n_[i]); gmshFree(api_data_[i]); } gmshFree(api_data_); gmshFree(api_data_n_);
}
// Add list-based post-processing data to the view with tag `tag'. `type'
// Add list-based post-processing data to the view with tag `tag'. `dataType'
// identifies the data: "SP" for scalar points, "VP", for vector points, etc.
// `numEle' gives the number of elements in the data. `data' contains the data
// for the `numEle' elements.
GMSH_API void addListData(const int tag,
const std::string & type,
const std::string & dataType,
const int numEle,
const std::vector<double> & data)
{
int ierr = 0;
double *api_data_; size_t api_data_n_; vector2ptr(data, &api_data_, &api_data_n_);
gmshViewAddListData(tag, type.c_str(), numEle, api_data_, api_data_n_, &ierr);
gmshViewAddListData(tag, dataType.c_str(), numEle, api_data_, api_data_n_, &ierr);
if(ierr) throw ierr;
gmshFree(api_data_);
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -3,18 +3,13 @@
# See the LICENSE.txt file for license information. Please report all
# bugs and problems to the public mailing list <gmsh@onelab.info>.
# This file defines the Gmsh Pyhton API.
# This file defines the Gmsh Python API.
#
# Do not edit it directly: it is automatically generated by `api/gen.py'.
#
# By design, the Gmsh Pyhton API is purely functional, and only uses elementary
# types (as well as `numpy' arrays if `numpy' is avaiable). A C++ as well as a
# pure C API are also automatically generated by `api/gen.py': see `gmsh.h'
# and `gmshc.h'.
#
# See `demos/api' for examples on how to use the Gmsh API. In particular,
# `demos/api' contains C++ and Python versions of several of the `.geo'
# tutorials from `tutorials'.
# By design, the Gmsh Python API is purely functional, and only uses elementary
# types (as well as `numpy' arrays if `numpy' is avaiable). See `demos/api' for
# examples.
from ctypes import *
import signal
......@@ -632,20 +627,20 @@ class model:
"""
Get the type of the entity of dimension `dim' and tag `tag'.
Return `type'.
Return `entityType'.
"""
api_type_ = c_char_p()
api_entityType_ = c_char_p()
ierr = c_int()
lib.gmshModelGetType(
c_int(dim),
c_int(tag),
byref(api_type_),
byref(api_entityType_),
byref(ierr))
if ierr.value != 0:
raise ValueError(
"gmshModelGetType returned non-zero error code: ",
ierr.value)
return _ostring(api_type_)
return _ostring(api_entityType_)
class mesh:
......@@ -1074,7 +1069,7 @@ class model:
ierr.value)
@staticmethod
def setElements(dim, tag, types, elementTags, nodeTags):
def setElements(dim, tag, elementTypes, elementTags, nodeTags):
"""
Set the mesh elements of the entity of dimension `dim' and `tag' tag.
`types' contains the MSH types of the elements (e.g. `2' for 3-node
......@@ -1086,14 +1081,14 @@ class model:
number of nodes per element, that contains the node tags of all the
elements of the given type, concatenated.
"""
api_types_, api_types_n_ = _ivectorint(types)
api_elementTypes_, api_elementTypes_n_ = _ivectorint(elementTypes)
api_elementTags_, api_elementTags_n_, api_elementTags_nn_ = _ivectorvectorint(elementTags)
api_nodeTags_, api_nodeTags_n_, api_nodeTags_nn_ = _ivectorvectorint(nodeTags)
ierr = c_int()
lib.gmshModelMeshSetElements(
c_int(dim),
c_int(tag),
api_types_, api_types_n_,
api_elementTypes_, api_elementTypes_n_,
api_elementTags_, api_elementTags_n_, api_elementTags_nn_,
api_nodeTags_, api_nodeTags_n_, api_nodeTags_nn_,
byref(ierr))
......@@ -1156,14 +1151,14 @@ class model:
reasonnable performance (in this case the internal cache is based on a
vector; otherwise it uses a map).
Return `type', `nodeTags'.
Return `elementType', `nodeTags'.
"""
api_type_ = c_int()
api_elementType_ = c_int()
api_nodeTags_, api_nodeTags_n_ = POINTER(c_int)(), c_size_t()
ierr = c_int()
lib.gmshModelMeshGetElement(
c_int(elementTag),
byref(api_type_),
byref(api_elementType_),
byref(api_nodeTags_), byref(api_nodeTags_n_),
byref(ierr))
if ierr.value != 0:
......@@ -1171,7 +1166,7 @@ class model:
"gmshModelMeshGetElement returned non-zero error code: ",
ierr.value)
return (
api_type_.value,
api_elementType_.value,
_ovectorint(api_nodeTags_, api_nodeTags_n_.value))
@staticmethod
......@@ -1192,18 +1187,18 @@ class model:
ierr.value)
@staticmethod
def setTransfiniteCurve(tag, numNodes, type="Progression", coef=1.):
def setTransfiniteCurve(tag, numNodes, meshType="Progression", coef=1.):
"""
Set a transfinite meshing constraint on the curve `tag', with `numNodes'
mesh nodes distributed according to `type' and `coef'. Currently supported
types are "Progression" (geometrical progression with power `coef') and
"Bump" (refinement toward both extremities of the curve).
mesh nodes distributed according to `meshType' and `coef'. Currently
supported types are "Progression" (geometrical progression with power
`coef') and "Bump" (refinement toward both extremities of the curve).
"""
ierr = c_int()
lib.gmshModelMeshSetTransfiniteCurve(
c_int(tag),
c_int(numNodes),
c_char_p(type.encode()),
c_char_p(meshType.encode()),
c_double(coef),
byref(ierr))
if ierr.value != 0:
......@@ -1356,17 +1351,17 @@ class model:
"""
@staticmethod
def add(type, tag=-1):
def add(fieldType, tag=-1):
"""
Add a new mesh size field of type `type'. If `tag' is positive, assign the
tag explcitly; otherwise a new tag is assigned automatically. Return the
field tag.
Add a new mesh size field of type `fieldType'. If `tag' is positive, assign
the tag explcitly; otherwise a new tag is assigned automatically. Return
the field tag.
Return an integer.
"""
ierr = c_int()
api__result__ = lib.gmshModelMeshFieldAdd(
c_char_p(type.encode()),
c_char_p(fieldType.encode()),
c_int(tag),
byref(ierr))
if ierr.value != 0:
......@@ -2039,18 +2034,18 @@ class model:
ierr.value)
@staticmethod
def setTransfiniteCurve(tag, nPoints, type="Progression", coef=1.):
def setTransfiniteCurve(tag, nPoints, meshType="Progression", coef=1.):
"""
Set a transfinite meshing constraint on the curve `tag', with `numNodes'
mesh nodes distributed according to `type' and `coef'. Currently supported
types are "Progression" (geometrical progression with power `coef') and
"Bump" (refinement toward both extreminties of the curve).
mesh nodes distributed according to `meshType' and `coef'. Currently
supported types are "Progression" (geometrical progression with power
`coef') and "Bump" (refinement toward both extreminties of the curve).
"""
ierr = c_int()
lib.gmshModelGeoMeshSetTransfiniteCurve(
c_int(tag),
c_int(nPoints),
c_char_p(type.encode()),
c_char_p(meshType.encode()),
c_double(coef),
byref(ierr))
if ierr.value != 0:
......@@ -3383,9 +3378,9 @@ class view:
api_numComponents_.value)
@staticmethod
def addListData(tag, type, numEle, data):
def addListData(tag, dataType, numEle, data):
"""
Add list-based post-processing data to the view with tag `tag'. `type'
Add list-based post-processing data to the view with tag `tag'. `dataType'
identifies the data: "SP" for scalar points, "VP", for vector points, etc.
`numEle' gives the number of elements in the data. `data' contains the data
for the `numEle' elements.
......@@ -3394,7 +3389,7 @@ class view:
ierr = c_int()
lib.gmshViewAddListData(
c_int(tag),
c_char_p(type.encode()),
c_char_p(dataType.encode()),
c_int(numEle),
api_data_, api_data_n_,
byref(ierr))
......
......@@ -376,13 +376,13 @@ GMSH_API void gmshModelRemoveEntities(int * dimTags, size_t dimTags_n, const int
}
}
GMSH_API void gmshModelGetType(const int dim, const int tag, char ** type, int * ierr)
GMSH_API void gmshModelGetType(const int dim, const int tag, char ** entityType, int * ierr)
{
if(ierr) *ierr = 0;
try {
std::string api_type_;
gmsh::model::getType(dim, tag, api_type_);
*type = strdup(api_type_.c_str());
std::string api_entityType_;
gmsh::model::getType(dim, tag, api_entityType_);
*entityType = strdup(api_entityType_.c_str());
}
catch(int api_ierr_){
if(ierr) *ierr = api_ierr_;
......@@ -623,18 +623,18 @@ GMSH_API void gmshModelMeshSetNodes(const int dim, const int tag, int * nodeTags
}
}
GMSH_API void gmshModelMeshSetElements(const int dim, const int tag, int * types, size_t types_n, const int ** elementTags, const size_t * elementTags_n, size_t elementTags_nn, const int ** nodeTags, const size_t * nodeTags_n, size_t nodeTags_nn, int * ierr)
GMSH_API void gmshModelMeshSetElements(const int dim, const int tag, int * elementTypes, size_t elementTypes_n, const int ** elementTags, const size_t * elementTags_n, size_t elementTags_nn, const int ** nodeTags, const size_t * nodeTags_n, size_t nodeTags_nn, int * ierr)
{
if(ierr) *ierr = 0;
try {
std::vector<int> api_types_(types, types + types_n);
std::vector<int> api_elementTypes_(elementTypes, elementTypes + elementTypes_n);
std::vector<std::vector<int> > api_elementTags_(elementTags_nn);
for(size_t i = 0; i < elementTags_nn; ++i)
api_elementTags_[i] = std::vector<int>(elementTags[i], elementTags[i] + elementTags_n[i]);
std::vector<std::vector<int> > api_nodeTags_(nodeTags_nn);
for(size_t i = 0; i < nodeTags_nn; ++i)
api_nodeTags_[i] = std::vector<int>(nodeTags[i], nodeTags[i] + nodeTags_n[i]);
gmsh::model::mesh::setElements(dim, tag, api_types_, api_elementTags_, api_nodeTags_);
gmsh::model::mesh::setElements(dim, tag, api_elementTypes_, api_elementTags_, api_nodeTags_);
}
catch(int api_ierr_){
if(ierr) *ierr = api_ierr_;
......@@ -667,12 +667,12 @@ GMSH_API void gmshModelMeshGetNode(const int nodeTag, double ** coord, size_t *
}
}
GMSH_API void gmshModelMeshGetElement(const int elementTag, int * type, int ** nodeTags, size_t * nodeTags_n, int * ierr)
GMSH_API void gmshModelMeshGetElement(const int elementTag, int * elementType, int ** nodeTags, size_t * nodeTags_n, int * ierr)
{
if(ierr) *ierr = 0;
try {
std::vector<int> api_nodeTags_;
gmsh::model::mesh::getElement(elementTag, *type, api_nodeTags_);
gmsh::model::mesh::getElement(elementTag, *elementType, api_nodeTags_);
vector2ptr(api_nodeTags_, nodeTags, nodeTags_n);
}
catch(int api_ierr_){
......@@ -696,11 +696,11 @@ GMSH_API void gmshModelMeshSetSize(int * dimTags, size_t dimTags_n, const double
}
}
GMSH_API void gmshModelMeshSetTransfiniteCurve(const int tag, const int numNodes, const char * type, const double coef, int * ierr)
GMSH_API void gmshModelMeshSetTransfiniteCurve(const int tag, const int numNodes, const char * meshType, const double coef, int * ierr)
{
if(ierr) *ierr = 0;
try {
gmsh::model::mesh::setTransfiniteCurve(tag, numNodes, type, coef);
gmsh::model::mesh::setTransfiniteCurve(tag, numNodes, meshType, coef);
}
catch(int api_ierr_){
if(ierr) *ierr = api_ierr_;
......@@ -790,12 +790,12 @@ GMSH_API void gmshModelMeshSetPeriodic(const int dim, int * tags, size_t tags_n,
}
}
GMSH_API int gmshModelMeshFieldAdd(const char * type, const int tag, int * ierr)
GMSH_API int gmshModelMeshFieldAdd(const char * fieldType, const int tag, int * ierr)
{
int result_api_;
if(ierr) *ierr = 0;
try {
result_api_ = gmsh::model::mesh::field::add(type, tag);
result_api_ = gmsh::model::mesh::field::add(fieldType, tag);
}
catch(int api_ierr_){
if(ierr) *ierr = api_ierr_;
......@@ -1230,11 +1230,11 @@ GMSH_API void gmshModelGeoMeshSetSize(int * dimTags, size_t dimTags_n, const dou
}
}
GMSH_API void gmshModelGeoMeshSetTransfiniteCurve(const int tag, const int nPoints, const char * type, const double coef, int * ierr)
GMSH_API void gmshModelGeoMeshSetTransfiniteCurve(const int tag, const int nPoints, const char * meshType, const double coef, int * ierr)
{
if(ierr) *ierr = 0;
try {
gmsh::model::geo::mesh::setTransfiniteCurve(tag, nPoints, type, coef);
gmsh::model::geo::mesh::setTransfiniteCurve(tag, nPoints, meshType, coef);
}
catch(int api_ierr_){
if(ierr) *ierr = api_ierr_;
......@@ -2023,12 +2023,12 @@ GMSH_API void gmshViewAddModelData(const int tag, const int step, const char * m
}
}
GMSH_API void gmshViewAddListData(const int tag, const char * type, const int numEle, double * data, size_t data_n, int * ierr)
GMSH_API void gmshViewAddListData(const int tag, const char * dataType, const int numEle, double * data, size_t data_n, int * ierr)
{
if(ierr) *ierr = 0;
try {
std::vector<double> api_data_(data, data + data_n);
gmsh::view::addListData(tag, type, numEle, api_data_);
gmsh::view::addListData(tag, dataType, numEle, api_data_);
}
catch(int api_ierr_){
if(ierr) *ierr = api_ierr_;
......
......@@ -14,12 +14,7 @@
* Do not edit it directly: it is automatically generated by `api/gen.py'.
*
* By design, the Gmsh C API is purely functional, and only uses elementary
* types. A C++ as well as a Python API are also automatically generated by
* `api/gen.py': see `gmsh.h' and `gmsh.py'.
*
* See `demos/api' for examples on how to use the Gmsh API. In particular,
* `demos/api' contains C++ and Python versions of several of the `.geo'
* tutorials from `tutorials'.
* types. See `demos/api' for examples.
*/
#include <stddef.h>
......@@ -206,7 +201,7 @@ GMSH_API void gmshModelRemoveEntities(int * dimTags, size_t dimTags_n,
/* Get the type of the entity of dimension `dim' and tag `tag'. */
GMSH_API void gmshModelGetType(const int dim,
const int tag,
char ** type,
char ** entityType,
int * ierr);
/* Generate a mesh of the current model, up to dimension `dim' (0, 1, 2 or 3). */
......@@ -389,7 +384,7 @@ GMSH_API void gmshModelMeshSetNodes(const int dim,
* elements of the given type, concatenated. */
GMSH_API void gmshModelMeshSetElements(const int dim,
const int tag,
int * types, size_t types_n,
int * elementTypes, size_t elementTypes_n,
const int ** elementTags, const size_t * elementTags_n, size_t elementTags_nn,
const int ** nodeTags, const size_t * nodeTags_n, size_t nodeTags_nn,
int * ierr);
......@@ -418,7 +413,7 @@ GMSH_API void gmshModelMeshGetNode(const int nodeTag,
* reasonnable performance (in this case the internal cache is based on a
* vector; otherwise it uses a map). */
GMSH_API void gmshModelMeshGetElement(const int elementTag,
int * type,
int * elementType,