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

trying to allow non-negative family numbers (apparently created by FLUX med export)

parent d829793d
No related branches found
No related tags found
No related merge requests found
...@@ -374,7 +374,7 @@ int GModel::readMED(const std::string &name, int meshIndex) ...@@ -374,7 +374,7 @@ int GModel::readMED(const std::string &name, int meshIndex)
for(int k = 0; k < numNodPerEle; k++) for(int k = 0; k < numNodPerEle; k++)
v[k] = verts[conn[numNodPerEle * j + med2mshNodeIndex(type, k)] - 1]; v[k] = verts[conn[numNodPerEle * j + med2mshNodeIndex(type, k)] - 1];
MElement *e = factory.create(mshType, v, eleTags.empty() ? 0 : eleTags[j]); MElement *e = factory.create(mshType, v, eleTags.empty() ? 0 : eleTags[j]);
if(e) elements[-fam[j]].push_back(e); if(e) elements[std::abs(fam[j])].push_back(e);
} }
_storeElementsInEntities(elements); _storeElementsInEntities(elements);
} }
...@@ -431,12 +431,12 @@ int GModel::readMED(const std::string &name, int meshIndex) ...@@ -431,12 +431,12 @@ int GModel::readMED(const std::string &name, int meshIndex)
#endif #endif
// family tags are unique (for all dimensions) // family tags are unique (for all dimensions)
GEntity *ge; GEntity *ge;
if((ge = getRegionByTag(-familyNum))){} if((ge = getRegionByTag(std::abs(familyNum)))){}
else if((ge = getFaceByTag(-familyNum))){} else if((ge = getFaceByTag(std::abs(familyNum)))){}
else if((ge = getEdgeByTag(-familyNum))){} else if((ge = getEdgeByTag(std::abs(familyNum)))){}
else ge = getVertexByTag(-familyNum); else ge = getVertexByTag(std::abs(familyNum));
if(ge){ if(ge){
elementaryNames[std::pair<int, int>(ge->dim(), -familyNum)] = familyName; elementaryNames[std::pair<int, int>(ge->dim(), std::abs(familyNum))] = familyName;
if(numGroups > 0){ if(numGroups > 0){
for(int j = 0; j < numGroups; j++){ for(int j = 0; j < numGroups; j++){
char tmp[MED_TAILLE_LNOM + 1]; char tmp[MED_TAILLE_LNOM + 1];
...@@ -558,8 +558,9 @@ int GModel::writeMED(const std::string &name, bool saveAll, double scalingFactor ...@@ -558,8 +558,9 @@ int GModel::writeMED(const std::string &name, bool saveAll, double scalingFactor
#endif #endif
Msg::Error("Could not create MED family 0"); Msg::Error("Could not create MED family 0");
// create one family per elementary entity, with one group per // create one family per elementary entity, with one group per physical
// physical entity and no attributes // entity and no attributes; we use negative family numbers, as intructed by
// Code_Aster devs.
for(unsigned int i = 0; i < entities.size(); i++){ for(unsigned int i = 0; i < entities.size(); i++){
if(saveAll || entities[i]->physicals.size()){ if(saveAll || entities[i]->physicals.size()){
int num = - ((int)families.size() + 1); int num = - ((int)families.size() + 1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment