From: Anthony Geay Date: Tue, 28 Apr 2020 20:35:36 +0000 (+0200) Subject: Some helpers for debugging X-Git-Tag: V9_5_0b1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7a93ea76e774d627872e578826c28ec92cac693f;p=tools%2Fmedcoupling.git Some helpers for debugging --- diff --git a/src/MEDCoupling/MEDCouplingMemArray.hxx b/src/MEDCoupling/MEDCouplingMemArray.hxx index 501cea75e..dd2b5f153 100755 --- a/src/MEDCoupling/MEDCouplingMemArray.hxx +++ b/src/MEDCoupling/MEDCouplingMemArray.hxx @@ -235,6 +235,13 @@ namespace MEDCoupling static MCAuto< typename Traits::ArrayTypeCh > NewFromArray(const T *arrBegin, const T *arrEnd); std::vector< MCAuto< typename Traits::ArrayTypeCh > > explodeComponents() const; // + void printForDebug(std::ostream& oss) const + { + this->checkAllocated(); + char comma[3] = {'\0',' ','\0'}; + std::for_each(this->begin(),this->end(),[&comma,&oss](const T& elt) { oss << comma << elt; comma[0]=','; } ); + oss << std::endl; + } std::size_t getHeapMemorySizeWithoutChildren() const; void updateTime() const { } // diff --git a/src/ParaMEDMEM/ParaUMesh.hxx b/src/ParaMEDMEM/ParaUMesh.hxx index ec404a653..8086d85b1 100644 --- a/src/ParaMEDMEM/ParaUMesh.hxx +++ b/src/ParaMEDMEM/ParaUMesh.hxx @@ -64,6 +64,8 @@ namespace MEDCoupling using DataArrayT = typename Traits::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 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 +105,8 @@ namespace MEDCoupling using DataArrayT = typename Traits::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 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.