From 27bcadf21b85a396932bfbd60f9535a4642d328c Mon Sep 17 00:00:00 2001 From: Gaetan Bricteux <gaetan.bricteux@uclouvain.be> Date: Tue, 18 Oct 2011 16:15:37 +0000 Subject: [PATCH] fix saveTri --- Geo/MElement.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Geo/MElement.cpp b/Geo/MElement.cpp index 0d1da05eb7..10ee6c994c 100644 --- a/Geo/MElement.cpp +++ b/Geo/MElement.cpp @@ -624,19 +624,20 @@ void MElement::writeMSH(FILE *fp, double version, bool binary, int num, int par = (parentNum) ? 1 : 0; int dom = (dom1Num) ? 2 : 0; bool poly = (type == MSH_POLYG_ || type == MSH_POLYH_ || type == MSH_POLYG_B); - bool polyb = (type == MSH_LIN_B ); + bool polyl = (type == MSH_LIN_B || type == MSH_LIN_C); // if poly loop over children - if ( CTX::instance()->mesh.saveTri && poly){ + if(CTX::instance()->mesh.saveTri && poly){ for (int i = 0; i < getNumChildren() ; i++){ MElement *t = getChild(i); - t->writeMSH(fp, version,binary,num,elementary,physical,0,0,0,ghosts); + t->writeMSH(fp, version, binary, num, elementary, physical, 0, 0, 0, ghosts); } return; } - else if (CTX::instance()->mesh.saveTri && polyb){ - MLine *l = (MLine*)this; - l->writeMSH(fp, version,binary,num,elementary,physical, 0,0,0,ghosts); + else if(CTX::instance()->mesh.saveTri && polyl){ + MLine *l = new MLine(getVertex(0), getVertex(1)); + l->writeMSH(fp, version, binary, num, elementary, physical, 0, 0, 0, ghosts); + delete l; return; } -- GitLab