diff --git a/Geo/Chain.cpp b/Geo/Chain.cpp index 02efc4d15f817952f0abd75cdd788e0c7ee4a5d5..c837aa7d6bd6ef2a5ad0383c542bf6ade6d3d015 100644 --- a/Geo/Chain.cpp +++ b/Geo/Chain.cpp @@ -27,7 +27,8 @@ void updateFltk() #endif } -std::string convertInt(int number){ +std::string convertInt(int number) +{ std::stringstream stream; stream << number; return stream.str(); @@ -49,8 +50,7 @@ inline void ElemChain::_sortVertexIndices() } void findEntitiesInPhysicalGroups -(GModel* m, const std::vector<int>& physicalGroups, -std::vector<GEntity*>& entities) +(GModel* m, const std::vector<int>& physicalGroups, std::vector<GEntity*>& entities) { std::map<int, std::vector<GEntity*> > groups[4]; m->getPhysicalGroups(groups); diff --git a/Geo/Chain.h b/Geo/Chain.h index fb1f2afb3eddafad35c7502bac16155a9efc39c7..f1b73ac2e00669996cc17bf7c42d123409d260ff 100644 --- a/Geo/Chain.h +++ b/Geo/Chain.h @@ -465,14 +465,18 @@ Chain<C>& Chain<C>::operator*=(const C& coeff) } template <class C> -int Chain<C>::addToModel(GModel* m, bool post, - int physicalNumRequest) const +int Chain<C>::addToModel(GModel* m, bool post, int physicalNumRequest) const { if(this->isZero()) { Msg::Info("A chain is zero element of C%d, not added to the model", this->getDim()); return -1; } + + std::string name = _name; + // avoid too long names, which screw up the GUI and the msh file + if(name.size() > 128) name.resize(128); + std::vector<MElement*> elements; std::map<int, std::vector<double> > data; int dim = this->getDim(); @@ -511,16 +515,16 @@ int Chain<C>::addToModel(GModel* m, bool post, entityMap[entityNum] = elements; std::map<int, std::map<int, std::string> > physicalMap; std::map<int, std::string> physicalInfo; - physicalInfo[physicalNum] = _name; + physicalInfo[physicalNum] = name; physicalMap[entityNum] = physicalInfo; m->storeChain(dim, entityMap, physicalMap); - m->setPhysicalName(_name, dim, physicalNum); + m->setPhysicalName(name, dim, physicalNum); #if defined(HAVE_POST) if(post && CTX::instance()->batch == 0) { // create PView for instant visualization std::string pnum = convertInt(physicalNum); - std::string postname = pnum + "=" + _name; + std::string postname = pnum + "=" + name; PView* view = new PView(postname, "ElementData", m, data, 0., 1); // the user should be interested about the orientations int size = 30; diff --git a/Geo/Homology.cpp b/Geo/Homology.cpp index 77a99110425fe16420cf0842ec38f24621f8f29f..d8f857bb3d02ef7705dcb673f7b0e6cae2be2b39 100644 --- a/Geo/Homology.cpp +++ b/Geo/Homology.cpp @@ -624,6 +624,7 @@ std::string Homology::_getDomainString(const std::vector<int>& domain, } domainString += "}"; } + return domainString; } @@ -673,4 +674,3 @@ void Homology::storeCells(CellComplex* cellComplex, int dim) } #endif -