GEOS
TableMpiComponents.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 TotalEnergies
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
21 #ifndef GEOS_COMMON_FORMAT_TABLE_TABLEMPICOMPONENTS_HPP
22 #define GEOS_COMMON_FORMAT_TABLE_TABLEMPICOMPONENTS_HPP
23 
24 #include "TableFormatter.hpp"
25 
26 namespace geos
27 {
28 
34 {
38  string m_rankTitle;
39 };
40 
46 {
47 public:
50 
57 
63  TableTextMpiOutput( TableLayout const & tableLayout,
64  TableMpiLayout mpiLayout = TableMpiLayout() );
65 
74  template< typename DATASOURCE >
75  void toStream( std::ostream & outputStream, DATASOURCE const & tableData ) const;
76 
77 private:
78 
79  // hiding toString() methods as they are not implemented with MPI support.
80  using Base::toString;
81 
82  struct Status
83  {
84  bool const m_isMasterRank;
85  bool const m_isContributing;
86  bool m_hasContent;
87  string m_sepLine;
88  };
89 
90  TableMpiLayout m_mpiLayout;
91 
98  void stretchColumnsByRanks( stdVector< size_t > & columnsWidth,
99  Status const & status ) const;
100 
101  void outputTableDataToRank0( std::ostream & tableOutput,
102  PreparedTableLayout const & tableLayout,
103  CellLayoutRows const & dataCellsLayout,
104  Status & status ) const;
105 
106 };
107 
108 }
109 
110 #endif /* GEOS_COMMON_FORMAT_TABLE_TABLEMPICOMPONENTS_HPP */
Variation of the TableLayout to store precomputed layout information, ready to be formatted.
stdVector< CellLayoutRow > CellLayoutRows
Represent a table section (title + header or values) layout: view on the data and its layout settings...
Class for setup the table layout.
Definition: TableLayout.hpp:34
Class to format data in a formatted text format (for log output typically, expecting fixed character ...
TableTextFormatter()
Construct a default Table Formatter without layout specification (to only insert data in it,...
string toString() const
class to format data in a formatted text format, allowing contributions from multiple MPI ranks.
void toStream(std::ostream &outputStream, DATASOURCE const &tableData) const
Convert a data source to a table string.
TableTextMpiOutput(TableLayout const &tableLayout, TableMpiLayout mpiLayout=TableMpiLayout())
Construct a new TableTextMpiOutput from a tableLayout.
TableTextMpiOutput(TableMpiLayout mpiLayout=TableMpiLayout())
Construct a default Table Formatter without layout specification (to only insert data in it,...
internal::StdVectorWrapper< T, Allocator, USE_STD_CONTAINER_BOUNDS_CHECKING > stdVector
Layout information specific to MPI distributed tables, completing those in TableLayout.
string m_rankTitle
Title for each rank's section visible in the separating line.
bool m_separatorBetweenRanks
Enable a separating line between ranks in the table output.