Salome HOME
MEDReader ready -> debug is in progress.
authorageay <ageay>
Mon, 29 Jul 2013 10:45:10 +0000 (10:45 +0000)
committerageay <ageay>
Mon, 29 Jul 2013 10:45:10 +0000 (10:45 +0000)
src/MEDCoupling/MEDCoupling1GTUMesh.cxx
src/MEDCoupling/MEDCoupling1GTUMesh.hxx
src/MEDCoupling/MEDCouplingPointSet.hxx
src/MEDCoupling/MEDCouplingUMeshDesc.cxx
src/MEDCoupling/MEDCouplingUMeshDesc.hxx
src/MEDLoader/MEDFileMesh.cxx

index 6b820629056a169c2ecd0e05216406cce5365c1d..193b34f2fac44a4789f240039801c6a0c9bfbff2 100644 (file)
@@ -1192,6 +1192,25 @@ MEDCouplingPointSet *MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoords2(int star
   return ret.retn();
 }
 
+void MEDCoupling1SGTUMesh::computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const throw(INTERP_KERNEL::Exception)
+{
+  int sz((int)nodeIdsInUse.size());
+  int nbCells(getNumberOfCells());
+  int nbOfNodesPerCell(getNumberOfNodesPerCell());
+  const int *w(_conn->begin());
+  for(int i=0;i<nbCells;i++)
+    for(int j=0;j<nbOfNodesPerCell;j++,w++)
+      {
+        if(*w>=0 && *w<sz)
+          nodeIdsInUse[*w]=true;
+        else
+          {
+            std::ostringstream oss; oss << "MEDCoupling1SGTUMesh::computeNodeIdsAlg : At cell #" << i << " presence of node id #" << *w << " should be in [0," << sz << ") !";
+            throw INTERP_KERNEL::Exception(oss.str().c_str());
+          }
+      }
+}
+
 MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception)
 {
   MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh(getName().c_str(),*_cm));
@@ -2177,6 +2196,25 @@ MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoords2(int star
   return ret.retn();
 }
 
+void MEDCoupling1DGTUMesh::computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const throw(INTERP_KERNEL::Exception)
+{
+  int sz((int)nodeIdsInUse.size());
+  int nbCells(getNumberOfCells());
+  const int *w(_conn->begin()),*wi(_conn_indx->begin());
+  for(int i=0;i<nbCells;i++,wi++)
+    for(const int *pt=w+wi[0];pt!=w+wi[1];pt++)
+      if(*pt!=-1)
+        {
+          if(*pt>=0 && *pt<sz)
+            nodeIdsInUse[*pt]=true;
+          else
+            {
+              std::ostringstream oss; oss << "MEDCoupling1DGTUMesh::computeNodeIdsAlg : At cell #" << i << " presence of node id #" << *pt << " should be in [0," << sz << ") !";
+              throw INTERP_KERNEL::Exception(oss.str().c_str());
+            }
+        }
+}
+
 void MEDCoupling1DGTUMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const throw(INTERP_KERNEL::Exception)
 {
   checkFullyDefined();
index 6cfebda37fdccb6038a7ccffe9936aa4c41018f8..32be52338dfcf6cc171fcd47fd67d448853c6772 100644 (file)
@@ -116,6 +116,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
     MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const int *begin, const int *end) const;
     MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoords2(int start, int end, int step) const;
+    MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector<int>& tinyInfo) const;
@@ -185,6 +186,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
     MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const int *begin, const int *end) const;
     MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoords2(int start, int end, int step) const;
+    MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector<int>& tinyInfo) const;
index 26471e5398d175706054d80b27e517822a43de92..b6f5ada5083f2dd41ed73e92d86fe70bb4824791 100644 (file)
@@ -75,6 +75,7 @@ namespace ParaMEDMEM
     virtual DataArrayInt *mergeNodes(double precision, bool& areNodesMerged, int& newNbOfNodes);
     virtual DataArrayInt *mergeNodes2(double precision, bool& areNodesMerged, int& newNbOfNodes);
     virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const = 0;
