From 0c6ea97eba9d2689eede4f889d0839faceb39c3e Mon Sep 17 00:00:00 2001 From: arng40 Date: Mon, 16 Dec 2024 17:01:19 +0100 Subject: [PATCH] missing doc --- .../common/format/table/TableData.hpp | 9 +++++ .../common/format/table/TableFormatter.cpp | 6 ++-- .../common/format/table/TableFormatter.hpp | 3 ++ .../common/format/table/TableLayout.cpp | 2 +- .../common/format/table/TableLayout.hpp | 36 +++++++++++++------ .../common/format/table/TableTypes.hpp | 3 ++ src/coreComponents/mesh/DomainPartition.cpp | 2 +- .../fluidFlow/LogLevelsInfo.hpp | 6 ++-- .../fluidFlow/SinglePhaseStatistics.cpp | 2 +- .../fluidFlow/SourceFluxStatistics.cpp | 2 +- 10 files changed, 50 insertions(+), 21 deletions(-) diff --git a/src/coreComponents/common/format/table/TableData.hpp b/src/coreComponents/common/format/table/TableData.hpp index 72c2123364..a2f1989b79 100644 --- a/src/coreComponents/common/format/table/TableData.hpp +++ b/src/coreComponents/common/format/table/TableData.hpp @@ -35,9 +35,14 @@ class TableData { public: + /** + * @brief Representing a data in TableData + */ struct CellData { + /// The cell type CellType type; + /// The cell value string value = ""; }; @@ -163,6 +168,10 @@ class TableData2D std::set< real64 > m_columnValues; }; +/** + * @brief Trait to check is the args is a special type of cell + * @tparam T The type of a cell + */ template< typename T > constexpr bool isCellType = std::is_same_v< T, CellType >; diff --git a/src/coreComponents/common/format/table/TableFormatter.cpp b/src/coreComponents/common/format/table/TableFormatter.cpp index b979fbccce..1e7390f4d2 100644 --- a/src/coreComponents/common/format/table/TableFormatter.cpp +++ b/src/coreComponents/common/format/table/TableFormatter.cpp @@ -3,7 +3,7 @@ * SPDX-License-Identifier: LGPL-2.1-only * * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC - * Copyright (c) 2018-2024 TotalEnergies + * Copyright (c) 2018-2024 Total, S.A * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University * Copyright (c) 2023-2024 Chevron * Copyright (c) 2019- GEOS/GEOSX Contributors @@ -237,8 +237,8 @@ void TableTextFormatter::setLinks( std::vector< TableLayout::Column > & columns void TableTextFormatter::populateHeaderCellsLayout( TableLayout & tableLayout, CellLayoutRows & cellsHeaderLayout ) const { - cellsHeaderLayout.resize( tableLayout.getMaxHeaderRow() ); - size_t const headerLayersCount = tableLayout.getMaxHeaderRow(); + cellsHeaderLayout.resize( tableLayout.getMaxDepth() ); + size_t const headerLayersCount = tableLayout.getMaxDepth(); std::vector< size_t > & sublineHeaderCounts = tableLayout.getSublineInHeaderCounts(); sublineHeaderCounts.resize( headerLayersCount, 1 ); diff --git a/src/coreComponents/common/format/table/TableFormatter.hpp b/src/coreComponents/common/format/table/TableFormatter.hpp index c2409e767a..4c06e9707b 100644 --- a/src/coreComponents/common/format/table/TableFormatter.hpp +++ b/src/coreComponents/common/format/table/TableFormatter.hpp @@ -34,7 +34,9 @@ class TableFormatter { public: + /// Represent the TableData values using RowsCellInput = std::vector< std::vector< TableData::CellData > >; + /// Represent the Table (header or values) structured using CellLayoutRows = std::vector< std::vector< TableLayout::CellLayout > >; @@ -79,6 +81,7 @@ class TableCSVFormatter : public TableFormatter /** * @brief Convert the table data to a CSV string.. + * @param tableData The table data * @return The CSV string representation of the table data. */ string dataToString( TableData const & tableData ) const; diff --git a/src/coreComponents/common/format/table/TableLayout.cpp b/src/coreComponents/common/format/table/TableLayout.cpp index f4ae2d66b4..b5d6e77ba2 100644 --- a/src/coreComponents/common/format/table/TableLayout.cpp +++ b/src/coreComponents/common/format/table/TableLayout.cpp @@ -65,7 +65,7 @@ TableLayout & TableLayout::setMargin( MarginValue marginValue ) bool TableLayout::isLineBreakEnabled() const { return m_wrapLine; } -size_t TableLayout::getMaxHeaderRow() const +size_t TableLayout::getMaxDepth() const { size_t depthMax = 1; size_t currDepth = 1; diff --git a/src/coreComponents/common/format/table/TableLayout.hpp b/src/coreComponents/common/format/table/TableLayout.hpp index 5ed2f69e74..24cf26b522 100644 --- a/src/coreComponents/common/format/table/TableLayout.hpp +++ b/src/coreComponents/common/format/table/TableLayout.hpp @@ -116,20 +116,36 @@ class TableLayout /** * @brief Constructor to initialize a column with a specific `CellLayout`. - * @param cell The `CellLayout` object to initialize the column. + * @param cellLayout The `CellLayout` object to initialize the column. * */ Column( TableLayout::CellLayout cellLayout ); + /** + * @brief Get the parent column. + * @return Pointer to the parent column, or `nullptr` if no parent is set. + */ Column * getParent() { return m_parent; } + /** + * @brief Set the parent column. + * @param parent Pointer to the parent column to set. + */ void setParent( Column * parent ) { m_parent = parent; } + /** + * @brief GGet the next column in the layout. + * @return Pointer to the next column or `nullptr` if no next column exists. + */ Column * getNextCell() { return m_next; } + /** + * @brief Set the next column in the layout. + * @param nextCell The next column in the table layout. + */ void setNextCell( Column * nextCell ) { m_next = nextCell; } @@ -142,13 +158,14 @@ class TableLayout /** * @brief Set the column visibility. + * @param CellType Cell type to apply to hide the colmun * @return The current column . */ Column & setVisibility( CellType celltype ); /** * @brief Adds multiple sub-columns to the column. - * @param subColName A list of sub-column names to add. + * @param subCol A list of sub-column names to add. * @return The current column object */ TableLayout::Column & addSubColumns( std::initializer_list< TableLayout::Column > subCol ); @@ -237,7 +254,7 @@ class TableLayout /** * @brief Copy assignment operator - * @param[in] source Coulmn to copy + * @param[in] columnPtr Coulmn to copy * @return Leaf iterator */ LeafIterator & operator=( Column * columnPtr ) @@ -357,12 +374,6 @@ class TableLayout return LeafIterator( nullptr, 0 ); } - struct Row - { - // maximum number of lines among the cells of a given row - size_t maxLineCount; // TODO : Assigner cette stat - }; - /// Alias for an initializer list of variants that can contain either a string or a layout column. using TableLayoutArgs = std::initializer_list< std::variant< string_view, TableLayout::Column > >; @@ -421,7 +432,11 @@ class TableLayout addToColumns( args ); } - size_t getMaxHeaderRow() const; + /** + * @brief Get the max depth of a column + * @return The max column depth + */ + size_t getMaxDepth() const; /** * @return The columns vector @@ -552,7 +567,6 @@ class TableLayout /// Contains the subdivision (line) counts for each line in data. std::vector< size_t > m_sublineDataCounts; bool m_wrapLine = true; - bool m_containSubColumn = false; string m_tableTitle; diff --git a/src/coreComponents/common/format/table/TableTypes.hpp b/src/coreComponents/common/format/table/TableTypes.hpp index 329bb7c715..77c9c2c860 100644 --- a/src/coreComponents/common/format/table/TableTypes.hpp +++ b/src/coreComponents/common/format/table/TableTypes.hpp @@ -26,6 +26,9 @@ namespace geos { +/** + * @brief The different type a cell can handle + */ enum class CellType : integer { Header, diff --git a/src/coreComponents/mesh/DomainPartition.cpp b/src/coreComponents/mesh/DomainPartition.cpp index 08131aa556..0d7f8c94ad 100644 --- a/src/coreComponents/mesh/DomainPartition.cpp +++ b/src/coreComponents/mesh/DomainPartition.cpp @@ -409,7 +409,7 @@ void DomainPartition::outputPartitionInformation() const TableLayout::Column() .setName( "Elems" ) .addSubColumns( { "Locales", "Ghost" } )} ); - // layoutPartition.setMargin( TableLayout::MarginValue::large ).disableLineBreak(); + // layoutPartition.setMargin( TableLayout::MarginValue::large ).disableLineBreak(); TableData dataPartition; dataPartition.addRow( "min", diff --git a/src/coreComponents/physicsSolvers/fluidFlow/LogLevelsInfo.hpp b/src/coreComponents/physicsSolvers/fluidFlow/LogLevelsInfo.hpp index 1f7915d5e1..016540b178 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/LogLevelsInfo.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/LogLevelsInfo.hpp @@ -50,19 +50,19 @@ struct Statistics struct sourceFluxRegionsStatistics { - static constexpr int getMinLogLevel() { return 3; } + static constexpr int getMinLogLevel() { return 3; } static constexpr std::string_view getDescription() { return "Print source flux statistics for each regions "; } }; struct sourceFluxStatistics { - static constexpr int getMinLogLevel() { return 2; } + static constexpr int getMinLogLevel() { return 2; } static constexpr std::string_view getDescription() { return "Print source flux statistics for each flux in a mesh"; } }; struct sourceFluxMeshStatistics { - static constexpr int getMinLogLevel() { return 1; } + static constexpr int getMinLogLevel() { return 1; } static constexpr std::string_view getDescription() { return "Print source flux statistics resulting from all flux in a mesh"; } }; diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseStatistics.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseStatistics.cpp index 398f6e42ce..6a54488063 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseStatistics.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseStatistics.cpp @@ -266,7 +266,7 @@ void SinglePhaseStatistics::computeRegionStatistics( real64 const time, singPhaseStatsData.addRow( "Total dynamic pore volume [rm^3]", "all", CellType::MergeNext, stats.totalPoreVolume ); singPhaseStatsData.addSeparator(); - singPhaseStatsData.addRow( GEOS_FMT("Total fluid mass [{}]", massUnit), "all", CellType::MergeNext, stats.totalMass ); + singPhaseStatsData.addRow( GEOS_FMT( "Total fluid mass [{}]", massUnit ), "all", CellType::MergeNext, stats.totalMass ); string const title = GEOS_FMT( "{}, {} (time {} s):", getName(), regionNames[i], time ); TableLayout const singPhaseStatsLayout( title, { "statistics", "min", "average", "max" } ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SourceFluxStatistics.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SourceFluxStatistics.cpp index 364d6e9fbb..b0382c8c45 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SourceFluxStatistics.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SourceFluxStatistics.cpp @@ -185,7 +185,7 @@ void SourceFluxStatsAggregator::outputStatsToLog( bool logLevelActive, string_vi { m_logLayout.setTitle( GEOS_FMT( "Source flux statistics in {}", elementSetName )); TableTextFormatter const tableStatFormatter( m_logLayout ); - GEOS_LOG_RANK( tableStatFormatter.toString( tableMeshData ) ); + GEOS_LOG_RANK( tableStatFormatter.toString( tableMeshData ) ); } } void SourceFluxStatsAggregator::outputStatsToCSV( string_array const & filenames, TableData & csvData )