Salome HOME
Typo and whitespace fixes by Kunda
[tools/medcoupling.git] / src / MEDLoader / MEDFileFieldOverView.cxx
index 8a52bf254091939ea398b5c06cc83594693af257..96feb1ddc6fc3d69f8f79cfff05e9190c1f9a3b2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -28,7 +28,7 @@
 using namespace MEDCoupling;
 
 const unsigned char MEDMeshMultiLev::PARAMEDMEM_2_VTKTYPE[MEDMeshMultiLev::PARAMEDMEM_2_VTKTYPE_LGTH]=
-{1,3,21,5,9,7,22,34,23,28,255,255,255,255,10,14,13,255,12,255,24,255,16,27,255,26,255,29,255,255,25,42,36,4};
+{1,3,21,5,9,7,22,34,23,28,35,255,255,255,10,14,13,255,12,255,24,255,16,27,255,26,255,29,32,255,25,42,36,4};
 
 const unsigned char MEDMeshMultiLev::HEXA27_PERM_ARRAY[27]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,24,22,21,23,20,25,26};
 
@@ -391,6 +391,30 @@ void MEDMeshMultiLev::retrieveNumberIdsOnNodes(DataArrayInt *& numIds, bool& isW
     }
 }
 
+/*!
+ * This method returns, if any, a new object containing the global node ids **BUT CONTRARY TO OTHER RETRIEVE METHODS** the returned object is always a NON AGGREGATED object. So the returned object if not null
+ * can be used as this safely.
+ */
+DataArrayInt *MEDMeshMultiLev::retrieveGlobalNodeIdsIfAny() const
+{
+  const MEDFileUMesh *umesh(dynamic_cast<const MEDFileUMesh *>(_mesh));
+  if(!umesh)
+    return 0;
+  const PartDefinition *pd(umesh->getPartDefAtLevel(1));
+  if(!pd)
+    return 0;
+  MCAuto<DataArrayInt> tmp(pd->toDAI());
+  const DataArrayInt *tmpCpp(tmp);
+  if(!tmpCpp)
+    return 0;
+  //
+  const DataArrayInt *nr(_node_reduction);
+  if(nr)
+    return tmp->selectByTupleIdSafe(nr->begin(),nr->end());
+  else
+    return tmp->deepCopy();// Yes a deep copy is needed because this method has to return a non aggregated object !
+}
+
 std::vector< INTERP_KERNEL::NormalizedCellType > MEDMeshMultiLev::getGeoTypes() const
 {
   return _geo_types;
@@ -1336,7 +1360,7 @@ MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<INTE
   if(!m)
     throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : null input pointer !");
   if(gts.size()!=1 || pfls.size()!=1)
-    throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : lengthes of gts and pfls must be equal to one !");
+    throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : lengths of gts and pfls must be equal to one !");
   int mdim(m->getMeshDimension());
   INTERP_KERNEL::NormalizedCellType gt(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(mdim));
   if(gt==gts[0])
@@ -1432,7 +1456,7 @@ MEDMeshMultiLev *MEDCMeshMultiLev::prepare() const
 }
 
 /*!
- * \a param [out] isInternal if true the returned pointers are those in main data structure. If false those pointers have been built espacially for that method.
+ * \a param [out] isInternal if true the returned pointers are those in main data structure. If false those pointers have been built especially for that method.
  */
 std::vector< DataArrayDouble * > MEDCMeshMultiLev::buildVTUArrays(bool& isInternal) const
 {
@@ -1478,7 +1502,7 @@ MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearM
   if(!m)
     throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : null input pointer !");
   if(gts.size()!=1 || pfls.size()!=1)
-    throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : lengthes of gts and pfls must be equal to one !");
+    throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : lengths of gts and pfls must be equal to one !");
   INTERP_KERNEL::NormalizedCellType gt(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(m->getMeshDimension()));
   if(gt==gts[0])
     {
@@ -1656,7 +1680,7 @@ const DataArrayInt *MEDFileField1TSStructItem2::getPfl(const MEDFileFieldGlobsRe
 }
 
 /*!
- * \param [in] nbOfEntity - number of entity that can be either cells or nodes. Not other possiblity.
+ * \param [in] nbOfEntity - number of entity that can be either cells or nodes. Not other possibility.
  * \param [in] nip - number of integration points. 1 for ON_CELLS and NO_NODES
  */
 void MEDFileField1TSStructItem2::checkInRange(int nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs)
@@ -2248,7 +2272,7 @@ std::vector<INTERP_KERNEL::NormalizedCellType> MEDFileField1TSStruct::getGeoType
 
 /*!
  * Returns true if presence in \a this of discretization ON_CELLS, ON_GAUSS_PT, ON_GAUSS_NE.
- * If true is returned the pos of the easiest is returned. The easiest is the first element in \a this having the less splitted subparts.
+ * If true is returned the pos of the easiest is returned. The easiest is the first element in \a this having the less split subparts.
  */
 bool MEDFileField1TSStruct::presenceOfCellDiscr(int& pos) const
 {