+    virtual void computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const throw(INTERP_KERNEL::Exception) = 0;
     void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const throw(INTERP_KERNEL::Exception);
     DataArrayInt *buildPermArrayForMergeNode(double precision, int limitNodeId, bool& areNodesMerged, int& newNbOfNodes) const;
     DataArrayInt *getNodeIdsNearPoint(const double *pos, double eps) const throw(INTERP_KERNEL::Exception);
index cce7da8d81252c626c6b588aced6018fae50b345..6f5a9ec2aba651ed46fb6dce4196a4ae75a0187c 100644 (file)
@@ -423,6 +423,11 @@ MEDCouplingPointSet *MEDCouplingUMeshDesc::buildPartOfMySelfKeepCoords2(int star
   throw INTERP_KERNEL::Exception("Not implemented yet !");
 }
 
+void MEDCouplingUMeshDesc::computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const throw(INTERP_KERNEL::Exception)
+{
+  throw INTERP_KERNEL::Exception("Not implemented yet !");
+}
+
 DataArrayInt *MEDCouplingUMeshDesc::simplexize(int policy) throw(INTERP_KERNEL::Exception)
 {
   throw INTERP_KERNEL::Exception("MEDCouplingUMeshDesc::simplexize : Not implemented yet !");
index bed0e3ae16799bbb73694bd2d5c2e276f8b823c0..e26b63d4465f77ed33bb8249f95668574ea4424e 100644 (file)
@@ -77,6 +77,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT void fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const;
     MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const int *begin, const int *end) const;
     MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoords2(int start, int end, int step) const;
+    MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfNode(const int *start, const int *end, bool fullyIn) const;
     MEDCOUPLING_EXPORT MEDCouplingPointSet *buildFacePartOfMySelfNode(const int *start, const int *end, bool fullyIn) const;
     MEDCOUPLING_EXPORT DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
index 222b914c3d98eb79981d557ce7d11bd6a4fea510..918bd4baa9d77ceafac9c6c6d3d5bf31c1e1ca23 100644 (file)
@@ -2631,29 +2631,14 @@ void MEDFileUMesh::whichAreNodesFetched(const MEDFileField1TSStructItem& st, con
   for(std::size_t i=0;i<sz;i++)
     {
       INTERP_KERNEL::NormalizedCellType curGt(st[i].getGeo());
-      const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(curGt);
-      int relDim((int)cm.getDimension()-mdim);
-      MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> um(getMeshAtLevel(relDim));
-      std::vector<int> d(um->getDistributionOfTypes());
-      std::size_t nbOfTypes(d.size()/3);
-      int offset=0,nbOfEltWT=-1;
-      for(std::size_t j=0;j<nbOfTypes;j++)
-        {
-          if(d[3*j]!=(int)curGt)
-            offset+=d[3*j+1];
-          else
-            { nbOfEltWT=d[3*j+1]; break; }
-        }
-      if(nbOfEltWT==-1)
-        throw INTERP_KERNEL::Exception("MEDFileUMesh::whichAreNodesFetched : asking for a geo type not present in this !");
-      um=dynamic_cast<MEDCouplingUMesh *>(um->buildPartOfMySelf2(offset,offset+nbOfEltWT,1,true));
+      const MEDCoupling1GTUMesh *m(getDirectUndergroundSingleGeoTypeMesh(curGt));
       if(st[i].getPflName().empty())
-        um->computeNodeIdsAlg(nodesFetched);
+        m->computeNodeIdsAlg(nodesFetched);
       else
         {
           const DataArrayInt *arr(globs->getProfile(st[i].getPflName().c_str()));
-          um=dynamic_cast<MEDCouplingUMesh *>(um->buildPartOfMySelf(arr->begin(),arr->end(),true));
-          um->computeNodeIdsAlg(nodesFetched);
+          MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> m2(dynamic_cast<MEDCoupling1GTUMesh *>(m->buildPartOfMySelf(arr->begin(),arr->end(),true)));
+          m2->computeNodeIdsAlg(nodesFetched);
         }
     }
 }