From 513fd9005e9d2cb703f1c2ad5e8036da3f3bee2b Mon Sep 17 00:00:00 2001 From: noels <l.noels@ulg.ac.be> Date: Mon, 28 Apr 2025 12:24:26 +0200 Subject: [PATCH] make GModel as current --- NonLinearSolver/nlsolver/cutMeshByBox.cpp | 3 ++- NonLinearSolver/nlsolver/getTotalVolume.cpp | 1 + NonLinearSolver/nlsolver/imperfectionToMesh.cpp | 2 ++ NonLinearSolver/nlsolver/meshModification.cpp | 5 ++++- NonLinearSolver/nlsolver/nonLinearMechSolver.cpp | 2 ++ NonLinearSolver/nlsolver/showDataOnMesh.cpp | 2 ++ NonLinearSolver/nlsolver/strainMapping.cpp | 1 + NonLinearSolver/periodicBC/geometryRotation.cpp | 1 + 8 files changed, 15 insertions(+), 2 deletions(-) diff --git a/NonLinearSolver/nlsolver/cutMeshByBox.cpp b/NonLinearSolver/nlsolver/cutMeshByBox.cpp index 2554a880e..665bb8ec3 100644 --- a/NonLinearSolver/nlsolver/cutMeshByBox.cpp +++ b/NonLinearSolver/nlsolver/cutMeshByBox.cpp @@ -286,7 +286,8 @@ std::set<MVertex*> cutMeshByBox::currentVertices; cutMeshByBox::cutMeshByBox(): _pModel(NULL),_g(NULL),_gVolume(NULL){} void cutMeshByBox::addModel(std::string meshFileName){ - _pModel = new GModel(); + _pModel = new GModel(); + _pModel->setAsCurrent(); _pModel->readMSH(meshFileName.c_str()); int dim = _pModel->getNumRegions() ? 3 : 2; _g = new elementGroup(); diff --git a/NonLinearSolver/nlsolver/getTotalVolume.cpp b/NonLinearSolver/nlsolver/getTotalVolume.cpp index 582d7ae5f..eea04a0d0 100644 --- a/NonLinearSolver/nlsolver/getTotalVolume.cpp +++ b/NonLinearSolver/nlsolver/getTotalVolume.cpp @@ -20,6 +20,7 @@ getTotalVolume::~getTotalVolume(){ void getTotalVolume::loadModel(const std::string filename){ GModel* pModel = new GModel(); + pModel->setAsCurrent(); //to check pModel->readMSH(filename.c_str()); int dim = pModel->getNumRegions() ? 3 : 2; std::map<int, std::vector<GEntity*> > groups[4]; diff --git a/NonLinearSolver/nlsolver/imperfectionToMesh.cpp b/NonLinearSolver/nlsolver/imperfectionToMesh.cpp index 3b46b1c7b..dbe414a31 100644 --- a/NonLinearSolver/nlsolver/imperfectionToMesh.cpp +++ b/NonLinearSolver/nlsolver/imperfectionToMesh.cpp @@ -166,6 +166,7 @@ void imperfectionPart::addAllEntities(){ void imperfectionToMesh::loadModel(const std::string meshFileName) { _pModel = new GModel(); + _pModel->setAsCurrent(); //to check _pModel->readMSH(meshFileName.c_str()); _meshFileName = meshFileName; } @@ -182,6 +183,7 @@ void imperfectionToMesh::addImperfection(imperfectionPart* ip){ void imperfectionToMesh::imposeImperfection(const std::string fname){ Msg::Info("Begin writing perturbed mesh"); GModel* dispgmodel = new GModel(); + dispgmodel->setAsCurrent(); //to check dispgmodel->readMSH(_meshFileName.c_str()); std::set<MVertex*> allPerturbedVertices; for (int i=0; i<_allImperfectionPart.size(); i++){ diff --git a/NonLinearSolver/nlsolver/meshModification.cpp b/NonLinearSolver/nlsolver/meshModification.cpp index 5b79feed1..68cf8ea37 100644 --- a/NonLinearSolver/nlsolver/meshModification.cpp +++ b/NonLinearSolver/nlsolver/meshModification.cpp @@ -26,6 +26,7 @@ void meshModification::loadModel(const std::string meshFileName) { if (_pModel) delete _pModel; _pModel = new GModel(); + _pModel->setAsCurrent(); //to check _pModel->readMSH(meshFileName.c_str()); _meshFileName = meshFileName; }; @@ -34,6 +35,7 @@ void meshModification::loadGeo(const std::string geoFile, int dimToMesh, int ord { if (_pModel) delete _pModel; _pModel = new GModel(); + _pModel->setAsCurrent(); //to check _pModel->readGEO(geoFile); // Overwrite options CTX::instance()->mesh.order = order; @@ -314,6 +316,7 @@ void QuadToTriangle::loadModel(const std::string meshFileName) { if (_pModel) delete _pModel; _pModel = new GModel(); + _pModel->setAsCurrent(); //to check _pModel->readMSH(meshFileName.c_str()); }; @@ -409,4 +412,4 @@ void QuadToTriangle::apply(const std::string fname) write_MSH2(allG,fname); Msg::Info("done modifying mesh"); -}; \ No newline at end of file +}; diff --git a/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp b/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp index 063035988..55208a056 100644 --- a/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp +++ b/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp @@ -17103,6 +17103,7 @@ void nonLinearMechSolver::setDisturbedEigenMode(int num, double val, bool flag){ void nonLinearMechSolver::writeDisturbedMeshByEigenVector(eigenSolver& eigS, int numberMode, double fact){ Msg::Info("Begin writing deformed mesh"); GModel* dispgmodel = new GModel(); + dispgmodel->setAsCurrent(); dispgmodel->readMSH(_meshFileName.c_str()); std::set<MVertex*> computedVertex; @@ -17158,6 +17159,7 @@ void nonLinearMechSolver::setWriteDeformedMeshToFile(bool flag){ void nonLinearMechSolver::writeDeformedMesh(int step){ Msg::Info("Begin writing deformed mesh"); GModel* dispgmodel = new GModel(); + dispgmodel->setAsCurrent(); dispgmodel->readMSH(_meshFileName.c_str()); std::set<MVertex*> computedVertex; diff --git a/NonLinearSolver/nlsolver/showDataOnMesh.cpp b/NonLinearSolver/nlsolver/showDataOnMesh.cpp index 4da21c701..7637eaf78 100644 --- a/NonLinearSolver/nlsolver/showDataOnMesh.cpp +++ b/NonLinearSolver/nlsolver/showDataOnMesh.cpp @@ -13,6 +13,7 @@ showDataOnMesh::showDataOnMesh(const std::string meshFileName) { _pModel = new GModel(); + _pModel->setAsCurrent(); //to check _pModel->readMSH(meshFileName.c_str()); _meshFileName = meshFileName; @@ -35,6 +36,7 @@ void showDataOnMesh::dataOnPhysical(int dim, int phys, const std::string partMes write_MSH2(_gr,partMeshFile.c_str()); _part = new GModel(); + _part->setAsCurrent(); //to check _part->readMSH(partMeshFile.c_str()); } diff --git a/NonLinearSolver/nlsolver/strainMapping.cpp b/NonLinearSolver/nlsolver/strainMapping.cpp index 7381569e5..fca0c32dc 100644 --- a/NonLinearSolver/nlsolver/strainMapping.cpp +++ b/NonLinearSolver/nlsolver/strainMapping.cpp @@ -28,6 +28,7 @@ strainMapping::~strainMapping(){ void strainMapping::readMesh(const std::string meshFileName){ _meshFileName = meshFileName; _pModel = new GModel(); + _pModel->setAsCurrent(); //to check _pModel->readMSH(meshFileName.c_str()); int dim = _pModel->getNumRegions() ? 3 : 2; _g = new elementGroup(); diff --git a/NonLinearSolver/periodicBC/geometryRotation.cpp b/NonLinearSolver/periodicBC/geometryRotation.cpp index 01f028811..f082ccd6b 100644 --- a/NonLinearSolver/periodicBC/geometryRotation.cpp +++ b/NonLinearSolver/periodicBC/geometryRotation.cpp @@ -118,6 +118,7 @@ void GeometryRotation::exportRotatedModel(const double e1x, const double e1y, co n3.normalize(); GModel* pModel = new GModel(); + pModel->setAsCurrent(); //to check pModel->readMSH(inMeshFile.c_str()); pModel->setFileName(inMeshFile); -- GitLab