diff --git a/src/coreComponents/codingUtilities/tests/testParsing.cpp b/src/coreComponents/codingUtilities/tests/testParsing.cpp index 6d9e7b3ae04..c45d354c145 100644 --- a/src/coreComponents/codingUtilities/tests/testParsing.cpp +++ b/src/coreComponents/codingUtilities/tests/testParsing.cpp @@ -63,7 +63,7 @@ class ParsingTest : public ::testing::TestWithParam< T > { protected: - static constexpr std::array< char, 4 > const separators = { ' ', ',', '\n', ';' }; + static constexpr geos::stdArray< char, 4 > const separators = { ' ', ',', '\n', ';' }; static bool issep( char const c ) { @@ -147,7 +147,7 @@ class ParsingTest : public ::testing::TestWithParam< T > }; template< typename T > -std::array< char, 4 > const ParsingTest< T >::separators; +geos::stdArray< char, 4 > const ParsingTest< T >::separators; using Types = ::testing::Types< float, diff --git a/src/coreComponents/common/MemoryInfos.cpp b/src/coreComponents/common/MemoryInfos.cpp index 7cd91ebeb0e..3a60e9f0854 100644 --- a/src/coreComponents/common/MemoryInfos.cpp +++ b/src/coreComponents/common/MemoryInfos.cpp @@ -139,7 +139,7 @@ void MemoryLogging::memoryStatsReport() const MPI_Comm_size( MPI_COMM_WORLD, &size ); size_t nbRank = (std::size_t)size; // Get a list of all the allocators and sort it so that it's in the same order on each rank. - std::vector< string > allocatorNames = rm.getAllocatorNames(); + stdVector< string > allocatorNames = rm.getAllocatorNames(); std::sort( allocatorNames.begin(), allocatorNames.end() ); // If each rank doesn't have the same number of allocators you can't aggregate them. diff --git a/src/coreComponents/common/MpiWrapper.cpp b/src/coreComponents/common/MpiWrapper.cpp index b80d0aa802a..bab26f78a02 100644 --- a/src/coreComponents/common/MpiWrapper.cpp +++ b/src/coreComponents/common/MpiWrapper.cpp @@ -445,9 +445,9 @@ int MpiWrapper::nodeCommSize() return 1; int len; - std::array< char, MPI_MAX_PROCESSOR_NAME + 1 > hostname; + stdArray< char, MPI_MAX_PROCESSOR_NAME + 1 > hostname; MPI_Get_processor_name( hostname.data(), &len ); - hostname[len] = '\0'; + hostname.at(len) = '\0'; int color = (int)std::hash< string >{} (hostname.data()); if( color < 0 ) color *= -1; diff --git a/src/coreComponents/common/StdContainerWrappers.hpp b/src/coreComponents/common/StdContainerWrappers.hpp index afb7506daab..2feaa283d23 100644 --- a/src/coreComponents/common/StdContainerWrappers.hpp +++ b/src/coreComponents/common/StdContainerWrappers.hpp @@ -1,6 +1,8 @@ #ifndef GEOS_COMMON_STD_CONTAINER_WRAPPERS_HPP #define GEOS_COMMON_STD_CONTAINER_WRAPPERS_HPP +#include +#include #include #include #include @@ -462,4 +464,52 @@ constexpr stdArray< T, N > to_stdArray( std::array< T, N > const & arr ) } // namespace geos +/** + * @namespace std + * @brief Partial specialization for stdArray. + * Those specialization serve to use geos::stdArray as tuples. + */ +namespace std +{ + +/** + * @brief Provides access to the number of elements in a tuple as a compile-time constant expression. + * @tparam T Type of elements in stdArray + * @tparam N The number of fixed element in the array + */ +template< typename T, size_t N > +struct tuple_size< geos::stdArray< T, N > > + : public integral_constant< size_t, N > { }; + +/** + * @brief Provides compile-time indexed access to the types of the elements of the tuple. + * @tparam Ind The index element of the tuple to access + * @tparam Tp Type of elements in stdArray + * @tparam Nm The number of fixed element in the array + */ +template< size_t Ind, typename Tp, size_t Nm > +struct tuple_element< Ind, geos::stdArray< Tp, Nm > > +{ + static_assert( Ind < Nm, "array index is in range" ); + using type = Tp; +}; + +#if __cplusplus >= 201703L +/** + * @brief Helper variable template + * @tparam Tp Type of elements in stdArray + * @tparam Nm The number of fixed element in the array + */ +template< typename Tp, size_t Nm > +inline constexpr size_t tuple_size_v< geos::stdArray< Tp, Nm > > = Nm; + +template< typename Tp, size_t Nm > +inline constexpr size_t tuple_size_v< const geos::stdArray< Tp, Nm > > = Nm; +#endif + +template< typename Tp, size_t Nm > +struct __is_tuple_like_impl< geos::stdArray< Tp, Nm > > : true_type +{ }; +} + #endif /* GEOS_COMMON_STD_CONTAINER_WRAPPERS_HPP */ diff --git a/src/coreComponents/common/format/table/TableFormatter.cpp b/src/coreComponents/common/format/table/TableFormatter.cpp index e34eaa8d37c..1e124595658 100644 --- a/src/coreComponents/common/format/table/TableFormatter.cpp +++ b/src/coreComponents/common/format/table/TableFormatter.cpp @@ -200,7 +200,7 @@ string TableCSVFormatter::toString< TableData >( TableData const & tableData ) c { if( tableData.getErrorsList().hasErrors() ) { - std::vector< string > cpyErrors = tableData.getErrorsList().getErrors(); + stdVector< string > cpyErrors = tableData.getErrorsList().getErrors(); getErrorsList().appendErrors( cpyErrors ); } @@ -518,7 +518,7 @@ void TableTextFormatter::populateErrorCellsLayout( PreparedTableLayout const & t { errorCellsLayout.push_back( { - std::vector< TableLayout::CellLayout >( nbCells, + stdVector< TableLayout::CellLayout >( nbCells, TableLayout::CellLayout( CellType::MergeNext ) ), 1 // subLines count } ); @@ -531,7 +531,7 @@ void TableTextFormatter::populateErrorCellsLayout( PreparedTableLayout const & t errorCellsLayout.push_back( { - std::vector< TableLayout::CellLayout >( nbCells, + stdVector< TableLayout::CellLayout >( nbCells, TableLayout::CellLayout( CellType::Separator ) ), 1 // subLines count } ); diff --git a/src/coreComponents/common/format/table/TableLayout.hpp b/src/coreComponents/common/format/table/TableLayout.hpp index b166f65b198..fcaf7cd590d 100644 --- a/src/coreComponents/common/format/table/TableLayout.hpp +++ b/src/coreComponents/common/format/table/TableLayout.hpp @@ -127,7 +127,7 @@ class TableLayout /** * @return The view on each cell line. */ - std::vector< string_view > & getLines() + stdVector< string_view > & getLines() { return m_lines; } /** diff --git a/src/coreComponents/common/format/table/TableTypes.hpp b/src/coreComponents/common/format/table/TableTypes.hpp index 4565ad92ff8..dd65747aa20 100644 --- a/src/coreComponents/common/format/table/TableTypes.hpp +++ b/src/coreComponents/common/format/table/TableTypes.hpp @@ -62,7 +62,7 @@ class TableErrorListing void clear(); /// The iterator alias for the errors vector of string - using Iterator = std::vector< string >::const_iterator; + using Iterator = stdVector< string >::const_iterator; /** * @return An Iterator pointing to the first element of the errors vector @@ -80,24 +80,24 @@ class TableErrorListing * @brief Append a vector of string to the errors vector. * @param errors A vector of string to append */ - void appendErrors( std::vector< string > & errors ) + void appendErrors( stdVector< string > & errors ) { m_errorList.insert( m_errorList.end(), errors.begin(), errors.end() );} /** * @return A const reference to the errors vector. */ - std::vector< string > const & getErrors() const + stdVector< string > const & getErrors() const { return m_errorList; } /** * @return A reference to the errors vector. */ - std::vector< string > & getErrors() + stdVector< string > & getErrors() { return m_errorList; } private: /// Contain all the errors to display at the end of the table - std::vector< string > m_errorList; + stdVector< string > m_errorList; }; inline void TableErrorListing::addError( string_view text ) diff --git a/src/coreComponents/constitutive/ConstitutiveBase.hpp b/src/coreComponents/constitutive/ConstitutiveBase.hpp index 7921ee28a78..b8bd67c2de0 100644 --- a/src/coreComponents/constitutive/ConstitutiveBase.hpp +++ b/src/coreComponents/constitutive/ConstitutiveBase.hpp @@ -170,7 +170,7 @@ class ConstitutiveBase : public dataRepository::Group /** * @return A const vector containing all fields */ - std::vector< std::string > const & getUserFields() const + stdVector< std::string > const & getUserFields() const { return m_userFields; } @@ -189,7 +189,7 @@ class ConstitutiveBase : public dataRepository::Group bool m_isClone; // Vector containing all fields registered with `registerField()` - std::vector< std::string > m_userFields; + stdVector< std::string > m_userFields; }; } diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/KValueFlashParameters.cpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/KValueFlashParameters.cpp index 3160bf2644b..4b08f78785c 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/KValueFlashParameters.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/KValueFlashParameters.cpp @@ -399,7 +399,7 @@ bool KValueFlashParameters< NUM_PHASE >::validateKValues( MultiFluidBase const * if( !tableData.getTableDataRows().empty()) { - std::vector< TableLayout::Column > columns; + stdVector< TableLayout::Column > columns; columns.emplace_back( TableLayout::Column().setName( "Phase" ).setValuesAlignment( TableLayout::Alignment::left ) ); columns.emplace_back( TableLayout::Column().setName( "Pressure" ).setValuesAlignment( TableLayout::Alignment::right ) ); columns.emplace_back( TableLayout::Column().setName( "Temperature" ).setValuesAlignment( TableLayout::Alignment::right ) ); diff --git a/src/coreComponents/constitutive/unitTests/TestFluid.hpp b/src/coreComponents/constitutive/unitTests/TestFluid.hpp index ea6d23fe70b..44ee83d67ce 100644 --- a/src/coreComponents/constitutive/unitTests/TestFluid.hpp +++ b/src/coreComponents/constitutive/unitTests/TestFluid.hpp @@ -60,7 +60,7 @@ struct Fluid static constexpr integer NP = 6; // Number of properties - static constexpr std::array data = { + static constexpr stdArray data = { // Mw Pc Tc Vc Ac Pr Name 1.80153e-02, 2.20640e+07, 6.47096e+02, 5.59480e-05, 3.44300e-01, 9.36563e-06, // H2O (water) 4.40095e-02, 7.37730e+06, 3.04128e+02, 9.41185e-05, 2.23940e-01, 7.37268e-06, // CO2 (carbon dioxide) @@ -83,7 +83,7 @@ struct Fluid }; template< int NC > -using Feed = std::array< real64, NC >; +using Feed = stdArray< real64, NC >; template< int NC > class TestFluid @@ -91,7 +91,7 @@ class TestFluid public: ~TestFluid() = default; - static std::unique_ptr< TestFluid< NC > > create( std::array< integer, NC > const & components ) + static std::unique_ptr< TestFluid< NC > > create( stdArray< integer, NC > const & components ) { std::unique_ptr< TestFluid< NC > > testFluid( new TestFluid() ); for( integer const ic : components ) diff --git a/src/coreComponents/constitutive/unitTests/testCompositionalDensity.cpp b/src/coreComponents/constitutive/unitTests/testCompositionalDensity.cpp index 6b5b6bf9f9c..c4849a6ca93 100644 --- a/src/coreComponents/constitutive/unitTests/testCompositionalDensity.cpp +++ b/src/coreComponents/constitutive/unitTests/testCompositionalDensity.cpp @@ -44,7 +44,7 @@ struct FluidData< 9 > static std::unique_ptr< TestFluid< 9 > > createFluid() { auto fluid = TestFluid< 9 >::create( {Fluid::H2O, Fluid::CO2, Fluid::N2, Fluid::CH4, Fluid::C2H6, Fluid::C3H8, Fluid::C4H10, Fluid::C5H12, Fluid::C10H22} ); - const std::array< real64 const, 36 > bics = { + const stdArray< real64 const, 36 > bics = { 0.01, 0, 0.003732, 0, 0.01, 0, 0, 0.01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01, 0, 0.028, 0.01, 0.01, 0, 0, 0.01, 0, 0.04532, 0.01, 0.01, 0, 0, 0 }; diff --git a/src/coreComponents/constitutive/unitTests/testCubicEOS.cpp b/src/coreComponents/constitutive/unitTests/testCubicEOS.cpp index 74b0d52b115..bd8a843f9a7 100644 --- a/src/coreComponents/constitutive/unitTests/testCubicEOS.cpp +++ b/src/coreComponents/constitutive/unitTests/testCubicEOS.cpp @@ -40,7 +40,7 @@ struct FluidData< 2 > return fluid; } - static std::array< Feed< 2 >, 3 > constexpr feeds = { + static stdArray< Feed< 2 >, 3 > constexpr feeds = { Feed< 2 >{0.995, 0.005}, Feed< 2 >{0.990, 0.010}, Feed< 2 >{0.100, 0.900} @@ -57,7 +57,7 @@ struct FluidData< 4 > return fluid; } - static std::array< Feed< 4 >, 4 > constexpr feeds = { + static stdArray< Feed< 4 >, 4 > constexpr feeds = { Feed< 4 >{0.030933, 0.319683, 0.637861, 0.011523}, Feed< 4 >{0.000000, 0.349686, 0.637891, 0.012423}, Feed< 4 >{0.000000, 0.349686, 0.650314, 0.000000}, diff --git a/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp b/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp index 6ecc3545c18..f3157b6a762 100644 --- a/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp +++ b/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp @@ -56,7 +56,7 @@ struct FluidData< 3 > static std::unique_ptr< TestFluid< 3 > > createFluid() { auto fluid = TestFluid< 3 >::create( {Fluid::CH4, Fluid::C10H22, Fluid::H2O} ); - const std::array< real64 const, 3 > bics = { 0.25, 0.0, 0.0 }; + const stdArray< real64 const, 3 > bics = { 0.25, 0.0, 0.0 }; fluid->setBinaryCoefficients( bics ); return fluid; } @@ -69,9 +69,9 @@ struct FluidData< 9 > static std::unique_ptr< TestFluid< 9 > > createFluid() { auto fluid = TestFluid< 9 >::create( {Fluid::H2O, Fluid::CO2, Fluid::N2, Fluid::C5H12, Fluid::C2H6, Fluid::C3H8, Fluid::C4H10, Fluid::C5H12, Fluid::C10H22} ); - const std::array< real64 const, 36 > bics = { + const stdArray< real64, 36 > bics = { 0.01, 0, 0.003732, 0, 0.01, 0, 0, 0.01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0.01, 0, 0.028, 0.01, 0.01, 0, 0, 0.01, 0, 0.04532, 0.01, 0.01, 0, 0, 0 + 0, 0, 0, 0.01, 0, 0.028, 0.01, 0.01, 0, 0, 0.01, 0, 0.04532, 0.01, 0.01, 0, 0, 0 }; fluid->setBinaryCoefficients( bics ); return fluid; diff --git a/src/coreComponents/constitutive/unitTests/testImmiscibleWaterProperties.cpp b/src/coreComponents/constitutive/unitTests/testImmiscibleWaterProperties.cpp index a4179d3bfe0..b8e5ae46652 100644 --- a/src/coreComponents/constitutive/unitTests/testImmiscibleWaterProperties.cpp +++ b/src/coreComponents/constitutive/unitTests/testImmiscibleWaterProperties.cpp @@ -47,7 +47,7 @@ struct FluidData< 3 > static std::unique_ptr< TestFluid< 3 > > createFluid() { auto fluid = TestFluid< 3 >::create( {Fluid::CH4, Fluid::C10H22, Fluid::H2O} ); - std::array< real64, 3 > const bics = {0.25, 0.0, 0.0}; + stdArray< real64, 3 > const bics = {0.25, 0.0, 0.0}; fluid->setBinaryCoefficients( bics ); return fluid; } diff --git a/src/coreComponents/constitutive/unitTests/testKValueFlashModel.cpp b/src/coreComponents/constitutive/unitTests/testKValueFlashModel.cpp index 93b4000e6eb..b088cc47d21 100644 --- a/src/coreComponents/constitutive/unitTests/testKValueFlashModel.cpp +++ b/src/coreComponents/constitutive/unitTests/testKValueFlashModel.cpp @@ -44,7 +44,7 @@ struct TestData< 9 > static std::unique_ptr< TestFluid< 9 > > createFluid() { auto fluid = TestFluid< 9 >::create( {Fluid::H2O, Fluid::CO2, Fluid::N2, Fluid::CH4, Fluid::C2H6, Fluid::C3H8, Fluid::C4H10, Fluid::C5H12, Fluid::C10H22} ); - const std::array< real64 const, 36 > bics = { + const stdArray< real64 const, 36 > bics = { 0.01, 0, 0.003732, 0, 0.01, 0, 0, 0.01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01, 0, 0.028, 0.01, 0.01, 0, 0, 0.01, 0, 0.04532, 0.01, 0.01, 0, 0, 0 }; @@ -113,7 +113,7 @@ class KValueFlashTestFixture< numPhases, numComps >::MockFluid : public MultiFlu void setProperties( ComponentProperties const & componentProperties ) { string_array & phaseNames = getReference< string_array >( MultiFluidBase::viewKeyStruct::phaseNamesString() ); - TestFluid< numPhases >::createArray( phaseNames, std::array< string, 2 >{"oil", "gas"} ); + TestFluid< numPhases >::createArray( phaseNames, stdArray< string, 2 >{"oil", "gas"} ); string_array & componentNames = getReference< string_array >( MultiFluidBase::viewKeyStruct::componentNamesString() ); TestFluid< numPhases >::createArray( componentNames, componentProperties.getComponentName()); } @@ -163,7 +163,7 @@ real64 getKValue( integer const phaseIndex, integer const compIndex, real64 cons { GEOS_UNUSED_VAR( phaseIndex ); - static std::array< real64, 5 > constexpr crookstonCoefficients[9] = { + static stdArray< real64, 5 > constexpr crookstonCoefficients[9] = { {3.0620e+00, 8.9414e+02, 1.1912e-02, 5.3659e+02, 1.1951e+02}, {-1.8141e+00, 6.2655e+02, 6.7489e-03, 5.0732e+00, 2.5249e+02}, {-3.5742e-01, 4.8660e+02, 5.7887e-03, 9.1910e+01, 1.8027e+02}, diff --git a/src/coreComponents/constitutive/unitTests/testLohrenzBrayClarkViscosity.cpp b/src/coreComponents/constitutive/unitTests/testLohrenzBrayClarkViscosity.cpp index 8b7ba80d682..605cab3e0ba 100644 --- a/src/coreComponents/constitutive/unitTests/testLohrenzBrayClarkViscosity.cpp +++ b/src/coreComponents/constitutive/unitTests/testLohrenzBrayClarkViscosity.cpp @@ -46,7 +46,7 @@ struct FluidData< 9 > static std::unique_ptr< TestFluid< 9 > > createFluid() { auto fluid = TestFluid< 9 >::create( {Fluid::H2O, Fluid::CO2, Fluid::N2, Fluid::CH4, Fluid::C2H6, Fluid::C3H8, Fluid::C4H10, Fluid::C5H12, Fluid::C10H22} ); - const std::array< real64 const, 36 > bics = { + const stdArray< real64 const, 36 > bics = { 0.01, 0, 0.003732, 0, 0.01, 0, 0, 0.01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01, 0, 0.028, 0.01, 0.01, 0, 0, 0.01, 0, 0.04532, 0.01, 0.01, 0, 0, 0 }; diff --git a/src/coreComponents/constitutive/unitTests/testMultiFluidThreePhaseCompositionalMultiphase.cpp b/src/coreComponents/constitutive/unitTests/testMultiFluidThreePhaseCompositionalMultiphase.cpp index 879c10ffe1a..d01422b414f 100644 --- a/src/coreComponents/constitutive/unitTests/testMultiFluidThreePhaseCompositionalMultiphase.cpp +++ b/src/coreComponents/constitutive/unitTests/testMultiFluidThreePhaseCompositionalMultiphase.cpp @@ -101,7 +101,7 @@ string MultiFluidCompositionalMultiphaseTestFixture< TEST_TYPE >::getFluidName() } template< integer NUM_COMP > -static void fillBinaryCoeffs( array2d< real64 > & binaryCoeff, std::array< real64 const, NUM_COMP *(NUM_COMP-1)/2 > const data ) +static void fillBinaryCoeffs( array2d< real64 > & binaryCoeff, stdArray< real64 const, NUM_COMP *(NUM_COMP-1)/2 > const data ) { auto bic = data.begin(); binaryCoeff.resize( NUM_COMP, NUM_COMP ); @@ -117,7 +117,7 @@ static void fillBinaryCoeffs( array2d< real64 > & binaryCoeff, std::array< real6 } template< integer NUM_COMP > -static void populateArray( arraySlice1d< real64 > array, std::array< real64 const, NUM_COMP > const data ) +static void populateArray( arraySlice1d< real64 > array, stdArray< real64 const, NUM_COMP > const data ) { for( integer i = 0; i < NUM_COMP; ++i ) { diff --git a/src/coreComponents/constitutive/unitTests/testMultiFluidTwoPhaseCompositionalMultiphase.cpp b/src/coreComponents/constitutive/unitTests/testMultiFluidTwoPhaseCompositionalMultiphase.cpp index b26f3541648..c02f841841c 100644 --- a/src/coreComponents/constitutive/unitTests/testMultiFluidTwoPhaseCompositionalMultiphase.cpp +++ b/src/coreComponents/constitutive/unitTests/testMultiFluidTwoPhaseCompositionalMultiphase.cpp @@ -122,7 +122,7 @@ string MultiFluidCompositionalMultiphaseTestFixture< TEST_TYPE >::getFluidName() } template< integer NUM_COMP > -static void fillBinaryCoeffs( array2d< real64 > & binaryCoeff, std::array< real64 const, NUM_COMP *(NUM_COMP-1)/2 > const data ) +static void fillBinaryCoeffs( array2d< real64 > & binaryCoeff, stdArray< real64 const, NUM_COMP *(NUM_COMP-1)/2 > const data ) { auto bic = data.begin(); binaryCoeff.resize( NUM_COMP, NUM_COMP ); @@ -138,7 +138,7 @@ static void fillBinaryCoeffs( array2d< real64 > & binaryCoeff, std::array< real6 } template< integer NUM_COMP > -static void populateArray( arraySlice1d< real64 > array, std::array< real64 const, NUM_COMP > const data ) +static void populateArray( arraySlice1d< real64 > array, stdArray< real64 const, NUM_COMP > const data ) { for( integer i = 0; i < NUM_COMP; ++i ) { diff --git a/src/coreComponents/constitutive/unitTests/testNegativeTwoPhaseFlashModel.cpp b/src/coreComponents/constitutive/unitTests/testNegativeTwoPhaseFlashModel.cpp index cd051c5e38d..e745593699a 100644 --- a/src/coreComponents/constitutive/unitTests/testNegativeTwoPhaseFlashModel.cpp +++ b/src/coreComponents/constitutive/unitTests/testNegativeTwoPhaseFlashModel.cpp @@ -55,7 +55,7 @@ struct FluidData< 2 > static std::unique_ptr< TestFluid< 2 > > createFluid() { auto fluid = TestFluid< 2 >::create( {Fluid::CH4, Fluid::C5H12} ); - const std::array< real64 const, 2 > bics = { 0.5 }; + const stdArray< real64 const, 2 > bics = { 0.5 }; fluid->setBinaryCoefficients( bics ); return fluid; } @@ -68,7 +68,7 @@ struct FluidData< 4 > static std::unique_ptr< TestFluid< 4 > > createFluid() { auto fluid = TestFluid< 4 >::create( {Fluid::CH4, Fluid::CO2, Fluid::H2S, Fluid::H2O} ); - const std::array< real64 const, 6 > bics = { 0.0, 0.0, 0.0, 0.4850, 0.1896, 0.1353 }; + const stdArray< real64 const, 6 > bics = { 0.0, 0.0, 0.0, 0.4850, 0.1896, 0.1353 }; fluid->setBinaryCoefficients( bics ); return fluid; } @@ -81,7 +81,7 @@ struct FluidData< 9 > static std::unique_ptr< TestFluid< 9 > > createFluid() { auto fluid = TestFluid< 9 >::create( {Fluid::H2O, Fluid::CO2, Fluid::N2, Fluid::CH4, Fluid::C2H6, Fluid::C3H8, Fluid::C4H10, Fluid::C5H12, Fluid::C8H18} ); - const std::array< real64 const, 36 > bics = { + const stdArray< real64 const, 36 > bics = { 0.01, 0, 0.003732, 0, 0.01, 0, 0, 0.01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01, 0, 0.028, 0.01, 0.01, 0, 0, 0.01, 0, 0.04532, 0.01, 0.01, 0, 0, 0 }; diff --git a/src/coreComponents/constitutive/unitTests/testSoreideWhitsonEOSPhaseModel.cpp b/src/coreComponents/constitutive/unitTests/testSoreideWhitsonEOSPhaseModel.cpp index 8c56a577404..3f659539e61 100644 --- a/src/coreComponents/constitutive/unitTests/testSoreideWhitsonEOSPhaseModel.cpp +++ b/src/coreComponents/constitutive/unitTests/testSoreideWhitsonEOSPhaseModel.cpp @@ -38,7 +38,7 @@ struct FluidData< 2 > return TestFluid< 2 >::create( {Fluid::H2O, Fluid::C10H22} ); } - static std::array< Feed< 2 >, 3 > constexpr feeds = { + static stdArray< Feed< 2 >, 3 > constexpr feeds = { Feed< 2 >{0.995, 0.005}, Feed< 2 >{1.000, 0.000}, Feed< 2 >{0.002, 0.998} @@ -53,7 +53,7 @@ struct FluidData< 3 > return TestFluid< 3 >::create( {Fluid::H2O, Fluid::H2S, Fluid::H2} ); } - static std::array< Feed< 3 >, 3 > constexpr feeds = { + static stdArray< Feed< 3 >, 3 > constexpr feeds = { Feed< 3 >{0.995, 0.000, 0.005}, Feed< 3 >{0.990, 0.005, 0.005}, Feed< 3 >{0.970, 0.025, 0.005} @@ -70,7 +70,7 @@ struct FluidData< 4 > return fluid; } - static std::array< Feed< 4 >, 4 > constexpr feeds = { + static stdArray< Feed< 4 >, 4 > constexpr feeds = { Feed< 4 >{0.030933, 0.319683, 0.637861, 0.011523}, Feed< 4 >{0.000000, 0.349686, 0.637891, 0.012423}, Feed< 4 >{0.000000, 0.349686, 0.650314, 0.000000}, diff --git a/src/coreComponents/constitutive/unitTests/testSoreideWhitsonFlash.cpp b/src/coreComponents/constitutive/unitTests/testSoreideWhitsonFlash.cpp index 54645b4207e..01de0a89e56 100644 --- a/src/coreComponents/constitutive/unitTests/testSoreideWhitsonFlash.cpp +++ b/src/coreComponents/constitutive/unitTests/testSoreideWhitsonFlash.cpp @@ -64,7 +64,7 @@ TEST_P( SoreideWhitsonSolubilityTestFixture, testSolubility ) /* UNCRUSTIFY-OFF */ // Soreide-Whitson correlations work only with "true" values of component parameters // kij_NA is the binary interation coefficient in the gas phase (see Table 5 Soreide-Whitson (1992)) - std::unordered_map const> const componentDatabase = { + std::unordered_map const> const componentDatabase = { // Mw Pc Tc Vc Ac kij_NA {Fluid::H2O, { 1.80153e-02, 2.20640e+07, 6.47096e+02, 5.59480e-05, 3.44300e-01, 0.0000 }}, {Fluid::CO2, { 4.40095e-02, 7.37730e+06, 3.04128e+02, 9.41185e-05, 2.23940e-01, 0.1896 }}, diff --git a/src/coreComponents/dataRepository/unitTests/testWrapperHelpers.cpp b/src/coreComponents/dataRepository/unitTests/testWrapperHelpers.cpp index a5956be0cf6..821c6f2256f 100644 --- a/src/coreComponents/dataRepository/unitTests/testWrapperHelpers.cpp +++ b/src/coreComponents/dataRepository/unitTests/testWrapperHelpers.cpp @@ -112,7 +112,7 @@ TEST( wrapperHelpers, size ) checkSizeMethod( string( "hello" ) ); checkSizeMethod( std::set< int > { 1, 2, 3 } ); checkSizeMethod( stdVector< int > { 1, 2, 3 } ); - checkSizeMethod( std::array< int, 5 > {} ); + checkSizeMethod( stdArray< int, 5 > {} ); checkSizeMethod( array1d< int >( 5 ) ); checkSizeMethod( array2d< int >( 5, 5 ) ); } diff --git a/src/coreComponents/dataRepository/wrapperHelpers.hpp b/src/coreComponents/dataRepository/wrapperHelpers.hpp index fcba757a07d..66925769860 100644 --- a/src/coreComponents/dataRepository/wrapperHelpers.hpp +++ b/src/coreComponents/dataRepository/wrapperHelpers.hpp @@ -425,7 +425,7 @@ pushDataToConduitNode( Array< T, NDIM, PERMUTATION > const & var, node[ "__dimensions__" ].set( dimensionType, temp ); // Create a copy of the permutation - constexpr std::array< camp::idx_t, NDIM > const perm = to_stdArray( RAJA::as_array< PERMUTATION >::get()); + constexpr stdArray< camp::idx_t, NDIM > const perm = to_stdArray( RAJA::as_array< PERMUTATION >::get()); for( int i = 0; i < NDIM; ++i ) { temp[ i ] = perm[ i ]; @@ -454,7 +454,7 @@ pullDataFromConduitNode( Array< T, NDIM, PERMUTATION > & var, conduit::Node const & permutationNode = node.fetch_existing( "__permutation__" ); GEOS_ERROR_IF_NE( permutationNode.dtype().number_of_elements(), totalNumDimensions ); - constexpr std::array< camp::idx_t, NDIM > const perm = to_stdArray( RAJA::as_array< PERMUTATION >::get()); + constexpr stdArray< camp::idx_t, NDIM > const perm = to_stdArray( RAJA::as_array< PERMUTATION >::get()); camp::idx_t const * const permFromConduit = permutationNode.value(); for( int i = 0; i < NDIM; ++i ) { diff --git a/src/coreComponents/integrationTests/fluidFlowTests/testTransmissibility.cpp b/src/coreComponents/integrationTests/fluidFlowTests/testTransmissibility.cpp index f4f9a046834..da8805e8b79 100644 --- a/src/coreComponents/integrationTests/fluidFlowTests/testTransmissibility.cpp +++ b/src/coreComponents/integrationTests/fluidFlowTests/testTransmissibility.cpp @@ -109,9 +109,9 @@ static string_view constexpr stencilDataCollectionPath = "/Tasks/cellToCellDataC /// a "stack" array to represent 3d floating point data (ie. coords) -using Float3 = std::array< real64, 3 >; +using Float3 = stdArray< real64, 3 >; /// a "stack" array to represent 3d integer data (ie. cell count / axis) -using Int3 = std::array< integer, 3 >; +using Int3 = stdArray< integer, 3 >; /// Enumeration of the 3D axis to take into account for a structured mesh. enum class Axis : integer { X = 0, Y = 1, Z = 2 }; @@ -196,7 +196,7 @@ TEST( TransmissibilityTest, StencilOutputVerificationAniso ) std::ostringstream xmlInput; xmlInput << xmlInputCommon << meshInput << xmlInputEnd; - static TestParams constexpr params { + static TestParams constexpr params { { 3, 4, 5 }, // cellCount { 70.0, 10.0, 54.321 }, // meshSize }; diff --git a/src/coreComponents/integrationTests/linearAlgebraTests/testDofManagerUtils.hpp b/src/coreComponents/integrationTests/linearAlgebraTests/testDofManagerUtils.hpp index 02dd0d8090c..e446738ad88 100644 --- a/src/coreComponents/integrationTests/linearAlgebraTests/testDofManagerUtils.hpp +++ b/src/coreComponents/integrationTests/linearAlgebraTests/testDofManagerUtils.hpp @@ -204,7 +204,7 @@ struct forLocalObjectsImpl< FieldLocation::Elem > { if( ghostRank[ei] < 0 ) { - lambda( std::array< localIndex, 3 > { er, esr, ei} ); + lambda( stdArray< localIndex, 3 > { er, esr, ei} ); } } } ); diff --git a/src/coreComponents/integrationTests/meshTests/testVTKImport.cpp b/src/coreComponents/integrationTests/meshTests/testVTKImport.cpp index 3eab728a833..4268b781bb4 100644 --- a/src/coreComponents/integrationTests/meshTests/testVTKImport.cpp +++ b/src/coreComponents/integrationTests/meshTests/testVTKImport.cpp @@ -397,13 +397,11 @@ TEST( VTKImport, cube ) // FIXME How to get the CellBlock as a function of the region, without knowing the naming pattern. // 1 elements type on 3 regions ("-1", "3", "9") = 3 sub-groups - std::array< std::pair< string, int >, 3 > const expectedCellBlocks = + stdArray const expectedCellBlocks = { - { - { "hexahedra", expectedSwap( 1, { 1, 0 } ) }, - { "3_hexahedra", expectedSwap( 25, { 16, 9 } ) }, - { "9_hexahedra", expectedSwap( 1, { 1, 0 } ) } - } + std::make_pair( "hexahedra", expectedSwap( 1, { 1, 0 } ) ), + std::make_pair( "3_hexahedra", expectedSwap( 25, { 16, 9 } ) ), + std::make_pair( "9_hexahedra", expectedSwap( 1, { 1, 0 } ) ) }; ASSERT_EQ( cellBlockManager.getCellBlocks().numSubGroups(), expectedCellBlocks.size() ); diff --git a/src/coreComponents/linearAlgebra/DofManagerHelpers.hpp b/src/coreComponents/linearAlgebra/DofManagerHelpers.hpp index 6ae81b10790..b3c077b009b 100644 --- a/src/coreComponents/linearAlgebra/DofManagerHelpers.hpp +++ b/src/coreComponents/linearAlgebra/DofManagerHelpers.hpp @@ -88,7 +88,7 @@ template<> struct MeshHelper< FieldLocation::Elem > { using ManagerType = ElementSubRegionBase; - using LocalIndexType = std::array< localIndex, 3 >; + using LocalIndexType = stdArray< localIndex, 3 >; static LocalIndexType constexpr invalid_local_index{ -1, -1, -1 }; diff --git a/src/coreComponents/linearAlgebra/solvers/BlockPreconditioner.hpp b/src/coreComponents/linearAlgebra/solvers/BlockPreconditioner.hpp index 58622d2f933..0de7a678c06 100644 --- a/src/coreComponents/linearAlgebra/solvers/BlockPreconditioner.hpp +++ b/src/coreComponents/linearAlgebra/solvers/BlockPreconditioner.hpp @@ -181,25 +181,25 @@ class BlockPreconditioner : public PreconditionerBase< LAI > LinearSolverParameters::Block m_params; /// Description of dof components making up each of the two main blocks - std::array< stdVector< DofManager::SubComponent >, 2 > m_blockDofs{}; + stdArray< stdVector< DofManager::SubComponent >, 2 > m_blockDofs{}; /// Pointers to prolongation operators for each sub-block - std::array< Matrix const *, 2 > m_prolongators{}; + stdArray< Matrix const *, 2 > m_prolongators{}; /// Prolongation operators for each sub-block - std::array< Matrix, 2 > m_prolongatorsOwned{}; + stdArray< Matrix, 2 > m_prolongatorsOwned{}; /// Matrix blocks BlockOperator< Vector, Matrix > m_matBlocks; /// Individual block preconditioner pointers - std::array< PreconditionerBase< LAI > *, 2 > m_solvers{}; + stdArray< PreconditionerBase< LAI > *, 2 > m_solvers{}; /// Individual block preconditioner operators (when owned) - std::array< std::unique_ptr< PreconditionerBase< LAI > >, 2 > m_solversOwned{}; + stdArray< std::unique_ptr< PreconditionerBase< LAI > >, 2 > m_solversOwned{}; /// Scaling of each block - std::array< real64, 2 > m_scaling{}; + stdArray< real64, 2 > m_scaling{}; /// Internal vector of block residuals mutable BlockVector< Vector > m_rhs; diff --git a/src/coreComponents/mesh/BufferOps.cpp b/src/coreComponents/mesh/BufferOps.cpp index 8cbc63dd265..f9b2132f0fb 100644 --- a/src/coreComponents/mesh/BufferOps.cpp +++ b/src/coreComponents/mesh/BufferOps.cpp @@ -85,7 +85,7 @@ localIndex Unpack( buffer_unit_type const * & buffer, sizeOfUnpackedChars += bufferOps::Unpack( buffer, numIndicesUnpacked ); GEOS_ERROR_IF( numIndicesUnpacked != packList.size(), "" ); - using ElementID = std::array< localIndex, 3 >; + using ElementID = stdArray< localIndex, 3 >; // Allocate some memory to store map entries that don't fit in existing capacity array1d< localIndex > indicesToReplace; diff --git a/src/coreComponents/mesh/DomainPartition.cpp b/src/coreComponents/mesh/DomainPartition.cpp index 943c6366974..aa837c47dd5 100644 --- a/src/coreComponents/mesh/DomainPartition.cpp +++ b/src/coreComponents/mesh/DomainPartition.cpp @@ -337,9 +337,9 @@ void DomainPartition::outputPartitionInformation() const { Node = 0, Edge, Face, Elem, Count }; - std::array< globalIndex, 4 > localCount = {}; - std::array< globalIndex, 4 > ghostCount = {}; - std::array< double, 4 > ratio = {}; + stdArray< globalIndex, 4 > localCount = {}; + stdArray< globalIndex, 4 > ghostCount = {}; + stdArray< double, 4 > ratio = {}; }; auto fillStats = []( RankMeshStats & stat, @@ -372,7 +372,7 @@ void DomainPartition::outputPartitionInformation() const addCommaSeparators( stat.localCount[3] + stat.ghostCount[3] ) ); }; - auto addSummaryRow = []( TableData & tableData, std::array< double, 4 > stats, string_view heading ) + auto addSummaryRow = []( TableData & tableData, stdArray< double, 4 > const & stats, string_view heading ) { tableData.addRow( heading, CellType::MergeNext, CellType::MergeNext, stats[0], @@ -462,8 +462,8 @@ void DomainPartition::outputPartitionInformation() const addLocalGhostRow( tableData, minStats, "min" ); addLocalGhostRow( tableData, maxStats, "max" ); - std::array< double, 4 > localTotalMinRatio; - std::array< double, 4 > localTotalMaxRatio; + stdArray< double, 4 > localTotalMinRatio; + stdArray< double, 4 > localTotalMaxRatio; for( size_t statId = 0; statId < RankMeshStats::Count; ++statId ) { diff --git a/src/coreComponents/mesh/ElementSubRegionBase.hpp b/src/coreComponents/mesh/ElementSubRegionBase.hpp index 21810289001..e5480a4d2da 100644 --- a/src/coreComponents/mesh/ElementSubRegionBase.hpp +++ b/src/coreComponents/mesh/ElementSubRegionBase.hpp @@ -281,7 +281,7 @@ class ElementSubRegionBase : public ObjectManagerBase { // collect node coordinates for element k localIndex const numNodes = this->numNodesPerElement( k ); - std::vector< std::array< real64, 3 > > nodes; + std::vector< stdArray< real64, 3 > > nodes; nodes.reserve( numNodes ); for( localIndex a = 0; a < numNodes; ++a ) { @@ -306,7 +306,7 @@ class ElementSubRegionBase : public ObjectManagerBase nodes.erase( std::unique( nodes.begin(), nodes.end(), almostEqual ), nodes.end() ); // compute average (center) of unique nodes - std::array< real64, 3 > centre = { 0.0, 0.0, 0.0 }; + stdArray< real64, 3 > centre = { 0.0, 0.0, 0.0 }; for( auto const & p : nodes ) { centre[0] += p[0]; diff --git a/src/coreComponents/mesh/WellElementSubRegion.cpp b/src/coreComponents/mesh/WellElementSubRegion.cpp index 1b61cc7c507..815df38257c 100644 --- a/src/coreComponents/mesh/WellElementSubRegion.cpp +++ b/src/coreComponents/mesh/WellElementSubRegion.cpp @@ -210,7 +210,7 @@ bool isPointInsideElement( SurfaceElementSubRegion const & subRegion, real64 const (&location)[3], real64 const geomTol ) { - typedef std::array< real64, 3 > Point3d; + typedef stdArray< real64, 3 > Point3d; // collect element nodes integer const nV = subRegion.numNodesPerElement( eiLocal ); diff --git a/src/coreComponents/mesh/generators/CellBlockManager.cpp b/src/coreComponents/mesh/generators/CellBlockManager.cpp index 2c7be094170..a91dab0a9c4 100644 --- a/src/coreComponents/mesh/generators/CellBlockManager.cpp +++ b/src/coreComponents/mesh/generators/CellBlockManager.cpp @@ -1022,7 +1022,7 @@ void CellBlockManager::generateHighOrderMaps( localIndex const order, nodeLocalToGlobalNew=nodeLocalToGlobalNew.toView(), numInternalNodesPerEdge, numNodesPerEdge, globalNodeOffset, glCoords, localNodeOffset, order]( localIndex const iter_edge ) { - std::unordered_map< std::array< localIndex, 6 >, localIndex, NodeKeyHasher< localIndex > > nodeIDs; + std::unordered_map< stdArray< localIndex, 6 >, localIndex, NodeKeyHasher< localIndex > > nodeIDs; localIndex edgeHeadNode = edgeToNodesMapSource[ iter_edge ][ 0 ]; localIndex edgeEndNode = edgeToNodesMapSource[ iter_edge ][ 1 ]; globalIndex edgeHeadNodeG = nodeLocalToGlobalNew[ edgeHeadNode ]; @@ -1039,7 +1039,7 @@ void CellBlockManager::generateHighOrderMaps( localIndex const order, localIndex nodeLocalID = localNodeOffset + iter_edge * ( numInternalNodesPerEdge ) + iter_node; edgeToNodeMapWork[ iter_node + 2 ] = nodeLocalID; nodeIDs[ createNodeKey( edgeHeadNode, edgeEndNode, iter_node + 1, order ) ] = iter_node + 2; - std::array< globalIndex, 6 > referenceOrientation = createNodeKey( edgeHeadNodeG, edgeEndNodeG, iter_node + 1, order ); + stdArray< globalIndex, 6 > referenceOrientation = createNodeKey( edgeHeadNodeG, edgeEndNodeG, iter_node + 1, order ); int gq = referenceOrientation[4] - 1; nodeLocalToGlobalNew[ nodeLocalID ] = globalNodeOffset + edgeLocalToGlobal[ iter_edge ] * numInternalNodesPerEdge + gq; localIndex e[2] = { edgeHeadNode, edgeEndNode }; @@ -1086,7 +1086,7 @@ void CellBlockManager::generateHighOrderMaps( localIndex const order, faceLocalToGlobal=faceLocalToGlobal.toView(), nodeLocalToGlobalNew=nodeLocalToGlobalNew.toView() ]( localIndex const iter_face ) { - std::unordered_map< std::array< localIndex, 6 >, localIndex, NodeKeyHasher< localIndex > > nodeIDs; + std::unordered_map< stdArray< localIndex, 6 >, localIndex, NodeKeyHasher< localIndex > > nodeIDs; localIndex faceVertID[ numVerticesPerFace ]; globalIndex faceVertGID[ numVerticesPerFace ]; array1d< localIndex > const faceToNodeMapWork( numNodesPerFace ); @@ -1122,7 +1122,7 @@ void CellBlockManager::generateHighOrderMaps( localIndex const order, localIndex nodeLocalID = localNodeOffset + iter_face * numInternalNodesPerFace + iter_node; faceToNodeMapNew[ iter_face ][ (q2 + 1) * numNodesPerEdge + (q1 + 1) ] = nodeLocalID; - std::array< globalIndex, 6 > referenceOrientation = createNodeKey( faceVertGID[ 0 ], faceVertGID[ 1 ], faceVertGID[ 2 ], faceVertGID[ 3 ], + stdArray< globalIndex, 6 > referenceOrientation = createNodeKey( faceVertGID[ 0 ], faceVertGID[ 1 ], faceVertGID[ 2 ], faceVertGID[ 3 ], q1 + 1, q2 + 1, order ); int gq1 = referenceOrientation[4] - 1; int gq2 = referenceOrientation[5] - 1; @@ -1189,7 +1189,7 @@ void CellBlockManager::generateHighOrderMaps( localIndex const order, elementLocalToGlobal=elementLocalToGlobal.toView(), nodeLocalToGlobalNew=nodeLocalToGlobalNew.toView() ]( localIndex const iter_elem ) { - std::unordered_map< std::array< localIndex, 6 >, localIndex, NodeKeyHasher< localIndex > > nodeIDs; + std::unordered_map< stdArray< localIndex, 6 >, localIndex, NodeKeyHasher< localIndex > > nodeIDs; localIndex elemVertID[ numVerticesPerCell]; array1d< localIndex > const elemToNodeMapWork( numNodesPerCell ); for( localIndex iter_node=0; iter_node < numVerticesPerCell; iter_node++ ) diff --git a/src/coreComponents/mesh/generators/VTKUtilities.cpp b/src/coreComponents/mesh/generators/VTKUtilities.cpp index b49e30e857a..082e1a5d8fb 100644 --- a/src/coreComponents/mesh/generators/VTKUtilities.cpp +++ b/src/coreComponents/mesh/generators/VTKUtilities.cpp @@ -855,7 +855,7 @@ void dispatchArray( vtkDataSetAttributes & data, InputError ); } -std::array< std::pair< int, int >, 2 > +stdArray< std::pair< int, int >, 2 > findGlobalIndexBounds( vtkDataSet & mesh, MPI_Comm const & comm, string const & indexArrayName ) @@ -899,7 +899,7 @@ redistributeByAreaGraphAndLayer( AllMeshes & input, GEOS_ERROR_IF_NE_MSG( numProcs % numPartZ, 0, "Number of ranks must evenly divide the number of z-partitions" ); // Compute conversion from cell z-index to partition z-index - std::array< std::pair< int, int >, 2 > const idxLimits = findGlobalIndexBounds( *input.getMainMesh(), comm, indexArrayName ); + stdArray< std::pair< int, int >, 2 > const idxLimits = findGlobalIndexBounds( *input.getMainMesh(), comm, indexArrayName ); double const cellPerPartZInv = static_cast< double >( numPartZ ) / ( idxLimits[1].second - idxLimits[1].first + 1 ); auto const computePartIndexZ = [minZ = idxLimits[1].first, cellPerPartZInv]( auto const zidx ) { @@ -1418,7 +1418,7 @@ splitCellsByType( vtkDataSet & mesh ) vtkIdType const numCells = mesh.GetNumberOfCells(); // Count the number of each cell type - std::array< size_t, numElementTypes() > cellTypeCounts{}; + stdArray< size_t, numElementTypes() > cellTypeCounts{}; for( vtkIdType c = 0; c < numCells; c++ ) { ElementType const elemType = convertVtkToGeosxElementType( mesh.GetCell( c ) ); @@ -1426,7 +1426,7 @@ splitCellsByType( vtkDataSet & mesh ) } // Allocate space to hold cell id lists by type - std::array< stdVector< vtkIdType >, numElementTypes() > cellListsByType; + stdArray< stdVector< vtkIdType >, numElementTypes() > cellListsByType; for( integer t = 0; t < numElementTypes(); ++t ) { cellListsByType[t].reserve( cellTypeCounts[t] ); diff --git a/src/coreComponents/mesh/graphs/GraphColoringBase.cpp b/src/coreComponents/mesh/graphs/GraphColoringBase.cpp index 55f1208b480..849d360c25e 100644 --- a/src/coreComponents/mesh/graphs/GraphColoringBase.cpp +++ b/src/coreComponents/mesh/graphs/GraphColoringBase.cpp @@ -27,9 +27,9 @@ namespace geos namespace graph { -bool GraphColoringBase::isColoringValid( const std::vector< camp::idx_t > & xadj, - const std::vector< camp::idx_t > & adjncy, - const std::vector< int > & coloring ) +bool GraphColoringBase::isColoringValid( const stdVector< camp::idx_t > & xadj, + const stdVector< camp::idx_t > & adjncy, + const stdVector< int > & coloring ) { for( size_t node = 0; node < coloring.size(); ++node ) { @@ -48,7 +48,7 @@ bool GraphColoringBase::isColoringValid( const std::vector< camp::idx_t > & xadj } -size_t GraphColoringBase::getNumberOfColors( const std::vector< int > & colors ) +size_t GraphColoringBase::getNumberOfColors( const stdVector< int > & colors ) { std::unordered_set< int > uniqueColors; for( int color : colors ) @@ -63,13 +63,13 @@ size_t GraphColoringBase::getNumberOfColors( const std::vector< int > & colors ) // Assume only one node per rank. -bool GraphColoringBase::isColoringValid( const std::vector< camp::idx_t > & adjncy, +bool GraphColoringBase::isColoringValid( const stdVector< camp::idx_t > & adjncy, const int color, MPI_Comm comm ) { // Gather neighbor colors asynchronously - std::vector< int > neighborColors( adjncy.size()); - std::vector< MPI_Request > requests( adjncy.size() * 2, MPI_REQUEST_NULL ); // Two requests per neighbor (send and receive) + stdVector< int > neighborColors( adjncy.size()); + stdVector< MPI_Request > requests( adjncy.size() * 2, MPI_REQUEST_NULL ); // Two requests per neighbor (send and receive) for( size_t i = 0; i < adjncy.size(); ++i ) { int const neighborRank = adjncy[i]; @@ -101,27 +101,27 @@ bool GraphColoringBase::isColoringValid( const std::vector< camp::idx_t > & adjn size_t GraphColoringBase::getNumberOfColors( const int color, MPI_Comm comm ) { - std::vector< int > colors = {color}; + stdVector< int > colors = {color}; return getNumberOfColors( colors, comm ); } -size_t GraphColoringBase::getNumberOfColors( const std::vector< int > & colors, MPI_Comm comm ) +size_t GraphColoringBase::getNumberOfColors( const stdVector< int > & colors, MPI_Comm comm ) { int const rank = MpiWrapper::commRank( comm ); int const size = MpiWrapper::commSize( comm ); std::set< int > localDistinctColors = std::set< int >( colors.begin(), colors.end()); - std::vector< int > localDistinctColorsVector( localDistinctColors.begin(), localDistinctColors.end()); + stdVector< int > localDistinctColorsVector( localDistinctColors.begin(), localDistinctColors.end()); int const localSize = localDistinctColorsVector.size(); // Gather the sizes of the local color vectors from all ranks - std::vector< int > allSizes( size ); + stdVector< int > allSizes( size ); MpiWrapper::gather( &localSize, 1, allSizes.data(), 1, 0, comm ); // Calculate the total number of colors and the displacements for gathering int totalSize = 0; - std::vector< int > displacements( size, 0 ); + stdVector< int > displacements( size, 0 ); if( rank == 0 ) { for( int i = 0; i < size; ++i ) @@ -132,7 +132,7 @@ size_t GraphColoringBase::getNumberOfColors( const std::vector< int > & colors, } // Gather all colors from all ranks to rank 0 - std::vector< int > allColors( totalSize ); + stdVector< int > allColors( totalSize ); MpiWrapper::gatherv( localDistinctColorsVector.data(), localSize, allColors.data(), allSizes.data(), displacements.data(), 0, comm ); diff --git a/src/coreComponents/mesh/graphs/GraphColoringBase.hpp b/src/coreComponents/mesh/graphs/GraphColoringBase.hpp index 2b8242c70cf..3ca8fc45165 100644 --- a/src/coreComponents/mesh/graphs/GraphColoringBase.hpp +++ b/src/coreComponents/mesh/graphs/GraphColoringBase.hpp @@ -54,14 +54,14 @@ class GraphColoringBase * @param adjncy Adjacency list containing neighbors of each node. * @return A vector of colors assigned to each node. */ - virtual std::vector< int > colorGraph( const std::vector< camp::idx_t > & xadj, const std::vector< camp::idx_t > & adjncy ) = 0; + virtual stdVector< int > colorGraph( const stdVector< camp::idx_t > & xadj, const stdVector< camp::idx_t > & adjncy ) = 0; /** * @brief Pure virtual method to color a graph assuming one node per rank. * @param adjncy Adjacency list containing neighbors of each node. * @return Color of the node. */ - virtual int colorGraph( const std::vector< camp::idx_t > & adjncy ) = 0; + virtual int colorGraph( const stdVector< camp::idx_t > & adjncy ) = 0; /** @@ -81,7 +81,7 @@ class GraphColoringBase * @param coloring A vector where the index represents the node and the value represents the assigned color.* * @return True if the coloring is valid, false otherwise. */ - static bool isColoringValid( const std::vector< camp::idx_t > & xadj, const std::vector< camp::idx_t > & adjncy, const std::vector< int > & coloring ); + static bool isColoringValid( const stdVector< camp::idx_t > & xadj, const stdVector< camp::idx_t > & adjncy, const stdVector< int > & coloring ); /** * @brief Checks the validity of the graph coloring assuming one node per rank. @@ -92,7 +92,7 @@ class GraphColoringBase * * @return True if the coloring is valid, false otherwise. */ - static bool isColoringValid( const std::vector< camp::idx_t > & adjncy, const int color, MPI_Comm comm ); + static bool isColoringValid( const stdVector< camp::idx_t > & adjncy, const int color, MPI_Comm comm ); /** * @brief Counts the number of distinct colors. @@ -103,7 +103,7 @@ class GraphColoringBase * @param colors A vector of integers representing colors. * @return The number of distinct colors in the vector. */ - static size_t getNumberOfColors( const std::vector< int > & colors ); + static size_t getNumberOfColors( const stdVector< int > & colors ); /** * @brief Counts the number of distinct colors (parallel version). @@ -111,7 +111,7 @@ class GraphColoringBase * @param comm MPI communicator. * @return Number of distinct colors. */ - static size_t getNumberOfColors( const std::vector< int > & colors, MPI_Comm comm ); + static size_t getNumberOfColors( const stdVector< int > & colors, MPI_Comm comm ); /** * @brief Counts the number of distinct colors assuming one node per rank (parallel version). diff --git a/src/coreComponents/mesh/graphs/GraphTools.cpp b/src/coreComponents/mesh/graphs/GraphTools.cpp index 84b5f287591..43e4b9cd5b6 100644 --- a/src/coreComponents/mesh/graphs/GraphTools.cpp +++ b/src/coreComponents/mesh/graphs/GraphTools.cpp @@ -29,13 +29,13 @@ namespace geos namespace graph { -size_t getGraphNodeDegree( idx_t node, const std::vector< idx_t > & xadj ) +size_t getGraphNodeDegree( idx_t node, const stdVector< idx_t > & xadj ) { return xadj[node + 1] - xadj[node]; } -std::unordered_set< idx_t > getGraphNodeNeighbors( idx_t node, const std::vector< idx_t > & xadj, const std::vector< idx_t > & adjncy ) +std::unordered_set< idx_t > getGraphNodeNeighbors( idx_t node, const stdVector< idx_t > & xadj, const stdVector< idx_t > & adjncy ) { std::unordered_set< idx_t > neighbors; for( idx_t i = xadj[node]; i < xadj[node + 1]; ++i ) @@ -46,8 +46,8 @@ std::unordered_set< idx_t > getGraphNodeNeighbors( idx_t node, const std::vector } -bool isGraphValid( const std::vector< idx_t > & xadj, - const std::vector< idx_t > & adjncy ) +bool isGraphValid( const stdVector< idx_t > & xadj, + const stdVector< idx_t > & adjncy ) { idx_t num_nodes = xadj.size() - 1; @@ -95,9 +95,9 @@ bool isGraphValid( const std::vector< idx_t > & xadj, } -std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphRandom( size_t numVertices, size_t numEdges ) +std::tuple< stdVector< idx_t >, stdVector< idx_t > > generateGraphRandom( size_t numVertices, size_t numEdges ) { - std::vector< std::pair< size_t, size_t > > edges; + stdVector< std::pair< size_t, size_t > > edges; srand( static_cast< unsigned int >(time( 0 ))); // Generate random edges @@ -116,8 +116,8 @@ std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphRandom( si std::sort( edges.begin(), edges.end()); // Initialize xadj and adjncy - std::vector< idx_t > xadj( numVertices + 1, 0 ); - std::vector< idx_t > adjncy; + stdVector< idx_t > xadj( numVertices + 1, 0 ); + stdVector< idx_t > adjncy; adjncy.reserve( edges.size()); // Fill xadj and adjncy @@ -142,11 +142,11 @@ std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphRandom( si } -std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphCartPartitionning3D( idx_t nx, idx_t ny, idx_t nz, const std::vector< std::array< int, 3 > > & neighbor_offsets ) +std::tuple< stdVector< idx_t >, stdVector< idx_t > > generateGraphCartPartitionning3D( idx_t nx, idx_t ny, idx_t nz, const stdVector< stdArray< int, 3 > > & neighbor_offsets ) { idx_t num_nodes = nx * ny * nz; - std::vector< idx_t > xadj( num_nodes + 1, 0 ); - std::vector< idx_t > adjncy; + stdVector< idx_t > xadj( num_nodes + 1, 0 ); + stdVector< idx_t > adjncy; auto getNodeIndex = [nx, ny] ( const idx_t x, const idx_t y, const idx_t z ) { @@ -160,7 +160,7 @@ std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphCartPartit { for( idx_t x = 0; x < nx; ++x ) { - std::vector< idx_t > neighbors; + stdVector< idx_t > neighbors; for( const auto & offset : neighbor_offsets ) { @@ -186,17 +186,17 @@ std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphCartPartit return {xadj, adjncy}; } -std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphCartPartitionning3D6( idx_t nx, idx_t ny, idx_t nz ) +std::tuple< stdVector< idx_t >, stdVector< idx_t > > generateGraphCartPartitionning3D6( idx_t nx, idx_t ny, idx_t nz ) { - std::vector< std::array< int, 3 > > neighbor_offsets = { + stdVector< stdArray< int, 3 > > neighbor_offsets = { {-1, 0, 0}, {1, 0, 0}, {0, -1, 0}, {0, 1, 0}, {0, 0, -1}, {0, 0, 1} }; return generateGraphCartPartitionning3D( nx, ny, nz, neighbor_offsets ); } -std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphCartPartitionning3D26( idx_t nx, idx_t ny, idx_t nz ) +std::tuple< stdVector< idx_t >, stdVector< idx_t > > generateGraphCartPartitionning3D26( idx_t nx, idx_t ny, idx_t nz ) { - std::vector< std::array< int, 3 > > neighbor_offsets; + stdVector< stdArray< int, 3 > > neighbor_offsets; for( int dz = -1; dz <= 1; ++dz ) { for( int dy = -1; dy <= 1; ++dy ) diff --git a/src/coreComponents/mesh/graphs/GraphTools.hpp b/src/coreComponents/mesh/graphs/GraphTools.hpp index 0aa09887889..c478863bbd8 100644 --- a/src/coreComponents/mesh/graphs/GraphTools.hpp +++ b/src/coreComponents/mesh/graphs/GraphTools.hpp @@ -45,7 +45,7 @@ using camp::idx_t; * @param adjncy The adjacency list containing the neighbors of each node. * @return True if the graph meets all criteria, false otherwise. */ -bool isGraphValid( const std::vector< idx_t > & xadj, const std::vector< idx_t > & adjncy ); +bool isGraphValid( const stdVector< idx_t > & xadj, const stdVector< idx_t > & adjncy ); /** * @brief Calculates the degree of a node in the graph. @@ -56,7 +56,7 @@ bool isGraphValid( const std::vector< idx_t > & xadj, const std::vector< idx_t > * @param xadj The adjacency list offsets for each node. * @return The degree of the node. */ -size_t getGraphNodeDegree( idx_t node, const std::vector< idx_t > & xadj ); +size_t getGraphNodeDegree( idx_t node, const stdVector< idx_t > & xadj ); /** * @brief Retrieves the neighbors of a node in the graph. @@ -68,7 +68,7 @@ size_t getGraphNodeDegree( idx_t node, const std::vector< idx_t > & xadj ); * @param adjncy The adjacency list containing the neighbors of each node. * @return A set of indices representing the neighbors of the node. */ -std::unordered_set< idx_t > getGraphNodeNeighbors( idx_t node, const std::vector< idx_t > & xadj, const std::vector< idx_t > & adjncy ); +std::unordered_set< idx_t > getGraphNodeNeighbors( idx_t node, const stdVector< idx_t > & xadj, const stdVector< idx_t > & adjncy ); @@ -81,7 +81,7 @@ std::unordered_set< idx_t > getGraphNodeNeighbors( idx_t node, const std::vector * @param num_edges Number of edges in the graph. * @return A tuple containing xadj and adjncy. */ -std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphRandom( size_t num_nodes, size_t num_edges ); +std::tuple< stdVector< idx_t >, stdVector< idx_t > > generateGraphRandom( size_t num_nodes, size_t num_edges ); /** * @brief Generates the adjacency list representation (xadj and adjncy) for a Cartesian domain decomposition in 3D. @@ -94,7 +94,7 @@ std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphRandom( si * @param nz Number of divisions along the z-axis. * @return A tuple containing xadj and adjncy. */ -std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphCartPartitionning3D6( idx_t nx, idx_t ny, idx_t nz ); +std::tuple< stdVector< idx_t >, stdVector< idx_t > > generateGraphCartPartitionning3D6( idx_t nx, idx_t ny, idx_t nz ); /** * @brief Generates the adjacency list representation (xadj and adjncy) for a Cartesian domain decomposition in 3D. @@ -107,7 +107,7 @@ std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphCartPartit * @param nz Number of divisions along the z-axis. * @return A tuple containing xadj and adjncy. */ -std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphCartPartitionning3D26( idx_t nx, idx_t ny, idx_t nz ); +std::tuple< stdVector< idx_t >, stdVector< idx_t > > generateGraphCartPartitionning3D26( idx_t nx, idx_t ny, idx_t nz ); } // namespace geos diff --git a/src/coreComponents/mesh/graphs/GraphToolsMPI.cpp b/src/coreComponents/mesh/graphs/GraphToolsMPI.cpp index c5206b26dd2..45651c21d3e 100644 --- a/src/coreComponents/mesh/graphs/GraphToolsMPI.cpp +++ b/src/coreComponents/mesh/graphs/GraphToolsMPI.cpp @@ -26,9 +26,9 @@ namespace geos namespace graph { -std::pair< std::vector< camp::idx_t >, std::vector< camp::idx_t > > -scatterGraphData( const std::vector< camp::idx_t > & xadj, - const std::vector< camp::idx_t > & adjncy, +std::pair< stdVector< camp::idx_t >, stdVector< camp::idx_t > > +scatterGraphData( const stdVector< camp::idx_t > & xadj, + const stdVector< camp::idx_t > & adjncy, MPI_Comm comm ) { int const rank = MpiWrapper::commRank( comm ); @@ -40,9 +40,9 @@ scatterGraphData( const std::vector< camp::idx_t > & xadj, GEOS_ASSERT_EQ_MSG( size, static_cast< int >(xadj.size()) - 1, "Number of ranks does not match the size of xadj-1" ); } - std::vector< int > sendCounts; - std::vector< int > displacements; - std::vector< camp::idx_t > xadjToScatter; + stdVector< int > sendCounts; + stdVector< int > displacements; + stdVector< camp::idx_t > xadjToScatter; if( rank == 0 ) { @@ -64,13 +64,13 @@ scatterGraphData( const std::vector< camp::idx_t > & xadj, } } - std::vector< camp::idx_t > localXadj( 2 ); // Each rank will have two elements in localXadj: xadj[i] and xadj[i+1] + stdVector< camp::idx_t > localXadj( 2 ); // Each rank will have two elements in localXadj: xadj[i] and xadj[i+1] MpiWrapper::scatter( xadjToScatter.data(), 2, localXadj.data(), 2, 0, comm ); int localSize; MpiWrapper::scatter( sendCounts.data(), 1, &localSize, 1, 0, comm ); - std::vector< camp::idx_t > localAdjncy( localSize ); + stdVector< camp::idx_t > localAdjncy( localSize ); MpiWrapper::scatterv( adjncy.data(), sendCounts.data(), displacements.data(), localAdjncy.data(), localSize, 0, comm ); @@ -78,9 +78,9 @@ scatterGraphData( const std::vector< camp::idx_t > & xadj, } -std::pair< std::vector< camp::idx_t >, std::vector< camp::idx_t > > -gatherGraphData( const std::vector< camp::idx_t > & localXadj, - const std::vector< camp::idx_t > & localAdjncy, +std::pair< stdVector< camp::idx_t >, stdVector< camp::idx_t > > +gatherGraphData( const stdVector< camp::idx_t > & localXadj, + const stdVector< camp::idx_t > & localAdjncy, MPI_Comm comm ) { int const rank = MpiWrapper::commRank( comm ); @@ -90,11 +90,11 @@ gatherGraphData( const std::vector< camp::idx_t > & localXadj, int nCounts = (rank < size - 1) ? static_cast< int >(localXadj.size() - 1) : static_cast< int >(localXadj.size()); // Gather the counts of elements from each rank - std::vector< int > recvCounts( size ); + stdVector< int > recvCounts( size ); MpiWrapper::gather( &nCounts, 1, recvCounts.data(), 1, 0, comm ); // Calculate displacements for the gathered data - std::vector< int > displacements( size ); + stdVector< int > displacements( size ); if( rank == 0 ) { displacements[0] = 0; @@ -105,7 +105,7 @@ gatherGraphData( const std::vector< camp::idx_t > & localXadj, } // Resize the xadj vector on rank 0 to hold the gathered data - std::vector< camp::idx_t > xadj; + stdVector< camp::idx_t > xadj; if( rank == 0 ) { int totalSize = std::accumulate( recvCounts.begin(), recvCounts.end(), 0 ); @@ -133,7 +133,7 @@ gatherGraphData( const std::vector< camp::idx_t > & localXadj, } // Resize the adjncy vector on rank 0 to hold the gathered data - std::vector< camp::idx_t > adjncy; + stdVector< camp::idx_t > adjncy; if( rank == 0 ) { int totalSize = std::accumulate( recvCounts.begin(), recvCounts.end(), 0 ); @@ -150,21 +150,21 @@ gatherGraphData( const std::vector< camp::idx_t > & localXadj, } -std::vector< camp::idx_t > createXadjFromAdjncy( const std::vector< camp::idx_t > & localAdjncy, MPI_Comm comm ) +stdVector< camp::idx_t > createXadjFromAdjncy( const stdVector< camp::idx_t > & localAdjncy, MPI_Comm comm ) { int const size = MpiWrapper::commSize( comm ); // Gather the counts of elements from each rank for localAdjncy int localAdjncySize = static_cast< int >(localAdjncy.size()); - std::vector< int > adjncyCounts( size ); + stdVector< int > adjncyCounts( size ); MpiWrapper::allgather( &localAdjncySize, 1, adjncyCounts.data(), 1, comm ); // Calculate xadj - std::vector< camp::idx_t > xadj( size + 1, 0 ); + stdVector< camp::idx_t > xadj( size + 1, 0 ); std::partial_sum( adjncyCounts.begin(), adjncyCounts.end(), xadj.begin() + 1 ); // Prepare data to scatter - std::vector< camp::idx_t > xadjToScatter( 2 * size ); + stdVector< camp::idx_t > xadjToScatter( 2 * size ); for( int i = 0; i < size; ++i ) { xadjToScatter[2 * i] = xadj[i]; @@ -172,29 +172,29 @@ std::vector< camp::idx_t > createXadjFromAdjncy( const std::vector< camp::idx_t } // Scatter the xadj data - std::vector< camp::idx_t > localXadj( 2 ); + stdVector< camp::idx_t > localXadj( 2 ); MpiWrapper::scatter( xadjToScatter.data(), 2, localXadj.data(), 2, 0, comm ); return localXadj; } -std::vector< int > createVertexGlobalID( const std::vector< camp::idx_t > & localXadj, MPI_Comm comm ) +stdVector< int > createVertexGlobalID( const stdVector< camp::idx_t > & localXadj, MPI_Comm comm ) { int const rank = MpiWrapper::commRank( comm ); int const size = MpiWrapper::commSize( comm ); int localNumVertices = static_cast< int >(localXadj.size()) - 1; - std::vector< int > allNumVertices( size ); + stdVector< int > allNumVertices( size ); MpiWrapper::allgather( &localNumVertices, 1, allNumVertices.data(), 1, comm ); // Compute displacement for the current rank - std::vector< int > displacements( size, 0 ); + stdVector< int > displacements( size, 0 ); std::partial_sum( allNumVertices.begin(), allNumVertices.end() - 1, displacements.begin() + 1 ); int displacement = displacements[rank]; - std::vector< int > globalID( localNumVertices ); + stdVector< int > globalID( localNumVertices ); std::iota( globalID.begin(), globalID.end(), displacement ); return globalID; diff --git a/src/coreComponents/mesh/graphs/GraphToolsMPI.hpp b/src/coreComponents/mesh/graphs/GraphToolsMPI.hpp index c0f09fe7086..c4b3cab082b 100644 --- a/src/coreComponents/mesh/graphs/GraphToolsMPI.hpp +++ b/src/coreComponents/mesh/graphs/GraphToolsMPI.hpp @@ -44,9 +44,9 @@ using camp::idx_t; * @param comm The MPI communicator (default is MPI_COMM_GEOS). * @return A pair of vectors containing the local adjacency list offsets and neighbors for each rank. */ -std::pair< std::vector< camp::idx_t >, std::vector< camp::idx_t > > -scatterGraphData( const std::vector< camp::idx_t > & xadj, - const std::vector< camp::idx_t > & adjncy, +std::pair< stdVector< camp::idx_t >, stdVector< camp::idx_t > > +scatterGraphData( const stdVector< camp::idx_t > & xadj, + const stdVector< camp::idx_t > & adjncy, MPI_Comm comm = MPI_COMM_GEOS ); @@ -62,9 +62,9 @@ scatterGraphData( const std::vector< camp::idx_t > & xadj, * @return A pair of vectors: global xadj and adjncy. */ -std::pair< std::vector< camp::idx_t >, std::vector< camp::idx_t > > -gatherGraphData( const std::vector< camp::idx_t > & localXadj, - const std::vector< camp::idx_t > & localAdjncy, +std::pair< stdVector< camp::idx_t >, stdVector< camp::idx_t > > +gatherGraphData( const stdVector< camp::idx_t > & localXadj, + const stdVector< camp::idx_t > & localAdjncy, MPI_Comm comm= MPI_COMM_GEOS ); @@ -78,7 +78,7 @@ gatherGraphData( const std::vector< camp::idx_t > & localXadj, * @param comm The MPI communicator. * @return The xadj array. */ -std::vector< camp::idx_t > createXadjFromAdjncy( const std::vector< camp::idx_t > & localAdjncy, MPI_Comm comm ); +stdVector< camp::idx_t > createXadjFromAdjncy( const stdVector< camp::idx_t > & localAdjncy, MPI_Comm comm ); /** @@ -90,7 +90,7 @@ std::vector< camp::idx_t > createXadjFromAdjncy( const std::vector< camp::idx_t * @param comm MPI communicator. * @return A vector of global vertex IDs. */ -std::vector< int > createVertexGlobalID( const std::vector< camp::idx_t > & localXadj, MPI_Comm comm ); +stdVector< int > createVertexGlobalID( const stdVector< camp::idx_t > & localXadj, MPI_Comm comm ); } // namespace geos } // namespace graph diff --git a/src/coreComponents/mesh/graphs/RLFGraphColoring.cpp b/src/coreComponents/mesh/graphs/RLFGraphColoring.cpp index 0abb5b5066f..184ea12cb75 100644 --- a/src/coreComponents/mesh/graphs/RLFGraphColoring.cpp +++ b/src/coreComponents/mesh/graphs/RLFGraphColoring.cpp @@ -34,20 +34,20 @@ RLFGraphColoring::~RLFGraphColoring() {} -int RLFGraphColoring::colorGraph( const std::vector< camp::idx_t > & GEOS_UNUSED_PARAM( adjncy )) +int RLFGraphColoring::colorGraph( const stdVector< camp::idx_t > & GEOS_UNUSED_PARAM( adjncy )) { return -1; } -std::vector< int > RLFGraphColoring::colorGraph( const std::vector< camp::idx_t > & xadj, const std::vector< camp::idx_t > & adjncy ) +stdVector< int > RLFGraphColoring::colorGraph( const stdVector< camp::idx_t > & xadj, const stdVector< camp::idx_t > & adjncy ) { return RecursiveLargestFirstColoring( xadj, adjncy ); } -std::vector< int > RLFGraphColoring::RecursiveLargestFirstColoring( const std::vector< camp::idx_t > & xadj, const std::vector< camp::idx_t > & adjncy ) +stdVector< int > RLFGraphColoring::RecursiveLargestFirstColoring( const stdVector< camp::idx_t > & xadj, const stdVector< camp::idx_t > & adjncy ) { - std::vector< int > color( xadj.size() - 1, -1 ); + stdVector< int > color( xadj.size() - 1, -1 ); std::unordered_set< camp::idx_t > uncoloredNodes; for( size_t i = 0; i < (xadj.size() - 1); ++i ) { @@ -104,8 +104,7 @@ std::vector< int > RLFGraphColoring::RecursiveLargestFirstColoring( const std::v } } size_t nodeDegree = getGraphNodeDegree( node, xadj ); - - if( commonNeighbors > maxCommonNeighbors || (commonNeighbors == maxCommonNeighbors && nodeDegree < getGraphNodeDegree( selectedNode, xadj ))) + if( commonNeighbors > maxCommonNeighbors || (commonNeighbors == maxCommonNeighbors && selectedNode >= 0 && nodeDegree < getGraphNodeDegree( selectedNode, xadj ))) { selectedNode = static_cast< int >(node); maxCommonNeighbors = commonNeighbors; @@ -120,12 +119,12 @@ std::vector< int > RLFGraphColoring::RecursiveLargestFirstColoring( const std::v return color; } -size_t RLFGraphColoring::getNumberOfColors( const std::vector< int > & colors ) const +size_t RLFGraphColoring::getNumberOfColors( const stdVector< int > & colors ) const { return GraphColoringBase::getNumberOfColors( colors ); } -bool RLFGraphColoring::isColoringValid( const std::vector< camp::idx_t > & xadj, const std::vector< camp::idx_t > & adjncy, const std::vector< int > & colors ) const +bool RLFGraphColoring::isColoringValid( const stdVector< camp::idx_t > & xadj, const stdVector< camp::idx_t > & adjncy, const stdVector< int > & colors ) const { return GraphColoringBase::isColoringValid( xadj, adjncy, colors ); } diff --git a/src/coreComponents/mesh/graphs/RLFGraphColoring.hpp b/src/coreComponents/mesh/graphs/RLFGraphColoring.hpp index af4c5338071..c59161f58e7 100644 --- a/src/coreComponents/mesh/graphs/RLFGraphColoring.hpp +++ b/src/coreComponents/mesh/graphs/RLFGraphColoring.hpp @@ -63,21 +63,21 @@ class RLFGraphColoring : public GraphColoringBase * @param adjncy Adjacency list. * @return A vector of assigned colors. */ - std::vector< int > colorGraph( const std::vector< camp::idx_t > & xadj, const std::vector< camp::idx_t > & adjncy ) override; + stdVector< int > colorGraph( const stdVector< camp::idx_t > & xadj, const stdVector< camp::idx_t > & adjncy ) override; /** * @brief Colors a graph assuming one node per rank. * @param localAdjncy Local adjacency list. * @return Color of the node. */ - int colorGraph( const std::vector< camp::idx_t > & localAdjncy ) override; + int colorGraph( const stdVector< camp::idx_t > & localAdjncy ) override; /** * @brief Returns the number of distinct colors used. * @param colors Vector of color assignments. * @return Number of unique colors. */ - size_t getNumberOfColors( const std::vector< int > & colors ) const; + size_t getNumberOfColors( const stdVector< int > & colors ) const; /** * @brief Validates the coloring of a graph. @@ -86,7 +86,7 @@ class RLFGraphColoring : public GraphColoringBase * @param colors Vector of assigned colors. * @return True if coloring is valid, false otherwise. */ - bool isColoringValid( const std::vector< camp::idx_t > & xadj, const std::vector< camp::idx_t > & adjncy, const std::vector< int > & colors ) const; + bool isColoringValid( const stdVector< camp::idx_t > & xadj, const stdVector< camp::idx_t > & adjncy, const stdVector< int > & colors ) const; private: @@ -96,7 +96,7 @@ class RLFGraphColoring : public GraphColoringBase * @param adjncy The adjacency list containing the neighbors of each node. * @return A vector where the index represents the node and the value represents the assigned color. */ - std::vector< int > RecursiveLargestFirstColoring( const std::vector< camp::idx_t > & xadj, const std::vector< camp::idx_t > & adjncy ); + stdVector< int > RecursiveLargestFirstColoring( const stdVector< camp::idx_t > & xadj, const stdVector< camp::idx_t > & adjncy ); }; } // namespace graph diff --git a/src/coreComponents/mesh/graphs/RLFGraphColoringMPI.cpp b/src/coreComponents/mesh/graphs/RLFGraphColoringMPI.cpp index 314ca4e577c..22238f12224 100644 --- a/src/coreComponents/mesh/graphs/RLFGraphColoringMPI.cpp +++ b/src/coreComponents/mesh/graphs/RLFGraphColoringMPI.cpp @@ -35,23 +35,23 @@ RLFGraphColoringMPI::~RLFGraphColoringMPI() {} -int RLFGraphColoringMPI::colorGraph( const std::vector< camp::idx_t > & localAdjncy ) +int RLFGraphColoringMPI::colorGraph( const stdVector< camp::idx_t > & localAdjncy ) { - std::vector< camp::idx_t > localXadj = createXadjFromAdjncy( localAdjncy, m_comm ); - std::vector< int > localColors = RLFGraphColoringMPI::colorGraph( localXadj, localAdjncy ); + stdVector< camp::idx_t > localXadj = createXadjFromAdjncy( localAdjncy, m_comm ); + stdVector< int > localColors = RLFGraphColoringMPI::colorGraph( localXadj, localAdjncy ); return localColors[0]; } -std::vector< int > RLFGraphColoringMPI::colorGraph( const std::vector< camp::idx_t > & localXadj, - const std::vector< camp::idx_t > & localAdjncy ) +stdVector< int > RLFGraphColoringMPI::colorGraph( const stdVector< camp::idx_t > & localXadj, + const stdVector< camp::idx_t > & localAdjncy ) { int const rank = MpiWrapper::commRank( m_comm ); int const size = MpiWrapper::commSize( m_comm ); // Perform coloring on rank 0 auto [xadj, adjncy] = gatherGraphData( localXadj, localAdjncy, m_comm ); - std::vector< int > colors; + stdVector< int > colors; if( rank == 0 ) { geos::graph::RLFGraphColoring graphColoring; @@ -59,8 +59,8 @@ std::vector< int > RLFGraphColoringMPI::colorGraph( const std::vector< camp::idx } // Scatter colors back to original ranks - std::vector< int > sendCounts; - std::vector< int > displacements; + stdVector< int > sendCounts; + stdVector< int > displacements; if( rank==0 ) { @@ -80,7 +80,7 @@ std::vector< int > RLFGraphColoringMPI::colorGraph( const std::vector< camp::idx } } - std::vector< int > localColors( localNodeCounts ); + stdVector< int > localColors( localNodeCounts ); MpiWrapper::scatterv( colors.data(), sendCounts.data(), displacements.data(), localColors.data(), localNodeCounts, 0, m_comm ); @@ -93,13 +93,13 @@ size_t RLFGraphColoringMPI::getNumberOfColors( const int color ) const return GraphColoringBase::getNumberOfColors( color, m_comm ); } -size_t RLFGraphColoringMPI::getNumberOfColors( const std::vector< int > & colors ) const +size_t RLFGraphColoringMPI::getNumberOfColors( const stdVector< int > & colors ) const { return GraphColoringBase::getNumberOfColors( colors, m_comm ); } -bool RLFGraphColoringMPI::isColoringValid( const std::vector< camp::idx_t > & adjncy, const int color ) const +bool RLFGraphColoringMPI::isColoringValid( const stdVector< camp::idx_t > & adjncy, const int color ) const { return GraphColoringBase::isColoringValid( adjncy, color, m_comm ); } diff --git a/src/coreComponents/mesh/graphs/RLFGraphColoringMPI.hpp b/src/coreComponents/mesh/graphs/RLFGraphColoringMPI.hpp index 93990c8e586..9c3aa934376 100644 --- a/src/coreComponents/mesh/graphs/RLFGraphColoringMPI.hpp +++ b/src/coreComponents/mesh/graphs/RLFGraphColoringMPI.hpp @@ -60,7 +60,7 @@ class RLFGraphColoringMPI : public GraphColoringBase * @param colors Vector of color assignments. * @return Number of unique colors. */ - size_t getNumberOfColors( const std::vector< int > & colors ) const; + size_t getNumberOfColors( const stdVector< int > & colors ) const; /** * @brief Returns the number of distinct colors used, assuming one node per rank. @@ -75,7 +75,7 @@ class RLFGraphColoringMPI : public GraphColoringBase * @param localColor Color assigned to the local node. * @return True if the coloring is valid, false otherwise. */ - bool isColoringValid( const std::vector< camp::idx_t > & localAdjncy, const int localColor ) const; + bool isColoringValid( const stdVector< camp::idx_t > & localAdjncy, const int localColor ) const; /** * @brief Colors a distributed graph. @@ -83,14 +83,14 @@ class RLFGraphColoringMPI : public GraphColoringBase * @param localAdjncy Local adjacency list. * @return A vector of assigned colors. */ - std::vector< int > colorGraph( const std::vector< camp::idx_t > & localXadj, const std::vector< camp::idx_t > & localAdjncy ) override; + stdVector< int > colorGraph( const stdVector< camp::idx_t > & localXadj, const stdVector< camp::idx_t > & localAdjncy ) override; /** * @brief Simplified coloring assuming one node per rank. * @param localAdjncy Local adjacency list. * @return Color of the node. */ - int colorGraph( const std::vector< camp::idx_t > & localAdjncy ) override; + int colorGraph( const stdVector< camp::idx_t > & localAdjncy ) override; }; } // namespace graph diff --git a/src/coreComponents/mesh/graphs/ZoltanGraphColoring.cpp b/src/coreComponents/mesh/graphs/ZoltanGraphColoring.cpp index 03fa9d0f5e5..903bb99086b 100644 --- a/src/coreComponents/mesh/graphs/ZoltanGraphColoring.cpp +++ b/src/coreComponents/mesh/graphs/ZoltanGraphColoring.cpp @@ -58,16 +58,16 @@ ZoltanGraphColoring::~ZoltanGraphColoring() } -int ZoltanGraphColoring::colorGraph( const std::vector< camp::idx_t > & localAdjncy ) +int ZoltanGraphColoring::colorGraph( const stdVector< camp::idx_t > & localAdjncy ) { - std::vector< camp::idx_t > localXadj = createXadjFromAdjncy( localAdjncy, m_comm ); - std::vector< int > colors = colorGraph( localXadj, localAdjncy ); + stdVector< camp::idx_t > localXadj = createXadjFromAdjncy( localAdjncy, m_comm ); + stdVector< int > colors = colorGraph( localXadj, localAdjncy ); return colors[0]; } -std::vector< int > ZoltanGraphColoring::colorGraph( const std::vector< camp::idx_t > & xadj, - const std::vector< camp::idx_t > & adjncy ) +stdVector< int > ZoltanGraphColoring::colorGraph( const stdVector< camp::idx_t > & xadj, + const stdVector< camp::idx_t > & adjncy ) { int const rank = MpiWrapper::commRank( m_comm ); @@ -77,7 +77,7 @@ std::vector< int > ZoltanGraphColoring::colorGraph( const std::vector< camp::idx graph.m_numVertices = xadj.size() - 1; graph.m_rank = rank; - std::vector< int > vertexGID = createVertexGlobalID( xadj, m_comm ); + stdVector< int > vertexGID = createVertexGlobalID( xadj, m_comm ); graph.m_vertexGID.resize( graph.m_numVertices ); for( int i = 0; i < graph.m_numVertices; i++ ) { @@ -103,7 +103,7 @@ std::vector< int > ZoltanGraphColoring::colorGraph( const std::vector< camp::idx std::fill( color, color + graph.m_numVertices, -1 ); GEOS_ZOLTAN_CHECK( m_zz->Color( numGidEntries, numReqObjs, reqObjs, color )); - std::vector< int > coloringVector; + stdVector< int > coloringVector; coloringVector.assign( color, color + graph.m_numVertices ); // Make numbering starts at 0, and not 1. @@ -198,13 +198,13 @@ size_t ZoltanGraphColoring::getNumberOfColors( const int color ) const return GraphColoringBase::getNumberOfColors( color, m_comm ); } -size_t ZoltanGraphColoring::getNumberOfColors( const std::vector< int > & colors ) const +size_t ZoltanGraphColoring::getNumberOfColors( const stdVector< int > & colors ) const { return GraphColoringBase::getNumberOfColors( colors, m_comm ); } -bool ZoltanGraphColoring::isColoringValid( const std::vector< camp::idx_t > & adjncy, const int color ) const +bool ZoltanGraphColoring::isColoringValid( const stdVector< camp::idx_t > & adjncy, const int color ) const { return GraphColoringBase::isColoringValid( adjncy, color, m_comm ); } diff --git a/src/coreComponents/mesh/graphs/ZoltanGraphColoring.hpp b/src/coreComponents/mesh/graphs/ZoltanGraphColoring.hpp index 219934b6471..7d73a15f042 100644 --- a/src/coreComponents/mesh/graphs/ZoltanGraphColoring.hpp +++ b/src/coreComponents/mesh/graphs/ZoltanGraphColoring.hpp @@ -61,7 +61,7 @@ class ZoltanGraphColoring : public GraphColoringBase * @param colors Vector of color assignments. * @return Number of unique colors. */ - size_t getNumberOfColors( const std::vector< int > & colors ) const; + size_t getNumberOfColors( const stdVector< int > & colors ) const; /** * @brief Returns the number of colors assuming one node per rank. @@ -76,7 +76,7 @@ class ZoltanGraphColoring : public GraphColoringBase * @param color Color of the node. * @return True if the coloring is valid, false otherwise. */ - bool isColoringValid( const std::vector< camp::idx_t > & adjncy, const int color ) const; + bool isColoringValid( const stdVector< camp::idx_t > & adjncy, const int color ) const; /** * @brief Colors a graph. @@ -84,14 +84,14 @@ class ZoltanGraphColoring : public GraphColoringBase * @param adjncy Adjacency list. * @return A vector of assigned colors. */ - std::vector< int > colorGraph( const std::vector< camp::idx_t > & xadj, const std::vector< camp::idx_t > & adjncy ) override; + stdVector< int > colorGraph( const stdVector< camp::idx_t > & xadj, const stdVector< camp::idx_t > & adjncy ) override; /** * @brief Simplified coloring assuming one node per rank. * @param adjncy Local adjacency list. * @return Number of colors used. */ - int colorGraph( const std::vector< camp::idx_t > & adjncy ) override; + int colorGraph( const stdVector< camp::idx_t > & adjncy ) override; private: @@ -100,9 +100,9 @@ class ZoltanGraphColoring : public GraphColoringBase struct ZoltanGraph { int m_numVertices; - std::vector< int > m_vertexGID; - std::vector< int > m_xadj; - std::vector< int > m_adjncy; + stdVector< int > m_vertexGID; + stdVector< int > m_xadj; + stdVector< int > m_adjncy; int m_rank; }; diff --git a/src/coreComponents/mesh/mpiCommunications/SpatialPartition.cpp b/src/coreComponents/mesh/mpiCommunications/SpatialPartition.cpp index 5beecb1842c..50f4ab41795 100644 --- a/src/coreComponents/mesh/mpiCommunications/SpatialPartition.cpp +++ b/src/coreComponents/mesh/mpiCommunications/SpatialPartition.cpp @@ -903,7 +903,7 @@ void SpatialPartition::sendListOfIndicesToNeighbors( stdVector< array1d< indexTy // Declare the receive buffers stdVector< unsigned int > sizeOfReceived( nn ); // TODO: decide if these number-of-neighbor-sized arrays should be array1d, stdVector - // or std::array + // or stdArray stdVector< buffer_type > receiveBuffer( nn ); // send the list of local indices to each neighbor using an asynchronous send @@ -994,7 +994,7 @@ void SpatialPartition::sendParticlesToNeighbor( ParticleSubRegionBase & subRegio // Declare the receive buffers stdVector< unsigned int > sizeOfReceived( nn ); // TODO: decide if these number-of-neighbor-sized arrays should be array1d, stdVector - // or std::array + // or stdArray stdVector< buffer_type > receiveBuffer( nn ); // send/receive the size of the packed particle data to each neighbor using an asynchronous send diff --git a/src/coreComponents/mesh/unitTests/testGraphColoring.cpp b/src/coreComponents/mesh/unitTests/testGraphColoring.cpp index db16eb574b0..a3b5a113e9d 100644 --- a/src/coreComponents/mesh/unitTests/testGraphColoring.cpp +++ b/src/coreComponents/mesh/unitTests/testGraphColoring.cpp @@ -25,9 +25,9 @@ using namespace geos; using namespace graph; -TEST( GraphColoringTest, CountPositiveDistinctColors ) +TEST( GraphColoringTest, CountPositiveDistinctColors ) { - std::vector< int > colors = {1, -1, 3, 2, 1, 4, 5, 3, -1, 0}; + stdVector< int > colors = {1, -1, 3, 2, 1, 4, 5, 3, -1, 0}; EXPECT_EQ( GraphColoringBase::getNumberOfColors( colors ), 6 ); } @@ -37,8 +37,7 @@ TEST( GraphColoringTest, CartesianDecomposition3D6 ) idx_t const nx = 3, ny = 4, nz = 3; auto [xadj, adjncy] = generateGraphCartPartitionning3D6( nx, ny, nz ); geos::graph::RLFGraphColoring graphColoring; - std::vector< int > colors = graphColoring.colorGraph( xadj, adjncy ); - + stdVector< int > colors = graphColoring.colorGraph( xadj, adjncy ); EXPECT_TRUE( graphColoring.isColoringValid( xadj, adjncy, colors )); EXPECT_EQ( graphColoring.getNumberOfColors( colors ), 2 ); } @@ -49,7 +48,7 @@ TEST( GraphColoringTest, CartesianDecomposition3D26 ) idx_t const nx = 3, ny = 4, nz = 3; auto [xadj, adjncy] = generateGraphCartPartitionning3D26( nx, ny, nz ); geos::graph::RLFGraphColoring graphColoring; - std::vector< int > colors = graphColoring.colorGraph( xadj, adjncy ); + stdVector< int > colors = graphColoring.colorGraph( xadj, adjncy ); EXPECT_TRUE( graphColoring.isColoringValid( xadj, adjncy, colors )); EXPECT_EQ( graphColoring.getNumberOfColors( colors ), 8 ); } @@ -64,7 +63,7 @@ TEST( GraphColoringTest, RandomGraphs ) size_t num_edges = rand() % (num_nodes * 6 + 1) + num_nodes; // between num_nodes and num_nodes * 6 auto [xadj, adjncy] = generateGraphRandom( num_nodes, num_edges ); geos::graph::RLFGraphColoring graphColoring; - std::vector< int > colors = graphColoring.colorGraph( xadj, adjncy ); + stdVector< int > colors = graphColoring.colorGraph( xadj, adjncy ); EXPECT_TRUE( graphColoring.isColoringValid( xadj, adjncy, colors )); } } @@ -73,11 +72,11 @@ TEST( GraphColoringTest, RandomGraphs ) TEST( GraphColoringTest, InvalidColoring ) { // Create a simple graph with 4 nodes and 3 edges - std::vector< idx_t > xadj = {0, 1, 2, 3, 3}; - std::vector< idx_t > adjncy = {1, 0, 2, 1}; + stdVector< idx_t > xadj = {0, 1, 2, 3, 3}; + stdVector< idx_t > adjncy = {1, 0, 2, 1}; // Intentionally create an invalid coloring where two adjacent nodes have the same color - std::vector< int > colors = {0, 0, 1, 1}; + stdVector< int > colors = {0, 0, 1, 1}; // Check if the coloring is valid (should fail) EXPECT_FALSE( GraphColoringBase::isColoringValid( xadj, adjncy, colors )); diff --git a/src/coreComponents/mesh/unitTests/testGraphColoringMPI.cpp b/src/coreComponents/mesh/unitTests/testGraphColoringMPI.cpp index 65bdaf0aa77..9b28880b841 100644 --- a/src/coreComponents/mesh/unitTests/testGraphColoringMPI.cpp +++ b/src/coreComponents/mesh/unitTests/testGraphColoringMPI.cpp @@ -47,7 +47,7 @@ class GraphColoringTest : public ::testing::Test }; -void runColoringTest( GraphColoringBase & graphColoring, const std::vector< camp::idx_t > & xadj, const std::vector< camp::idx_t > & adjncy, int expectedNumberOfColors ) +void runColoringTest( GraphColoringBase & graphColoring, const stdVector< camp::idx_t > & xadj, const stdVector< camp::idx_t > & adjncy, int expectedNumberOfColors ) { auto [localXadj, localAdjncy] = scatterGraphData( xadj, adjncy, MPI_COMM_GEOS ); int color = graphColoring.colorGraph( localAdjncy ); @@ -67,8 +67,8 @@ TEST_F( GraphColoringTest, CartesianDecomposition3D6 ) #endif RLFGraphColoringMPI rlfColoringMPI; - std::vector< camp::idx_t > xadj; - std::vector< camp::idx_t > adjncy; + stdVector< camp::idx_t > xadj; + stdVector< camp::idx_t > adjncy; if( rank == 0 ) { @@ -90,8 +90,8 @@ TEST_F( GraphColoringTest, CartesianDecomposition3D26 ) #endif RLFGraphColoringMPI rlfColoringMPI; - std::vector< camp::idx_t > xadj; - std::vector< camp::idx_t > adjncy; + stdVector< camp::idx_t > xadj; + stdVector< camp::idx_t > adjncy; if( rank == 0 ) { @@ -116,8 +116,8 @@ TEST_F( GraphColoringTest, RandomGraphs ) size_t const iterations = 10; for( size_t i = 0; i < iterations; ++i ) { - std::vector< camp::idx_t > xadj; - std::vector< camp::idx_t > adjncy; + stdVector< camp::idx_t > xadj; + stdVector< camp::idx_t > adjncy; if( rank == 0 ) { @@ -136,7 +136,7 @@ TEST_F( GraphColoringTest, RandomGraphs ) TEST_F( GraphColoringTest, CountPositiveDistinctColors ) { - std::vector< int > colors = {1, -1, 3, 2, 1, 4, 5, 3}; + stdVector< int > colors = {1, -1, 3, 2, 1, 4, 5, 3}; EXPECT_EQ( GraphColoringBase::getNumberOfColors( colors, MPI_COMM_GEOS ), 6 ); } diff --git a/src/coreComponents/mesh/utilities/MeshMapUtilities.hpp b/src/coreComponents/mesh/utilities/MeshMapUtilities.hpp index a3508a6e55b..be64f25551b 100644 --- a/src/coreComponents/mesh/utilities/MeshMapUtilities.hpp +++ b/src/coreComponents/mesh/utilities/MeshMapUtilities.hpp @@ -223,7 +223,7 @@ struct NodeKeyHasher * @brief @return the hash of an interpolation array representing a high-order node. * @param arr the array corresponding to the node to be hashed */ - std::size_t operator()( const std::array< T, 6 > & arr ) const + std::size_t operator()( const stdArray< T, 6 > & arr ) const { std::size_t hash = 0; // use a boost-style hash function @@ -241,9 +241,9 @@ struct NodeKeyHasher * @param v the mesh vertex on which the high-order node lies. */ template< typename T > -static std::array< T, 6 > createNodeKey( T v ) +static stdArray< T, 6 > createNodeKey( T v ) { - return std::array< T, 6 > { v, -1, -1, -1, -1, -1 }; + return stdArray< T, 6 > { v, -1, -1, -1, -1, -1 }; } /** @@ -255,7 +255,7 @@ static std::array< T, 6 > createNodeKey( T v ) * @param order the order of the discretization */ template< typename T > -static std::array< T, 6 > createNodeKey( T v1, T v2, int a, int order ) +static stdArray< T, 6 > createNodeKey( T v1, T v2, int a, int order ) { if( a == 0 ) return createNodeKey( v1 ); @@ -263,11 +263,11 @@ static std::array< T, 6 > createNodeKey( T v1, T v2, int a, int order ) return createNodeKey( v2 ); if( v1 < v2 ) { - return std::array< T, 6 > { v1, v2, -1, -1, a, -1 }; + return stdArray< T, 6 > { v1, v2, -1, -1, a, -1 }; } else { - return std::array< T, 6 > { v2, v1, -1, -1, order - a, -1 }; + return stdArray< T, 6 > { v2, v1, -1, -1, order - a, -1 }; } } @@ -283,7 +283,7 @@ static std::array< T, 6 > createNodeKey( T v1, T v2, int a, int order ) * @param order the order of the discretization */ template< typename T > -static std::array< T, 6 > createNodeKey( T v1, T v2, T v3, T v4, int a, int b, int order ) +static stdArray< T, 6 > createNodeKey( T v1, T v2, T v3, T v4, int a, int b, int order ) { if( a == 0 ) return createNodeKey( v1, v3, b, order ); @@ -322,7 +322,7 @@ static std::array< T, 6 > createNodeKey( T v1, T v2, T v3, T v4, int a, int b, i std::swap( a, b ); } } - return std::array< T, 6 > { v1, v2, v3, v4, a, b }; + return stdArray< T, 6 > { v1, v2, v3, v4, a, b }; } /** @@ -335,7 +335,7 @@ static std::array< T, 6 > createNodeKey( T v1, T v2, T v3, T v4, int a, int b, i * @param order the order of the discretization */ template< typename T > -static std::array< T, 6 > createNodeKey( T const (&elemNodes)[ 8 ], int q1, int q2, int q3, int order ) +static stdArray< T, 6 > createNodeKey( T const (&elemNodes)[ 8 ], int q1, int q2, int q3, int order ) { bool extremal1 = q1 == 0 || q1 == order; bool extremal2 = q2 == 0 || q2 == order; diff --git a/src/coreComponents/physicsSolvers/inducedSeismicity/ExplicitQDRateAndState.hpp b/src/coreComponents/physicsSolvers/inducedSeismicity/ExplicitQDRateAndState.hpp index c5f2bb4f473..26b54e04eee 100644 --- a/src/coreComponents/physicsSolvers/inducedSeismicity/ExplicitQDRateAndState.hpp +++ b/src/coreComponents/physicsSolvers/inducedSeismicity/ExplicitQDRateAndState.hpp @@ -114,7 +114,7 @@ class ExplicitQDRateAndState : public QDRateAndStateBase public: GEOS_HOST_DEVICE - PIDController( std::array< const real64, 3 > const & cparams, + PIDController( stdArray< const real64, 3 > const & cparams, const real64 atol, const real64 rtol, const real64 safety ): @@ -141,7 +141,7 @@ class ExplicitQDRateAndState : public QDRateAndStateBase PIDController & operator=( PIDController && ) = delete; /// Parameters for the PID error controller - const std::array< const real64, 3 > controlParameters; // Controller parameters + const stdArray< const real64, 3 > controlParameters; // Controller parameters real64 const absTol; // absolut tolerence @@ -149,7 +149,7 @@ class ExplicitQDRateAndState : public QDRateAndStateBase real64 const acceptSafety; // Acceptance safety - std::array< real64, 3 > errors; // Errors for current and two previous updates + stdArray< real64, 3 > errors; // Errors for current and two previous updates // stored as [n+1, n, n-1] real64 computeUpdateFactor( integer const algHighOrder, integer const algLowOrder ) diff --git a/src/coreComponents/physicsSolvers/multiphysics/CoupledSolver.hpp b/src/coreComponents/physicsSolvers/multiphysics/CoupledSolver.hpp index bb485b2fade..1c0d2ad0001 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CoupledSolver.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CoupledSolver.hpp @@ -780,7 +780,7 @@ class CoupledSolver : public PhysicsSolverBase std::tuple< SOLVERS *... > m_solvers; /// Names of the single-physics solvers - std::array< string, sizeof...( SOLVERS ) > m_names; + stdArray< string, sizeof...( SOLVERS ) > m_names; }; } /* namespace geos */ diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp index e4fdff69db4..e0237dfbd48 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp @@ -2470,7 +2470,7 @@ void SolidMechanicsMPM::computeDamageFieldGradient( ParticleManager & particleMa arraySlice1d< localIndex const > const subRegionIndices = neighborSubRegions[p]; arraySlice1d< localIndex const > const particleIndices = neighborIndices[p]; - // Declare and size neighbor data arrays - TODO: switch to std::array? But then we'd need to template computeKernelFieldGradient + // Declare and size neighbor data arrays - TODO: switch to stdArray? But then we'd need to template computeKernelFieldGradient stdVector< real64 > neighborVolumes( numNeighbors ); stdVector< stdVector< real64 > > neighborPositions; neighborPositions.resize( numNeighbors, stdVector< real64 >( 3 ) ); @@ -3464,7 +3464,7 @@ void SolidMechanicsMPM::computeSphF( ParticleManager & particleManager ) arraySlice1d< localIndex const > const subRegionIndices = neighborSubRegions[p]; arraySlice1d< localIndex const > const particleIndices = neighborIndices[p]; - // Declare and size neighbor data arrays - TODO: switch to std::array? But then we'd need to template computeKernelFieldGradient + // Declare and size neighbor data arrays - TODO: switch to stdArray? But then we'd need to template computeKernelFieldGradient stdVector< real64 > neighborVolumes( numNeighbors ); stdVector< stdVector< real64 > > neighborPositions; neighborPositions.resize( numNeighbors, stdVector< real64 >( 3 ) ); diff --git a/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustoelastic/secondOrderEqn/isotropic/AcousticElasticWaveEquationSEM.hpp b/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustoelastic/secondOrderEqn/isotropic/AcousticElasticWaveEquationSEM.hpp index 122a0aa5b2a..731e56894be 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustoelastic/secondOrderEqn/isotropic/AcousticElasticWaveEquationSEM.hpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustoelastic/secondOrderEqn/isotropic/AcousticElasticWaveEquationSEM.hpp @@ -91,7 +91,7 @@ class CoupledWaveSolver : public PhysicsSolverBase std::tuple< SOLVERS *... > m_solvers; /// Names of the single-physics solvers - std::array< string, sizeof...( SOLVERS ) > m_names; + stdArray< string, sizeof...( SOLVERS ) > m_names; }; diff --git a/src/coreComponents/schema/schema.xsd.other b/src/coreComponents/schema/schema.xsd.other index 380d963e2ef..33a2ec00f2c 100644 --- a/src/coreComponents/schema/schema.xsd.other +++ b/src/coreComponents/schema/schema.xsd.other @@ -516,7 +516,7 @@ - + @@ -1516,7 +1516,7 @@ - + diff --git a/src/pygeosx/pygeosx.cpp b/src/pygeosx/pygeosx.cpp index fff9d7aea9c..bebec16d3ed 100644 --- a/src/pygeosx/pygeosx.cpp +++ b/src/pygeosx/pygeosx.cpp @@ -284,7 +284,7 @@ PyObject * finalize( PyObject * self, PyObject * args ) noexcept static bool addConstants( PyObject * module ) { - std::array< std::pair< long, char const * >, 4 > const constants = { { + stdArray< std::pair< long, char const * >, 4 > const constants = { { { static_cast< long >( geos::State::COMPLETED ), "COMPLETED" }, { static_cast< long >( geos::State::INITIALIZED ), "INITIALIZED" }, { static_cast< long >( geos::State::UNINITIALIZED ), "UNINITIALIZED" },