Skip to content
Snippets Groups Projects
Commit 79e2c740 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

limit export name length

parent 5b08f736
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
......@@ -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;
......
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment