if(isCellsLoaded)
if(!isFamilyPresent) return 0;
else if(!aFamily.mySubMesh.empty()) return 0;
+
if(MYDEBUG) {
MESSAGE("LoadCellsOnEntity - theFamilyName = '"<<theFamilyName<<"'");
MESSAGE("LoadCellsOnEntity - isCellsLoaded = "<<isCellsLoaded<<"; isFamilyPresent = "<<isFamilyPresent);
}
+
//Main part of code
int iGeomElemEnd;
med_geometrie_element* aGeomElemVector;
"; iGeomElemEnd = "<<iGeomElemEnd<<"; theFamilyName = '"<<theFamilyName<<"'");
VISU::TMesh &aMesh = myMeshMap[theMeshOnEntity.myMeshName];
int aNbPoints = aMesh.myPointsCoord.size()/aMesh.myDim;
+
for (int iGeomElem = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
+
int medId = getIdMedType(aGeomElemVector[iGeomElem]);
int nbMedNodes = med2vtk[medId].medNbNodes;
int nbVtkNodes = med2vtk[medId].vtkNbNodes;
- int aVtkType = med2vtk[medId].vtkType;
+ int aVtkType = med2vtk[medId].vtkType;
med_geometrie_element aMedType = med2vtk[medId].medType;
med_int iNumElemEnd = MEDnEntMaa(fid,aMeshName,MED_CONN,aMedEntity,aMedType,MED_NOD);
+
if (iNumElemEnd > 0) {
+
med_booleen iname_elem, inum_elem;
valarray<med_int> num_elem(iNumElemEnd), num_fam_elem(iNumElemEnd);
valarray<char> name_elem('\0',iNumElemEnd*MED_TAILLE_PNOM+1);
if(MYDEBUG) MESSAGE("LoadCellsOnEntity - medName = "<<med2vtk[medId].medName<<
"; iNumElemEnd = "<<iNumElemEnd<<"; aNbConnForElem = "<<aNbConnForElem);
valarray<med_int> conn(aNbConnForElem*iNumElemEnd);
+
+ // MODIF 24/09/03 E.F. et Je.R.
+ bool optionnalNumbers = false;
+ map<int,int> optionnalToCanonicNodesNumbers;
+ int * tmp_node_number = new int[aNbPoints] ;
+
+ ret = MEDnumLire(fid,aMeshName, tmp_node_number,aNbPoints,
+ MED_NOEUD, (med_geometrie_element) 0 );
+
+ if ( optionnalNumbers = (ret >= 0) ) {
+ for (int canonicNumber=1; canonicNumber <= aNbPoints ;canonicNumber++)
+ optionnalToCanonicNodesNumbers[tmp_node_number[canonicNumber-1]]=canonicNumber;
+ }
+
+ delete[] tmp_node_number;
+ // END MODIF
+
ret = MEDelementsLire(fid,aMeshName,aMesh.myDim,&conn[0],MED_FULL_INTERLACE,
&name_elem[0],&iname_elem,&num_elem[0],&inum_elem,
&num_fam_elem[0],iNumElemEnd,aMedEntity,aMedType,MED_NOD);
+
if (ret < 0) throw std::runtime_error("LoadCellsOnEntity >> MEDelementsLire(...)");
if(!isCellsLoaded){
VISU::TMeshOnEntity::TConnForCellType& aConnForCellType = theMeshOnEntity.myCellsConn[aVtkType];
aConnForCellType.resize(iNumElemEnd);
valarray<med_int> aConnect(nbMedNodes);
+
+ // Parcours des mailles
for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
VISU::TMeshOnEntity::TConnect& anArray = aConnForCellType[iNumElem];
anArray.resize(nbVtkNodes);
- for (int k = 0, kj = iNumElem*aNbConnForElem; k < nbMedNodes; k++) {
- aConnect[k] = conn[kj+k] - 1;
- }
+
+ // MODIF 24/09/03 E.F. et Je.R.
+ if ( optionnalNumbers )
+ for (int k = 0, kj = iNumElem*aNbConnForElem; k < nbMedNodes; k++) {
+ aConnect[k] = optionnalToCanonicNodesNumbers[conn[kj+k]] - 1;
+ }
+ else
+ for (int k = 0, kj = iNumElem*aNbConnForElem; k < nbMedNodes; k++) {
+ aConnect[k] = conn[kj+k] - 1;
+ };
+ // END MODIF
+
switch(aMedType){
case MED_TETRA4 :
case MED_TETRA10 :