diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 622294f4bbf..26864916f7e 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -140,6 +140,22 @@ jobs: RUNS_ON: ubuntu-22.04 USE_SCCACHE: false + check_code_rules: + needs: [is_not_draft_pull_request] + runs-on: ubuntu-22.04 + steps: + - name: Checkout Repository + uses: actions/checkout@v4.2.2 + with: + submodules: false + lfs: false + fetch-depth: 0 + sparse-checkout: | + scripts + src + - name: Check the code rules + run: "scripts/check_code_rules.sh" + # Matrix containing all the CPU build. # Those are quite fast and can efficiently benefit from the `sccache' tool to make them even faster. cpu_builds: @@ -451,6 +467,7 @@ jobs: - if_not_unassigned_pull_request - are_submodules_in_sync - check_code_style_and_documentation + - check_code_rules - cpu_builds - cuda_builds - run_integrated_tests diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh new file mode 100755 index 00000000000..291133b23e6 --- /dev/null +++ b/scripts/check_code_rules.sh @@ -0,0 +1,151 @@ +#!/bin/bash + + +################################ +## I. Function initializations +################################ + +# while +# ... done < <(grep -n "std::map\s*<" "$file") +# Process the result of grep command as a file. +# This allows everything to be handled in the same shell environment. +check_container_usage() { + local container_name="$1" + local str=" Found forbidden ${container_name} usage in: $file"$'\n' + + if grep -q "${container_name}\s*<" "$file"; then + while IFS= read -r line; do + str+=" $line"$'\n' + done < <(grep -n "${container_name}\s*<" "$file") + + ERRORS_CONTAINER[$container_name]+="$str" + ((FORBIDDEN_CONTAINER_MAP["$container_name"]++)) + fi +} + +print_violation() +{ + local container_name="$1" + + if [ "${FORBIDDEN_CONTAINER_MAP[$container_name]}" -eq 1 ];then + echo $'\n' + echo "ERROR: Forbidden $container_name usage detected" + echo "==========================================" + + printf '%s' "${ERRORS_CONTAINER[$container_name]}" + + fi +} + +################################ +## II. GLOBAL INITIALIZATION +################################ + +FORBIDDEN_EXPRESSIONS=( + "std::map" + "std::unordered_map" + "std::vector" +) + +declare -A FORBIDDEN_CONTAINER_MAP=() +for exp in "${FORBIDDEN_EXPRESSIONS[@]}"; do + FORBIDDEN_CONTAINER_MAP["$exp"]=0 +done + +declare -A ERRORS_CONTAINER=() +for exp in "${FORBIDDEN_EXPRESSIONS[@]}"; do + ERRORS_CONTAINER["$exp"]="" +done + +FILEPATH_PREFIX="src/coreComponents/" +FILEPATH_SUBFOLDERS=( + "codingUtilities" + "common" + "dataRepository" + "constitutive" + "denseLinearAlgebra" + "discretizationMethods" + "events" + "fieldSpecification" + "fileIO" + "finiteElement" + "finiteVolume" + "functions" + "linearAlgebra" + "mainInterface" + "mesh" + "physicsSolvers" +) + +FILEPATH_EXCLUDE_PATTERNS=( + "Datatype.hpp" + "StdContainerWrappers.hpp" + "BufferOps_inline.hpp" + "BufferOps.hpp" + "PVTPackage" + "hdf5_interface" +) + +FILE_PATH_ARGS=() +for pattern in "${FILEPATH_SUBFOLDERS[@]}"; do + if [ -d "${FILEPATH_PREFIX}${pattern}" ]; then + FILE_PATH_ARGS+=("${FILEPATH_PREFIX}${pattern}") + fi +done + +EXCLUDED_NAME_PATTERNS=() +for pattern in "${FILEPATH_EXCLUDE_PATTERNS[@]}"; do + if [[ ! "$pattern" == *".hpp"* ]]; then + EXCLUDED_NAME_PATTERNS+=( -path "*/$pattern" -prune -o ) + else + EXCLUDED_NAME_PATTERNS+=( -name "*${pattern}" -prune -o ) + fi +done + +echo "======================================================" +echo -e " TREE LIST OF FILES FOUND " +echo "======================================================" + +if [ ${#FILE_PATH_ARGS[@]} -gt 0 ]; then + find "${FILE_PATH_ARGS[@]}" "${EXCLUDED_NAME_PATTERNS[@]}" -type d -print | sort | while IFS= read -r dir; do + echo -e "->" $(echo "$dir" | sed 's/[]^$*.[]/\\&/g' | sed 's/\// |---/g') + done +fi + +ARRAY_FILES=() +# mapfile used for reading inMAPput lines into an array; -d $'\0': Specifies that the delimiter is (\0). +# -print0 : ask find to separate file paths by '\0' +mapfile -d $'\0' ARRAY_FILES < <(find "${FILE_PATH_ARGS[@]}" "${EXCLUDED_NAME_PATTERNS[@]}" \ + -type f \( -name "*.hpp" -o -name "*.cpp" -o -name "*.hpp.template" -o -name "*.cpp.template" \) \ + -print0 2>/dev/null) + +################################ +## III. MAIN LOOP +################################ + +for file in "${ARRAY_FILES[@]}"; do + for container_name in "${!FORBIDDEN_CONTAINER_MAP[@]}"; do + check_container_usage "$container_name" + done +done + +# Print section +for key in "${!FORBIDDEN_CONTAINER_MAP[@]}"; do + if [[ "${FORBIDDEN_CONTAINER_MAP[$key]}" == "1" ]]; then + echo $'\n' + echo "----------------------------------------" + echo "SUMMARY: Code rule violations found" + echo "----------------------------------------" + + for container_name in "${!FORBIDDEN_CONTAINER_MAP[@]}"; do + print_violation "$container_name" + done + + echo "" + exit 1; + fi +done + +echo $'\n' +echo "No code rule violations found" +exit 0 diff --git a/src/coreComponents/codingUtilities/RTTypes.cpp b/src/coreComponents/codingUtilities/RTTypes.cpp index 648f94e6b31..a90eabb61d8 100644 --- a/src/coreComponents/codingUtilities/RTTypes.cpp +++ b/src/coreComponents/codingUtilities/RTTypes.cpp @@ -39,7 +39,7 @@ void printTypeSummary() string rtTypes::getTypeName( std::type_index const key ) { - static const std::unordered_map< std::type_index, string > type_names = + static const stdUnorderedMap< std::type_index, string > type_names = { {std::type_index( typeid(integer)), "integer"}, {std::type_index( typeid(real32)), "real32"}, diff --git a/src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp b/src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp index 7a20ee4238c..121cb4f71de 100644 --- a/src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp +++ b/src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp @@ -53,7 +53,7 @@ TEST( testGeosxTraits, HasMemberFunction_at ) static_assert( HasMemberFunction_at< stdVector< int > >, "Should be true." ); static_assert( HasMemberFunction_at< stdVector< double > >, "Should be true." ); static_assert( HasMemberFunction_at< stdMap< int, string > >, "Should be true." ); - static_assert( HasMemberFunction_at< std::unordered_map< int, string > >, "Should be true." ); + static_assert( HasMemberFunction_at< stdUnorderedMap< int, string > >, "Should be true." ); static_assert( !HasMemberFunction_at< int >, "Should be false." ); static_assert( !HasMemberFunction_at< stdMap< string, string > >, "Should be false." ); 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/TypeDispatch.hpp b/src/coreComponents/common/TypeDispatch.hpp index b38b5858066..2e45170d098 100644 --- a/src/coreComponents/common/TypeDispatch.hpp +++ b/src/coreComponents/common/TypeDispatch.hpp @@ -269,7 +269,7 @@ template< typename LIST, std::size_t ... Is > auto const & getTypeMap( LIST, std::integer_sequence< std::size_t, Is... > ) { using KeyType = decltype( createTypeIndexTuple( camp::first< LIST > {} ) ); - static std::unordered_map< KeyType, std::size_t, tuple_hash > const result = { { createTypeIndexTuple( camp::at_t< LIST, camp::num< Is > >{} ), Is } ... }; + static stdUnorderedMap< KeyType, std::size_t, tuple_hash > const result = { { createTypeIndexTuple( camp::at_t< LIST, camp::num< Is > >{} ), Is } ... }; return result; } diff --git a/src/coreComponents/common/format/table/TableFormatter.cpp b/src/coreComponents/common/format/table/TableFormatter.cpp index e34eaa8d37c..55bcd96ee03 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,8 +518,8 @@ void TableTextFormatter::populateErrorCellsLayout( PreparedTableLayout const & t { errorCellsLayout.push_back( { - std::vector< TableLayout::CellLayout >( nbCells, - TableLayout::CellLayout( CellType::MergeNext ) ), + stdVector< TableLayout::CellLayout >( nbCells, + TableLayout::CellLayout( CellType::MergeNext ) ), 1 // subLines count } ); errorCellsLayout.back().cells.back().m_cellType = CellType::Value; @@ -531,8 +531,8 @@ void TableTextFormatter::populateErrorCellsLayout( PreparedTableLayout const & t errorCellsLayout.push_back( { - std::vector< TableLayout::CellLayout >( nbCells, - TableLayout::CellLayout( CellType::Separator ) ), + 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/common/logger/ErrorHandling.hpp b/src/coreComponents/common/logger/ErrorHandling.hpp index 62e3db66df6..852cf1fdf97 100644 --- a/src/coreComponents/common/logger/ErrorHandling.hpp +++ b/src/coreComponents/common/logger/ErrorHandling.hpp @@ -116,9 +116,9 @@ class ErrorLogger /// the source location line corresponding to the error in the code (default is 0) integer m_line = 0; /// Additional information about the error in the input file - std::vector< ErrorContext > m_contextsInfo; + stdVector< ErrorContext > m_contextsInfo; /// the stack trace - std::vector< std::string > m_sourceCallStack; + stdVector< std::string > m_sourceCallStack; /** * @brief Construct a default Error Message diff --git a/src/coreComponents/common/unitTests/testDataTypes.cpp b/src/coreComponents/common/unitTests/testDataTypes.cpp index 5c2daf1655a..081487fa943 100644 --- a/src/coreComponents/common/unitTests/testDataTypes.cpp +++ b/src/coreComponents/common/unitTests/testDataTypes.cpp @@ -61,7 +61,7 @@ TEST( testDataTypes, testBoundChecking ) // std::cout <<" sdsfs "<< mapBoundsChecking.get_inserted(0)<< std::endl; // std::cout << mapBoundsChecking.get_inserted(1); - internal::StdMapWrapper< std::unordered_map< integer, integer >, true > unorderedMapBoundsChecking{{0, 1}}; + internal::StdMapWrapper< stdUnorderedMap< integer, integer >, true > unorderedMapBoundsChecking{{0, 1}}; EXPECT_THROW( { try { 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/fluid/multifluid/compositional/parameters/PhaseType.cpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/PhaseType.cpp index a86de714834..435b50a6202 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/PhaseType.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/PhaseType.cpp @@ -29,7 +29,7 @@ namespace constitutive namespace compositional { -static std::unordered_map< PhaseType, std::string > const phase_aliases{ +static stdUnorderedMap< PhaseType, std::string > const phase_aliases{ {PhaseType::LIQUID, "liquid,liq,oil"}, {PhaseType::VAPOUR, "gas,vap,vapor,vapour"}, {PhaseType::AQUEOUS, "wat,water,aqueous"} diff --git a/src/coreComponents/constitutive/unitTests/TestFluid.hpp b/src/coreComponents/constitutive/unitTests/TestFluid.hpp index ea6d23fe70b..9be655cfca7 100644 --- a/src/coreComponents/constitutive/unitTests/TestFluid.hpp +++ b/src/coreComponents/constitutive/unitTests/TestFluid.hpp @@ -78,7 +78,7 @@ struct Fluid 7.45513e-02, 1.80000e+07, 3.47000e+03, 6.25000e-04, -1.21200e-01, 3.05992e-05, // KCL (potassium chloride) }; - static std::unordered_map const componentNames; + static stdUnorderedMap const componentNames; /* UNCRUSTIFY-ON */ }; @@ -199,7 +199,7 @@ class TestFluid }; /* UNCRUSTIFY-OFF */ -std::unordered_map const Fluid::componentNames = { +stdUnorderedMap const Fluid::componentNames = { { H2O, "H2O" }, // water { CO2, "CO2" }, // carbon dioxide { N2, "N2" }, // nitrogen diff --git a/src/coreComponents/constitutive/unitTests/testSoreideWhitsonFlash.cpp b/src/coreComponents/constitutive/unitTests/testSoreideWhitsonFlash.cpp index 54645b4207e..87d948828a1 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 = { + stdUnorderedMap 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/ObjectCatalog.hpp b/src/coreComponents/dataRepository/ObjectCatalog.hpp index 2fd0762c97b..e9fc2ab9d65 100644 --- a/src/coreComponents/dataRepository/ObjectCatalog.hpp +++ b/src/coreComponents/dataRepository/ObjectCatalog.hpp @@ -22,8 +22,8 @@ * a similar manner to classic virtual factory method, except that it is no * maintained list of derived objects that is required to create new objects. * Instead, the ``ObjectCatalog`` creates a "catalog" of derived objects using - * a ``std::unordered_map``. - * This ``std::unordered_map`` is then statically initialized through the declaration + * a ``stdUnorderedMap``. + * This ``stdUnorderedMap`` is then statically initialized through the declaration * of a */ @@ -71,8 +71,8 @@ class CatalogInterface /// This is the type that will be used for the catalog. The catalog is actually instantiated in the @p BASETYPE. //START_SPHINX_1 - typedef std::unordered_map< std::string, - std::unique_ptr< CatalogInterface< BASETYPE, ARGS... > > > CatalogType; + typedef stdUnorderedMap< std::string, + std::unique_ptr< CatalogInterface< BASETYPE, ARGS... > > > CatalogType; //STOP_SPHINX /** @@ -426,7 +426,7 @@ class CatalogInterface< BASETYPE > public: /// This is the type that will be used for the catalog. The catalog is actually instantiated in the @p BASETYPE. - typedef std::unordered_map< std::string, std::unique_ptr< CatalogInterface< BASETYPE > > > CatalogType; + typedef stdUnorderedMap< std::string, std::unique_ptr< CatalogInterface< BASETYPE > > > CatalogType; /** * @brief Default constructor. diff --git a/src/coreComponents/dataRepository/unitTests/testErrorHandling.cpp b/src/coreComponents/dataRepository/unitTests/testErrorHandling.cpp index 39103cc5580..f003bfae77c 100644 --- a/src/coreComponents/dataRepository/unitTests/testErrorHandling.cpp +++ b/src/coreComponents/dataRepository/unitTests/testErrorHandling.cpp @@ -62,7 +62,7 @@ void beginLocalLoggerTest( ErrorLogger & errorLogger, string_view filename ) * @param expectedFileBits reference file parts that must be in the logger file output */ void endLocalLoggerTest( ErrorLogger & errorLogger, - std::vector< string > expectedFileBits ) + stdVector< string > expectedFileBits ) { auto const readFile = [] ( string_view filename ) { if( !fs::exists( filename )) diff --git a/src/coreComponents/fileIO/Outputs/unitTests/testMemoryStats.cpp b/src/coreComponents/fileIO/Outputs/unitTests/testMemoryStats.cpp index b07a30431a2..84cd000bc60 100644 --- a/src/coreComponents/fileIO/Outputs/unitTests/testMemoryStats.cpp +++ b/src/coreComponents/fileIO/Outputs/unitTests/testMemoryStats.cpp @@ -170,7 +170,7 @@ TEST( testXML, testMemoryCSVOutput ) memOutput.execute( 0.0, 0.0, dummyCycle, 0, 0.0, problem.getDomainPartition() ); // read the CSV output (parseFile() will throw if no CSV is generated) - std::vector< string > csvLines; + stdVector< string > csvLines; { std::ifstream is( memOutputFileName ); EXPECT_TRUE( is.good() ); @@ -184,9 +184,9 @@ TEST( testXML, testMemoryCSVOutput ) auto const findCSVMemoryEntry = [=]( string_view cycleStr, string_view memSpaceName ) -> bool { for( string const & csvLine : csvLines ) { - std::vector< string > const lineEntries = stringutilities::tokenize( csvLine, - TableCSVFormatter::m_separator, - false ); + stdVector< string > const lineEntries = stringutilities::tokenize( csvLine, + TableCSVFormatter::m_separator, + false ); EXPECT_GT( lineEntries.size(), 3 ); if( lineEntries[0] == cycleStr && lineEntries[2] == memSpaceName ) { // we found the line coresponding to the given cycle & memory-space diff --git a/src/coreComponents/fileIO/vtk/VTKPolyDataWriterInterface.cpp b/src/coreComponents/fileIO/vtk/VTKPolyDataWriterInterface.cpp index f1539d4d61d..633139a0017 100644 --- a/src/coreComponents/fileIO/vtk/VTKPolyDataWriterInterface.cpp +++ b/src/coreComponents/fileIO/vtk/VTKPolyDataWriterInterface.cpp @@ -362,7 +362,7 @@ getSurface( FaceElementSubRegion const & subRegion, stdVector< int > cellTypes; cellTypes.reserve( subRegion.size() ); - std::unordered_map< localIndex, localIndex > geos2VTKIndexing; + stdUnorderedMap< localIndex, localIndex > geos2VTKIndexing; geos2VTKIndexing.reserve( subRegion.size() * subRegion.numNodesPerElement() ); localIndex nodeIndexInVTK = 0; // FaceElementSubRegion being heterogeneous, the size of the connectivity vector may vary for each element. diff --git a/src/coreComponents/finiteVolume/mimeticInnerProducts/unitTests/testMimeticInnerProducts.cpp b/src/coreComponents/finiteVolume/mimeticInnerProducts/unitTests/testMimeticInnerProducts.cpp index 49c1df7a4c5..20da0e14b04 100644 --- a/src/coreComponents/finiteVolume/mimeticInnerProducts/unitTests/testMimeticInnerProducts.cpp +++ b/src/coreComponents/finiteVolume/mimeticInnerProducts/unitTests/testMimeticInnerProducts.cpp @@ -1381,7 +1381,7 @@ TEST( MimeticIP_Linear, UnitCube_LinearPressure_BdVLM ) TEST( MimeticIP_Linear, Distortion_Planar_LinearPressure ) { int neps = 3; - std::vector< double > eps_values( 3 ); + stdVector< double > eps_values( 3 ); eps_values[0] = 0.0; // no distortion eps_values[1] = 0.2; // moderate distortion eps_values[2] = 0.9; // severe distortion @@ -1422,7 +1422,7 @@ TEST( MimeticIP_Linear, Distortion_Planar_LinearPressure ) TEST( MimeticIP_Linear, Distortion_NonPlanar_LinearPressure ) { int neps = 2; - std::vector< double > eps_values( 2 ); + stdVector< double > eps_values( 2 ); eps_values[0] = 0.2; // moderate distortion eps_values[1] = 0.9; // severe distortion @@ -1727,7 +1727,7 @@ TEST( Hydrostatic, GravityConsistency_NoDistortion_BdVLM ) TEST( Hydrostatic, GravityConsistency_Distortion_Planar ) { int neps = 2; - std::vector< double > eps_values( 2 ); + stdVector< double > eps_values( 2 ); eps_values[0] = 0.2; // moderate distortion eps_values[1] = 0.9; // severe distortion @@ -1754,7 +1754,7 @@ TEST( Hydrostatic, GravityConsistency_Distortion_Planar ) TEST( Hydrostatic, GravityConsistency_Distortion_NonPlanar ) { int neps = 2; - std::vector< double > eps_values( 2 ); + stdVector< double > eps_values( 2 ); eps_values[0] = 0.2; // moderate distortion eps_values[1] = 0.9; // severe distortion diff --git a/src/coreComponents/integrationTests/fieldSpecificationTests/testFieldSpecification.cpp b/src/coreComponents/integrationTests/fieldSpecificationTests/testFieldSpecification.cpp index 2e576dc3283..6491ef4d0e4 100644 --- a/src/coreComponents/integrationTests/fieldSpecificationTests/testFieldSpecification.cpp +++ b/src/coreComponents/integrationTests/fieldSpecificationTests/testFieldSpecification.cpp @@ -199,10 +199,10 @@ void setupAndPlayWrongBC( string const & xml ) problem.applyInitialConditions(); } -std::vector< string > splitStringByDelimiter( string const & s, string const & delimiter ) +stdVector< string > splitStringByDelimiter( string const & s, string const & delimiter ) { string cpyTokens = s; - std::vector< string > tokens; + stdVector< string > tokens; size_t pos = 0; string token; while((pos = cpyTokens.find( delimiter )) != string::npos ) @@ -279,7 +279,7 @@ TEST( testIncorrectFieldSpecification, testRightFieldNames ) "ghostRank, localToGlobalMap, mass, pressure, rockPorosity_initialPorosity, rockPorosity_porosity, " "rockPorosity_referencePorosity, temperature, water_dDensity, water_dEnthalpy, water_dInternalEnergy, " "water_dViscosity, water_density, water_enthalpy, water_internalEnergy, water_viscosity"; - std::vector< string > const splitToken = splitStringByDelimiter( tokens, "," ); + stdVector< string > const splitToken = splitStringByDelimiter( tokens, "," ); for( auto const & token : splitToken ) { string const xmlTemplate = R"xml( diff --git a/src/coreComponents/integrationTests/fluidFlowTests/testCompositionalMultiPhaseMFDPolyhedral.cpp b/src/coreComponents/integrationTests/fluidFlowTests/testCompositionalMultiPhaseMFDPolyhedral.cpp index 8dfd432d91a..acf299b9871 100644 --- a/src/coreComponents/integrationTests/fluidFlowTests/testCompositionalMultiPhaseMFDPolyhedral.cpp +++ b/src/coreComponents/integrationTests/fluidFlowTests/testCompositionalMultiPhaseMFDPolyhedral.cpp @@ -327,21 +327,21 @@ static std::string generateXmlInputCompMFD( std::string const & innerProductType return oss.str(); } -// Helper: copy arrayView1d to std::vector -static inline std::vector< real64 > arrayViewToVector( arrayView1d< real64 const > & arr ) +// Helper: copy arrayView1d to stdVector +static inline stdVector< real64 > arrayViewToVector( arrayView1d< real64 const > & arr ) { arr.move( hostMemorySpace, false ); - return std::vector< real64 >( arr.data(), arr.data() + arr.size() ); + return stdVector< real64 >( arr.data(), arr.data() + arr.size() ); } // Helper: copy a 2D view to flat vector (row-major by phase index), accepts any 2D view type template< typename View2D > -static inline std::vector< real64 > arrayView2dToVector( View2D & arr ) +static inline stdVector< real64 > arrayView2dToVector( View2D & arr ) { arr.move( hostMemorySpace, false ); localIndex nCells = arr.size( 0 ); localIndex nCols = arr.size( 1 ); - std::vector< real64 > out; + stdVector< real64 > out; out.reserve( static_cast< size_t >( nCells ) * static_cast< size_t >( nCols ) ); for( localIndex i = 0; i < nCells; ++i ) { @@ -535,8 +535,8 @@ TEST_P( CompositionalTPFAvsMFDTPFA, PressureAndSaturationComparison ) std::string const testBinaryDir = TEST_BINARY_DIR; std::string const meshFile = testBinaryDir + std::string( "/" ) + GetParam(); - std::vector< real64 > p_tpfa, p_mfd; - std::vector< real64 > sat_tpfa, sat_mfd; // phase volume fractions flattened [cell,phase] + stdVector< real64 > p_tpfa, p_mfd; + stdVector< real64 > sat_tpfa, sat_mfd; // phase volume fractions flattened [cell,phase] localIndex n_cells_tpfa = 0, n_cells_mfd = 0; localIndex n_phases_tpfa = 2, n_phases_mfd = 2; // From XML phaseNames diff --git a/src/coreComponents/integrationTests/fluidFlowTests/testSinglePhaseMFDPolyhedral.cpp b/src/coreComponents/integrationTests/fluidFlowTests/testSinglePhaseMFDPolyhedral.cpp index 58c8c167f66..77915637bb8 100644 --- a/src/coreComponents/integrationTests/fluidFlowTests/testSinglePhaseMFDPolyhedral.cpp +++ b/src/coreComponents/integrationTests/fluidFlowTests/testSinglePhaseMFDPolyhedral.cpp @@ -433,11 +433,11 @@ class TPFAvsMFDTPFATest : public ::testing::TestWithParam< const char * > TPFAvsMFDTPFATest() = default; }; -// Helper function to copy arrayView1d to std::vector -static inline std::vector< real64 > arrayViewToVector( arrayView1d< real64 const > & arr, localIndex n ) +// Helper function to copy arrayView1d to stdVector +static inline stdVector< real64 > arrayViewToVector( arrayView1d< real64 const > & arr, localIndex n ) { arr.move( hostMemorySpace, false ); - return std::vector< real64 >( arr.data(), arr.data() + n ); + return stdVector< real64 >( arr.data(), arr.data() + n ); } @@ -458,8 +458,8 @@ TEST_P( TPFAvsMFDTPFATest, PressureFieldComparison ) // Use the CMAKE-defined TEST_BINARY_DIR variable std::string testBinaryDir = TEST_BINARY_DIR; - std::vector< real64 > p_tpfa; - std::vector< real64 > p_mfd; + stdVector< real64 > p_tpfa; + stdVector< real64 > p_mfd; localIndex n_data_tpfa = 0; localIndex n_data_mfd = 0; diff --git a/src/coreComponents/integrationTests/solverStatisticsTests/testSolverStats.cpp b/src/coreComponents/integrationTests/solverStatisticsTests/testSolverStats.cpp index 54415a077a5..f5373c21c07 100644 --- a/src/coreComponents/integrationTests/solverStatisticsTests/testSolverStats.cpp +++ b/src/coreComponents/integrationTests/solverStatisticsTests/testSolverStats.cpp @@ -54,8 +54,8 @@ class ConvergenceTest : public ConvergenceStatistics public: - void AssertConvergenceValuesEquals( std::vector< std::string > const & actualValues, - std::vector< std::string > const & expectedValues ) + void AssertConvergenceValuesEquals( stdVector< std::string > const & actualValues, + stdVector< std::string > const & expectedValues ) { EXPECT_EQ( actualValues[0], expectedValues[0] ); EXPECT_EQ( actualValues[1], expectedValues[1] ); @@ -238,7 +238,7 @@ TEST( testSolverStats, testOutputFiles ) ConvergenceTest & convergenceStat = static_cast< ConvergenceTest & >(solver.getConvergenceStats()); IterationTest & iterationStat = static_cast< IterationTest & >(solver.getIterationStats()); - auto loadCsvLines = []( string const & filename, std::vector< string > & lines ) { + auto loadCsvLines = []( string const & filename, stdVector< string > & lines ) { if( !std::filesystem::exists( filename )) { @@ -293,7 +293,7 @@ TEST( testSolverStats, testOutputFiles ) return true; }; - std::vector< string > csvLines; + stdVector< string > csvLines; loadCsvLines( iterationStat.getFilename(), csvLines ); EXPECT_EQ( csvLines[0], @@ -304,7 +304,7 @@ TEST( testSolverStats, testOutputFiles ) iterationStat.AssertIterationValuesEquals(); - std::vector< string > csvLines2; + stdVector< string > csvLines2; loadCsvLines( convergenceStat.getFilename(), csvLines2 ); EXPECT_EQ( csvLines2[0], "Cycle number,time_n (s),dt (s),iteration,R,Rflow" ); diff --git a/src/coreComponents/integrationTests/wellsTests/testOpenClosePerf.cpp b/src/coreComponents/integrationTests/wellsTests/testOpenClosePerf.cpp index c45c9a21e68..ea018e2284d 100644 --- a/src/coreComponents/integrationTests/wellsTests/testOpenClosePerf.cpp +++ b/src/coreComponents/integrationTests/wellsTests/testOpenClosePerf.cpp @@ -177,7 +177,7 @@ void testPlugTopDownPerfCheck( CompositionalMultiphaseReservoirAndWells<> & solv { CompositionalMultiphaseWell & wellSolver = *solver.wellSolver(); - typedef stdMap< real64, std::vector< int > > map_type; + typedef stdMap< real64, stdVector< int > > map_type; map_type refVal; refVal.insert( {29800.0, { 1, 1, 1, 1, 1}} ); refVal.insert( {32400.0, { 1, 1, 1, 1, 0}} ); @@ -189,7 +189,7 @@ void testPlugTopDownPerfCheck( CompositionalMultiphaseReservoirAndWells<> & solv { perfFunction( it->first ); - const std::vector< int > & refStatus = it->second; + const stdVector< int > & refStatus = it->second; wellSolver.forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, string_array const & regionNames ) @@ -219,7 +219,7 @@ void testPlugBottomUpPerfCheck( CompositionalMultiphaseReservoirAndWells<> & sol { CompositionalMultiphaseWell & wellSolver = *solver.wellSolver(); - typedef stdMap< real64, std::vector< int > > map_type; + typedef stdMap< real64, stdVector< int > > map_type; map_type refVal; refVal.insert( {4800.0, { 1, 1, 1, 1, 1}} ); refVal.insert( {14800.0, { 1, 1, 1, 1, 0}} ); @@ -232,7 +232,7 @@ void testPlugBottomUpPerfCheck( CompositionalMultiphaseReservoirAndWells<> & sol { perfFunction( it->first ); - const std::vector< int > & refStatus = it->second; + const stdVector< int > & refStatus = it->second; wellSolver.forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, string_array const & regionNames ) @@ -262,7 +262,7 @@ void testOpenTopDownPerfCheck( CompositionalMultiphaseReservoirAndWells<> & solv { CompositionalMultiphaseWell & wellSolver = *solver.wellSolver(); - typedef stdMap< real64, std::vector< int > > map_type; + typedef stdMap< real64, stdVector< int > > map_type; map_type refPerfTable; refPerfTable.insert( {4800.0, { 0, 0, 0, 0, 0}} ); refPerfTable.insert( {14800.0, { 1, 0, 0, 0, 0}} ); @@ -274,7 +274,7 @@ void testOpenTopDownPerfCheck( CompositionalMultiphaseReservoirAndWells<> & solv { perfFunction( it->first ); - const std::vector< int > & refStatus = it->second; + const stdVector< int > & refStatus = it->second; wellSolver.forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, string_array const & regionNames ) @@ -304,7 +304,7 @@ void testOpenBottomUpPerfCheck( CompositionalMultiphaseReservoirAndWells<> & sol { CompositionalMultiphaseWell & wellSolver = *solver.wellSolver(); - typedef stdMap< real64, std::vector< int > > map_type; + typedef stdMap< real64, stdVector< int > > map_type; map_type refVal; refVal.insert( {4800.0, { 0, 0, 0, 0, 0}} ); refVal.insert( {33000.0, { 1, 1, 1, 1, 1}} ); @@ -314,7 +314,7 @@ void testOpenBottomUpPerfCheck( CompositionalMultiphaseReservoirAndWells<> & sol { perfFunction( it->first ); - const std::vector< int > & refStatus = it->second; + const stdVector< int > & refStatus = it->second; wellSolver.forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, string_array const & regionNames ) diff --git a/src/coreComponents/integrationTests/wellsTests/testReservoirThermalSinglePhaseMSWells.cpp b/src/coreComponents/integrationTests/wellsTests/testReservoirThermalSinglePhaseMSWells.cpp index d10f1da56f6..049313c9c01 100644 --- a/src/coreComponents/integrationTests/wellsTests/testReservoirThermalSinglePhaseMSWells.cpp +++ b/src/coreComponents/integrationTests/wellsTests/testReservoirThermalSinglePhaseMSWells.cpp @@ -175,8 +175,8 @@ void printCompareLocalMatrices( CRSMatrixView< T const, COL_INDEX const > const std::ofstream omat1( testName+".csv" ); - std::vector< std::vector< double > > fmat1( matrix1.numRows(), std::vector< double >( matrix1.numRows(), 0.0 )); - std::vector< std::vector< double > > fmat2( matrix2.numRows(), std::vector< double >( matrix2.numRows(), 0.0 )); + stdVector< stdVector< double > > fmat1( matrix1.numRows(), stdVector< double >( matrix1.numRows(), 0.0 )); + stdVector< stdVector< double > > fmat2( matrix2.numRows(), stdVector< double >( matrix2.numRows(), 0.0 )); for( localIndex i = 0; i < matrix1.numRows(); ++i ) { diff --git a/src/coreComponents/integrationTests/wellsTests/testReservoirThermalSinglePhaseMSWells_RateInj.cpp b/src/coreComponents/integrationTests/wellsTests/testReservoirThermalSinglePhaseMSWells_RateInj.cpp index 255b0201692..5c34a364eba 100644 --- a/src/coreComponents/integrationTests/wellsTests/testReservoirThermalSinglePhaseMSWells_RateInj.cpp +++ b/src/coreComponents/integrationTests/wellsTests/testReservoirThermalSinglePhaseMSWells_RateInj.cpp @@ -257,8 +257,8 @@ void printCompareLocalMatrices( CRSMatrixView< T const, COL_INDEX const > const std::ofstream omat1( testName+".csv" ); - std::vector< std::vector< double > > fmat1( matrix1.numRows(), std::vector< double >( matrix1.numRows(), 0.0 )); - std::vector< std::vector< double > > fmat2( matrix2.numRows(), std::vector< double >( matrix2.numRows(), 0.0 )); + stdVector< stdVector< double > > fmat1( matrix1.numRows(), stdVector< double >( matrix1.numRows(), 0.0 )); + stdVector< stdVector< double > > fmat2( matrix2.numRows(), stdVector< double >( matrix2.numRows(), 0.0 )); for( localIndex i = 0; i < matrix1.numRows(); ++i ) { diff --git a/src/coreComponents/linearAlgebra/interfaces/hypre/HypreUtils.cpp b/src/coreComponents/linearAlgebra/interfaces/hypre/HypreUtils.cpp index f2dba640c9c..5d4a64195b7 100644 --- a/src/coreComponents/linearAlgebra/interfaces/hypre/HypreUtils.cpp +++ b/src/coreComponents/linearAlgebra/interfaces/hypre/HypreUtils.cpp @@ -82,7 +82,7 @@ HYPRE_Vector parVectorToVector( HYPRE_ParVector const vec, int const targetRank newVec = hypre_SeqVectorCreate( globalSize ); hypre_SeqVectorInitialize_v2( newVec, HYPRE_MEMORY_HOST ); - std::vector< MPI_Request > requests( numProcs, MPI_REQUEST_NULL ); + stdVector< MPI_Request > requests( numProcs, MPI_REQUEST_NULL ); for( int i = 0; i < numProcs; ++i ) { HYPRE_Real * const data = hypre_VectorData( newVec ) + offsets[i]; diff --git a/src/coreComponents/linearAlgebra/multiscale/MultiscalePreconditioner.hpp b/src/coreComponents/linearAlgebra/multiscale/MultiscalePreconditioner.hpp index c4758aeb7e2..f462331b6c3 100644 --- a/src/coreComponents/linearAlgebra/multiscale/MultiscalePreconditioner.hpp +++ b/src/coreComponents/linearAlgebra/multiscale/MultiscalePreconditioner.hpp @@ -100,7 +100,7 @@ class MultiscalePreconditioner : public PreconditionerBase< LAI > DomainPartition & m_domain; - std::vector< LevelData > m_levels; + stdVector< LevelData > m_levels; std::unique_ptr< PreconditionerBase< LAI > > m_coarse_solver; diff --git a/src/coreComponents/linearAlgebra/multiscale/mesh/DofManager.hpp b/src/coreComponents/linearAlgebra/multiscale/mesh/DofManager.hpp index c27b6be3857..10f97b23fd1 100644 --- a/src/coreComponents/linearAlgebra/multiscale/mesh/DofManager.hpp +++ b/src/coreComponents/linearAlgebra/multiscale/mesh/DofManager.hpp @@ -235,7 +235,7 @@ class DofManager DomainPartition * m_domain = nullptr; /// Array of field descriptions - std::vector< FieldDescription > m_fields; + stdVector< FieldDescription > m_fields; /// Flag indicating that DOFs have been reordered rank-wise. bool m_reordered = false; diff --git a/src/coreComponents/linearAlgebra/multiscale/mesh/MeshLevel.cpp b/src/coreComponents/linearAlgebra/multiscale/mesh/MeshLevel.cpp index 0d8bf0cdf29..b45e08c7e52 100644 --- a/src/coreComponents/linearAlgebra/multiscale/mesh/MeshLevel.cpp +++ b/src/coreComponents/linearAlgebra/multiscale/mesh/MeshLevel.cpp @@ -123,7 +123,7 @@ void populateNodeManager( string const & localIndexKey, numLocalNodes ); // Setup neighbor data - std::vector< int > const neighborRanks = domain.getNeighborRanks(); + stdVector< int > const neighborRanks = domain.getNeighborRanks(); for( int const rank : neighborRanks ) { msNodeManager.addNeighbor( rank ); @@ -255,7 +255,7 @@ void populateCellManager( string const & localIndexKey, numLocalCells ); // Setup neighbor data - std::vector< int > const neighborRanks = domain.getNeighborRanks(); + stdVector< int > const neighborRanks = domain.getNeighborRanks(); for( int const rank : neighborRanks ) { msCellManager.addNeighbor( rank ); @@ -424,7 +424,7 @@ void MeshLevel::buildCoarseMesh( multiscale::MeshLevel & fineMesh, coarsening::buildCoarseMesh( fineMesh, *this, coarse_params, boundaryNodeSets ); } -void MeshLevel::writeCellData( std::vector< string > const & fieldNames, int depth ) const +void MeshLevel::writeCellData( stdVector< string > const & fieldNames, int depth ) const { if( m_fineMesh ) { @@ -436,7 +436,7 @@ void MeshLevel::writeCellData( std::vector< string > const & fieldNames, int dep } } -void MeshLevel::writeNodeData( std::vector< string > const & fieldNames, int depth ) const +void MeshLevel::writeNodeData( stdVector< string > const & fieldNames, int depth ) const { if( m_fineMesh ) { @@ -448,7 +448,7 @@ void MeshLevel::writeNodeData( std::vector< string > const & fieldNames, int dep } } -void MeshLevel::writeCellDataFine( std::vector< string > const & fieldNames, int depth ) const +void MeshLevel::writeCellDataFine( stdVector< string > const & fieldNames, int depth ) const { geos::MeshLevel & sourceMesh = m_domain->getMeshBody( m_support.meshBodyName ).getMeshLevel( m_support.meshLevelName ); arrayView1d< localIndex const > const origRegion = m_cellManager.getField< fields::multiscale::OrigElementRegion >(); @@ -492,13 +492,13 @@ void MeshLevel::writeCellDataFine( std::vector< string > const & fieldNames, int } } -void MeshLevel::writeCellDataCoarse( std::vector< string > const & fieldNames, int depth ) const +void MeshLevel::writeCellDataCoarse( stdVector< string > const & fieldNames, int depth ) const { GEOS_ASSERT( m_fineMesh != nullptr ); arrayView1d< localIndex const > const coarseCellIndex = m_fineMesh->cellManager().getField< fields::multiscale::CoarseCellLocalIndex >(); - std::vector< string > fineFieldNames; + stdVector< string > fineFieldNames; for( string const & fieldName : fieldNames ) { WrapperBase const & wrapper = m_cellManager.getWrapperBase( fieldName ); @@ -534,7 +534,7 @@ void MeshLevel::writeCellDataCoarse( std::vector< string > const & fieldNames, i m_fineMesh->writeCellData( fineFieldNames, depth + 1 ); } -void MeshLevel::writeNodeDataFine( std::vector< string > const & fieldNames, int depth ) const +void MeshLevel::writeNodeDataFine( stdVector< string > const & fieldNames, int depth ) const { geos::MeshLevel & sourceMesh = m_domain->getMeshBody( m_support.meshBodyName ).getMeshLevel( m_support.meshLevelName ); arrayView1d< localIndex const > const origNodeIndex = m_nodeManager.getField< fields::multiscale::OrigNodeIndex >(); @@ -570,12 +570,12 @@ void MeshLevel::writeNodeDataFine( std::vector< string > const & fieldNames, int } } -void MeshLevel::writeNodeDataCoarse( std::vector< string > const & fieldNames, int depth ) const +void MeshLevel::writeNodeDataCoarse( stdVector< string > const & fieldNames, int depth ) const { GEOS_ASSERT( m_fineMesh != nullptr ); arrayView1d< localIndex const > const fineNodeIndex = m_nodeManager.getField< fields::multiscale::FineNodeLocalIndex >(); - std::vector< string > fineFieldNames; + stdVector< string > fineFieldNames; for( string const & fieldName : fieldNames ) { WrapperBase const & wrapper = m_nodeManager.getWrapperBase( fieldName ); diff --git a/src/coreComponents/linearAlgebra/multiscale/mesh/MeshLevel.hpp b/src/coreComponents/linearAlgebra/multiscale/mesh/MeshLevel.hpp index 69843f3170e..db96de9ecd3 100644 --- a/src/coreComponents/linearAlgebra/multiscale/mesh/MeshLevel.hpp +++ b/src/coreComponents/linearAlgebra/multiscale/mesh/MeshLevel.hpp @@ -96,14 +96,14 @@ class MeshLevel * @param fieldNames the list of field names to write * @param depth counter used to track recursion depth (leave default value of 0) */ - void writeCellData( std::vector< string > const & fieldNames, int depth = 0 ) const; + void writeCellData( stdVector< string > const & fieldNames, int depth = 0 ) const; /** * @brief Push node data to finer levels * @param fieldNames the list of field names to write * @param depth counter used to track recursion depth (leave default value of 0) */ - void writeNodeData( std::vector< string > const & fieldNames, int depth = 0 ) const; + void writeNodeData( stdVector< string > const & fieldNames, int depth = 0 ) const; /** * @brief @return the level name @@ -122,10 +122,10 @@ class MeshLevel private: - void writeCellDataFine( std::vector< string > const & fieldNames, int depth ) const; - void writeCellDataCoarse( std::vector< string > const & fieldNames, int depth ) const; - void writeNodeDataFine( std::vector< string > const & fieldNames, int depth ) const; - void writeNodeDataCoarse( std::vector< string > const & fieldNames, int depth ) const; + void writeCellDataFine( stdVector< string > const & fieldNames, int depth ) const; + void writeCellDataCoarse( stdVector< string > const & fieldNames, int depth ) const; + void writeNodeDataFine( stdVector< string > const & fieldNames, int depth ) const; + void writeNodeDataCoarse( stdVector< string > const & fieldNames, int depth ) const; string m_name; ///< Unique name prefix diff --git a/src/coreComponents/linearAlgebra/multiscale/mesh/MeshUtils.hpp b/src/coreComponents/linearAlgebra/multiscale/mesh/MeshUtils.hpp index 24a02ccffd7..38f820f756b 100644 --- a/src/coreComponents/linearAlgebra/multiscale/mesh/MeshUtils.hpp +++ b/src/coreComponents/linearAlgebra/multiscale/mesh/MeshUtils.hpp @@ -247,7 +247,7 @@ void fillArrayBySrcIndex( arrayView1d< INDEX const > const & map, template< typename FUNC > void copyNeighborData( ObjectManagerBase const & srcManager, string const & mapKey, - std::vector< integer > const & ranks, + stdVector< integer > const & ranks, ObjectManagerBase & dstManager, FUNC && copyFunc ) { diff --git a/src/coreComponents/linearAlgebra/multiscale/mesh/coarsening/Coarsening.cpp b/src/coreComponents/linearAlgebra/multiscale/mesh/coarsening/Coarsening.cpp index 5571fd2b719..4a325636475 100644 --- a/src/coreComponents/linearAlgebra/multiscale/mesh/coarsening/Coarsening.cpp +++ b/src/coreComponents/linearAlgebra/multiscale/mesh/coarsening/Coarsening.cpp @@ -234,7 +234,7 @@ void buildCoarseCells( multiscale::MeshLevel & fineMesh, fillBasicCellData( fineCellManager, coarseCellManager ); // Populate neighbor data and sets - std::vector< int > neighborRanks = fineMesh.domain()->getNeighborRanks(); + stdVector< int > neighborRanks = fineMesh.domain()->getNeighborRanks(); for( int const rank : neighborRanks ) { coarseCellManager.addNeighbor( rank ); @@ -375,7 +375,7 @@ void buildCoarseNodes( multiscale::MeshLevel & fineMesh, fillBasicNodeData( fineNodeManager, coarseNodeManager ); // Populate neighbor data and sets - std::vector< int > neighborRanks = fineMesh.domain()->getNeighborRanks(); + stdVector< int > neighborRanks = fineMesh.domain()->getNeighborRanks(); for( int const rank : neighborRanks ) { coarseNodeManager.addNeighbor( rank ); diff --git a/src/coreComponents/linearAlgebra/multiscale/mesh/coarsening/SemistructuredPartitioner.cpp b/src/coreComponents/linearAlgebra/multiscale/mesh/coarsening/SemistructuredPartitioner.cpp index 82c8ab67a29..e7b58e1c508 100644 --- a/src/coreComponents/linearAlgebra/multiscale/mesh/coarsening/SemistructuredPartitioner.cpp +++ b/src/coreComponents/linearAlgebra/multiscale/mesh/coarsening/SemistructuredPartitioner.cpp @@ -40,7 +40,7 @@ template< typename FUNC > CRSMatrix< int64_t, int64_t, int64_t > buildLayerGraph( multiscale::MeshLevel const & mesh, arrayView1d< localIndex const > const & layerCells, - std::unordered_map< integer, localIndex > const & structIndexToLayerCell, + stdUnorderedMap< integer, localIndex > const & structIndexToLayerCell, integer const layerIndex, integer const minCommonNodes, FUNC && weightFunc ) @@ -151,7 +151,7 @@ localIndex SemistructuredPartitioner::generate( MeshLevel const & mesh, array1d< localIndex > layerCells; layerCells.reserve( numCellsA ); - std::unordered_map< integer, localIndex > indexToLayer; + stdUnorderedMap< integer, localIndex > indexToLayer; indexToLayer.reserve( numCellsA ); forAll< serialPolicy >( numCells, [&]( localIndex const i ) diff --git a/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilder.cpp b/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilder.cpp index a8b4ddd1d4e..97740161d51 100644 --- a/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilder.cpp +++ b/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilder.cpp @@ -578,7 +578,7 @@ void MsrsbLevelBuilder< LAI >::writeProlongationForDebug() const MeshObjectManager & manager = m_location == FieldLocation::Node ? m_mesh.fineMesh()->nodeManager() : m_mesh.fineMesh()->cellManager(); - auto const writeFunc = [location = m_location]( multiscale::MeshLevel & mesh, std::vector< string > const & names ) + auto const writeFunc = [location = m_location]( multiscale::MeshLevel & mesh, stdVector< string > const & names ) { return location == FieldLocation::Node ? mesh.writeNodeData( names ) diff --git a/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilderCoupled.cpp b/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilderCoupled.cpp index dc268a33e17..ae2e3b112c5 100644 --- a/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilderCoupled.cpp +++ b/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilderCoupled.cpp @@ -126,12 +126,12 @@ void MsrsbLevelBuilderCoupled< LAI >::initializeFineLevel( DomainPartition & dom createSmoothers(); } -std::unordered_map< globalIndex, globalIndex > +stdUnorderedMap< globalIndex, globalIndex > makeGhostDofMap( MeshObjectManager const & manager, string const & oldDofKey, string const & newDofKey ) { - std::unordered_map< globalIndex, globalIndex > ghostDofMap; + stdUnorderedMap< globalIndex, globalIndex > ghostDofMap; arrayView1d< globalIndex const > const oldDofNumber = manager.getReference< array1d< globalIndex > >( oldDofKey ); arrayView1d< globalIndex const > const newDofNumber = manager.getReference< array1d< globalIndex > >( newDofKey ); for( localIndex i = manager.numOwnedObjects(); i < manager.size(); ++i ) @@ -176,7 +176,7 @@ void MsrsbLevelBuilderCoupled< LAI >::buildProlongationStructure( DofManager con integer const numComp = m_dofManager.numComponents( fieldName ); - std::unordered_map< globalIndex, globalIndex > const ghostDofMap = + stdUnorderedMap< globalIndex, globalIndex > const ghostDofMap = makeGhostDofMap( m_builders[blockId]->manager(), dofManager.key( fieldName ), m_dofManager.key( fieldName ) ); auto const mapGhostCol = [numComp, &ghostDofMap]( globalIndex const col ) diff --git a/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilderCoupled.hpp b/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilderCoupled.hpp index 7f58df98b1c..e9d33362cd1 100644 --- a/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilderCoupled.hpp +++ b/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilderCoupled.hpp @@ -98,16 +98,16 @@ class MsrsbLevelBuilderCoupled : public MsrsbLevelBuilderBase< LAI > void buildProlongationStructure( DofManager const & fineDofManager ); /// A field description for each sub-block - std::vector< string > m_fields; + stdVector< string > m_fields; /// Subproblem selector matrices at the current level - std::vector< Matrix > m_selectors; + stdVector< Matrix > m_selectors; /// Levels for each sub-problem - std::vector< std::unique_ptr< MsrsbLevelBuilder< LAI > > > m_builders; + stdVector< std::unique_ptr< MsrsbLevelBuilder< LAI > > > m_builders; /// Sub-problem prolongators in extracted (local) form - std::vector< CRSMatrix< real64, globalIndex > > m_prolongationBlocks; + stdVector< CRSMatrix< real64, globalIndex > > m_prolongationBlocks; /// Temporary storage for combined prolongation operator (stored to avoid recreating the structure) CRSMatrix< real64, globalIndex > m_localProlongation; diff --git a/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbUtils.cpp b/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbUtils.cpp index 24802af7456..c6da0affd6d 100644 --- a/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbUtils.cpp +++ b/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbUtils.cpp @@ -609,17 +609,17 @@ void writeProlongation( CRSMatrixView< real64 const, globalIndex const > const & string const & prefix, multiscale::MeshLevel & mesh, multiscale::MeshObjectManager & fineManager, - std::function< void ( multiscale::MeshLevel &, std::vector< string > const & ) > const & writeFunc ) + std::function< void ( multiscale::MeshLevel &, stdVector< string > const & ) > const & writeFunc ) { - std::vector< string > bNames{ "X ", "Y ", "Z " }; - std::vector< string > cNames{ " x", " y", " z" }; + stdVector< string > bNames{ "X ", "Y ", "Z " }; + stdVector< string > cNames{ " x", " y", " z" }; integer const numComp = dofManager.numComponents( fieldName ); globalIndex const numBfuncs = prolongation.numColumns() / numComp; int const labelWidth = static_cast< int >( std::log10( numBfuncs ) ) + 1; - std::vector< arrayView3d< real64 > > views; - std::vector< string > names; + stdVector< arrayView3d< real64 > > views; + stdVector< string > names; for( globalIndex bfIndex = 0; bfIndex < numBfuncs; ++bfIndex ) { diff --git a/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbUtils.hpp b/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbUtils.hpp index e4bcb7f8526..7dd1b7340fd 100644 --- a/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbUtils.hpp +++ b/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbUtils.hpp @@ -254,7 +254,7 @@ void writeProlongation( CRSMatrixView< real64 const, globalIndex const > const & string const & prefix, multiscale::MeshLevel & mesh, multiscale::MeshObjectManager & fineManager, - std::function< void ( multiscale::MeshLevel &, std::vector< string > const & ) > const & writeFunc ); + std::function< void ( multiscale::MeshLevel &, stdVector< string > const & ) > const & writeFunc ); } // namespace msrsb } // namespace multiscale diff --git a/src/coreComponents/linearAlgebra/solvers/BlockPreconditioner.cpp b/src/coreComponents/linearAlgebra/solvers/BlockPreconditioner.cpp index 4d500926c0b..e0fd2af73ac 100644 --- a/src/coreComponents/linearAlgebra/solvers/BlockPreconditioner.cpp +++ b/src/coreComponents/linearAlgebra/solvers/BlockPreconditioner.cpp @@ -81,7 +81,7 @@ void BlockPreconditioner< LAI >::setupBlock( localIndex const blockIndex, template< typename LAI > void BlockPreconditioner< LAI >::setupBlock( localIndex const blockIndex, - std::vector< DofManager::SubComponent > blockDofs, + stdVector< DofManager::SubComponent > blockDofs, PreconditionerBase< LAI > * const solver, real64 const scaling ) { diff --git a/src/coreComponents/linearAlgebra/solvers/BlockPreconditioner.hpp b/src/coreComponents/linearAlgebra/solvers/BlockPreconditioner.hpp index 58622d2f933..951c1992fd1 100644 --- a/src/coreComponents/linearAlgebra/solvers/BlockPreconditioner.hpp +++ b/src/coreComponents/linearAlgebra/solvers/BlockPreconditioner.hpp @@ -115,7 +115,7 @@ class BlockPreconditioner : public PreconditionerBase< LAI > * DoF components in the monolithic system. */ void setupBlock( localIndex const blockIndex, - std::vector< DofManager::SubComponent > blockDofs, + stdVector< DofManager::SubComponent > blockDofs, PreconditionerBase< LAI > * const solver, real64 const scaling = 1.0 ); diff --git a/src/coreComponents/linearAlgebra/unitTests/testComponentMask.cpp b/src/coreComponents/linearAlgebra/unitTests/testComponentMask.cpp index 23aef693db0..ad7e46fbcaa 100644 --- a/src/coreComponents/linearAlgebra/unitTests/testComponentMask.cpp +++ b/src/coreComponents/linearAlgebra/unitTests/testComponentMask.cpp @@ -27,21 +27,21 @@ using namespace geos; template< int N > -void compare( ComponentMask< N > const & mask, std::vector< int > const & expected ) +void compare( ComponentMask< N > const & mask, stdVector< int > const & expected ) { EXPECT_EQ( mask.empty(), expected.empty() ); EXPECT_EQ( mask.size(), expected.size() ); - EXPECT_EQ( std::vector< int >( mask.begin(), mask.end() ), expected ); + EXPECT_EQ( stdVector< int >( mask.begin(), mask.end() ), expected ); } -std::vector< int > make_range( int lo, int const hi, int const step = 1 ) +stdVector< int > make_range( int lo, int const hi, int const step = 1 ) { - std::vector< int > r( hi - lo ); + stdVector< int > r( hi - lo ); std::generate( r.begin(), r.end(), [&lo, step] { int const ret = lo; lo += step; return ret; } ); return r; } -std::vector< int > join_range( std::vector< int > lhs, std::vector< int > const & rhs ) +stdVector< int > join_range( stdVector< int > lhs, stdVector< int > const & rhs ) { lhs.insert( lhs.end(), rhs.begin(), rhs.end() ); return lhs; @@ -173,7 +173,7 @@ TYPED_TEST( ComponentMaskTest, Set_EveryOtherComp ) using Mask = typename TestFixture::CompMask; constexpr int N = TestFixture::MAX_COMP; Mask mask( N ); - std::vector< int > expected; + stdVector< int > expected; for( int i = 0; i < N; i += 2 ) { mask.set( i ); @@ -187,7 +187,7 @@ TYPED_TEST( ComponentMaskTest, Set_EveryComp ) using Mask = typename TestFixture::CompMask; constexpr int N = TestFixture::MAX_COMP; Mask mask( N ); - std::vector< int > expected; + stdVector< int > expected; for( int i = 0; i < N; i += 1 ) { mask.set( i ); @@ -213,7 +213,7 @@ TYPED_TEST( ComponentMaskTest, Unset_EveryOtherComp ) using Mask = typename TestFixture::CompMask; constexpr int N = TestFixture::MAX_COMP; Mask mask( N, true ); - std::vector< int > expected; + stdVector< int > expected; for( int i = 0; i < N; i += 2 ) { mask.unset( i ); diff --git a/src/coreComponents/mesh/DomainPartition.hpp b/src/coreComponents/mesh/DomainPartition.hpp index 6644915738c..870ad00bec2 100644 --- a/src/coreComponents/mesh/DomainPartition.hpp +++ b/src/coreComponents/mesh/DomainPartition.hpp @@ -278,9 +278,9 @@ class DomainPartition : public dataRepository::Group * @brief Get a list of neighbor ranks. * @return Container of neighbor ranks. */ - std::vector< int > getNeighborRanks() const + stdVector< int > getNeighborRanks() const { - std::vector< int > ranks; + stdVector< int > ranks; ranks.reserve( m_neighbors.size() ); for( NeighborCommunicator const & neighbor : m_neighbors ) { diff --git a/src/coreComponents/mesh/ElementSubRegionBase.hpp b/src/coreComponents/mesh/ElementSubRegionBase.hpp index 21810289001..3af0767c53b 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; + stdVector< std::array< real64, 3 > > nodes; nodes.reserve( numNodes ); for( localIndex a = 0; a < numNodes; ++a ) { diff --git a/src/coreComponents/mesh/WellElementSubRegion.cpp b/src/coreComponents/mesh/WellElementSubRegion.cpp index b58343bdd12..eb4d58acd6f 100644 --- a/src/coreComponents/mesh/WellElementSubRegion.cpp +++ b/src/coreComponents/mesh/WellElementSubRegion.cpp @@ -215,7 +215,7 @@ bool isPointInsideElement( SurfaceElementSubRegion const & subRegion, // collect element nodes integer const nV = subRegion.numNodesPerElement( eiLocal ); SurfaceElementSubRegion::NodeMapType const & nodeList = subRegion.nodeList(); - std::vector< Point3d > polygon( nV ); + stdVector< Point3d > polygon( nV ); for( integer i = 0; i < nV; ++i ) { for( integer j = 0; j < 3; ++j ) @@ -1087,7 +1087,7 @@ void WellElementSubRegion::setElementStatus( arrayView1d< integer > const & loca // Sort indices based on the global index - std::vector< size_t > indices( numElements ); + stdVector< size_t > indices( numElements ); for( size_t i = 0; i < indices.size(); ++i ) { indices[i] = i; // Initialize indices diff --git a/src/coreComponents/mesh/generators/CellBlockManager.cpp b/src/coreComponents/mesh/generators/CellBlockManager.cpp index 7506e96b77e..d21d2ff7df7 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; + stdUnorderedMap< std::array< localIndex, 6 >, localIndex, NodeKeyHasher< localIndex > > nodeIDs; localIndex edgeHeadNode = edgeToNodesMapSource[ iter_edge ][ 0 ]; localIndex edgeEndNode = edgeToNodesMapSource[ iter_edge ][ 1 ]; globalIndex edgeHeadNodeG = nodeLocalToGlobalNew[ edgeHeadNode ]; @@ -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; + stdUnorderedMap< std::array< localIndex, 6 >, localIndex, NodeKeyHasher< localIndex > > nodeIDs; localIndex faceVertID[ numVerticesPerFace ]; globalIndex faceVertGID[ numVerticesPerFace ]; array1d< localIndex > const faceToNodeMapWork( numNodesPerFace ); @@ -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; + stdUnorderedMap< std::array< 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/VTKFaceBlockUtilities.cpp b/src/coreComponents/mesh/generators/VTKFaceBlockUtilities.cpp index 7b540945686..9a7b2b59fd0 100644 --- a/src/coreComponents/mesh/generators/VTKFaceBlockUtilities.cpp +++ b/src/coreComponents/mesh/generators/VTKFaceBlockUtilities.cpp @@ -238,7 +238,7 @@ ArrayOfArrays< localIndex > buildFace2dToElems2d( vtkPolyData * edges, { // Each edge is first associated to an hash and to an id. // Then we loop over all the edges of each cell and compute its hash to recover the associated id. - std::unordered_map< std::pair< vtkIdType, vtkIdType >, int, pairHashComputer > face2dIds; + stdUnorderedMap< std::pair< vtkIdType, vtkIdType >, int, pairHashComputer > face2dIds; for( int i = 0; i < edges->GetNumberOfCells(); ++i ) { vtkCell * c = edges->GetCell( i ); diff --git a/src/coreComponents/mesh/generators/VTKUtilities.cpp b/src/coreComponents/mesh/generators/VTKUtilities.cpp index 1f21a300d52..93eaf103443 100644 --- a/src/coreComponents/mesh/generators/VTKUtilities.cpp +++ b/src/coreComponents/mesh/generators/VTKUtilities.cpp @@ -1516,7 +1516,7 @@ splitCellsByTypeAndAttribute( stdMap< ElementType, stdVector< vtkIdType > > & ty { using ArrayType = TYPEOFPTR( attributeArray ); vtkDataArrayAccessor< ArrayType > attribute( attributeArray ); - std::unordered_map< int, size_t > cellCounts; + stdUnorderedMap< int, size_t > cellCounts; for( vtkIdType c: cells ) { int const region = static_cast< int >( attribute.Get( c, 0 ) ); @@ -1713,7 +1713,7 @@ stdVector< localIndex > getWedgeNodeOrderingFromPolyhedron( vtkCell * const cell stdVector< localIndex > nodeOrder( 6 ); // Generate global to local map - std::unordered_map< localIndex, localIndex > G2L; + stdUnorderedMap< localIndex, localIndex > G2L; for( localIndex iPoint = 0; iPoint < 6; ++iPoint ) { G2L[cell->GetPointId( iPoint )] = iPoint; @@ -1808,7 +1808,7 @@ stdVector< localIndex > getPyramidNodeOrderingFromPolyhedron( vtkCell * const ce stdVector< localIndex > nodeOrder( 5 ); // Generate global to local map - std::unordered_map< localIndex, localIndex > G2L; + stdUnorderedMap< localIndex, localIndex > G2L; for( iPoint = 0; iPoint < 5; ++iPoint ) { G2L[cell->GetPointId( iPoint )] = iPoint; @@ -1882,7 +1882,7 @@ stdVector< localIndex > getPrismNodeOrderingFromPolyhedron( vtkCell * const cell stdVector< localIndex > nodeOrder( 2*NUM_SIDES ); // Generate global to local map - std::unordered_map< localIndex, localIndex > G2L; + stdUnorderedMap< localIndex, localIndex > G2L; for( localIndex iPoint = 0; iPoint < cell->GetNumberOfPoints(); ++iPoint ) { G2L[cell->GetPointId( iPoint )] = iPoint; @@ -2436,7 +2436,7 @@ void writeCells( integer const logLevel, { continue; } - std::unordered_map< int, stdVector< vtkIdType > > const & regionIdToCellIds = typeRegions.second; + stdUnorderedMap< int, stdVector< vtkIdType > > const & regionIdToCellIds = typeRegions.second; for( auto const & regionCells : regionIdToCellIds ) { int const regionId = regionCells.first; 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..3c112afacac 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< std::array< 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< std::array< 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< std::array< 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..6051ab888e7 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 ) { @@ -120,12 +120,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..3986395d6f6 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..d763ceae5b8 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/CommunicationTools.cpp b/src/coreComponents/mesh/mpiCommunications/CommunicationTools.cpp index 5b674816102..4ba010377fe 100644 --- a/src/coreComponents/mesh/mpiCommunications/CommunicationTools.cpp +++ b/src/coreComponents/mesh/mpiCommunications/CommunicationTools.cpp @@ -701,7 +701,7 @@ void fixReceiveLists( ObjectManagerBase & objectManager, stdVector< localIndex > ghostsToFix; /// Map from owning MPI rank to an array of local objects we need to fix. - std::unordered_map< int, stdVector< localIndex > > ghostsBySecondNeighbor; + stdUnorderedMap< int, stdVector< localIndex > > ghostsBySecondNeighbor; arrayView1d< integer > const & ghostRank = objectManager.ghostRank(); diff --git a/src/coreComponents/mesh/mpiCommunications/SpatialPartition.cpp b/src/coreComponents/mesh/mpiCommunications/SpatialPartition.cpp index 5beecb1842c..86734c67f57 100644 --- a/src/coreComponents/mesh/mpiCommunications/SpatialPartition.cpp +++ b/src/coreComponents/mesh/mpiCommunications/SpatialPartition.cpp @@ -118,7 +118,7 @@ int SpatialPartition::getColor() else { // External partitioner such as ParMetis or PTScotch (for VTK external mesh) - std::vector< camp::idx_t > adjncy; + stdVector< camp::idx_t > adjncy; adjncy.reserve( m_metisNeighborList.size()); std::copy( m_metisNeighborList.begin(), m_metisNeighborList.end(), std::back_inserter( adjncy )); #ifdef GEOS_USE_TRILINOS diff --git a/src/coreComponents/mesh/unitTests/testGraphColoring.cpp b/src/coreComponents/mesh/unitTests/testGraphColoring.cpp index db16eb574b0..6f0e60787e6 100644 --- a/src/coreComponents/mesh/unitTests/testGraphColoring.cpp +++ b/src/coreComponents/mesh/unitTests/testGraphColoring.cpp @@ -27,7 +27,7 @@ using namespace geos; using namespace graph; 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,7 +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 +49,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 +64,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 +73,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/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp index e4fdff69db4..70ee8742f28 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp @@ -2009,7 +2009,7 @@ real64 SolidMechanicsMPM::computeNeighborList( ParticleManager & particleManager // Declare bin key and bins data structure BinKey binKey; - std::unordered_map< BinKey, stdVector< localIndex >, BinKeyHash > bins; + stdUnorderedMap< BinKey, stdVector< localIndex >, BinKeyHash > bins; // Reverse entries in bins based on even distribution of particles in partition - OPTIONAL particleManager.forParticleRegions< ParticleRegion >( [&]( ParticleRegion & region ) // idk why this requires a template argument and the