Commit c011f9e7 by Christophe Geuzaine

fix return value of addThruSections and addThickSolid (should not return anything)

parent be1e8fcf
Pipeline #948 passed with stage
in 35 minutes 46 seconds
......@@ -1648,36 +1648,32 @@ int gmsh::model::occ::addTorus(const double x, const double y, const double z,
return outTag;
}
int gmsh::model::occ::addThruSections(const std::vector<int> &wireTags,
vector_pair &outDimTags,
const int tag, const bool makeSolid,
const bool makeRuled)
void gmsh::model::occ::addThruSections(const std::vector<int> &wireTags,
vector_pair &outDimTags,
const int tag, const bool makeSolid,
const bool makeRuled)
{
if(!_isInitialized()){ throw -1; }
_createOcc();
int outTag = tag;
outDimTags.clear();
if(!GModel::current()->getOCCInternals()->addThruSections
(outTag, wireTags, makeSolid, makeRuled, outDimTags)){
(tag, wireTags, makeSolid, makeRuled, outDimTags)){
throw 1;
}
return outTag;
}
int gmsh::model::occ::addThickSolid(const int solidTag,
const std::vector<int> &excludeFaceTags,
const double offset, vector_pair &outDimTags,
const int tag)
void gmsh::model::occ::addThickSolid(const int solidTag,
const std::vector<int> &excludeFaceTags,
const double offset, vector_pair &outDimTags,
const int tag)
{
if(!_isInitialized()){ throw -1; }
_createOcc();
int outTag = tag;
outDimTags.clear();
if(!GModel::current()->getOCCInternals()->addThickSolid
(outTag, solidTag, excludeFaceTags, offset, outDimTags)){
(tag, solidTag, excludeFaceTags, offset, outDimTags)){
throw 1;
}
return outTag;
}
void gmsh::model::occ::extrude(const vector_pair &dimTags,
......
......@@ -482,7 +482,6 @@ def _ovectordouble(ptr,size):
lib.gmshFree(ptr)
return v
def _ovectorvectorint(ptr,size,n):
v = [_ovectorint(pointer(ptr[i].contents),size[i]) for i in range(n.value)]
lib.gmshFree(size)
......
......@@ -355,10 +355,10 @@ doc = '''Adds a torus, defined by its center (`x', `y', `z') and its 2 radii `r'
occ.add('addTorus',doc,oint,idouble('x'),idouble('y'),idouble('z'),idouble('r1'),idouble('r2'),iint('tag','-1'),idouble('angle','2*M_PI','2*pi'))
doc = '''Adds a volume (if the optional argument `makeSolid' is set) or surfaces defined through the open or closed wires `wireTags'. If `tag' is positive, sets the tag explicitly; otherwise a new tag is selected automatically. The new entities are returned in `outDimTags'. If the optional argument `makeRuled' is set, the surfaces created on the boundary are forced to be ruled surfaces.'''
occ.add('addThruSections',doc,oint,ivectorint('wireTags'),ovectorpair('outDimTags'),iint('tag','-1'),ibool('makeSolid','true','True'),ibool('makeRuled','false','False'))
occ.add('addThruSections',doc,None,ivectorint('wireTags'),ovectorpair('outDimTags'),iint('tag','-1'),ibool('makeSolid','true','True'),ibool('makeRuled','false','False'))
doc = '''Adds a hollowed volume built from an initial volume `solidTag' and a set of faces from this volume `excludeFaceTags', which are to be removed. The remaining faces of the volume become the walls of the hollowed solid, with thickness `offset'. If `tag' is positive, sets the tag explicitly; otherwise a new tag is selected automatically. Returns the tag of the volume.'''
occ.add('addThickSolid',doc,oint,iint('solidTag'),ivectorint('excludeFaceTags'),idouble('offset'),ovectorpair('outDimTags'),iint('tag','-1'))
doc = '''Adds a hollowed volume built from an initial volume `solidTag' and a set of faces from this volume `excludeFaceTags', which are to be removed. The remaining faces of the volume become the walls of the hollowed solid, with thickness `offset'. If `tag' is positive, sets the tag explicitly; otherwise a new tag is selected automatically.'''
occ.add('addThickSolid',doc,None,iint('solidTag'),ivectorint('excludeFaceTags'),idouble('offset'),ovectorpair('outDimTags'),iint('tag','-1'))
doc = '''Extrudes the geometrical entities `dimTags' by translation along (`dx', `dy', `dz'). Returns extruded entities in `outDimTags'. If `numElements' is not empty, also extrude the mesh: the entries in `numElements' give the number of elements in each layer. If `height' is not empty, it provides the (cummulative) height of the different layers, normalized to 1.'''
occ.add('extrude',doc,None,ivectorpair('dimTags'),idouble('dx'),idouble('dy'),idouble('dz'),ovectorpair('outDimTags'),ivectorint('numElements','std::vector<int>()',"[]"),ivectordouble('heights','std::vector<double>()',"[]"),ibool('recombine','false','False'))
......
......@@ -891,23 +891,22 @@ namespace gmsh { // Top-level functions
// The new entities are returned in `outDimTags'. If the optional argument
// `makeRuled' is set, the surfaces created on the boundary are forced to be
// ruled surfaces.
GMSH_API int addThruSections(const std::vector<int> & wireTags,
gmsh::vector_pair & outDimTags,
const int tag = -1,
const bool makeSolid = true,
const bool makeRuled = false);
GMSH_API void addThruSections(const std::vector<int> & wireTags,
gmsh::vector_pair & outDimTags,
const int tag = -1,
const bool makeSolid = true,
const bool makeRuled = false);
// Adds a hollowed volume built from an initial volume `solidTag' and a set
// of faces from this volume `excludeFaceTags', which are to be removed. The
// remaining faces of the volume become the walls of the hollowed solid, with
// thickness `offset'. If `tag' is positive, sets the tag explicitly;
// otherwise a new tag is selected automatically. Returns the tag of the
// volume.
GMSH_API int addThickSolid(const int solidTag,
const std::vector<int> & excludeFaceTags,
const double offset,
gmsh::vector_pair & outDimTags,
const int tag = -1);
// otherwise a new tag is selected automatically.
GMSH_API void addThickSolid(const int solidTag,
const std::vector<int> & excludeFaceTags,
const double offset,
gmsh::vector_pair & outDimTags,
const int tag = -1);
// Extrudes the geometrical entities `dimTags' by translation along (`dx',
// `dy', `dz'). Returns extruded entities in `outDimTags'. If `numElements'
......
......@@ -74,7 +74,6 @@ def _ovectordouble(ptr,size):
lib.gmshFree(ptr)
return v
def _ovectorvectorint(ptr,size,n):
v = [_ovectorint(pointer(ptr[i].contents),size[i]) for i in range(n.value)]
lib.gmshFree(size)
......@@ -2356,12 +2355,12 @@ class model:
`makeRuled' is set, the surfaces created on the boundary are forced to be
ruled surfaces.
return int, outDimTags
return outDimTags
"""
api_wireTags_, api_wireTags_n_ = _ivectorint(wireTags)
api_outDimTags_, api_outDimTags_n_ = POINTER(c_int)(), c_size_t()
ierr = c_int()
api__result__ = lib.gmshModelOccAddThruSections(
lib.gmshModelOccAddThruSections(
api_wireTags_, api_wireTags_n_,
byref(api_outDimTags_), byref(api_outDimTags_n_),
c_int(tag),
......@@ -2372,9 +2371,7 @@ class model:
raise ValueError(
"gmshModelOccAddThruSections returned non-zero error code : ",
ierr.value)
return (
api__result__,
_ovectorpair(api_outDimTags_, api_outDimTags_n_.value))
return _ovectorpair(api_outDimTags_, api_outDimTags_n_.value)
@staticmethod
def addThickSolid(solidTag,excludeFaceTags,offset,tag=-1):
......@@ -2383,15 +2380,14 @@ class model:
faces from this volume `excludeFaceTags', which are to be removed. The
remaining faces of the volume become the walls of the hollowed solid, with
thickness `offset'. If `tag' is positive, sets the tag explicitly;
otherwise a new tag is selected automatically. Returns the tag of the
volume.
otherwise a new tag is selected automatically.
return int, outDimTags
return outDimTags
"""
api_excludeFaceTags_, api_excludeFaceTags_n_ = _ivectorint(excludeFaceTags)
api_outDimTags_, api_outDimTags_n_ = POINTER(c_int)(), c_size_t()
ierr = c_int()
api__result__ = lib.gmshModelOccAddThickSolid(
lib.gmshModelOccAddThickSolid(
c_int(solidTag),
api_excludeFaceTags_, api_excludeFaceTags_n_,
c_double(offset),
......@@ -2402,9 +2398,7 @@ class model:
raise ValueError(
"gmshModelOccAddThickSolid returned non-zero error code : ",
ierr.value)
return (
api__result__,
_ovectorpair(api_outDimTags_, api_outDimTags_n_.value))
return _ovectorpair(api_outDimTags_, api_outDimTags_n_.value)
@staticmethod
def extrude(dimTags,dx,dy,dz,numElements=[],heights=[],recombine=False):
......
......@@ -904,26 +904,22 @@ int gmshModelOccAddTorus(const double x,const double y,const double z,const doub
return result_api_;
}
int gmshModelOccAddThruSections(int* wireTags, size_t wireTags_n,int ** outDimTags, size_t * outDimTags_n,const int tag,const int makeSolid,const int makeRuled,int * ierr){
int result_api_;
void gmshModelOccAddThruSections(int* wireTags, size_t wireTags_n,int ** outDimTags, size_t * outDimTags_n,const int tag,const int makeSolid,const int makeRuled,int * ierr){
if(ierr) *ierr = 0;
try {
gmsh::vector_pair api_outDimTags_;
result_api_ = gmsh::model::occ::addThruSections(ptr2vector(wireTags,wireTags_n),api_outDimTags_,tag,makeSolid,makeRuled);
gmsh::model::occ::addThruSections(ptr2vector(wireTags,wireTags_n),api_outDimTags_,tag,makeSolid,makeRuled);
pairvector2intptr(api_outDimTags_,outDimTags,outDimTags_n);
} catch(int api_ierr_) {if (ierr) *ierr = api_ierr_;}
return result_api_;
}
int gmshModelOccAddThickSolid(const int solidTag,int* excludeFaceTags, size_t excludeFaceTags_n,const double offset,int ** outDimTags, size_t * outDimTags_n,const int tag,int * ierr){
int result_api_;
void gmshModelOccAddThickSolid(const int solidTag,int* excludeFaceTags, size_t excludeFaceTags_n,const double offset,int ** outDimTags, size_t * outDimTags_n,const int tag,int * ierr){
if(ierr) *ierr = 0;
try {
gmsh::vector_pair api_outDimTags_;
result_api_ = gmsh::model::occ::addThickSolid(solidTag,ptr2vector(excludeFaceTags,excludeFaceTags_n),offset,api_outDimTags_,tag);
gmsh::model::occ::addThickSolid(solidTag,ptr2vector(excludeFaceTags,excludeFaceTags_n),offset,api_outDimTags_,tag);
pairvector2intptr(api_outDimTags_,outDimTags,outDimTags_n);
} catch(int api_ierr_) {if (ierr) *ierr = api_ierr_;}
return result_api_;
}
void gmshModelOccExtrude(int * dimTags, size_t dimTags_n,const double dx,const double dy,const double dz,int ** outDimTags, size_t * outDimTags_n,int* numElements, size_t numElements_n,double * heights, size_t heights_n,const int recombine,int * ierr){
......
......@@ -949,25 +949,24 @@ GMSH_API int gmshModelOccAddTorus(const double x,
* new entities are returned in `outDimTags'. If the optional argument
* `makeRuled' is set, the surfaces created on the boundary are forced to be
* ruled surfaces. */
GMSH_API int gmshModelOccAddThruSections(int* wireTags, size_t wireTags_n,
int ** outDimTags, size_t * outDimTags_n,
const int tag,
const int makeSolid,
const int makeRuled,
int * ierr);
GMSH_API void gmshModelOccAddThruSections(int* wireTags, size_t wireTags_n,
int ** outDimTags, size_t * outDimTags_n,
const int tag,
const int makeSolid,
const int makeRuled,
int * ierr);
/* Adds a hollowed volume built from an initial volume `solidTag' and a set of
* faces from this volume `excludeFaceTags', which are to be removed. The
* remaining faces of the volume become the walls of the hollowed solid, with
* thickness `offset'. If `tag' is positive, sets the tag explicitly;
* otherwise a new tag is selected automatically. Returns the tag of the
* volume. */
GMSH_API int gmshModelOccAddThickSolid(const int solidTag,
int* excludeFaceTags, size_t excludeFaceTags_n,
const double offset,
int ** outDimTags, size_t * outDimTags_n,
const int tag,
int * ierr);
* otherwise a new tag is selected automatically. */
GMSH_API void gmshModelOccAddThickSolid(const int solidTag,
int* excludeFaceTags, size_t excludeFaceTags_n,
const double offset,
int ** outDimTags, size_t * outDimTags_n,
const int tag,
int * ierr);
/* Extrudes the geometrical entities `dimTags' by translation along (`dx',
* `dy', `dz'). Returns extruded entities in `outDimTags'. If `numElements' is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment