From a54ed4db1f4b684348a2bc2d30abf7f887e311b0 Mon Sep 17 00:00:00 2001 From: Arlie Capps Date: Fri, 6 Oct 2023 11:55:36 -0700 Subject: [PATCH] Edits to tighten up the Totalview helper --- src/cmake/thirdparty/SetupTotalview.cmake | 1 + src/libs/conduit/CMakeLists.txt | 8 +++-- .../conduit/debug/conduit_node_totalview.cpp | 34 ++++--------------- 3 files changed, 12 insertions(+), 31 deletions(-) diff --git a/src/cmake/thirdparty/SetupTotalview.cmake b/src/cmake/thirdparty/SetupTotalview.cmake index f410ca20a..a5ce9a347 100644 --- a/src/cmake/thirdparty/SetupTotalview.cmake +++ b/src/cmake/thirdparty/SetupTotalview.cmake @@ -23,6 +23,7 @@ if(TOTALVIEW_DIR) if (TOTALVIEW_INCLUDE_DIRECTORIES) set(TOTALVIEW_FOUND TRUE) set(CONDUIT_USE_TOTALVIEW TRUE) + set(CONDUIT_EXCLUDE_TV_DATA_DISPLAY FALSE) endif() endif() diff --git a/src/libs/conduit/CMakeLists.txt b/src/libs/conduit/CMakeLists.txt index bd88c3494..f8eae9895 100644 --- a/src/libs/conduit/CMakeLists.txt +++ b/src/libs/conduit/CMakeLists.txt @@ -99,8 +99,10 @@ set(conduit_sources ) if(TOTALVIEW_FOUND) - list(APPEND conduit_sources $<$:debug/conduit_node_totalview.cpp>) - list(APPEND conduit_sources $<$:${TOTALVIEW_SOURCE_DIRECTORY}/tv_data_display.c>) + list(APPEND conduit_sources debug/conduit_node_totalview.cpp) + if(NOT CONDUIT_EXCLUDE_TV_DATA_DISPLAY) + list(APPEND conduit_sources ${TOTALVIEW_SOURCE_DIRECTORY}/tv_data_display.c) + endif() endif() # @@ -170,7 +172,7 @@ target_include_directories(conduit PUBLIC $ $ - $<$,$>:${TOTALVIEW_INCLUDE_DIRECTORIES}>) + $<$:${TOTALVIEW_INCLUDE_DIRECTORIES}>) ################################# diff --git a/src/libs/conduit/debug/conduit_node_totalview.cpp b/src/libs/conduit/debug/conduit_node_totalview.cpp index 23733f7c3..8991621c4 100644 --- a/src/libs/conduit/debug/conduit_node_totalview.cpp +++ b/src/libs/conduit/debug/conduit_node_totalview.cpp @@ -10,30 +10,8 @@ static const char * empty_Node_TV_string = "(empty Node)"; -const std::string dtype_to_TV_string ( const conduit::DataType dtype ); const std::string dtype_to_TV_string ( const conduit::DataType dtype, const char *hint ); const std::string index_to_TV_string ( int idx ); -const std::string dtype_subscript ( const conduit::DataType dtype ); - -const std::string dtype_to_TV_string ( const conduit::DataType dtype ) -{ - // We'll see if this works. - const char *hint = dtype.name().c_str(); - - return dtype_to_TV_string(dtype, hint); -} - -const std::string dtype_subscript ( const conduit::DataType dtype ) -{ - std::stringstream ss; - - if (dtype.number_of_elements() > 1) - { - ss << "[" << dtype.number_of_elements() << "]"; - } - - return ss.str(); -} const std::string dtype_to_TV_string ( const conduit::DataType dtype, const char *hint ) { @@ -45,8 +23,6 @@ const std::string dtype_to_TV_string ( const conduit::DataType dtype, const char ss << index_to_TV_string(dtype.number_of_elements()); } - std::cout << "dtype_to_TV_string: " << ss.str() << std::endl; - return ss.str(); } @@ -61,17 +37,18 @@ const std::string index_to_TV_string ( int idx ) int TV_ttf_display_type ( const conduit::Node *n ) { - const std::string type_name = dtype_to_TV_string(n->dtype()); - switch(n->dtype().id()) { case conduit::DataType::EMPTY_ID: + { TV_ttf_add_row ("data", TV_ttf_type_ascii_string, empty_Node_TV_string); break; + } case conduit::DataType::OBJECT_ID: { const std::vector & child_names = n->child_names(); const conduit::Schema & schema = n->schema(); - for (const std::string & name : child_names) { + for (const std::string & name : child_names) + { size_t cidx = (size_t)schema.child_index(name); TV_ttf_add_row (name.c_str(), "conduit::Node *", &(n->m_children[cidx])); } @@ -80,7 +57,8 @@ int TV_ttf_display_type ( const conduit::Node *n ) case conduit::DataType::LIST_ID: { size_t number_of_children = (size_t)n->number_of_children(); - for (size_t cidx = 0; cidx < number_of_children; ++cidx) { + for (size_t cidx = 0; cidx < number_of_children; ++cidx) + { TV_ttf_add_row (index_to_TV_string(cidx).c_str(), "conduit::Node *", &(n->m_children[cidx])); } break;