]> SALOME platform Git repositories - tools/medcoupling.git/blobdiff - src/ParaMEDMEM/ParaUMesh.hxx
Salome HOME
refactor!: remove adm_local/ directory
[tools/medcoupling.git] / src / ParaMEDMEM / ParaUMesh.hxx
index ec404a6535c5e4fcf9cbb9a64017afb9530765e6..9e6d83e5034a9d88fdf96fa83334e43a545476b1 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2020  CEA/DEN, EDF R&D
+// Copyright (C) 2020-2024  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -58,12 +58,16 @@ namespace MEDCoupling
     MCAuto<DataArrayIdType> _cell_global;
     MCAuto<DataArrayIdType> _node_global;
   private:
+    MCAuto<DataArrayIdType> getCellIdsLyingOnNodesFalse(const DataArrayIdType *globalNodeIds) const;
+    MCAuto<DataArrayIdType> getCellIdsLyingOnNodesTrue(const DataArrayIdType *globalNodeIds) const;
     template<class T>
     typename Traits<T>::ArrayType *redistributeCellFieldT(const DataArrayIdType *globalCellIds, const typename Traits<T>::ArrayType *fieldValueToRed) const
     {
       using DataArrayT = typename Traits<T>::ArrayType;
       MPI_Comm comm(MPI_COMM_WORLD);
       CommInterface ci;
+      if( _cell_global->getNumberOfTuples() != fieldValueToRed->getNumberOfTuples() )
+        throw INTERP_KERNEL::Exception("PAraUMesh::redistributeCellFieldT : invalid input length of array !");
       std::unique_ptr<mcIdType[]> allGlobalCellIds,allGlobalCellIdsIndex;
       int size(ci.allGatherArrays(comm,globalCellIds,allGlobalCellIds,allGlobalCellIdsIndex));
       // Prepare ParaUMesh parts to be sent : compute for each proc the contribution of current rank.
@@ -103,6 +107,8 @@ namespace MEDCoupling
       using DataArrayT = typename Traits<T>::ArrayType;
       MPI_Comm comm(MPI_COMM_WORLD);
       CommInterface ci;
+      if( _node_global->getNumberOfTuples() != fieldValueToRed->getNumberOfTuples() )
+        throw INTERP_KERNEL::Exception("PAraUMesh::redistributeNodeFieldT : invalid input length of array !");
       std::unique_ptr<mcIdType[]> allGlobalCellIds,allGlobalCellIdsIndex;
       int size(ci.allGatherArrays(comm,globalCellIds,allGlobalCellIds,allGlobalCellIdsIndex));
       // Prepare ParaUMesh parts to be sent : compute for each proc the contribution of current rank.