diff --git a/Common/gmsh.cpp b/Common/gmsh.cpp index 19ce09c27ab6c802196b9edd2b5697a58ec4f1bc..b5ac7ddd5e4997fe20203881c883ed9733a7f981 100644 --- a/Common/gmsh.cpp +++ b/Common/gmsh.cpp @@ -127,12 +127,12 @@ GMSH_API void gmsh::initialize(int argc, char **argv, bool readConfigFiles) for(int i = 0; i < argc; i++) _argv[i] = argv[i]; return; } - throw - 1; + throw -1; } GMSH_API void gmsh::finalize() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(GmshFinalize()) { _argc = 0; if(_argv) delete[] _argv; @@ -146,28 +146,28 @@ GMSH_API void gmsh::finalize() GMSH_API void gmsh::open(const std::string &fileName) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(GmshOpenProject(fileName)) return; throw 1; } GMSH_API void gmsh::merge(const std::string &fileName) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(GmshMergeFile(fileName)) return; throw 1; } GMSH_API void gmsh::write(const std::string &fileName) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(GmshWriteFile(fileName)) return; throw 1; } GMSH_API void gmsh::clear() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(GmshClearProject()) return; throw 1; } @@ -177,7 +177,7 @@ GMSH_API void gmsh::clear() GMSH_API void gmsh::option::setNumber(const std::string &name, const double value) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } std::string c, n; int i; SplitOptionName(name, c, n, i); @@ -187,7 +187,7 @@ GMSH_API void gmsh::option::setNumber(const std::string &name, GMSH_API void gmsh::option::getNumber(const std::string &name, double &value) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } std::string c, n; int i; SplitOptionName(name, c, n, i); @@ -198,7 +198,7 @@ GMSH_API void gmsh::option::getNumber(const std::string &name, double &value) GMSH_API void gmsh::option::setString(const std::string &name, const std::string &value) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } std::string c, n; int i; SplitOptionName(name, c, n, i); @@ -209,7 +209,7 @@ GMSH_API void gmsh::option::setString(const std::string &name, GMSH_API void gmsh::option::getString(const std::string &name, std::string &value) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } std::string c, n; int i; SplitOptionName(name, c, n, i); @@ -220,7 +220,7 @@ GMSH_API void gmsh::option::getString(const std::string &name, GMSH_API void gmsh::option::setColor(const std::string &name, const int r, const int g, const int b, const int a) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } std::string c, n; int i; SplitOptionName(name, c, n, i); @@ -232,7 +232,7 @@ GMSH_API void gmsh::option::setColor(const std::string &name, const int r, GMSH_API void gmsh::option::getColor(const std::string &name, int &r, int &g, int &b, int &a) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } std::string c, n; int i; SplitOptionName(name, c, n, i); @@ -251,14 +251,14 @@ GMSH_API void gmsh::option::getColor(const std::string &name, int &r, int &g, GMSH_API void gmsh::model::add(const std::string &name) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel *m = new GModel(name); if(!m) { throw 1; } } GMSH_API void gmsh::model::remove() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel *m = GModel::current(); if(!m) { throw 1; } delete m; @@ -266,20 +266,20 @@ GMSH_API void gmsh::model::remove() GMSH_API void gmsh::model::list(std::vector<std::string> &names) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } for(std::size_t i = 0; i < GModel::list.size(); i++) names.push_back(GModel::list[i]->getName()); } GMSH_API void gmsh::model::getCurrent(std::string &name) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } name = GModel::current()->getName(); } GMSH_API void gmsh::model::setCurrent(const std::string &name) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel *m = GModel::findByName(name); if(!m) { throw 1; } GModel::setCurrent(m); @@ -291,7 +291,7 @@ GMSH_API void gmsh::model::setCurrent(const std::string &name) GMSH_API void gmsh::model::getEntities(vectorpair &dimTags, const int dim) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } dimTags.clear(); std::vector<GEntity *> entities; GModel::current()->getEntities(entities, dim); @@ -303,20 +303,20 @@ GMSH_API void gmsh::model::getEntities(vectorpair &dimTags, const int dim) GMSH_API void gmsh::model::setEntityName(const int dim, const int tag, const std::string &name) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->setElementaryName(dim, tag, name); } GMSH_API void gmsh::model::getEntityName(const int dim, const int tag, std::string &name) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } name = GModel::current()->getElementaryName(dim, tag); } GMSH_API void gmsh::model::getPhysicalGroups(vectorpair &dimTags, const int dim) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } dimTags.clear(); std::map<int, std::vector<GEntity *> > groups[4]; GModel::current()->getPhysicalGroups(groups); @@ -347,7 +347,7 @@ GMSH_API void gmsh::model::getEntitiesForPhysicalGroup(const int dim, const int tag, std::vector<int> &tags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } tags.clear(); std::map<int, std::vector<GEntity *> > groups; GModel::current()->getPhysicalGroups(dim, groups); @@ -366,7 +366,7 @@ GMSH_API void gmsh::model::getPhysicalGroupsForEntity(const int dim, const int tag, std::vector<int> &physicalTags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } physicalTags.clear(); GEntity *ge = GModel::current()->getEntityByTag(dim, tag); if(!ge) { @@ -388,7 +388,7 @@ GMSH_API int gmsh::model::addPhysicalGroup(const int dim, // physicals to GModel, we need to add the physicals in GEOInternals and // perform a hidden sync (which should not reset the mesh attributes of the // entities of they have already been created...). - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int outTag = tag; if(outTag < 0) { outTag = @@ -407,14 +407,14 @@ GMSH_API int gmsh::model::addPhysicalGroup(const int dim, GMSH_API void gmsh::model::setPhysicalName(const int dim, const int tag, const std::string &name) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->setPhysicalName(name, dim, tag); } GMSH_API void gmsh::model::getPhysicalName(const int dim, const int tag, std::string &name) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } name = GModel::current()->getPhysicalName(dim, tag); } @@ -423,7 +423,7 @@ GMSH_API void gmsh::model::getBoundary(const vectorpair &dimTags, const bool combined, const bool oriented, const bool recursive) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } outDimTags.clear(); if(!GModel::current()->getBoundaryTags(dimTags, outDimTags, combined, oriented, recursive)) { @@ -435,7 +435,7 @@ GMSH_API void gmsh::model::getEntitiesInBoundingBox( const double xmin, const double ymin, const double zmin, const double xmax, const double ymax, const double zmax, vectorpair &dimTags, const int dim) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } dimTags.clear(); SBoundingBox3d box(xmin, ymin, zmin, xmax, ymax, zmax); std::vector<GEntity *> entities; @@ -450,7 +450,7 @@ GMSH_API void gmsh::model::getBoundingBox(const int dim, const int tag, double &zmin, double &xmax, double &ymax, double &zmax) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } SBoundingBox3d box; if(dim < 0 && tag < 0) { @@ -476,7 +476,7 @@ GMSH_API void gmsh::model::getBoundingBox(const int dim, const int tag, GMSH_API int gmsh::model::getDimension() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } return GModel::current()->getDim(); } @@ -484,7 +484,7 @@ GMSH_API int gmsh::model::getDimension() GMSH_API int gmsh::model::addDiscreteEntity(const int dim, const int tag, const std::vector<int> &boundary) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int outTag = tag; if(outTag < 0) { outTag = GModel::current()->getMaxElementaryNumber(dim) + 1; @@ -540,19 +540,19 @@ GMSH_API int gmsh::model::addDiscreteEntity(const int dim, const int tag, GMSH_API void gmsh::model::removeEntities(const vectorpair &dimTags, const bool recursive) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->remove(dimTags, recursive); } GMSH_API void gmsh::model::removeEntityName(const std::string &name) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->removeElementaryName(name); } GMSH_API void gmsh::model::removePhysicalGroups(const vectorpair &dimTags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(dimTags.empty()) { GModel::current()->getGEOInternals()->resetPhysicalGroups(); GModel::current()->removePhysicalGroups(); @@ -570,14 +570,14 @@ GMSH_API void gmsh::model::removePhysicalGroups(const vectorpair &dimTags) GMSH_API void gmsh::model::removePhysicalName(const std::string &name) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->removePhysicalName(name); } GMSH_API void gmsh::model::getType(const int dim, const int tag, std::string &entityType) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GEntity *ge = GModel::current()->getEntityByTag(dim, tag); if(!ge) { Msg::Error("%s does not exist", _getEntityName(dim, tag).c_str()); @@ -589,7 +589,7 @@ GMSH_API void gmsh::model::getType(const int dim, const int tag, GMSH_API void gmsh::model::getParent(const int dim, const int tag, int &parentDim, int &parentTag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } parentDim = -1; parentTag = -1; GEntity *ge = GModel::current()->getEntityByTag(dim, tag); @@ -607,7 +607,7 @@ GMSH_API void gmsh::model::getParent(const int dim, const int tag, GMSH_API void gmsh::model::getPartitions(const int dim, const int tag, std::vector<int> &partitions) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } partitions.clear(); GEntity *ge = GModel::current()->getEntityByTag(dim, tag); if(!ge) { @@ -637,7 +637,7 @@ GMSH_API void gmsh::model::getValue(const int dim, const int tag, const std::vector<double> ¶metricCoord, std::vector<double> &coord) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } coord.clear(); GEntity *entity = GModel::current()->getEntityByTag(dim, tag); if(!entity) { @@ -676,7 +676,7 @@ gmsh::model::getDerivative(const int dim, const int tag, const std::vector<double> ¶metricCoord, std::vector<double> &deriv) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } deriv.clear(); GEntity *entity = GModel::current()->getEntityByTag(dim, tag); if(!entity) { @@ -713,7 +713,7 @@ gmsh::model::getCurvature(const int dim, const int tag, const std::vector<double> ¶metricCoord, std::vector<double> &curvatures) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } curvatures.clear(); GEntity *entity = GModel::current()->getEntityByTag(dim, tag); if(!entity) { @@ -740,7 +740,7 @@ GMSH_API void gmsh::model::getPrincipalCurvatures( std::vector<double> &curvaturesMax, std::vector<double> &curvaturesMin, std::vector<double> &directionsMax, std::vector<double> &directionsMin) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GFace *gf = GModel::current()->getFaceByTag(tag); if(!gf) { Msg::Error("%s does not exist", _getEntityName(2, tag).c_str()); @@ -771,7 +771,7 @@ GMSH_API void gmsh::model::getNormal(const int tag, const std::vector<double> ¶metricCoord, std::vector<double> &normals) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GFace *gf = GModel::current()->getFaceByTag(tag); if(!gf) { Msg::Error("%s does not exist", _getEntityName(2, tag).c_str()); @@ -793,7 +793,7 @@ gmsh::model::getParametrization(const int dim, const int tag, const std::vector<double> &coord, std::vector<double> ¶metricCoord) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } parametricCoord.clear(); GEntity *entity = GModel::current()->getEntityByTag(dim, tag); if(!entity) { @@ -820,12 +820,12 @@ gmsh::model::getParametrization(const int dim, const int tag, } } -GMSH_API void -gmsh::model::getParametrizationBounds(const int dim, const int tag, - std::vector<double> &min, - std::vector<double> &max) +GMSH_API void gmsh::model::getParametrizationBounds(const int dim, + const int tag, + std::vector<double> &min, + std::vector<double> &max) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } min.clear(); max.clear(); GEntity *entity = GModel::current()->getEntityByTag(dim, tag); @@ -840,11 +840,10 @@ gmsh::model::getParametrizationBounds(const int dim, const int tag, } } -GMSH_API int -gmsh::model::isInside(const int dim, const int tag, - const std::vector<double> ¶metricCoord) +GMSH_API int gmsh::model::isInside(const int dim, const int tag, + const std::vector<double> ¶metricCoord) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GEntity *entity = GModel::current()->getEntityByTag(dim, tag); if(!entity) { Msg::Error("%s does not exist", _getEntityName(dim, tag).c_str()); @@ -868,14 +867,12 @@ gmsh::model::isInside(const int dim, const int tag, return num; } -GMSH_API void -gmsh::model::reparametrizeOnSurface(const int dim, const int tag, - const std::vector<double> ¶metricCoord, - const int surfaceTag, - std::vector<double> &surfaceParametricCoord, - const int which) +GMSH_API void gmsh::model::reparametrizeOnSurface( + const int dim, const int tag, const std::vector<double> ¶metricCoord, + const int surfaceTag, std::vector<double> &surfaceParametricCoord, + const int which) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } surfaceParametricCoord.clear(); GEntity *entity = GModel::current()->getEntityByTag(dim, tag); if(!entity) { @@ -906,7 +903,7 @@ gmsh::model::reparametrizeOnSurface(const int dim, const int tag, GMSH_API void gmsh::model::setVisibility(const vectorpair &dimTags, const int value, const bool recursive) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } for(std::size_t i = 0; i < dimTags.size(); i++) { GEntity *ge = GModel::current()->getEntityByTag( dimTags[i].first, std::abs(dimTags[i].second)); @@ -917,7 +914,7 @@ GMSH_API void gmsh::model::setVisibility(const vectorpair &dimTags, GMSH_API void gmsh::model::getVisibility(const int dim, const int tag, int &value) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GEntity *ge = GModel::current()->getEntityByTag(dim, tag); if(!ge) { Msg::Error("%s does not exist", _getEntityName(dim, tag).c_str()); @@ -930,7 +927,7 @@ GMSH_API void gmsh::model::setColor(const vectorpair &dimTags, const int r, const int g, const int b, const int a, const bool recursive) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } for(std::size_t i = 0; i < dimTags.size(); i++) { GEntity *ge = GModel::current()->getEntityByTag( dimTags[i].first, std::abs(dimTags[i].second)); @@ -944,7 +941,7 @@ GMSH_API void gmsh::model::setColor(const vectorpair &dimTags, const int r, GMSH_API void gmsh::model::getColor(const int dim, const int tag, int &r, int &g, int &b, int &a) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GEntity *ge = GModel::current()->getEntityByTag(dim, tag); if(!ge) { Msg::Error("%s does not exist", _getEntityName(dim, tag).c_str()); @@ -960,7 +957,7 @@ GMSH_API void gmsh::model::getColor(const int dim, const int tag, int &r, GMSH_API void gmsh::model::setCoordinates(const int tag, const double x, const double y, const double z) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GVertex *gv = GModel::current()->getVertexByTag(tag); if(!gv) { Msg::Error("%s does not exist", _getEntityName(0, tag).c_str()); @@ -974,14 +971,14 @@ GMSH_API void gmsh::model::setCoordinates(const int tag, const double x, GMSH_API void gmsh::model::mesh::generate(const int dim) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->mesh(dim); CTX::instance()->mesh.changed = ENT_ALL; } GMSH_API void gmsh::model::mesh::partition(const int numPart) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->partitionMesh( numPart >= 0 ? numPart : CTX::instance()->mesh.numPartitions); CTX::instance()->mesh.changed = ENT_ALL; @@ -989,14 +986,14 @@ GMSH_API void gmsh::model::mesh::partition(const int numPart) GMSH_API void gmsh::model::mesh::unpartition() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->unpartitionMesh(); CTX::instance()->mesh.changed = ENT_ALL; } GMSH_API void gmsh::model::mesh::refine() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->refineMesh(CTX::instance()->mesh.secondOrderLinear, CTX::instance()->mesh.algoSubdivide == 1, CTX::instance()->mesh.algoSubdivide == 2, @@ -1006,7 +1003,7 @@ GMSH_API void gmsh::model::mesh::refine() GMSH_API void gmsh::model::mesh::recombine() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->recombineMesh(); CTX::instance()->mesh.changed = ENT_ALL; } @@ -1015,7 +1012,7 @@ GMSH_API void gmsh::model::mesh::optimize(const std::string &how, const bool force, const int niter, const vectorpair &dimTags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(dimTags.size()) { Msg::Warning( "Optimization of specified model entities is not interfaced yet"); @@ -1026,19 +1023,19 @@ GMSH_API void gmsh::model::mesh::optimize(const std::string &how, GMSH_API void gmsh::model::mesh::computeCrossField(std::vector<int> &tags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_MESH) if(computeCrossField(GModel::current(), tags)) throw 1; #else Msg::Error("computeCrossField requires the mesh module"); - throw - 1; + throw -1; #endif } GMSH_API void gmsh::model::mesh::splitQuadrangles(const double quality, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_MESH) std::vector<GEntity *> entities; if(tag < 0) { GModel::current()->getEntities(entities, 2); } @@ -1057,13 +1054,13 @@ GMSH_API void gmsh::model::mesh::splitQuadrangles(const double quality, CTX::instance()->mesh.changed = ENT_ALL; #else Msg::Error("splitQuadrangles requires the mesh module"); - throw - 1; + throw -1; #endif } GMSH_API void gmsh::model::mesh::setOrder(const int order) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->setOrderN(order, CTX::instance()->mesh.secondOrderLinear, CTX::instance()->mesh.secondOrderIncomplete); CTX::instance()->mesh.changed = ENT_ALL; @@ -1071,7 +1068,7 @@ GMSH_API void gmsh::model::mesh::setOrder(const int order) GMSH_API void gmsh::model::mesh::getLastEntityError(vectorpair &dimTags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } std::vector<GEntity *> e = GModel::current()->getLastMeshEntityError(); dimTags.clear(); for(std::size_t i = 0; i < e.size(); i++) @@ -1081,7 +1078,7 @@ GMSH_API void gmsh::model::mesh::getLastEntityError(vectorpair &dimTags) GMSH_API void gmsh::model::mesh::getLastNodeError(std::vector<std::size_t> &nodeTags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } std::vector<MVertex *> v = GModel::current()->getLastMeshVertexError(); nodeTags.clear(); for(std::size_t i = 0; i < v.size(); i++) nodeTags.push_back(v[i]->getNum()); @@ -1089,8 +1086,8 @@ gmsh::model::mesh::getLastNodeError(std::vector<std::size_t> &nodeTags) GMSH_API void gmsh::model::mesh::clear(const vectorpair &dimTags) { - if(!_isInitialized()) { throw - 1; } - std::vector<GEntity*> entities; + if(!_isInitialized()) { throw -1; } + std::vector<GEntity *> entities; for(std::size_t i = 0; i < dimTags.size(); i++) { int dim = dimTags[i].first; int tag = dimTags[i].second; @@ -1178,7 +1175,7 @@ GMSH_API void gmsh::model::mesh::getNodes(std::vector<std::size_t> &nodeTags, const bool includeBoundary, const bool returnParametricCoord) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } nodeTags.clear(); coord.clear(); parametricCoord.clear(); @@ -1220,7 +1217,7 @@ GMSH_API void gmsh::model::mesh::getNodesByElementType( std::vector<double> &coord, std::vector<double> ¶metricCoord, const int tag, const bool returnParametricCoord) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } nodeTags.clear(); coord.clear(); parametricCoord.clear(); @@ -1276,7 +1273,7 @@ GMSH_API void gmsh::model::mesh::getNode(const std::size_t nodeTag, std::vector<double> &coord, std::vector<double> ¶metricCoord) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } MVertex *v = GModel::current()->getMeshVertexByTag(nodeTag); if(!v) { Msg::Error("Unknown node %d", nodeTag); @@ -1297,7 +1294,7 @@ gmsh::model::mesh::setNode(const std::size_t nodeTag, const std::vector<double> &coord, const std::vector<double> ¶metricCoord) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } MVertex *v = GModel::current()->getMeshVertexByTag(nodeTag); if(!v) { Msg::Error("Unknown node %d", nodeTag); @@ -1314,7 +1311,7 @@ gmsh::model::mesh::setNode(const std::size_t nodeTag, GMSH_API void gmsh::model::mesh::rebuildNodeCache(bool onlyIfNecessary) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->rebuildMeshVertexCache(onlyIfNecessary); } @@ -1323,7 +1320,7 @@ gmsh::model::mesh::getNodesForPhysicalGroup(const int dim, const int tag, std::vector<std::size_t> &nodeTags, std::vector<double> &coord) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } nodeTags.clear(); coord.clear(); std::vector<MVertex *> v; @@ -1343,7 +1340,7 @@ GMSH_API void gmsh::model::mesh::addNodes( const int dim, const int tag, const std::vector<std::size_t> &nodeTags, const std::vector<double> &coord, const std::vector<double> ¶metricCoord) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GEntity *ge = GModel::current()->getEntityByTag(dim, tag); if(!ge) { Msg::Error("%s does not exist", _getEntityName(dim, tag).c_str()); @@ -1389,13 +1386,13 @@ GMSH_API void gmsh::model::mesh::addNodes( GMSH_API void gmsh::model::mesh::reclassifyNodes() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->pruneMeshVertexAssociations(); } GMSH_API void gmsh::model::mesh::relocateNodes(const int dim, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } std::vector<GEntity *> entities; if(dim >= 0 && tag >= 0) { GEntity *ge = GModel::current()->getEntityByTag(dim, tag); @@ -1473,7 +1470,7 @@ GMSH_API void gmsh::model::mesh::getElements( std::vector<std::vector<std::size_t> > &nodeTags, const int dim, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } elementTypes.clear(); elementTags.clear(); nodeTags.clear(); @@ -1505,7 +1502,7 @@ GMSH_API void gmsh::model::mesh::getElement(const std::size_t elementTag, int &elementType, std::vector<std::size_t> &nodeTags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } MElement *e = GModel::current()->getMeshElementByTag(elementTag); if(!e) { Msg::Error("Unknown element %d", elementTag); @@ -1528,7 +1525,7 @@ GMSH_API void gmsh::model::mesh::getElementByCoordinates( int &elementType, std::vector<std::size_t> &nodeTags, double &u, double &v, double &w, const int dim, const bool strict) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } SPoint3 xyz(x, y, z), uvw; MElement *e = GModel::current()->getMeshElementByCoord(xyz, uvw, dim, strict); if(!e) { @@ -1555,7 +1552,7 @@ GMSH_API void gmsh::model::mesh::getElementsByCoordinates( const double x, const double y, const double z, std::vector<std::size_t> &elementTags, const int dim, const bool strict) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } SPoint3 xyz(x, y, z), uvw; elementTags.clear(); std::vector<MElement *> e = @@ -1573,7 +1570,7 @@ GMSH_API void gmsh::model::mesh::getLocalCoordinatesInElement( const std::size_t elementTag, const double x, const double y, const double z, double &u, double &v, double &w) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } MElement *e = GModel::current()->getMeshElementByTag(elementTag); if(!e) { Msg::Error("Unknown element %d", elementTag); @@ -1671,7 +1668,7 @@ GMSH_API void gmsh::model::mesh::addElements( const std::vector<std::vector<std::size_t> > &elementTags, const std::vector<std::vector<std::size_t> > &nodeTags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GEntity *ge = GModel::current()->getEntityByTag(dim, tag); if(!ge) { Msg::Error("%s does not exist", _getEntityName(dim, tag).c_str()); @@ -1696,7 +1693,7 @@ GMSH_API void gmsh::model::mesh::addElementsByType( const std::vector<std::size_t> &elementTags, const std::vector<std::size_t> &nodeTags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int dim = ElementType::getDimension(elementType); GEntity *ge = GModel::current()->getEntityByTag(dim, tag); if(!ge) { @@ -1710,7 +1707,7 @@ GMSH_API void gmsh::model::mesh::addElementsByType( GMSH_API void gmsh::model::mesh::getElementTypes(std::vector<int> &elementTypes, const int dim, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } elementTypes.clear(); std::map<int, std::vector<GEntity *> > typeEnt; _getEntitiesForElementTypes(dim, tag, typeEnt); @@ -1725,7 +1722,7 @@ GMSH_API int gmsh::model::mesh::getElementType(const std::string &family, const int order, const bool serendip) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int familyType = (family == "point") ? TYPE_PNT : (family == "line") ? @@ -1754,7 +1751,7 @@ GMSH_API void gmsh::model::mesh::getElementProperties( const int elementType, std::string &name, int &dim, int &order, int &numNodes, std::vector<double> &localNodeCoord, int &numPrimaryNodes) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } const char *n; MElement::getInfoMSH(elementType, &n); name = n; @@ -1784,7 +1781,7 @@ GMSH_API void gmsh::model::mesh::getElementsByType( std::vector<std::size_t> &nodeTags, const int tag, const std::size_t task, const std::size_t numTasks) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int dim = ElementType::getDimension(elementType); std::map<int, std::vector<GEntity *> > typeEnt; _getEntitiesForElementTypes(dim, tag, typeEnt); @@ -1845,7 +1842,7 @@ GMSH_API void gmsh::model::mesh::preallocateElementsByType( std::vector<std::size_t> &elementTags, std::vector<std::size_t> &nodeTags, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int dim = ElementType::getDimension(elementType); std::map<int, std::vector<GEntity *> > typeEnt; _getEntitiesForElementTypes(dim, tag, typeEnt); @@ -1920,7 +1917,7 @@ GMSH_API void gmsh::model::mesh::getJacobians( std::vector<double> &coord, const int tag, const std::size_t task, const std::size_t numTasks) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int dim = ElementType::getDimension(elementType); std::map<int, std::vector<GEntity *> > typeEnt; _getEntitiesForElementTypes(dim, tag, typeEnt); @@ -2157,12 +2154,12 @@ GMSH_API void gmsh::model::mesh::getJacobians( } GMSH_API void gmsh::model::mesh::preallocateJacobians( - const int elementType, const int numPoints, - const bool allocateJacobians, const bool allocateDeterminants, - const bool allocateCoord, std::vector<double> &jacobians, - std::vector<double> &determinants, std::vector<double> &coord, const int tag) + const int elementType, const int numPoints, const bool allocateJacobians, + const bool allocateDeterminants, const bool allocateCoord, + std::vector<double> &jacobians, std::vector<double> &determinants, + std::vector<double> &coord, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int dim = ElementType::getDimension(elementType); BasisFactory::getNodalBasis(elementType); std::map<int, std::vector<GEntity *> > typeEnt; @@ -2190,9 +2187,9 @@ GMSH_API void gmsh::model::mesh::getBasisFunctions( const int elementType, const std::vector<double> &localCoord, const std::string &functionSpaceType, int &numComponents, std::vector<double> &basisFunctions, int &numOrientations, - const std::vector< int > &wantedOrientations) + const std::vector<int> &wantedOrientations) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } numComponents = 0; basisFunctions.clear(); std::string fsName = ""; @@ -2208,19 +2205,21 @@ GMSH_API void gmsh::model::mesh::getBasisFunctions( if(fsName == "Lagrange" || fsName == "GradLagrange") { // Lagrange type // Check if there is no error in wantedOrientations - if(wantedOrientations.size() != 0) - { + if(wantedOrientations.size() != 0) { if(wantedOrientations.size() > 1) { Msg::Error("Asking for more orientation that there exist."); throw 10; } - + if(wantedOrientations[0] != 0) { - Msg::Error("Orientation %i does not exist for function stace named '%s' on %s.", wantedOrientations[0], fsName.c_str(), ElementType::nameOfParentType(familyType, true).c_str()); + Msg::Error( + "Orientation %i does not exist for function stace named '%s' on %s.", + wantedOrientations[0], fsName.c_str(), + ElementType::nameOfParentType(familyType, true).c_str()); throw 11; } } - + const nodalBasis *basis = 0; if(numComponents) { if(fsOrder == -1) { // isoparametric @@ -2320,31 +2319,34 @@ GMSH_API void gmsh::model::mesh::getBasisFunctions( basis->getnTriFaceFunction() + basis->getnQuadFaceFunction(); const std::size_t maxOrientation = basis->getNumberOfOrientations(); numOrientations = maxOrientation; - const std::size_t numFunctionsPerElement = vSize + - bSize + - eSize + - fSize; + const std::size_t numFunctionsPerElement = vSize + bSize + eSize + fSize; const unsigned int numVertices = ElementType::getNumVertices(ElementType::getType(familyType, 1, false)); - basisFunctions.resize((wantedOrientations.size() == 0 ? maxOrientation : wantedOrientations.size()) * numberOfGaussPoints * - numFunctionsPerElement * numComponents); - + basisFunctions.resize( + (wantedOrientations.size() == 0 ? maxOrientation : + wantedOrientations.size()) * + numberOfGaussPoints * numFunctionsPerElement * numComponents); + // Check if there is no error in wantedOrientations - if(wantedOrientations.size() != 0) - { + if(wantedOrientations.size() != 0) { if(wantedOrientations.size() > maxOrientation) { Msg::Error("Asking for more orientation that there exist."); throw 10; } for(unsigned int i = 0; i < wantedOrientations.size(); ++i) { - if(wantedOrientations[i] >= static_cast< int >(maxOrientation) || wantedOrientations[i] < 0) { - Msg::Error("Orientation %i does not exist for function stace named '%s' on %s.", wantedOrientations[i], fsName.c_str(), ElementType::nameOfParentType(familyType, true).c_str()); + if(wantedOrientations[i] >= static_cast<int>(maxOrientation) || + wantedOrientations[i] < 0) { + Msg::Error("Orientation %i does not exist for function stace named " + "'%s' on %s.", + wantedOrientations[i], fsName.c_str(), + ElementType::nameOfParentType(familyType, true).c_str()); throw 11; } } - std::vector< int > sortedWantedOrientations = wantedOrientations; - std::sort(sortedWantedOrientations.begin(), sortedWantedOrientations.end()); + std::vector<int> sortedWantedOrientations = wantedOrientations; + std::sort(sortedWantedOrientations.begin(), + sortedWantedOrientations.end()); int previousInt = sortedWantedOrientations[0]; for(unsigned int i = 1; i < sortedWantedOrientations.size(); ++i) { if(previousInt == sortedWantedOrientations[i]) { @@ -2445,9 +2447,11 @@ GMSH_API void gmsh::model::mesh::getBasisFunctions( std::vector<double>(fSize, 0)); // use fTableCopy to orient the faces unsigned int iOrientationIndex = 0; - for(unsigned int iOrientation = 0; iOrientation < maxOrientation; ++iOrientation) { + for(unsigned int iOrientation = 0; iOrientation < maxOrientation; + ++iOrientation) { if(wantedOrientations.size() != 0) { - std::vector< int >::const_iterator it = std::find(wantedOrientations.begin(), wantedOrientations.end(), iOrientation); + std::vector<int>::const_iterator it = std::find( + wantedOrientations.begin(), wantedOrientations.end(), iOrientation); if(it != wantedOrientations.end()) { iOrientationIndex = &(*it) - &wantedOrientations[0]; } @@ -2458,7 +2462,7 @@ GMSH_API void gmsh::model::mesh::getBasisFunctions( else { iOrientationIndex = iOrientation; } - + if(eSize != 0) { for(int iEdge = 0; iEdge < basis->getNumEdge(); ++iEdge) { MEdge edge = element->getEdge(iEdge); @@ -2601,7 +2605,8 @@ GMSH_API void gmsh::model::mesh::getBasisFunctions( for(unsigned int iOrientation = 0; iOrientation < maxOrientation; ++iOrientation) { if(wantedOrientations.size() != 0) { - std::vector< int >::const_iterator it = std::find(wantedOrientations.begin(), wantedOrientations.end(), iOrientation); + std::vector<int>::const_iterator it = std::find( + wantedOrientations.begin(), wantedOrientations.end(), iOrientation); if(it != wantedOrientations.end()) { iOrientationIndex = &(*it) - &wantedOrientations[0]; } @@ -2612,7 +2617,7 @@ GMSH_API void gmsh::model::mesh::getBasisFunctions( else { iOrientationIndex = iOrientation; } - + if(eSize != 0) { for(int iEdge = 0; iEdge < basis->getNumEdge(); ++iEdge) { MEdge edge = element->getEdge(iEdge); @@ -2697,9 +2702,7 @@ GMSH_API void gmsh::model::mesh::getBasisFunctions( } } - for(unsigned int i = 0; i < numVertices; ++i) { - delete vertices[i]; - } + for(unsigned int i = 0; i < numVertices; ++i) { delete vertices[i]; } delete element; delete basis; } @@ -2712,7 +2715,7 @@ GMSH_API void gmsh::model::mesh::getBasisFunctionsOrientationForElements( std::vector<int> &basisFunctionsOrientation, const int tag, const std::size_t task, const std::size_t numTasks) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(!basisFunctionsOrientation.size()) { if(numTasks > 1) { @@ -2804,7 +2807,8 @@ GMSH_API void gmsh::model::mesh::getBasisFunctionsOrientationForElements( } } - basisFunctionsOrientation[entityOffset + iElement] = (int)elementOrientation; + basisFunctionsOrientation[entityOffset + iElement] = + (int)elementOrientation; } entityOffset += localNumElements; @@ -2814,10 +2818,11 @@ GMSH_API void gmsh::model::mesh::getBasisFunctionsOrientationForElements( return; } -GMSH_API int gmsh::model::mesh::getNumberOfOrientations(const int elementType, - const std::string & functionSpaceType) +GMSH_API int +gmsh::model::mesh::getNumberOfOrientations(const int elementType, + const std::string &functionSpaceType) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int basisOrder = 0; std::string fsName = ""; @@ -2833,7 +2838,8 @@ GMSH_API int gmsh::model::mesh::getNumberOfOrientations(const int elementType, } else { // Hierarchical type const int familyType = ElementType::getParentType(elementType); - const unsigned int numVertices = ElementType::getNumVertices(ElementType::getType(familyType, 1, false)); + const unsigned int numVertices = + ElementType::getNumVertices(ElementType::getType(familyType, 1, false)); const std::size_t factorial[8] = {1, 1, 2, 6, 24, 120, 720, 5040}; return factorial[numVertices]; } @@ -2846,7 +2852,7 @@ gmsh::model::mesh::preallocateBasisFunctionsOrientationForElements( const int elementType, std::vector<int> &basisFunctionsOrientation, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } const int dim = ElementType::getDimension(elementType); std::map<int, std::vector<GEntity *> > typeEnt; @@ -2863,7 +2869,6 @@ gmsh::model::mesh::preallocateBasisFunctionsOrientationForElements( basisFunctionsOrientation.resize(numElements); } - GMSH_API void gmsh::model::mesh::getEdgeNumber(const std::vector<int> &edgeNodes, std::vector<int> &edgeNum) @@ -2943,7 +2948,7 @@ GMSH_API void gmsh::model::mesh::getKeysForElements( gmsh::vectorpair &keys, std::vector<double> &coord, const int tag, const bool generateCoord) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } coord.clear(); keys.clear(); int order = 0; @@ -3407,7 +3412,7 @@ GMSH_API void gmsh::model::mesh::getBarycenters( std::vector<double> &barycenters, const std::size_t task, const std::size_t numTasks) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int dim = ElementType::getDimension(elementType); std::map<int, std::vector<GEntity *> > typeEnt; _getEntitiesForElementTypes(dim, tag, typeEnt); @@ -3476,13 +3481,11 @@ static bool _getIntegrationInfo(const std::string &intType, return false; } -GMSH_API void -gmsh::model::mesh::getIntegrationPoints(const int elementType, - const std::string &integrationType, - std::vector<double> &localCoord, - std::vector<double> &weigths) +GMSH_API void gmsh::model::mesh::getIntegrationPoints( + const int elementType, const std::string &integrationType, + std::vector<double> &localCoord, std::vector<double> &weigths) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } localCoord.clear(); weigths.clear(); std::string intName = ""; @@ -3513,7 +3516,7 @@ gmsh::model::mesh::getIntegrationPoints(const int elementType, GMSH_API void gmsh::model::mesh::preallocateBarycenters( const int elementType, std::vector<double> &barycenters, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int dim = ElementType::getDimension(elementType); std::map<int, std::vector<GEntity *> > typeEnt; _getEntitiesForElementTypes(dim, tag, typeEnt); @@ -3530,7 +3533,7 @@ GMSH_API void gmsh::model::mesh::getElementEdgeNodes( const int elementType, std::vector<std::size_t> &nodeTags, const int tag, const bool primary, const std::size_t task, const std::size_t numTasks) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int dim = ElementType::getDimension(elementType); std::map<int, std::vector<GEntity *> > typeEnt; _getEntitiesForElementTypes(dim, tag, typeEnt); @@ -3594,7 +3597,7 @@ GMSH_API void gmsh::model::mesh::getElementFaceNodes( const int tag, const bool primary, const std::size_t task, const std::size_t numTasks) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int dim = ElementType::getDimension(elementType); std::map<int, std::vector<GEntity *> > typeEnt; _getEntitiesForElementTypes(dim, tag, typeEnt); @@ -3666,7 +3669,7 @@ gmsh::model::mesh::getGhostElements(const int dim, const int tag, std::vector<std::size_t> &elementTags, std::vector<int> &partitions) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } elementTags.clear(); partitions.clear(); GEntity *ge = GModel::current()->getEntityByTag(dim, tag); @@ -3693,7 +3696,7 @@ gmsh::model::mesh::getGhostElements(const int dim, const int tag, GMSH_API void gmsh::model::mesh::setSize(const vectorpair &dimTags, const double size) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } for(std::size_t i = 0; i < dimTags.size(); i++) { int dim = dimTags[i].first, tag = dimTags[i].second; if(dim == 0) { @@ -3704,24 +3707,22 @@ GMSH_API void gmsh::model::mesh::setSize(const vectorpair &dimTags, } GMSH_API void gmsh::model::mesh::setSizeAtParametricPoints( - const int dim, const int tag, - const std::vector<double> ¶metricCoord, - const std::vector<double> &sizes) + const int dim, const int tag, const std::vector<double> ¶metricCoord, + const std::vector<double> &sizes) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(dim == 1) { GEdge *ge = GModel::current()->getEdgeByTag(tag); if(ge) ge->setMeshSizeParametric(parametricCoord, sizes); } } - GMSH_API void gmsh::model::mesh::setTransfiniteCurve(const int tag, const int numNodes, const std::string &meshType, const double coef) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GEdge *ge = GModel::current()->getEdgeByTag(tag); if(!ge) { Msg::Error("%s does not exist", _getEntityName(1, tag).c_str()); @@ -3743,7 +3744,7 @@ gmsh::model::mesh::setTransfiniteSurface(const int tag, const std::string &arrangement, const std::vector<int> &cornerTags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GFace *gf = GModel::current()->getFaceByTag(tag); if(!gf) { Msg::Error("%s does not exist", _getEntityName(2, tag).c_str()); @@ -3771,7 +3772,7 @@ GMSH_API void gmsh::model::mesh::setTransfiniteVolume(const int tag, const std::vector<int> &cornerTags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GRegion *gr = GModel::current()->getRegionByTag(tag); if(!gr) { Msg::Error("%s does not exist", _getEntityName(3, tag).c_str()); @@ -3788,7 +3789,7 @@ gmsh::model::mesh::setTransfiniteVolume(const int tag, GMSH_API void gmsh::model::mesh::setRecombine(const int dim, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(dim != 2) { throw 2; } GFace *gf = GModel::current()->getFaceByTag(tag); if(!gf) { @@ -3802,7 +3803,7 @@ GMSH_API void gmsh::model::mesh::setRecombine(const int dim, const int tag) GMSH_API void gmsh::model::mesh::setSmoothing(const int dim, const int tag, const int val) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(dim != 2) { throw 2; } GFace *gf = GModel::current()->getFaceByTag(tag); if(!gf) { @@ -3815,7 +3816,7 @@ GMSH_API void gmsh::model::mesh::setSmoothing(const int dim, const int tag, GMSH_API void gmsh::model::mesh::setReverse(const int dim, const int tag, const bool val) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(dim == 1) { GEdge *ge = GModel::current()->getEdgeByTag(tag); if(!ge) { @@ -3837,7 +3838,7 @@ GMSH_API void gmsh::model::mesh::setReverse(const int dim, const int tag, GMSH_API void gmsh::model::mesh::setAlgorithm(const int dim, const int tag, const int val) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(dim == 2) { GFace *gf = GModel::current()->getFaceByTag(tag); if(!gf) { @@ -3852,7 +3853,7 @@ GMSH_API void gmsh::model::mesh::setSizeFromBoundary(const int dim, const int tag, const int val) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(dim == 2) { GFace *gf = GModel::current()->getFaceByTag(tag); if(!gf) { @@ -3866,7 +3867,7 @@ GMSH_API void gmsh::model::mesh::setSizeFromBoundary(const int dim, GMSH_API void gmsh::model::mesh::setCompound(const int dim, const std::vector<int> &tags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } std::vector<GEntity *> ents; for(std::size_t i = 0; i < tags.size(); i++) { GEntity *ent = GModel::current()->getEntityByTag(dim, tags[i]); @@ -3880,7 +3881,7 @@ GMSH_API void gmsh::model::mesh::setCompound(const int dim, GMSH_API void gmsh::model::mesh::setOutwardOrientation(const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GRegion *gr = GModel::current()->getRegionByTag(tag); if(!gr) { Msg::Error("%s does not exist", _getEntityName(3, tag).c_str()); @@ -3893,7 +3894,7 @@ GMSH_API void gmsh::model::mesh::embed(const int dim, const std::vector<int> &tags, const int inDim, const int inTag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(inDim == 2) { GFace *gf = GModel::current()->getFaceByTag(inTag); if(!gf) { @@ -3957,7 +3958,7 @@ GMSH_API void gmsh::model::mesh::embed(const int dim, GMSH_API void gmsh::model::mesh::removeEmbedded(const vectorpair &dimTags, const int rdim) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } for(std::size_t i = 0; i < dimTags.size(); i++) { int dim = dimTags[i].first, tag = dimTags[i].second; if(dim == 2) { @@ -3986,7 +3987,7 @@ GMSH_API void gmsh::model::mesh::reorderElements(const int elementType, const int tag, const std::vector<std::size_t> &ordering) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int dim = ElementType::getDimension(elementType); std::map<int, std::vector<GEntity *> > typeEnt; _getEntitiesForElementTypes(dim, tag, typeEnt); @@ -4005,13 +4006,13 @@ gmsh::model::mesh::reorderElements(const int elementType, const int tag, GMSH_API void gmsh::model::mesh::renumberNodes() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->renumberMeshVertices(); } GMSH_API void gmsh::model::mesh::renumberElements() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->renumberMeshElements(); } @@ -4020,7 +4021,7 @@ gmsh::model::mesh::setPeriodic(const int dim, const std::vector<int> &tags, const std::vector<int> &tagsMaster, const std::vector<double> &affineTransform) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(tags.size() != tagsMaster.size()) { Msg::Error("Incompatible number of tags and master tags for periodic mesh"); throw 2; @@ -4067,7 +4068,7 @@ GMSH_API void gmsh::model::mesh::getPeriodicNodes( std::vector<std::size_t> &nodeTags, std::vector<std::size_t> &nodeTagsMaster, std::vector<double> &affineTransform) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GEntity *ge = GModel::current()->getEntityByTag(dim, tag); if(!ge) { Msg::Error("%s does not exist", _getEntityName(dim, tag).c_str()); @@ -4093,7 +4094,7 @@ GMSH_API void gmsh::model::mesh::getPeriodicNodes( GMSH_API void gmsh::model::mesh::removeDuplicateNodes() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->removeDuplicateMeshVertices( CTX::instance()->geom.tolerance); CTX::instance()->mesh.changed = ENT_ALL; @@ -4104,21 +4105,21 @@ gmsh::model::mesh::classifySurfaces(const double angle, const bool boundary, const bool forReparametrization, const double curveAngle) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->classifySurfaces(angle, boundary, forReparametrization, curveAngle); } GMSH_API void gmsh::model::mesh::createGeometry() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->createGeometryOfDiscreteEntities(); } GMSH_API void gmsh::model::mesh::createTopology(const bool makeSimplyConnected, const bool exportDiscrete) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(makeSimplyConnected) { GModel::current()->makeDiscreteRegionsSimplyConnected(); @@ -4136,7 +4137,7 @@ gmsh::model::mesh::computeHomology(const std::vector<int> &domainTags, const std::vector<int> &subdomainTags, const std::vector<int> &dims) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->addHomologyRequest("Homology", domainTags, subdomainTags, dims); } @@ -4146,7 +4147,7 @@ gmsh::model::mesh::computeCohomology(const std::vector<int> &domainTags, const std::vector<int> &subdomainTags, const std::vector<int> &dims) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->addHomologyRequest("Cohomology", domainTags, subdomainTags, dims); } @@ -4156,7 +4157,7 @@ gmsh::model::mesh::computeCohomology(const std::vector<int> &domainTags, GMSH_API int gmsh::model::mesh::field::add(const std::string &fieldType, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int outTag = tag; #if defined(HAVE_MESH) if(outTag < 0) { outTag = GModel::current()->getFields()->newId(); } @@ -4169,14 +4170,14 @@ GMSH_API int gmsh::model::mesh::field::add(const std::string &fieldType, #endif #else Msg::Error("Fields require the mesh module"); - throw - 1; + throw -1; #endif return outTag; } GMSH_API void gmsh::model::mesh::field::remove(const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_MESH) GModel::current()->getFields()->deleteField(tag); #if defined(HAVE_FLTK) @@ -4184,7 +4185,7 @@ GMSH_API void gmsh::model::mesh::field::remove(const int tag) #endif #else Msg::Error("Fields require the mesh module"); - throw - 1; + throw -1; #endif } @@ -4210,7 +4211,7 @@ GMSH_API void gmsh::model::mesh::field::setNumber(const int tag, const std::string &option, const double value) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_MESH) FieldOption *o = _getFieldOption(tag, option); if(!o) { throw 1; } @@ -4223,7 +4224,7 @@ GMSH_API void gmsh::model::mesh::field::setNumber(const int tag, } #else Msg::Error("Fields require the mesh module"); - throw - 1; + throw -1; #endif } @@ -4231,7 +4232,7 @@ GMSH_API void gmsh::model::mesh::field::setString(const int tag, const std::string &option, const std::string &value) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_MESH) FieldOption *o = _getFieldOption(tag, option); if(!o) { throw 1; } @@ -4244,7 +4245,7 @@ GMSH_API void gmsh::model::mesh::field::setString(const int tag, } #else Msg::Error("Fields require the mesh module"); - throw - 1; + throw -1; #endif } @@ -4252,7 +4253,7 @@ GMSH_API void gmsh::model::mesh::field::setNumbers(const int tag, const std::string &option, const std::vector<double> &value) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_MESH) FieldOption *o = _getFieldOption(tag, option); if(!o) { throw 1; } @@ -4274,29 +4275,29 @@ gmsh::model::mesh::field::setNumbers(const int tag, const std::string &option, } #else Msg::Error("Fields require the mesh module"); - throw - 1; + throw -1; #endif } GMSH_API void gmsh::model::mesh::field::setAsBackgroundMesh(const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_MESH) GModel::current()->getFields()->setBackgroundFieldId(tag); #else Msg::Error("Fields require the mesh module"); - throw - 1; + throw -1; #endif } GMSH_API void gmsh::model::mesh::field::setAsBoundaryLayer(const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_MESH) GModel::current()->getFields()->addBoundaryLayerFieldId(tag); #else Msg::Error("Fields require the mesh module"); - throw - 1; + throw -1; #endif } @@ -4306,7 +4307,7 @@ GMSH_API int gmsh::model::geo::addPoint(const double x, const double y, const double z, const double meshSize, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int outTag = tag; double xx = CTX::instance()->geom.scalingFactor * x; double yy = CTX::instance()->geom.scalingFactor * y; @@ -4321,7 +4322,7 @@ GMSH_API int gmsh::model::geo::addPoint(const double x, const double y, GMSH_API int gmsh::model::geo::addLine(const int startTag, const int endTag, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int outTag = tag; if(!GModel::current()->getGEOInternals()->addLine(outTag, startTag, endTag)) { throw 1; @@ -4335,7 +4336,7 @@ GMSH_API int gmsh::model::geo::addCircleArc(const int startTag, const double nx, const double ny, const double nz) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int outTag = tag; if(!GModel::current()->getGEOInternals()->addCircleArc( outTag, startTag, centerTag, endTag, nx, ny, nz)) { @@ -4348,7 +4349,7 @@ GMSH_API int gmsh::model::geo::addEllipseArc( const int startTag, const int centerTag, const int majorTag, const int endTag, const int tag, const double nx, const double ny, const double nz) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int outTag = tag; if(!GModel::current()->getGEOInternals()->addEllipseArc( outTag, startTag, centerTag, majorTag, endTag, nx, ny, nz)) { @@ -4360,7 +4361,7 @@ GMSH_API int gmsh::model::geo::addEllipseArc( GMSH_API int gmsh::model::geo::addSpline(const std::vector<int> &pointTags, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int outTag = tag; if(!GModel::current()->getGEOInternals()->addSpline(outTag, pointTags)) { throw 1; @@ -4371,7 +4372,7 @@ GMSH_API int gmsh::model::geo::addSpline(const std::vector<int> &pointTags, GMSH_API int gmsh::model::geo::addBSpline(const std::vector<int> &pointTags, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int outTag = tag; if(!GModel::current()->getGEOInternals()->addBSpline(outTag, pointTags)) { throw 1; @@ -4382,7 +4383,7 @@ GMSH_API int gmsh::model::geo::addBSpline(const std::vector<int> &pointTags, GMSH_API int gmsh::model::geo::addBezier(const std::vector<int> &pointTags, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int outTag = tag; if(!GModel::current()->getGEOInternals()->addBezier(outTag, pointTags)) { throw 1; @@ -4394,7 +4395,7 @@ GMSH_API int gmsh::model::geo::addCompoundSpline(const std::vector<int> &curveTags, const int numIntervals, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int outTag = tag; if(!GModel::current()->getGEOInternals()->addCompoundSpline(outTag, curveTags, numIntervals)) { @@ -4407,7 +4408,7 @@ GMSH_API int gmsh::model::geo::addCompoundBSpline(const std::vector<int> &curveTags, const int numIntervals, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int outTag = tag; if(!GModel::current()->getGEOInternals()->addCompoundBSpline( outTag, curveTags, numIntervals)) { @@ -4419,7 +4420,7 @@ gmsh::model::geo::addCompoundBSpline(const std::vector<int> &curveTags, GMSH_API int gmsh::model::geo::addCurveLoop(const std::vector<int> &curveTags, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int outTag = tag; if(!GModel::current()->getGEOInternals()->addLineLoop(outTag, curveTags)) { throw 1; @@ -4430,7 +4431,7 @@ GMSH_API int gmsh::model::geo::addCurveLoop(const std::vector<int> &curveTags, GMSH_API int gmsh::model::geo::addPlaneSurface(const std::vector<int> &wireTags, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int outTag = tag; if(!GModel::current()->getGEOInternals()->addPlaneSurface(outTag, wireTags)) { throw 1; @@ -4442,7 +4443,7 @@ GMSH_API int gmsh::model::geo::addSurfaceFilling(const std::vector<int> &wireTags, const int tag, const int sphereCenterTag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int outTag = tag; if(!GModel::current()->getGEOInternals()->addSurfaceFilling( outTag, wireTags, sphereCenterTag)) { @@ -4455,7 +4456,7 @@ GMSH_API int gmsh::model::geo::addSurfaceLoop(const std::vector<int> &surfaceTags, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int outTag = tag; if(!GModel::current()->getGEOInternals()->addSurfaceLoop(outTag, surfaceTags)) { @@ -4467,7 +4468,7 @@ gmsh::model::geo::addSurfaceLoop(const std::vector<int> &surfaceTags, GMSH_API int gmsh::model::geo::addVolume(const std::vector<int> &shellTags, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int outTag = tag; if(!GModel::current()->getGEOInternals()->addVolume(outTag, shellTags)) { throw 1; @@ -4504,7 +4505,7 @@ GMSH_API void gmsh::model::geo::extrude(const vectorpair &dimTags, const std::vector<double> &heights, const bool recombine) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } outDimTags.clear(); if(dx || dy || dz) { if(!GModel::current()->getGEOInternals()->extrude( @@ -4528,7 +4529,7 @@ GMSH_API void gmsh::model::geo::revolve( vectorpair &outDimTags, const std::vector<int> &numElements, const std::vector<double> &heights, const bool recombine) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } outDimTags.clear(); if(!GModel::current()->getGEOInternals()->revolve( dimTags, x, y, z, ax, ay, az, angle, outDimTags, @@ -4544,7 +4545,7 @@ GMSH_API void gmsh::model::geo::twist( const std::vector<int> &numElements, const std::vector<double> &heights, const bool recombine) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } outDimTags.clear(); if(!GModel::current()->getGEOInternals()->twist( dimTags, x, y, z, dx, dy, dz, ax, ay, az, angle, outDimTags, @@ -4557,7 +4558,7 @@ GMSH_API void gmsh::model::geo::translate(const vectorpair &dimTags, const double dx, const double dy, const double dz) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(!GModel::current()->getGEOInternals()->translate(dimTags, dx, dy, dz)) { throw 1; } @@ -4569,7 +4570,7 @@ GMSH_API void gmsh::model::geo::rotate(const vectorpair &dimTags, const double ay, const double az, const double angle) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(!GModel::current()->getGEOInternals()->rotate(dimTags, x, y, z, ax, ay, az, angle)) { throw 1; @@ -4581,7 +4582,7 @@ GMSH_API void gmsh::model::geo::dilate(const vectorpair &dimTags, const double z, const double a, const double b, const double c) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(!GModel::current()->getGEOInternals()->dilate(dimTags, x, y, z, a, b, c)) { throw 1; } @@ -4591,7 +4592,7 @@ GMSH_API void gmsh::model::geo::mirror(const vectorpair &dimTags, const double a, const double b, const double c, const double d) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(!GModel::current()->getGEOInternals()->symmetry(dimTags, a, b, c, d)) { throw 1; } @@ -4608,7 +4609,7 @@ GMSH_API void gmsh::model::geo::symmetrize(const vectorpair &dimTags, GMSH_API void gmsh::model::geo::copy(const vectorpair &dimTags, vectorpair &outDimTags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } outDimTags.clear(); if(!GModel::current()->getGEOInternals()->copy(dimTags, outDimTags)) { throw 1; @@ -4618,7 +4619,7 @@ GMSH_API void gmsh::model::geo::copy(const vectorpair &dimTags, GMSH_API void gmsh::model::geo::remove(const vectorpair &dimTags, const bool recursive) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(!GModel::current()->getGEOInternals()->remove(dimTags, recursive)) { throw 1; } @@ -4626,7 +4627,7 @@ GMSH_API void gmsh::model::geo::remove(const vectorpair &dimTags, GMSH_API void gmsh::model::geo::removeAllDuplicates() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->getGEOInternals()->removeAllDuplicates(); } @@ -4634,7 +4635,7 @@ GMSH_API void gmsh::model::geo::splitCurve(const int tag, const std::vector<int> &pointTags, std::vector<int> &curveTags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(!GModel::current()->getGEOInternals()->splitCurve(tag, pointTags, curveTags)) { throw 1; @@ -4643,19 +4644,19 @@ GMSH_API void gmsh::model::geo::splitCurve(const int tag, GMSH_API int gmsh::model::geo::getMaxTag(const int dim) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } return GModel::current()->getGEOInternals()->getMaxTag(dim); } GMSH_API void gmsh::model::geo::setMaxTag(const int dim, const int maxTag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->getGEOInternals()->setMaxTag(dim, maxTag); } GMSH_API void gmsh::model::geo::synchronize() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->getGEOInternals()->synchronize(GModel::current()); } @@ -4666,7 +4667,7 @@ gmsh::model::geo::mesh::setTransfiniteCurve(const int tag, const int nPoints, const std::string &meshType, const double coef) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int t = (meshType == "Progression" || meshType == "Power") ? 1 : (meshType == "Bump") ? 2 : 1; @@ -4680,7 +4681,7 @@ GMSH_API void gmsh::model::geo::mesh::setTransfiniteSurface( const int tag, const std::string &arrangement, const std::vector<int> &cornerTags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int t = (arrangement == "Right") ? 1 : (arrangement == "Left") ? -1 : @@ -4697,21 +4698,21 @@ GMSH_API void gmsh::model::geo::mesh::setTransfiniteVolume(const int tag, const std::vector<int> &cornerTags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->getGEOInternals()->setTransfiniteVolume(tag, cornerTags); } GMSH_API void gmsh::model::geo::mesh::setRecombine(const int dim, const int tag, const double angle) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->getGEOInternals()->setRecombine(dim, tag, angle); } GMSH_API void gmsh::model::geo::mesh::setSmoothing(const int dim, const int tag, const int val) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(dim != 2) { throw 2; } GModel::current()->getGEOInternals()->setSmoothing(tag, val); } @@ -4719,14 +4720,14 @@ GMSH_API void gmsh::model::geo::mesh::setSmoothing(const int dim, const int tag, GMSH_API void gmsh::model::geo::mesh::setReverse(const int dim, const int tag, const bool val) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->getGEOInternals()->setReverseMesh(dim, tag, val); } GMSH_API void gmsh::model::geo::mesh::setAlgorithm(const int dim, const int tag, const int val) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->getGEOInternals()->setMeshAlgorithm(dim, tag, val); } @@ -4734,21 +4735,20 @@ GMSH_API void gmsh::model::geo::mesh::setSizeFromBoundary(const int dim, const int tag, const int val) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->getGEOInternals()->setMeshSizeFromBoundary(dim, tag, val); } GMSH_API void gmsh::model::geo::mesh::setSize(const vectorpair &dimTags, const double size) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } for(std::size_t i = 0; i < dimTags.size(); i++) { int dim = dimTags[i].first, tag = dimTags[i].second; GModel::current()->getGEOInternals()->setMeshSize(dim, tag, size); } } - // gmsh::model::occ static void _createOcc() @@ -4761,7 +4761,7 @@ GMSH_API int gmsh::model::occ::addPoint(const double x, const double y, const double z, const double meshSize, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); int outTag = tag; if(!GModel::current()->getOCCInternals()->addVertex(outTag, x, y, z, @@ -4774,7 +4774,7 @@ GMSH_API int gmsh::model::occ::addPoint(const double x, const double y, GMSH_API int gmsh::model::occ::addLine(const int startTag, const int endTag, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); int outTag = tag; if(!GModel::current()->getOCCInternals()->addLine(outTag, startTag, endTag)) { @@ -4787,7 +4787,7 @@ GMSH_API int gmsh::model::occ::addCircleArc(const int startTag, const int centerTag, const int endTag, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); int outTag = tag; if(!GModel::current()->getOCCInternals()->addCircleArc(outTag, startTag, @@ -4802,7 +4802,7 @@ GMSH_API int gmsh::model::occ::addCircle(const double x, const double y, const int tag, const double angle1, const double angle2) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); int outTag = tag; if(!GModel::current()->getOCCInternals()->addCircle(outTag, x, y, z, r, @@ -4817,7 +4817,7 @@ GMSH_API int gmsh::model::occ::addEllipseArc(const int startTag, const int majorTag, const int endTag, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); int outTag = tag; if(!GModel::current()->getOCCInternals()->addEllipseArc( @@ -4833,7 +4833,7 @@ GMSH_API int gmsh::model::occ::addEllipse(const double x, const double y, const double angle1, const double angle2) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); int outTag = tag; if(!GModel::current()->getOCCInternals()->addEllipse(outTag, x, y, z, r1, r2, @@ -4846,7 +4846,7 @@ GMSH_API int gmsh::model::occ::addEllipse(const double x, const double y, GMSH_API int gmsh::model::occ::addSpline(const std::vector<int> &pointTags, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); int outTag = tag; if(!GModel::current()->getOCCInternals()->addSpline(outTag, pointTags)) { @@ -4860,7 +4860,7 @@ GMSH_API int gmsh::model::occ::addBSpline( const std::vector<double> &weights, const std::vector<double> &knots, const std::vector<int> &multiplicities) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } int outTag = tag; if(!GModel::current()->getOCCInternals()->addBSpline( outTag, pointTags, degree, weights, knots, multiplicities)) { @@ -4872,7 +4872,7 @@ GMSH_API int gmsh::model::occ::addBSpline( GMSH_API int gmsh::model::occ::addBezier(const std::vector<int> &pointTags, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); int outTag = tag; if(!GModel::current()->getOCCInternals()->addBezier(outTag, pointTags)) { @@ -4884,7 +4884,7 @@ GMSH_API int gmsh::model::occ::addBezier(const std::vector<int> &pointTags, GMSH_API int gmsh::model::occ::addWire(const std::vector<int> &curveTags, const int tag, const bool checkClosed) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); int outTag = tag; if(!GModel::current()->getOCCInternals()->addWire(outTag, curveTags, @@ -4897,7 +4897,7 @@ GMSH_API int gmsh::model::occ::addWire(const std::vector<int> &curveTags, GMSH_API int gmsh::model::occ::addCurveLoop(const std::vector<int> &curveTags, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); int outTag = tag; if(!GModel::current()->getOCCInternals()->addLineLoop(outTag, curveTags)) { @@ -4911,7 +4911,7 @@ GMSH_API int gmsh::model::occ::addRectangle(const double x, const double y, const double dy, const int tag, const double roundedRadius) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); int outTag = tag; if(!GModel::current()->getOCCInternals()->addRectangle(outTag, x, y, z, dx, @@ -4925,7 +4925,7 @@ GMSH_API int gmsh::model::occ::addDisk(const double xc, const double yc, const double zc, const double rx, const double ry, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); int outTag = tag; if(!GModel::current()->getOCCInternals()->addDisk(outTag, xc, yc, zc, rx, @@ -4938,7 +4938,7 @@ GMSH_API int gmsh::model::occ::addDisk(const double xc, const double yc, GMSH_API int gmsh::model::occ::addPlaneSurface(const std::vector<int> &wireTags, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); int outTag = tag; if(!GModel::current()->getOCCInternals()->addPlaneSurface(outTag, wireTags)) { @@ -4951,7 +4951,7 @@ GMSH_API int gmsh::model::occ::addSurfaceFilling(const int wireTag, const int tag, const std::vector<int> &pointTags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); int outTag = tag; if(!GModel::current()->getOCCInternals()->addSurfaceFilling(outTag, wireTag, @@ -4965,7 +4965,7 @@ GMSH_API int gmsh::model::occ::addSurfaceLoop(const std::vector<int> &surfaceTags, const int tag, const bool sewing) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); int outTag = tag; if(!GModel::current()->getOCCInternals()->addSurfaceLoop(outTag, surfaceTags, @@ -4978,7 +4978,7 @@ gmsh::model::occ::addSurfaceLoop(const std::vector<int> &surfaceTags, GMSH_API int gmsh::model::occ::addVolume(const std::vector<int> &shellTags, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); int outTag = tag; if(!GModel::current()->getOCCInternals()->addVolume(outTag, shellTags)) { @@ -4993,7 +4993,7 @@ GMSH_API int gmsh::model::occ::addSphere(const double xc, const double yc, const double angle2, const double angle3) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); int outTag = tag; if(!GModel::current()->getOCCInternals()->addSphere( @@ -5008,7 +5008,7 @@ GMSH_API int gmsh::model::occ::addBox(const double x, const double y, const double dy, const double dz, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); int outTag = tag; if(!GModel::current()->getOCCInternals()->addBox(outTag, x, y, z, dx, dy, @@ -5024,7 +5024,7 @@ GMSH_API int gmsh::model::occ::addCylinder(const double x, const double y, const double r, const int tag, const double angle) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); int outTag = tag; if(!GModel::current()->getOCCInternals()->addCylinder(outTag, x, y, z, dx, dy, @@ -5040,7 +5040,7 @@ GMSH_API int gmsh::model::occ::addCone(const double x, const double y, const double r1, const double r2, const int tag, const double angle) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); int outTag = tag; if(!GModel::current()->getOCCInternals()->addCone(outTag, x, y, z, dx, dy, dz, @@ -5055,7 +5055,7 @@ GMSH_API int gmsh::model::occ::addWedge(const double x, const double y, const double dy, const double dz, const int tag, const double ltx) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); int outTag = tag; if(!GModel::current()->getOCCInternals()->addWedge(outTag, x, y, z, dx, dy, @@ -5070,7 +5070,7 @@ GMSH_API int gmsh::model::occ::addTorus(const double x, const double y, const double r2, const int tag, const double angle) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); int outTag = tag; if(!GModel::current()->getOCCInternals()->addTorus(outTag, x, y, z, r1, r2, @@ -5080,13 +5080,11 @@ GMSH_API int gmsh::model::occ::addTorus(const double x, const double y, return outTag; } -GMSH_API void -gmsh::model::occ::addThruSections(const std::vector<int> &wireTags, - vectorpair &outDimTags, const int tag, - const bool makeSolid, const bool makeRuled, - const int maxDegree) +GMSH_API void gmsh::model::occ::addThruSections( + const std::vector<int> &wireTags, vectorpair &outDimTags, const int tag, + const bool makeSolid, const bool makeRuled, const int maxDegree) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); outDimTags.clear(); if(!GModel::current()->getOCCInternals()->addThruSections( @@ -5099,7 +5097,7 @@ GMSH_API void gmsh::model::occ::addThickSolid( const int volumeTag, const std::vector<int> &excludeSurfaceTags, const double offset, vectorpair &outDimTags, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); outDimTags.clear(); if(!GModel::current()->getOCCInternals()->addThickSolid( @@ -5115,7 +5113,7 @@ GMSH_API void gmsh::model::occ::extrude(const vectorpair &dimTags, const std::vector<double> &heights, const bool recombine) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); outDimTags.clear(); if(!GModel::current()->getOCCInternals()->extrude( @@ -5131,7 +5129,7 @@ GMSH_API void gmsh::model::occ::revolve( vectorpair &outDimTags, const std::vector<int> &numElements, const std::vector<double> &heights, const bool recombine) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); outDimTags.clear(); if(!GModel::current()->getOCCInternals()->revolve( @@ -5145,7 +5143,7 @@ GMSH_API void gmsh::model::occ::addPipe(const vectorpair &dimTags, const int wireTag, vectorpair &outDimTags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); outDimTags.clear(); if(!GModel::current()->getOCCInternals()->addPipe(dimTags, wireTag, @@ -5160,7 +5158,7 @@ GMSH_API void gmsh::model::occ::fillet(const std::vector<int> &volumeTags, vectorpair &outDimTags, const bool removeVolume) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); outDimTags.clear(); if(!GModel::current()->getOCCInternals()->fillet(volumeTags, curveTags, radii, @@ -5176,7 +5174,7 @@ GMSH_API void gmsh::model::occ::chamfer(const std::vector<int> &volumeTags, vectorpair &outDimTags, const bool removeVolume) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); outDimTags.clear(); if(!GModel::current()->getOCCInternals()->chamfer(volumeTags, curveTags, @@ -5193,7 +5191,7 @@ GMSH_API void gmsh::model::occ::fuse(const vectorpair &objectDimTags, const int tag, const bool removeObject, const bool removeTool) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); outDimTags.clear(); outDimTagsMap.clear(); @@ -5209,7 +5207,7 @@ GMSH_API void gmsh::model::occ::intersect( vectorpair &outDimTags, std::vector<vectorpair> &outDimTagsMap, const int tag, const bool removeObject, const bool removeTool) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); outDimTags.clear(); outDimTagsMap.clear(); @@ -5227,7 +5225,7 @@ GMSH_API void gmsh::model::occ::cut(const vectorpair &objectDimTags, const int tag, const bool removeObject, const bool removeTool) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); outDimTags.clear(); outDimTagsMap.clear(); @@ -5245,7 +5243,7 @@ GMSH_API void gmsh::model::occ::fragment(const vectorpair &objectDimTags, const int tag, const bool removeObject, const bool removeTool) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); outDimTags.clear(); outDimTagsMap.clear(); @@ -5260,7 +5258,7 @@ GMSH_API void gmsh::model::occ::translate(const vectorpair &dimTags, const double dx, const double dy, const double dz) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); if(!GModel::current()->getOCCInternals()->translate(dimTags, dx, dy, dz)) { throw 1; @@ -5273,7 +5271,7 @@ GMSH_API void gmsh::model::occ::rotate(const vectorpair &dimTags, const double ay, const double az, const double angle) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); if(!GModel::current()->getOCCInternals()->rotate(dimTags, x, y, z, ax, ay, az, angle)) { @@ -5286,7 +5284,7 @@ GMSH_API void gmsh::model::occ::dilate(const vectorpair &dimTags, const double z, const double a, const double b, const double c) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); if(!GModel::current()->getOCCInternals()->dilate(dimTags, x, y, z, a, b, c)) { throw 1; @@ -5297,7 +5295,7 @@ GMSH_API void gmsh::model::occ::mirror(const vectorpair &dimTags, const double a, const double b, const double c, const double d) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); if(!GModel::current()->getOCCInternals()->symmetry(dimTags, a, b, c, d)) { throw 1; @@ -5314,7 +5312,7 @@ GMSH_API void gmsh::model::occ::symmetrize(const vectorpair &dimTags, GMSH_API void gmsh::model::occ::affineTransform(const vectorpair &dimTags, const std::vector<double> &a) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); if(!GModel::current()->getOCCInternals()->affine(dimTags, a)) { throw 1; } } @@ -5322,7 +5320,7 @@ GMSH_API void gmsh::model::occ::affineTransform(const vectorpair &dimTags, GMSH_API void gmsh::model::occ::copy(const vectorpair &dimTags, vectorpair &outDimTags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); outDimTags.clear(); if(!GModel::current()->getOCCInternals()->copy(dimTags, outDimTags)) { @@ -5333,7 +5331,7 @@ GMSH_API void gmsh::model::occ::copy(const vectorpair &dimTags, GMSH_API void gmsh::model::occ::remove(const vectorpair &dimTags, const bool recursive) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); if(!GModel::current()->getOCCInternals()->remove(dimTags, recursive)) { throw 1; @@ -5342,7 +5340,7 @@ GMSH_API void gmsh::model::occ::remove(const vectorpair &dimTags, GMSH_API void gmsh::model::occ::removeAllDuplicates() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); GModel::current()->getOCCInternals()->removeAllDuplicates(); } @@ -5352,7 +5350,7 @@ GMSH_API void gmsh::model::occ::healShapes( const bool fixDegenerated, const bool fixSmallEdges, const bool fixSmallFaces, const bool sewFaces, const bool makeSolids) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); outDimTags.clear(); if(!GModel::current()->getOCCInternals()->healShapes( @@ -5367,7 +5365,7 @@ GMSH_API void gmsh::model::occ::importShapes(const std::string &fileName, const bool highestDimOnly, const std::string &format) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); outDimTags.clear(); if(!GModel::current()->getOCCInternals()->importShapes( @@ -5379,7 +5377,7 @@ GMSH_API void gmsh::model::occ::importShapes(const std::string &fileName, GMSH_API void gmsh::model::occ::importShapesNativePointer( const void *shape, vectorpair &outDimTags, const bool highestDimOnly) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); outDimTags.clear(); #if defined(HAVE_OCC) @@ -5389,13 +5387,13 @@ GMSH_API void gmsh::model::occ::importShapesNativePointer( } #else Msg::Error("Gmsh requires OpenCASCADE to import native shape"); - throw - 1; + throw -1; #endif } GMSH_API void gmsh::model::occ::getEntities(vectorpair &dimTags, const int dim) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); if(!GModel::current()->getOCCInternals()->getEntities(dimTags, dim)) { throw 1; @@ -5406,10 +5404,10 @@ GMSH_API void gmsh::model::occ::getEntitiesInBoundingBox( const double xmin, const double ymin, const double zmin, const double xmax, const double ymax, const double zmax, vectorpair &dimTags, const int dim) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } dimTags.clear(); - if(!GModel::current()->getOCCInternals()->getEntitiesInBoundingBox - (xmin, ymin, zmin, xmax, ymax, zmax, dimTags, dim)) { + if(!GModel::current()->getOCCInternals()->getEntitiesInBoundingBox( + xmin, ymin, zmin, xmax, ymax, zmax, dimTags, dim)) { throw 1; } } @@ -5419,10 +5417,10 @@ GMSH_API void gmsh::model::occ::getBoundingBox(const int dim, const int tag, double &zmin, double &xmax, double &ymax, double &zmax) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); - if(!GModel::current()->getOCCInternals()->getBoundingBox - (dim, tag, xmin, ymin, zmin, xmax, ymax, zmax)) { + if(!GModel::current()->getOCCInternals()->getBoundingBox( + dim, tag, xmin, ymin, zmin, xmax, ymax, zmax)) { throw 1; } } @@ -5430,7 +5428,7 @@ GMSH_API void gmsh::model::occ::getBoundingBox(const int dim, const int tag, GMSH_API void gmsh::model::occ::getMass(const int dim, const int tag, double &mass) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); if(!GModel::current()->getOCCInternals()->getMass(dim, tag, mass)) { throw 1; @@ -5440,7 +5438,7 @@ GMSH_API void gmsh::model::occ::getMass(const int dim, const int tag, GMSH_API void gmsh::model::occ::getCenterOfMass(const int dim, const int tag, double &x, double &y, double &z) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); if(!GModel::current()->getOCCInternals()->getCenterOfMass(dim, tag, x, y, z)) { @@ -5451,7 +5449,7 @@ GMSH_API void gmsh::model::occ::getCenterOfMass(const int dim, const int tag, GMSH_API void gmsh::model::occ::getMatrixOfInertia(const int dim, const int tag, std::vector<double> &m) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); if(!GModel::current()->getOCCInternals()->getMatrixOfInertia(dim, tag, m)) { throw 1; @@ -5460,19 +5458,19 @@ GMSH_API void gmsh::model::occ::getMatrixOfInertia(const int dim, const int tag, GMSH_API int gmsh::model::occ::getMaxTag(const int dim) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } return GModel::current()->getOCCInternals()->getMaxTag(dim); } GMSH_API void gmsh::model::occ::setMaxTag(const int dim, const int maxTag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GModel::current()->getOCCInternals()->setMaxTag(dim, maxTag); } GMSH_API void gmsh::model::occ::synchronize() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); GModel::current()->getOCCInternals()->synchronize(GModel::current()); } @@ -5482,7 +5480,7 @@ GMSH_API void gmsh::model::occ::synchronize() GMSH_API void gmsh::model::occ::mesh::setSize(const vectorpair &dimTags, const double size) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } _createOcc(); for(std::size_t i = 0; i < dimTags.size(); i++) { int dim = dimTags[i].first, tag = dimTags[i].second; @@ -5494,7 +5492,7 @@ GMSH_API void gmsh::model::occ::mesh::setSize(const vectorpair &dimTags, GMSH_API int gmsh::view::add(const std::string &name, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_POST) PView *view = new PView(tag); view->getData()->setName(name); @@ -5504,13 +5502,13 @@ GMSH_API int gmsh::view::add(const std::string &name, const int tag) return view->getTag(); #else Msg::Error("Views require the post-processing module"); - throw - 1; + throw -1; #endif } GMSH_API void gmsh::view::remove(const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_POST) PView *view = PView::getViewByTag(tag); if(!view) { @@ -5523,13 +5521,13 @@ GMSH_API void gmsh::view::remove(const int tag) #endif #else Msg::Error("Views require the post-processing module"); - throw - 1; + throw -1; #endif } GMSH_API int gmsh::view::getIndex(const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_POST) PView *view = PView::getViewByTag(tag); if(!view) { @@ -5539,29 +5537,29 @@ GMSH_API int gmsh::view::getIndex(const int tag) return view->getIndex(); #else Msg::Error("Views require the post-processing module"); - throw - 1; + throw -1; #endif } GMSH_API void gmsh::view::getTags(std::vector<int> &tags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_POST) tags.clear(); for(std::size_t i = 0; i < PView::list.size(); i++) tags.push_back(PView::list[i]->getTag()); #else Msg::Error("Views require the post-processing module"); - throw - 1; + throw -1; #endif } template <class T> -static void _addModelData( - const int tag, const int step, const std::string &modelName, - const std::string &dataType, const std::vector<std::size_t> &tags, - const T &data, const double time, const int numComponents, - const int partition) +static void +_addModelData(const int tag, const int step, const std::string &modelName, + const std::string &dataType, const std::vector<std::size_t> &tags, + const T &data, const double time, const int numComponents, + const int partition) { #if defined(HAVE_POST) PView *view = PView::getViewByTag(tag); @@ -5611,7 +5609,7 @@ static void _addModelData( view->getOptions()->targetError); #else Msg::Error("Views require the post-processing module"); - throw - 1; + throw -1; #endif } @@ -5621,24 +5619,24 @@ GMSH_API void gmsh::view::addModelData( const std::vector<std::vector<double> > &data, const double time, const int numComponents, const int partition) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(tags.size() != data.size()) { Msg::Error("Incompatible number of tags and data"); throw 2; } - _addModelData(tag, step, modelName, dataType, tags, data, time, - numComponents, partition); + _addModelData(tag, step, modelName, dataType, tags, data, time, numComponents, + partition); } GMSH_API void gmsh::view::addHomogeneousModelData( const int tag, const int step, const std::string &modelName, const std::string &dataType, const std::vector<std::size_t> &tags, - const std::vector<double> &data, const double time, - const int numComponents, const int partition) + const std::vector<double> &data, const double time, const int numComponents, + const int partition) { - if(!_isInitialized()) { throw - 1; } - _addModelData(tag, step, modelName, dataType, tags, data, time, - numComponents, partition); + if(!_isInitialized()) { throw -1; } + _addModelData(tag, step, modelName, dataType, tags, data, time, numComponents, + partition); } GMSH_API void gmsh::view::getModelData(const int tag, const int step, @@ -5647,7 +5645,7 @@ GMSH_API void gmsh::view::getModelData(const int tag, const int step, std::vector<std::vector<double> > &data, double &time, int &numComponents) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_POST) PView *view = PView::getViewByTag(tag); if(!view) { @@ -5701,7 +5699,7 @@ GMSH_API void gmsh::view::getModelData(const int tag, const int step, } #else Msg::Error("Views require the post-processing module"); - throw - 1; + throw -1; #endif } @@ -5785,7 +5783,7 @@ GMSH_API void gmsh::view::addListData(const int tag, const int numElements, const std::vector<double> &data) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_POST) PView *view = PView::getViewByTag(tag); if(!view) { @@ -5814,7 +5812,7 @@ GMSH_API void gmsh::view::addListData(const int tag, throw 2; #else Msg::Error("Views require the post-processing module"); - throw - 1; + throw -1; #endif } @@ -5823,7 +5821,7 @@ GMSH_API void gmsh::view::getListData(const int tag, std::vector<int> &numElements, std::vector<std::vector<double> > &data) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_POST) PView *view = PView::getViewByTag(tag); if(!view) { @@ -5850,7 +5848,7 @@ GMSH_API void gmsh::view::getListData(const int tag, } #else Msg::Error("Views require the post-processing module"); - throw - 1; + throw -1; #endif } @@ -5858,11 +5856,11 @@ static double getStringStyle(const std::vector<std::string> &style) { if(style.empty()) return 0.; int align = 0, font = 0, fontsize = CTX::instance()->glFontSize; - if(style.size() % 2){ + if(style.size() % 2) { Msg::Error("Number of string style attributes should be even"); } - else{ - for(std::size_t i = 0 ; i < style.size(); i += 2){ + else { + for(std::size_t i = 0; i < style.size(); i += 2) { std::string key = style[i], val = style[i + 1]; #if defined(HAVE_OPENGL) if(key == "Font") @@ -5874,15 +5872,15 @@ static double getStringStyle(const std::vector<std::string> &style) #endif } } - return (double)((align<<16)|(font<<8)|(fontsize)); + return (double)((align << 16) | (font << 8) | (fontsize)); } -GMSH_API void gmsh::view::addListDataString(const int tag, - const std::vector<double> &coord, - const std::vector<std::string> &data, - const std::vector<std::string> &style) +GMSH_API void +gmsh::view::addListDataString(const int tag, const std::vector<double> &coord, + const std::vector<std::string> &data, + const std::vector<std::string> &style) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_POST) PView *view = PView::getViewByTag(tag); if(!view) { @@ -5902,8 +5900,7 @@ GMSH_API void gmsh::view::addListDataString(const int tag, d->T3D.push_back(coord[0]); d->T3D.push_back(coord[1]); d->T3D.push_back(coord[2]); - d->T3D.push_back(getStringStyle(style)), - d->T3D.push_back(d->T3C.size()); + d->T3D.push_back(getStringStyle(style)), d->T3D.push_back(d->T3C.size()); d->NbT3++; for(std::size_t i = 0; i < data.size(); i++) { for(std::size_t j = 0; j < data[i].size(); j++) { @@ -5915,8 +5912,7 @@ GMSH_API void gmsh::view::addListDataString(const int tag, else if(coord.size() == 2) { d->T2D.push_back(coord[0]); d->T2D.push_back(coord[1]); - d->T2D.push_back(getStringStyle(style)), - d->T2D.push_back(d->T2C.size()); + d->T2D.push_back(getStringStyle(style)), d->T2D.push_back(d->T2C.size()); d->NbT2++; for(std::size_t i = 0; i < data.size(); i++) { for(std::size_t j = 0; j < data[i].size(); j++) { @@ -5928,7 +5924,7 @@ GMSH_API void gmsh::view::addListDataString(const int tag, d->finalize(); #else Msg::Error("Views require the post-processing module"); - throw - 1; + throw -1; #endif } @@ -5937,7 +5933,7 @@ GMSH_API void gmsh::view::getListDataStrings(const int tag, const int dim, std::vector<std::string> &data, std::vector<std::string> &style) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_POST) PView *view = PView::getViewByTag(tag); if(!view) { @@ -5989,14 +5985,14 @@ GMSH_API void gmsh::view::getListDataStrings(const int tag, const int dim, } #else Msg::Error("Views require the post-processing module"); - throw - 1; + throw -1; #endif } GMSH_API int gmsh::view::addAlias(const int refTag, const bool copyOptions, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_POST) PView *ref = PView::getViewByTag(refTag); if(!ref) { @@ -6010,13 +6006,13 @@ GMSH_API int gmsh::view::addAlias(const int refTag, const bool copyOptions, return view->getTag(); #else Msg::Error("Views require the post-processing module"); - throw - 1; + throw -1; #endif } GMSH_API void gmsh::view::copyOptions(const int refTag, const int tag) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_POST) PView *ref = PView::getViewByTag(refTag); if(!ref) { @@ -6034,7 +6030,7 @@ GMSH_API void gmsh::view::copyOptions(const int refTag, const int tag) #endif #else Msg::Error("Views require the post-processing module"); - throw - 1; + throw -1; #endif } @@ -6042,7 +6038,7 @@ GMSH_API void gmsh::view::combine(const std::string &what, const std::string &how, const bool remove, const bool copyOptions) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_POST) bool time = (what == "steps") ? true : false; // "elements" int ihow = (how == "all") ? 1 : (how == "name") ? 2 : 0; // "visible" @@ -6052,7 +6048,7 @@ GMSH_API void gmsh::view::combine(const std::string &what, #endif #else Msg::Error("Views require the post-processing module"); - throw - 1; + throw -1; #endif } @@ -6064,7 +6060,7 @@ GMSH_API void gmsh::view::probe(const int tag, const double x, const double y, const std::vector<double> &yElemCoord, const std::vector<double> &zElemCoord) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_POST) PView *view = PView::getViewByTag(tag); if(!view) { @@ -6113,14 +6109,14 @@ GMSH_API void gmsh::view::probe(const int tag, const double x, const double y, if(found) value.insert(value.end(), val.begin(), val.end()); #else Msg::Error("Views require the post-processing module"); - throw - 1; + throw -1; #endif } GMSH_API void gmsh::view::write(const int tag, const std::string &fileName, const bool append) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_POST) PView *view = PView::getViewByTag(tag); if(!view) { @@ -6130,7 +6126,7 @@ GMSH_API void gmsh::view::write(const int tag, const std::string &fileName, view->write(fileName, 10, append); #else Msg::Error("Views require the post-processing module"); - throw - 1; + throw -1; #endif } @@ -6140,7 +6136,7 @@ GMSH_API void gmsh::plugin::setNumber(const std::string &name, const std::string &option, const double value) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_PLUGINS) try { PluginManager::instance()->setPluginOption(name, option, value); @@ -6150,7 +6146,7 @@ GMSH_API void gmsh::plugin::setNumber(const std::string &name, } #else Msg::Error("Views require the post-processing and plugin modules"); - throw - 1; + throw -1; #endif } @@ -6158,7 +6154,7 @@ GMSH_API void gmsh::plugin::setString(const std::string &name, const std::string &option, const std::string &value) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_PLUGINS) try { PluginManager::instance()->setPluginOption(name, option, value); @@ -6168,13 +6164,13 @@ GMSH_API void gmsh::plugin::setString(const std::string &name, } #else Msg::Error("Views require the post-processing and plugin modules"); - throw - 1; + throw -1; #endif } GMSH_API void gmsh::plugin::run(const std::string &name) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_PLUGINS) try { PluginManager::instance()->action(name, "Run", 0); @@ -6184,7 +6180,7 @@ GMSH_API void gmsh::plugin::run(const std::string &name) } #else Msg::Error("Views require the post-processing and plugin modules"); - throw - 1; + throw -1; #endif } @@ -6207,25 +6203,25 @@ static void error_handler(const char *fmt, ...) vsnprintf(str, sizeof(str), fmt, args); va_end(args); Msg::Error("%s (FLTK internal error)", str); - throw - 1; + throw -1; } GMSH_API void gmsh::fltk::initialize() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_FLTK) FlGui::instance(_argc, _argv, false, error_handler); FlGui::setFinishedProcessingCommandLine(); FlGui::check(true); #else Msg::Error("Fltk not available"); - throw - 1; + throw -1; #endif } GMSH_API int gmsh::fltk::isAvailable() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_FLTK) return FlGui::available() ? 1 : 0; #else @@ -6235,7 +6231,7 @@ GMSH_API int gmsh::fltk::isAvailable() GMSH_API void gmsh::fltk::wait(const double time) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_FLTK) if(!FlGui::available()) FlGui::instance(_argc, _argv, false, error_handler); if(time >= 0) @@ -6244,64 +6240,64 @@ GMSH_API void gmsh::fltk::wait(const double time) FlGui::wait(true); #else Msg::Error("Fltk not available"); - throw - 1; + throw -1; #endif } GMSH_API void gmsh::fltk::lock() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_FLTK) FlGui::lock(); #else Msg::Error("Fltk not available"); - throw - 1; + throw -1; #endif } GMSH_API void gmsh::fltk::unlock() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_FLTK) FlGui::unlock(); #else Msg::Error("Fltk not available"); - throw - 1; + throw -1; #endif } GMSH_API void gmsh::fltk::update() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_FLTK) if(!FlGui::available()) FlGui::instance(_argc, _argv, false, error_handler); FlGui::instance()->updateViews(true, true); #else Msg::Error("Fltk not available"); - throw - 1; + throw -1; #endif } GMSH_API void gmsh::fltk::awake(const std::string &action) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_FLTK) FlGui::awake(action); #else Msg::Error("Fltk not available"); - throw - 1; + throw -1; #endif } GMSH_API void gmsh::fltk::run() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_FLTK) if(!FlGui::available()) FlGui::instance(_argc, _argv, false, error_handler); FlGui::instance()->run(); // this calls draw() once #else Msg::Error("Fltk not available"); - throw - 1; + throw -1; #endif } @@ -6321,7 +6317,7 @@ static int selectionCode(char val) GMSH_API int gmsh::fltk::selectEntities(vectorpair &dimTags, const int dim) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } dimTags.clear(); #if defined(HAVE_FLTK) if(!FlGui::available()) FlGui::instance(_argc, _argv, false, error_handler); @@ -6353,7 +6349,7 @@ GMSH_API int gmsh::fltk::selectEntities(vectorpair &dimTags, const int dim) GMSH_API int gmsh::fltk::selectElements(std::vector<std::size_t> &elementTags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } elementTags.clear(); #if defined(HAVE_FLTK) if(!FlGui::available()) FlGui::instance(_argc, _argv, false, error_handler); @@ -6372,7 +6368,7 @@ GMSH_API int gmsh::fltk::selectElements(std::vector<std::size_t> &elementTags) GMSH_API int gmsh::fltk::selectViews(std::vector<int> &viewTags) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } viewTags.clear(); #if defined(HAVE_FLTK) if(!FlGui::available()) FlGui::instance(_argc, _argv, false, error_handler); @@ -6390,7 +6386,7 @@ GMSH_API int gmsh::fltk::selectViews(std::vector<int> &viewTags) GMSH_API void gmsh::onelab::set(const std::string &data, const std::string &format) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_ONELAB) if(format == "json") { if(!::onelab::server::instance()->fromJSON(data)) @@ -6400,14 +6396,14 @@ GMSH_API void gmsh::onelab::set(const std::string &data, Msg::Error("Unknown data format"); #else Msg::Error("ONELAB not available"); - throw - 1; + throw -1; #endif } GMSH_API void gmsh::onelab::get(std::string &data, const std::string &name, const std::string &format) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_ONELAB) data.clear(); if(name.empty()) { @@ -6438,14 +6434,14 @@ GMSH_API void gmsh::onelab::get(std::string &data, const std::string &name, } #else Msg::Error("ONELAB not available"); - throw - 1; + throw -1; #endif } GMSH_API void gmsh::onelab::setNumber(const std::string &name, const std::vector<double> &value) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_ONELAB) ::onelab::number p(name); std::vector< ::onelab::number> ps; @@ -6455,14 +6451,14 @@ GMSH_API void gmsh::onelab::setNumber(const std::string &name, ::onelab::server::instance()->set(p); #else Msg::Error("ONELAB not available"); - throw - 1; + throw -1; #endif } GMSH_API void gmsh::onelab::getNumber(const std::string &name, std::vector<double> &value) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_ONELAB) value.clear(); std::vector< ::onelab::number> ps; @@ -6470,14 +6466,14 @@ GMSH_API void gmsh::onelab::getNumber(const std::string &name, if(ps.size()) value = ps[0].getValues(); #else Msg::Error("ONELAB not available"); - throw - 1; + throw -1; #endif } GMSH_API void gmsh::onelab::setString(const std::string &name, const std::vector<std::string> &value) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_ONELAB) ::onelab::string p(name); std::vector< ::onelab::string> ps; @@ -6487,14 +6483,14 @@ GMSH_API void gmsh::onelab::setString(const std::string &name, ::onelab::server::instance()->set(p); #else Msg::Error("ONELAB not available"); - throw - 1; + throw -1; #endif } GMSH_API void gmsh::onelab::getString(const std::string &name, std::vector<std::string> &value) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_ONELAB) value.clear(); std::vector< ::onelab::string> ps; @@ -6502,25 +6498,25 @@ GMSH_API void gmsh::onelab::getString(const std::string &name, if(ps.size()) value = ps[0].getValues(); #else Msg::Error("ONELAB not available"); - throw - 1; + throw -1; #endif } GMSH_API void gmsh::onelab::clear(const std::string &name) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_ONELAB) ::onelab::server::instance()->clear(name); #else Msg::Error("ONELAB not available"); - throw - 1; + throw -1; #endif } GMSH_API void gmsh::onelab::run(const std::string &name, const std::string &command) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } #if defined(HAVE_ONELAB) onelabUtils::runClient(name, command); #endif @@ -6531,7 +6527,7 @@ GMSH_API void gmsh::onelab::run(const std::string &name, GMSH_API void gmsh::logger::write(const std::string &message, const std::string &level) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } if(level == "error") Msg::Error("%s", message.c_str()); else if(level == "warning") @@ -6555,7 +6551,7 @@ public: GMSH_API void gmsh::logger::start() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GmshMessage *msg = Msg::GetCallback(); if(msg) { Msg::Warning("Logger already started - ignoring"); } else { @@ -6566,7 +6562,7 @@ GMSH_API void gmsh::logger::start() GMSH_API void gmsh::logger::get(std::vector<std::string> &log) { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } apiMsg *msg = dynamic_cast<apiMsg *>(Msg::GetCallback()); if(msg) { msg->get(log); } else { @@ -6576,7 +6572,7 @@ GMSH_API void gmsh::logger::get(std::vector<std::string> &log) GMSH_API void gmsh::logger::stop() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } GmshMessage *msg = Msg::GetCallback(); if(msg) { delete msg; @@ -6589,12 +6585,12 @@ GMSH_API void gmsh::logger::stop() GMSH_API double gmsh::logger::getWallTime() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } return TimeOfDay(); } GMSH_API double gmsh::logger::getCpuTime() { - if(!_isInitialized()) { throw - 1; } + if(!_isInitialized()) { throw -1; } return Cpu(); }