diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index 79c482bdeee8dfbf068d490a78ffc1b20ac95e44..ed620e77db2729e6701566bcd4bfd8ebb2f8ae54 100644 --- a/Geo/GModel.cpp +++ b/Geo/GModel.cpp @@ -471,7 +471,7 @@ int GModel::getPhysicalNumber(const int &dim, const std::string &name) return -1; } -int GModel::getDim() +int GModel::getDim() const { if(getNumRegions() > 0) return 3; if(getNumFaces() > 0) return 2; diff --git a/Geo/GModel.h b/Geo/GModel.h index f8f97c37be9b78b502eb4354b15f95ed2b9f83bb..77e3415daa12e9d18872c14e0efe7b62a8d91eda 100644 --- a/Geo/GModel.h +++ b/Geo/GModel.h @@ -48,7 +48,8 @@ class GModel int _writeMSH2(const std::string &name, double version=2.2, bool binary=false, bool saveAll=false, bool saveParametric=false, double scalingFactor=1.0, int elementStartNum=0, - int saveSinglePartition=0); + int saveSinglePartition=0, + bool multipleView=false); protected: // the name of the model @@ -299,7 +300,7 @@ class GModel std::string getElementaryName(int dim, int num); //get the highest dimension of the GModel - int getDim(); + int getDim() const; // set the selection flag on all entities void setSelection(int val); @@ -554,7 +555,7 @@ class GModel int writeMSH(const std::string &name, double version=2.2, bool binary=false, bool saveAll=false, bool saveParametric=false, double scalingFactor=1.0, int elementStartNum=0, - int saveSinglePartition=0); + int saveSinglePartition=0, bool multipleView=false); int writePartitionedMSH(const std::string &baseName, bool binary=false, bool saveAll=false, bool saveParametric=false, double scalingFactor=1.0); diff --git a/Geo/GModelIO_MSH.cpp b/Geo/GModelIO_MSH.cpp index bbff62863647a5f66bca516b9be2b91320727d2a..023ffc6704d1bc80f103e2ceb57539056eedae36 100644 --- a/Geo/GModelIO_MSH.cpp +++ b/Geo/GModelIO_MSH.cpp @@ -373,13 +373,17 @@ static void writeElementsMSH(FILE *fp, GModel *model, GEntity *ge, std::vector<T int GModel::writeMSH(const std::string &name, double version, bool binary, bool saveAll, bool saveParametric, double scalingFactor, int elementStartNum, - int saveSinglePartition) + int saveSinglePartition,bool multipleView ) { if(version < 3) return _writeMSH2(name, version, binary, saveAll, saveParametric, - scalingFactor, elementStartNum, saveSinglePartition); + scalingFactor, elementStartNum, saveSinglePartition,multipleView); - FILE *fp = fopen(name.c_str(), binary ? "wb" : "w"); + FILE *fp; + if(multipleView) + fp = fopen(name.c_str(), binary ? "ab" : "a"); + else + fp = fopen(name.c_str(), binary ? "wb" : "w"); if(!fp){ Msg::Error("Unable to open file '%s'", name.c_str()); return 0; diff --git a/Geo/GModelIO_MSH2.cpp b/Geo/GModelIO_MSH2.cpp index 5d2ddaae236f0391b977b02b8e669b280481a033..85bdc629fce34cac35b3aac0213e4049bb8c6129 100644 --- a/Geo/GModelIO_MSH2.cpp +++ b/Geo/GModelIO_MSH2.cpp @@ -816,9 +816,13 @@ static int getNumElementsMSH(GModel *m, bool saveAll, int saveSinglePartition) int GModel::_writeMSH2(const std::string &name, double version, bool binary, bool saveAll, bool saveParametric, double scalingFactor, - int elementStartNum, int saveSinglePartition) + int elementStartNum, int saveSinglePartition,bool multipleView) { - FILE *fp = fopen(name.c_str(), binary ? "wb" : "w"); + FILE *fp; + if(multipleView) + fp = fopen(name.c_str(), binary ? "ab" : "a"); + else + fp = fopen(name.c_str(), binary ? "wb" : "w"); if(!fp){ Msg::Error("Unable to open file '%s'", name.c_str()); return 0; diff --git a/Post/PViewDataGModel.h b/Post/PViewDataGModel.h index d436e746d11c1ea529e347b8a31b48e81ce50f2a..103ba9259f60347c464c358be4f001f3381959c6 100644 --- a/Post/PViewDataGModel.h +++ b/Post/PViewDataGModel.h @@ -10,7 +10,7 @@ #include "GModel.h" #include "SBoundingBox3d.h" -template<class real> +template<class Real> class stepData{ private: // a pointer to the underlying model @@ -34,7 +34,7 @@ class stepData{ // optimal. This is the price to pay if we want 1) rapid access to // the data and 2) not to store any additional info in MVertex or // MElement) - std::vector<real*> *_data; + std::vector<Real*> *_data; // a vector containing the multiplying factor allowing to compute // the number of values stored in _data for each index (number of // values = getMult() * getNumComponents()). If _mult is empty, a @@ -52,7 +52,7 @@ class stepData{ _min(min), _max(max), _numComp(numComp), _data(0) { } - stepData(stepData<real> &other) : _data(0) + stepData(stepData<Real> &other) : _data(0) { _model = other._model; _entities = other._entities; @@ -65,12 +65,12 @@ class stepData{ _numComp = other._numComp; if(other._data){ int n = other.getNumData(); - _data = new std::vector<real*>(n, (real*)0); + _data = new std::vector<Real*>(n, (Real*)0); for(int i = 0; i < n; i++){ - real *d = other.getData(i); + Real *d = other.getData(i); if(d){ int m = other.getMult(i) * _numComp; - (*_data)[i] = new real[m]; + (*_data)[i] = new Real[m]; for(int j = 0; j < m; j++) (*_data)[i][j] = d[j]; } } @@ -109,15 +109,15 @@ class stepData{ } void resizeData(int n) { - if(!_data) _data = new std::vector<real*>(n, (real*)0); - if(n > (int)_data->size()) _data->resize(n, (real*)0); + if(!_data) _data = new std::vector<Real*>(n, (Real*)0); + if(n > (int)_data->size()) _data->resize(n, (Real*)0); } - real *getData(int index, bool allocIfNeeded=false, int mult=1) + Real *getData(int index, bool allocIfNeeded=false, int mult=1) { if(allocIfNeeded){ if(index >= getNumData()) resizeData(index + 100); // optimize this if(!(*_data)[index]){ - (*_data)[index] = new real[_numComp * mult]; + (*_data)[index] = new Real[_numComp * mult]; for(int i = 0; i < _numComp * mult; i++) (*_data)[index][i] = 0.; } if(mult > 1){ @@ -234,12 +234,14 @@ class PViewDataGModel : public PViewData { bool addData(GModel *model, std::map<int, std::vector<double> > &data, int step, double time, int partition, int numComp); + // Allow to destroy the data + void destroyData(); // I/O routines bool readMSH(const std::string &viewName, const std::string &fileName, int fileIndex, FILE *fp, bool binary, bool swap, int step, double time, int partition, int numComp, int numNodes, const std::string &interpolationScheme); - bool writeMSH(const std::string &fileName, bool binary=false, bool savemesh=true); + bool writeMSH(const std::string &fileName, bool binary=false, bool savemesh=true,bool multipleView=false); bool readMED(const std::string &fileName, int fileIndex); bool writeMED(const std::string &fileName); }; diff --git a/Post/PViewDataGModelIO.cpp b/Post/PViewDataGModelIO.cpp index a635925a3144b12236471a77bba84f5e845ba393..2c3e0ace838b17298115b83fb21c606ce0bff4ef 100644 --- a/Post/PViewDataGModelIO.cpp +++ b/Post/PViewDataGModelIO.cpp @@ -46,6 +46,14 @@ bool PViewDataGModel::addData(GModel *model, std::map<int, std::vector<double> > return true; } +void PViewDataGModel::destroyData() +{ + for(unsigned int i=0;i<_steps.size();i++) + { + _steps[i]->destroyData(); + } +} + bool PViewDataGModel::readMSH(const std::string &viewName, const std::string &fileName, int fileIndex, FILE *fp, bool binary, bool swap, int step, double time, int partition, int numComp, @@ -125,7 +133,7 @@ bool PViewDataGModel::readMSH(const std::string &viewName, const std::string &fi return true; } -bool PViewDataGModel::writeMSH(const std::string &fileName, bool binary, bool savemesh) +bool PViewDataGModel::writeMSH(const std::string &fileName, bool binary, bool savemesh,bool multipleView) { if(_steps.empty()) return true; @@ -139,7 +147,7 @@ bool PViewDataGModel::writeMSH(const std::string &fileName, bool binary, bool sa bool writeNodesAndElements = savemesh; FILE *fp; if(writeNodesAndElements){ - if(!model->writeMSH(fileName, 2.0, binary)) return false; + if(!model->writeMSH(fileName, 2.0, binary,false,false,1.0,0,0,multipleView)) return false; // append data fp = fopen(fileName.c_str(), binary ? "ab" : "a"); if(!fp){ @@ -148,7 +156,10 @@ bool PViewDataGModel::writeMSH(const std::string &fileName, bool binary, bool sa } } else{ - fp = fopen(fileName.c_str(), binary ? "wb" : "w"); + if(multipleView) + fp = fopen(fileName.c_str(), binary ? "ab" : "a"); + else + fp = fopen(fileName.c_str(), binary ? "wb" : "w"); if(!fp){ Msg::Error("Unable to open file '%s'", fileName.c_str()); return false; diff --git a/contrib/blossom/concorde97/XSTUFF/Xclique.c b/contrib/blossom/concorde97/XSTUFF/Xclique.c index a89741e0863c65d52da9832800d94520d15024fc..3571f51fb3c4721ffb7ca3883e91abd1f657898a 100644 --- a/contrib/blossom/concorde97/XSTUFF/Xclique.c +++ b/contrib/blossom/concorde97/XSTUFF/Xclique.c @@ -1143,15 +1143,15 @@ Xnodeptr *u1, *u2, *u3, *u4, *u5; #endif { printf ("U1: "); - nodeptr_print (u1); + nodeptr_print (G,u1); printf ("U2: "); - nodeptr_print (u2); + nodeptr_print (G,u2); printf ("U3: "); - nodeptr_print (u3); + nodeptr_print (G,u3); printf ("U4: "); - nodeptr_print (u4); + nodeptr_print (G,u4); printf ("U5: "); - nodeptr_print (u5); + nodeptr_print (G,u5); } #endif /* DEBUG */ diff --git a/contrib/blossom/concorde97/XSTUFF/Xgomhu.c b/contrib/blossom/concorde97/XSTUFF/Xgomhu.c index af8b4f685e365d2efdc3307e68cff73094aa9794..5ff2bd0a9e632e26c18a36bf8cabfef982ccd365 100644 --- a/contrib/blossom/concorde97/XSTUFF/Xgomhu.c +++ b/contrib/blossom/concorde97/XSTUFF/Xgomhu.c @@ -55,10 +55,10 @@ static int #ifdef DEBUG #ifdef CC_PROTOTYPE_ANSI static void - dumpcutcadj (Xgraph *G), + dumpcutcadj (Xgraph *G); #else static void - dumpcutcadj (), + dumpcutcadj (); #endif #endif diff --git a/contrib/mmg3d/build/sources/eigenv.c b/contrib/mmg3d/build/sources/eigenv.c index 8a75bd32b24001c5cf92da39a9c062deba91cbd3..6a4bf0bf71ff67e09942df5e1b638952657e0b3b 100644 --- a/contrib/mmg3d/build/sources/eigenv.c +++ b/contrib/mmg3d/build/sources/eigenv.c @@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0 Co-auteurs : Cecile Dobrzynski et Pascal Frey. Propriétaires :IPB - UPMC -INRIA. -Copyright © 2004-2005-2006-2007-2008-2009-2010-2011, +Copyright © 2004-2005-2006-2007-2008-2009-2010-2011, diffusé sous les termes et conditions de la licence publique générale de GNU -Version 3 ou toute version ultérieure. +Version 3 ou toute version ultérieure. Ce fichier est une partie de MMG3D. MMG3D est un logiciel libre ; vous pouvez le redistribuer et/ou le modifier suivant les termes de la licence publique générale de GNU Version 3 ou toute version ultérieure. -MMG3D est distribué dans l'espoir qu'il sera utile, mais SANS -AUCUNE GARANTIE ; sans même garantie de valeur marchande. +MMG3D est distribué dans l'espoir qu'il sera utile, mais SANS +AUCUNE GARANTIE ; sans même garantie de valeur marchande. Voir la licence publique générale de GNU pour plus de détails. -MMG3D est diffusé en espérant qu’il sera utile, -mais SANS AUCUNE GARANTIE, ni explicite ni implicite, -y compris les garanties de commercialisation ou -d’adaptation dans un but spécifique. +MMG3D est diffusé en espérant qu’il sera utile, +mais SANS AUCUNE GARANTIE, ni explicite ni implicite, +y compris les garanties de commercialisation ou +d’adaptation dans un but spécifique. Reportez-vous à la licence publique générale de GNU pour plus de détails. -Vous devez avoir reçu une copie de la licence publique générale de GNU -en même temps que ce document. +Vous devez avoir reçu une copie de la licence publique générale de GNU +en même temps que ce document. Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>. /**************************************************************************** Initial software: MMG3D Version 4.0 Co-authors: Cecile Dobrzynski et Pascal Frey. Owners: IPB - UPMC -INRIA. -Copyright © 2004-2005-2006-2007-2008-2009-2010-2011, -spread under the terms and conditions of the license GNU General Public License +Copyright © 2004-2005-2006-2007-2008-2009-2010-2011, +spread under the terms and conditions of the license GNU General Public License as published Version 3, or (at your option) any later version. This file is part of MMG3D @@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with MMG3D. If not, see <http://www.gnu.org/licenses/>. +along with MMG3D. If not, see <http://www.gnu.org/licenses/>. ****************************************************************************/ #include <stdio.h> #include <string.h> @@ -55,20 +55,20 @@ along with MMG3D. If not, see <http://www.gnu.org/licenses/>. #define EPSX2 2.e-06 #define MAXTOU 50 -/* check if numbers are equal */ +/* check if numbers are equal */ #define egal(x,y) ( \ ( ((x) == 0.0f) ? (fabs(y) < EPS) : \ ( ((y) == 0.0f) ? (fabs(x) < EPS) : \ (fabs((x)-(y)) / (fabs(x) + fabs(y)) < EPSX2) ) ) ) -static double Id[3][3] = { +static double Id[3][3] = { {1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0} }; -/* find root(s) of polynomial: P(x)= x^3+bx^2+cx+d +/* find root(s) of polynomial: P(x)= x^3+bx^2+cx+d return 1: 3 roots, 2: 2 roots, 3: 1 root */ static int newton3(double p[4],double x[3]) { double b,c,d,da,db,dc,epsd; @@ -152,7 +152,7 @@ static int newton3(double p[4],double x[3]) { } return(n); } - + else { #ifdef DEBUG fprintf(stderr," ## ERR 9101, newton3: no real roots\n"); @@ -204,7 +204,7 @@ static int newton3(double p[4],double x[3]) { db = b + x[0]; dc = c + x[0]*db; delta = db*db - 4.0*dc; - + if ( delta <= 0.0 ) { fprintf(stderr," ## ERR 9103, newton3, det = 0.\n"); return(0); @@ -214,7 +214,7 @@ static int newton3(double p[4],double x[3]) { x[1] = 0.5 * (-db+delta); x[2] = 0.5 * (-db-delta); -#ifdef DEBUG +#ifdef DEBUG /* check for root accuracy */ fx = d + x[1]*(c+x[1]*(b+x[1])); if ( fabs(fx) > EPSD2 ) { @@ -226,7 +226,6 @@ static int newton3(double p[4],double x[3]) { fprintf(stderr," ## ERR 9104, newton3: fx= %E x= %E\n",fx,x[2]); return(0); } - } #endif return(n); @@ -234,7 +233,7 @@ static int newton3(double p[4],double x[3]) { /* find eigenvalues and vectors of a 3x3 symmetric definite - * positive matrix + * positive matrix * return order of eigenvalues (1,2,3) or 0 if failed */ int eigenv(int symmat,double *mat,double lambda[3],double v[3][3]) { double a11,a12,a13,a21,a22,a23,a31,a32,a33; @@ -277,7 +276,7 @@ int eigenv(int symmat,double *mat,double lambda[3],double v[3][3]) { a21 = a12; a31 = a13; a32 = a23; - + /* build characteristic polynomial P(X) = X^3 - trace X^2 + (somme des mineurs)X - det = 0 */ aa = a11*a22; @@ -334,7 +333,7 @@ int eigenv(int symmat,double *mat,double lambda[3],double v[3][3]) { cc = a21*a32 - a31*a22; ee = a11*a33 - a13*a31; ii = a11*a22 - a12*a21; - + p[0] = -a11*aa - a12*bb - a13*cc; p[1] = aa + ee + ii; p[2] = -a11 - a22 - a33; @@ -394,7 +393,7 @@ int eigenv(int symmat,double *mat,double lambda[3],double v[3][3]) { } } else { - if ( dd2 > dd3 ) { + if ( dd2 > dd3 ) { dd2 = 1.0 / sqrt(dd2); v[k][0] = vx2[0] * dd2; v[k][1] = vx2[1] * dd2; @@ -405,7 +404,7 @@ int eigenv(int symmat,double *mat,double lambda[3],double v[3][3]) { v[k][0] = vx3[0] * dd3; v[k][1] = vx3[1] * dd3; v[k][2] = vx3[2] * dd3; - } + } } } } @@ -421,7 +420,7 @@ int eigenv(int symmat,double *mat,double lambda[3],double v[3][3]) { vx1[1] = w1[2]*w3[0] - w1[0]*w3[2]; vx1[2] = w1[0]*w3[1] - w1[1]*w3[0]; dd1 = vx1[0]*vx1[0] + vx1[1]*vx1[1] + vx1[2]*vx1[2]; - + vx2[0] = w1[1]*w2[2] - w1[2]*w2[1]; vx2[1] = w1[2]*w2[0] - w1[0]*w2[2]; vx2[2] = w1[0]*w2[1] - w1[1]*w2[0]; @@ -529,7 +528,7 @@ int eigenv(int symmat,double *mat,double lambda[3],double v[3][3]) { v[0][0]*v[2][0]+v[0][1]*v[2][1]+ v[0][2]*v[2][2]); printf("v2.v3 = %.14f\n", v[1][0]*v[2][0]+v[1][1]*v[2][1]+ v[1][2]*v[2][2]); - + printf("Consistency\n"); for (i=0; i<3; i++) { tmpx = v[0][i]*m[0] + v[1][i]*m[1] @@ -540,7 +539,7 @@ int eigenv(int symmat,double *mat,double lambda[3],double v[3][3]) { + v[2][i]*m[5] - lambda[i]*v[2][i]; printf(" Av %d - lambda %d *v %d = %f %f %f\n", i,i,i,tmpx,tmpy,tmpz); - + printf("w1 %f %f %f\n",w1[0],w1[1],w1[2]); printf("w2 %f %f %f\n",w2[0],w2[1],w2[2]); printf("w3 %f %f %f\n",w3[0],w3[1],w3[2]); @@ -569,7 +568,7 @@ int eigen2(double *mm,double *lambda,double vp[2][2]) { if ( fabs(m[2]) > xn ) xn = fabs(m[2]); if ( xn < EPSD2 ) { lambda[0] = lambda[1] = 0.0; - vp[0][0] = 1.0; + vp[0][0] = 1.0; vp[0][1] = 0.0; vp[1][0] = 0.0; vp[1][1] = 1.0; @@ -599,7 +598,7 @@ int eigen2(double *mm,double *lambda,double vp[2][2]) { if ( fabs(a1) < EPS ) { rr1 = 0.5 * sqrt(ddeltb); rr2 = -rr1; - } + } else if ( a1 < 0.0 ) { rr1 = 0.5 * (-a1 + ddeltb); rr2 = (-m[1]*m[1] + m[0]*m[2]) / rr1; @@ -623,7 +622,7 @@ vect: if ( fabs(a1)+fabs(m[1]) < EPS ) { if (fabs(lambda[1]) < fabs(lambda[0]) ) { ux = 1.0; - uy = 0.0; + uy = 0.0; } else { ux = 0.0;