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

create unique physical tags across dimensions, so that MED files can be...

create unique physical tags across dimensions, so that MED files can be converted into MSH with unique physical groups for GetDP
parent 4eb69393
Branches
Tags
No related merge requests found
......@@ -430,7 +430,7 @@ int GModel::getMaxPhysicalNumber(int dim)
getEntities(entities);
int num = 0;
for(unsigned int i = 0; i < entities.size(); i++)
if(entities[i]->dim() == dim)
if(dim < 0 || entities[i]->dim() == dim)
for(unsigned int j = 0; j < entities[i]->physicals.size(); j++)
num = std::max(num, std::abs(entities[i]->physicals[j]));
return num;
......
......@@ -304,7 +304,7 @@ class GModel
void deletePhysicalGroup(int dim, int num);
// return the highest number associated with a physical entity of a
// given dimension
// given dimension (or highest for all dimenions if dim < 0)
int getMaxPhysicalNumber(int dim);
// elementary/physical name iterator
......
......@@ -442,7 +442,9 @@ int GModel::readMED(const std::string &name, int meshIndex)
char tmp[MED_TAILLE_LNOM + 1];
strncpy(tmp, &groupNames[j * MED_TAILLE_LNOM], MED_TAILLE_LNOM);
tmp[MED_TAILLE_LNOM] = '\0';
int pnum = setPhysicalName(tmp, ge->dim());
// don't use same physical number across dimensions, as e.g. getdp
// does not support this
int pnum = setPhysicalName(tmp, ge->dim(), getMaxPhysicalNumber(-1) + 1);
if(std::find(ge->physicals.begin(), ge->physicals.end(), pnum) ==
ge->physicals.end())
ge->physicals.push_back(pnum);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment