Skip to content
Snippets Groups Projects
Commit 513fd900 authored by Ludovic Noels's avatar Ludovic Noels
Browse files

make GModel as current

parent 0ad90d4d
No related branches found
No related tags found
No related merge requests found
...@@ -287,6 +287,7 @@ cutMeshByBox::cutMeshByBox(): _pModel(NULL),_g(NULL),_gVolume(NULL){} ...@@ -287,6 +287,7 @@ cutMeshByBox::cutMeshByBox(): _pModel(NULL),_g(NULL),_gVolume(NULL){}
void cutMeshByBox::addModel(std::string meshFileName){ void cutMeshByBox::addModel(std::string meshFileName){
_pModel = new GModel(); _pModel = new GModel();
_pModel->setAsCurrent();
_pModel->readMSH(meshFileName.c_str()); _pModel->readMSH(meshFileName.c_str());
int dim = _pModel->getNumRegions() ? 3 : 2; int dim = _pModel->getNumRegions() ? 3 : 2;
_g = new elementGroup(); _g = new elementGroup();
......
...@@ -20,6 +20,7 @@ getTotalVolume::~getTotalVolume(){ ...@@ -20,6 +20,7 @@ getTotalVolume::~getTotalVolume(){
void getTotalVolume::loadModel(const std::string filename){ void getTotalVolume::loadModel(const std::string filename){
GModel* pModel = new GModel(); GModel* pModel = new GModel();
pModel->setAsCurrent(); //to check
pModel->readMSH(filename.c_str()); pModel->readMSH(filename.c_str());
int dim = pModel->getNumRegions() ? 3 : 2; int dim = pModel->getNumRegions() ? 3 : 2;
std::map<int, std::vector<GEntity*> > groups[4]; std::map<int, std::vector<GEntity*> > groups[4];
......
...@@ -166,6 +166,7 @@ void imperfectionPart::addAllEntities(){ ...@@ -166,6 +166,7 @@ void imperfectionPart::addAllEntities(){
void imperfectionToMesh::loadModel(const std::string meshFileName) void imperfectionToMesh::loadModel(const std::string meshFileName)
{ {
_pModel = new GModel(); _pModel = new GModel();
_pModel->setAsCurrent(); //to check
_pModel->readMSH(meshFileName.c_str()); _pModel->readMSH(meshFileName.c_str());
_meshFileName = meshFileName; _meshFileName = meshFileName;
} }
...@@ -182,6 +183,7 @@ void imperfectionToMesh::addImperfection(imperfectionPart* ip){ ...@@ -182,6 +183,7 @@ void imperfectionToMesh::addImperfection(imperfectionPart* ip){
void imperfectionToMesh::imposeImperfection(const std::string fname){ void imperfectionToMesh::imposeImperfection(const std::string fname){
Msg::Info("Begin writing perturbed mesh"); Msg::Info("Begin writing perturbed mesh");
GModel* dispgmodel = new GModel(); GModel* dispgmodel = new GModel();
dispgmodel->setAsCurrent(); //to check
dispgmodel->readMSH(_meshFileName.c_str()); dispgmodel->readMSH(_meshFileName.c_str());
std::set<MVertex*> allPerturbedVertices; std::set<MVertex*> allPerturbedVertices;
for (int i=0; i<_allImperfectionPart.size(); i++){ for (int i=0; i<_allImperfectionPart.size(); i++){
......
...@@ -26,6 +26,7 @@ void meshModification::loadModel(const std::string meshFileName) ...@@ -26,6 +26,7 @@ void meshModification::loadModel(const std::string meshFileName)
{ {
if (_pModel) delete _pModel; if (_pModel) delete _pModel;
_pModel = new GModel(); _pModel = new GModel();
_pModel->setAsCurrent(); //to check
_pModel->readMSH(meshFileName.c_str()); _pModel->readMSH(meshFileName.c_str());
_meshFileName = meshFileName; _meshFileName = meshFileName;
}; };
...@@ -34,6 +35,7 @@ void meshModification::loadGeo(const std::string geoFile, int dimToMesh, int ord ...@@ -34,6 +35,7 @@ void meshModification::loadGeo(const std::string geoFile, int dimToMesh, int ord
{ {
if (_pModel) delete _pModel; if (_pModel) delete _pModel;
_pModel = new GModel(); _pModel = new GModel();
_pModel->setAsCurrent(); //to check
_pModel->readGEO(geoFile); _pModel->readGEO(geoFile);
// Overwrite options // Overwrite options
CTX::instance()->mesh.order = order; CTX::instance()->mesh.order = order;
...@@ -314,6 +316,7 @@ void QuadToTriangle::loadModel(const std::string meshFileName) ...@@ -314,6 +316,7 @@ void QuadToTriangle::loadModel(const std::string meshFileName)
{ {
if (_pModel) delete _pModel; if (_pModel) delete _pModel;
_pModel = new GModel(); _pModel = new GModel();
_pModel->setAsCurrent(); //to check
_pModel->readMSH(meshFileName.c_str()); _pModel->readMSH(meshFileName.c_str());
}; };
......
...@@ -17103,6 +17103,7 @@ void nonLinearMechSolver::setDisturbedEigenMode(int num, double val, bool flag){ ...@@ -17103,6 +17103,7 @@ void nonLinearMechSolver::setDisturbedEigenMode(int num, double val, bool flag){
void nonLinearMechSolver::writeDisturbedMeshByEigenVector(eigenSolver& eigS, int numberMode, double fact){ void nonLinearMechSolver::writeDisturbedMeshByEigenVector(eigenSolver& eigS, int numberMode, double fact){
Msg::Info("Begin writing deformed mesh"); Msg::Info("Begin writing deformed mesh");
GModel* dispgmodel = new GModel(); GModel* dispgmodel = new GModel();
dispgmodel->setAsCurrent();
dispgmodel->readMSH(_meshFileName.c_str()); dispgmodel->readMSH(_meshFileName.c_str());
std::set<MVertex*> computedVertex; std::set<MVertex*> computedVertex;
   
...@@ -17158,6 +17159,7 @@ void nonLinearMechSolver::setWriteDeformedMeshToFile(bool flag){ ...@@ -17158,6 +17159,7 @@ void nonLinearMechSolver::setWriteDeformedMeshToFile(bool flag){
void nonLinearMechSolver::writeDeformedMesh(int step){ void nonLinearMechSolver::writeDeformedMesh(int step){
Msg::Info("Begin writing deformed mesh"); Msg::Info("Begin writing deformed mesh");
GModel* dispgmodel = new GModel(); GModel* dispgmodel = new GModel();
dispgmodel->setAsCurrent();
dispgmodel->readMSH(_meshFileName.c_str()); dispgmodel->readMSH(_meshFileName.c_str());
std::set<MVertex*> computedVertex; std::set<MVertex*> computedVertex;
   
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
showDataOnMesh::showDataOnMesh(const std::string meshFileName) showDataOnMesh::showDataOnMesh(const std::string meshFileName)
{ {
_pModel = new GModel(); _pModel = new GModel();
_pModel->setAsCurrent(); //to check
_pModel->readMSH(meshFileName.c_str()); _pModel->readMSH(meshFileName.c_str());
_meshFileName = meshFileName; _meshFileName = meshFileName;
...@@ -35,6 +36,7 @@ void showDataOnMesh::dataOnPhysical(int dim, int phys, const std::string partMes ...@@ -35,6 +36,7 @@ void showDataOnMesh::dataOnPhysical(int dim, int phys, const std::string partMes
write_MSH2(_gr,partMeshFile.c_str()); write_MSH2(_gr,partMeshFile.c_str());
_part = new GModel(); _part = new GModel();
_part->setAsCurrent(); //to check
_part->readMSH(partMeshFile.c_str()); _part->readMSH(partMeshFile.c_str());
} }
......
...@@ -28,6 +28,7 @@ strainMapping::~strainMapping(){ ...@@ -28,6 +28,7 @@ strainMapping::~strainMapping(){
void strainMapping::readMesh(const std::string meshFileName){ void strainMapping::readMesh(const std::string meshFileName){
_meshFileName = meshFileName; _meshFileName = meshFileName;
_pModel = new GModel(); _pModel = new GModel();
_pModel->setAsCurrent(); //to check
_pModel->readMSH(meshFileName.c_str()); _pModel->readMSH(meshFileName.c_str());
int dim = _pModel->getNumRegions() ? 3 : 2; int dim = _pModel->getNumRegions() ? 3 : 2;
_g = new elementGroup(); _g = new elementGroup();
......
...@@ -118,6 +118,7 @@ void GeometryRotation::exportRotatedModel(const double e1x, const double e1y, co ...@@ -118,6 +118,7 @@ void GeometryRotation::exportRotatedModel(const double e1x, const double e1y, co
n3.normalize(); n3.normalize();
GModel* pModel = new GModel(); GModel* pModel = new GModel();
pModel->setAsCurrent(); //to check
pModel->readMSH(inMeshFile.c_str()); pModel->readMSH(inMeshFile.c_str());
pModel->setFileName(inMeshFile); pModel->setFileName(inMeshFile);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment