Skip to content

Commit

Permalink
Merge pull request arcaneframework#1590 from arcaneframework/dev/ah-d…
Browse files Browse the repository at this point in the history
…ebug-name-in-num-array

Add debugName() and setDebugName() in NumArray class
  • Loading branch information
AlexlHer authored Aug 26, 2024
2 parents 0b3401c + 560c22d commit 47ce292
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
16 changes: 16 additions & 0 deletions arcane/src/arcane/tests/accelerator/NumArrayUnitTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class NumArrayUnitTest
void _executeTest2();
void _executeTest3();
void _executeTest4(eMemoryRessource mem_kind);
void _executeTest5();

private:

Expand Down Expand Up @@ -192,6 +193,7 @@ executeTest()
_executeTest2();
_executeTest2();
_executeTest3();
_executeTest5();
}

/*---------------------------------------------------------------------------*/
Expand Down Expand Up @@ -673,6 +675,20 @@ _executeTest4(eMemoryRessource mem_kind)
}
}

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/

void NumArrayUnitTest::
_executeTest5()
{
ValueChecker vc(A_FUNCINFO);

NumArray<Int32, MDDim1> t1;
t1.setDebugName("Bonjour");
String str_test = "Bonjour";
vc.areEqual(t1.debugName(), str_test, "Pas bonjour :-(");
}

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
namespace
Expand Down
11 changes: 11 additions & 0 deletions arcane/src/arcane/utils/NumArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "arcane/utils/MDDim.h"
#include "arcane/utils/NumArrayContainer.h"
#include "arcane/utils/ArcaneCxx20.h"
#include "arcane/utils/String.h"

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
Expand Down Expand Up @@ -252,6 +253,16 @@ class NumArray
//! Allocateur mémoire associé
IMemoryAllocator* memoryAllocator() const { return m_data.allocator(); }

/*!
* \brief Positionne le nom du tableau pour les informations de debug.
*
* Ce nom peut être utilisé par exemple pour les affichages listing.
*/
void setDebugName(const String& str) { m_data.setDebugName(str); }

//! Nom de debug (nul si aucun nom spécifié)
String debugName() { return m_data.debugName(); }

public:

//! Valeur de la première dimension
Expand Down
2 changes: 2 additions & 0 deletions arcane/src/arcane/utils/NumArrayContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ class NumArrayContainer
public:

using BaseClass::capacity;
using BaseClass::debugName;
using BaseClass::fill;
using BaseClass::setDebugName;

private:

Expand Down

0 comments on commit 47ce292

Please sign in to comment.