Skip to content

Applying stdMap to the code #3759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/coreComponents/codingUtilities/RTTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class rtTypes
/**
* @brief the regex map type to store and find the regexes by the associated rtTypeName.
*/
using RegexMapType = std::map< string, Regex >;
using RegexMapType = stdMap< string, Regex >;

/**
* @brief Custom types are useful to customize the regexes of an existing type. The type name
Expand Down
14 changes: 7 additions & 7 deletions src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ TEST( testGeosxTraits, HasMemberFunction_at )
static_assert( HasMemberFunction_at< string >, "Should be true." );
static_assert( HasMemberFunction_at< stdVector< int > >, "Should be true." );
static_assert( HasMemberFunction_at< stdVector< double > >, "Should be true." );
static_assert( HasMemberFunction_at< std::map< int, string > >, "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< int >, "Should be false." );
static_assert( !HasMemberFunction_at< std::map< string, string > >, "Should be false." );
static_assert( !HasMemberFunction_at< stdMap< string, string > >, "Should be false." );
static_assert( !HasMemberFunction_at< array1d< localIndex > >, "Should be false." );
}

Expand All @@ -66,7 +66,7 @@ HAS_MEMBER_FUNCTION_NO_RTYPE( insert,
TEST( testGeosxTraits, HasMemberFunction_insert )
{
static_assert( HasMemberFunction_insert< stdVector< int > >, "Should be true." );
static_assert( HasMemberFunction_insert< std::map< string, int > >, "Should be true." );
static_assert( HasMemberFunction_insert< stdMap< string, int > >, "Should be true." );
static_assert( HasMemberFunction_insert< std::list< stdVector< int > > >, "Should be true." );

static_assert( !HasMemberFunction_insert< int >, "Should be false." );
Expand All @@ -79,7 +79,7 @@ TEST( testGeosxTraits, HasAlias_value_type )
static_assert( HasAlias_value_type< array1d< double > >, "Should be true." );
static_assert( HasAlias_value_type< array5d< array1d< R1Tensor > > >, "Should be true." );
static_assert( HasAlias_value_type< stdVector< int > >, "Should be true." );
static_assert( HasAlias_value_type< std::map< string, string > >, "Should be true." );
static_assert( HasAlias_value_type< stdMap< string, string > >, "Should be true." );

static_assert( !HasAlias_value_type< int >, "Should be false." );
static_assert( !HasAlias_value_type< double >, "Should be false." );
Expand Down Expand Up @@ -108,7 +108,7 @@ TEST( testGeosxTraits, HasMemberFunction_data )
static_assert( HasMemberFunction_data< array5d< array1d< R1Tensor > > >, "Should be true." );
static_assert( HasMemberFunction_data< stdVector< int > >, "Should be true." );

static_assert( !HasMemberFunction_data< std::map< string, string > >, "Should be false." );
static_assert( !HasMemberFunction_data< stdMap< string, string > >, "Should be false." );
static_assert( !HasMemberFunction_data< int >, "Should be false." );
static_assert( !HasMemberFunction_data< double >, "Should be false." );
}
Expand All @@ -118,7 +118,7 @@ TEST( testGeosxTraits, HasMemberFunction_size )
static_assert( HasMemberFunction_size< array1d< double > >, "Should be true." );
static_assert( HasMemberFunction_size< array5d< array1d< R1Tensor > > >, "Should be true." );
static_assert( HasMemberFunction_size< stdVector< int > >, "Should be true." );
static_assert( HasMemberFunction_size< std::map< string, string > >, "Should be true." );
static_assert( HasMemberFunction_size< stdMap< string, string > >, "Should be true." );

static_assert( !HasMemberFunction_size< int >, "Should be false." );
static_assert( !HasMemberFunction_size< double >, "Should be false." );
Expand All @@ -132,7 +132,7 @@ TEST( testGeosxTraits, HasMemberFunction_resize )
static_assert( HasMemberFunction_resize< ArrayOfArrays< int > >, "Should be true." );
static_assert( HasMemberFunction_resize< ArrayOfSets< int > >, "Should be true." );

static_assert( !HasMemberFunction_resize< std::map< string, string > >, "Should be false." );
static_assert( !HasMemberFunction_resize< stdMap< string, string > >, "Should be false." );
static_assert( !HasMemberFunction_resize< int >, "Should be false." );
static_assert( !HasMemberFunction_resize< double >, "Should be false." );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ using namespace geos;

TEST( Utilities, MapExtraction )
{
std::map< string, int > const m{
stdMap< string, int > const m{
{ "k0", 0 },
{ "k1", 1 },
{ "k2", 2 }
Expand Down
12 changes: 6 additions & 6 deletions src/coreComponents/common/MpiWrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,9 @@ struct MpiWrapper
///@}

#if !defined(GEOS_USE_MPI)
static std::map< int, std::pair< int, void * > > & getTagToPointersMap()
static stdMap< int, std::pair< int, void * > > & getTagToPointersMap()
{
static std::map< int, std::pair< int, void * > > tagToPointers;
static stdMap< int, std::pair< int, void * > > tagToPointers;
return tagToPointers;
}
#endif
Expand Down Expand Up @@ -1169,8 +1169,8 @@ int MpiWrapper::iRecv( T * const buf,
"Attempting to use an MPI_Request that is still in use." );
return MPI_Irecv( buf, count, internal::getMpiType< T >(), source, tag, comm, request );
#else
std::map< int, std::pair< int, void * > > & pointerMap = getTagToPointersMap();
std::map< int, std::pair< int, void * > >::iterator iPointer = pointerMap.find( tag );
stdMap< int, std::pair< int, void * > > & pointerMap = getTagToPointersMap();
stdMap< int, std::pair< int, void * > >::iterator iPointer = pointerMap.find( tag );

if( iPointer==pointerMap.end() )
{
Expand Down Expand Up @@ -1252,8 +1252,8 @@ int MpiWrapper::iSend( T const * const buf,
"Attempting to use an MPI_Request that is still in use." );
return MPI_Isend( buf, count, internal::getMpiType< T >(), dest, tag, comm, request );
#else
std::map< int, std::pair< int, void * > > & pointerMap = getTagToPointersMap();
std::map< int, std::pair< int, void * > >::iterator iPointer = pointerMap.find( tag );
stdMap< int, std::pair< int, void * > > & pointerMap = getTagToPointersMap();
stdMap< int, std::pair< int, void * > >::iterator iPointer = pointerMap.find( tag );

if( iPointer==pointerMap.end() )
{
Expand Down
10 changes: 5 additions & 5 deletions src/coreComponents/common/StdContainerWrappers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ namespace internal
/**
* Wrapper for the underlying map that allows toggling between bounds-checked access
* (using at()) and unchecked access (using operator[]).
* @tparam MapType The type of the underlying map (e.g., std::map).
* @tparam MapType The type of the underlying map (e.g., stdMap).
* @tparam Allocator Allocator type for the vector.
* @tparam USE_STD_CONTAINER_BOUNDS_CHECKING A boolean flag to enable or disable bounds checking.
*/
Expand All @@ -154,7 +154,7 @@ template< typename MapType,
class StdMapWrapper : public MapType
{
public:
/// Type alias for the base class (i.e., std::map)
/// Type alias for the base class (i.e., stdMap)
using Base = MapType;
using KeyType = typename Base::key_type;
using MappedType = typename Base::mapped_type;
Expand Down Expand Up @@ -205,9 +205,9 @@ class StdMapWrapper : public MapType
} //namespace internal

/**
* type alias for std::map
* @tparam Key The unique std::map key.
* @tparam T Type of elements in the std::map.
* type alias for stdMap
* @tparam Key The unique stdMap key.
* @tparam T Type of elements in the stdMap.
* @tparam Compare The comparison function used to order the keys. Defaults to std::less<Key>.
* @tparam Allocator Allocator type for the map. Defaults to std::allocator<std::pair<const Key, T>>
*/
Expand Down
2 changes: 1 addition & 1 deletion src/coreComponents/common/format/table/TableData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class TableData2D

private:
/// @brief all cell values by their [ row ][ column ]
std::map< RowType, std::map< ColumnType, string > > m_data;
stdMap< RowType, stdMap< ColumnType, string > > m_data;

/// @brief Store all column values when adding cell
std::set< real64 > m_columnValues;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ void TableTextFormatter::populateHeaderCellsLayout( PreparedTableLayout const &
}

// number of times we will divide the each headers in the headerCellsLayout (key is the Column ptr)
std::map< std::ptrdiff_t, size_t > subdivsCount;
stdMap< std::ptrdiff_t, size_t > subdivsCount;

for( auto it = tableLayout.beginDeepFirst(); it != tableLayout.endDeepFirst(); ++it )
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreComponents/dataRepository/LogLevelsRegistry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class LogLevelsRegistry
* @brief Map for building the log level string for each wrapper.
* key : a logLevel condition, values : a set of description for a corresponding loglevel.
*/
std::map< integer, stdVector< std::string > > m_logLevelsDescriptions;
stdMap< integer, stdVector< std::string > > m_logLevelsDescriptions;

};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void FieldSpecificationManager::expandObjectCatalogs()
void FieldSpecificationManager::validateBoundaryConditions( MeshLevel & mesh ) const
{
string invalidRegion = "";
std::map< std::string, std::vector< string > > allPresentFieldsName;
stdMap< std::string, std::vector< string > > allPresentFieldsName;
std::set< string > allPresentSets;

mesh.getElemManager().forElementSubRegions< CellElementSubRegion >( [&]( CellElementSubRegion const & subRegion )
Expand Down
2 changes: 1 addition & 1 deletion src/coreComponents/fileIO/silo/SiloFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ void SiloFile::writeElementRegionSilo( ElementRegionBase const & elemRegion,
Group fakeGroup( elemRegion.getName(), conduitNode );

localIndex numElems = 0;
stdVector< std::map< string, WrapperBase const * > > viewPointers;
stdVector< stdMap< string, WrapperBase const * > > viewPointers;

viewPointers.resize( elemRegion.numSubRegions() );
elemRegion.forElementSubRegionsIndex< ElementSubRegionBase >(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ class VTKPolyDataWriterInterface
integer m_numberOfTargetProcesses;

/// Map a region name to the array of ranks outputed for it
std::map< string, stdVector< integer > > m_targetProcessesId;
stdMap< string, stdVector< integer > > m_targetProcessesId;
};

} // namespace vtk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ void TwoPointFluxApproximation::computeAquiferStencil( DomainPartition & domain,

// Step 1: count individual aquifers

std::map< string, localIndex > aquiferNameToAquiferId;
stdMap< string, localIndex > aquiferNameToAquiferId;
localIndex aquiferCounter = 0;

fsManager.forSubGroups< AquiferBoundaryCondition >( [&] ( AquiferBoundaryCondition const & bc )
Expand Down
4 changes: 2 additions & 2 deletions src/coreComponents/linearAlgebra/DofManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,7 @@ void DofManager::reorderByRank()
{
GEOS_LAI_ASSERT( !m_reordered );

std::map< string, array1d< localIndex > > permutations;
stdMap< string, array1d< localIndex > > permutations;

// First loop: compute the local permutation
for( FieldDescription & field : m_fields )
Expand Down Expand Up @@ -1599,7 +1599,7 @@ void DofManager::reorderByRank()
// ( MeshBody name, MeshLevel name), and a value that is another map with a
// key that indicates the name of the object that contains the field to be
// synced, and a value that contans the name of the field to be synced.
std::map< std::pair< string, string >, FieldIdentifiers > fieldsToBeSync;
stdMap< std::pair< string, string >, FieldIdentifiers > fieldsToBeSync;

// adjust index arrays for owned locations
for( FieldDescription const & field : m_fields )
Expand Down
2 changes: 1 addition & 1 deletion src/coreComponents/linearAlgebra/DofManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ class DofManager
stdVector< FieldDescription > m_fields;

/// Table of connector types within and between fields
std::map< std::pair< localIndex, localIndex >, CouplingDescription > m_coupling;
stdMap< std::pair< localIndex, localIndex >, CouplingDescription > m_coupling;

/// Flag indicating that DOFs have been reordered rank-wise.
bool m_reordered = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace
*/
colperm_t const & getColPermType( LinearSolverParameters::Direct::ColPerm const & value )
{
static std::map< LinearSolverParameters::Direct::ColPerm, colperm_t > const optionMap =
static stdMap< LinearSolverParameters::Direct::ColPerm, colperm_t > const optionMap =
{
{ LinearSolverParameters::Direct::ColPerm::none, NATURAL },
{ LinearSolverParameters::Direct::ColPerm::MMD_AtplusA, MMD_AT_PLUS_A },
Expand All @@ -77,7 +77,7 @@ colperm_t const & getColPermType( LinearSolverParameters::Direct::ColPerm const
*/
rowperm_t const & getRowPermType( LinearSolverParameters::Direct::RowPerm const & value )
{
static std::map< LinearSolverParameters::Direct::RowPerm, rowperm_t > const optionMap =
static stdMap< LinearSolverParameters::Direct::RowPerm, rowperm_t > const optionMap =
{
{ LinearSolverParameters::Direct::RowPerm::none, NOROWPERM },
{ LinearSolverParameters::Direct::RowPerm::mc64, LargeDiag_MC64 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void convertRigidBodyModes( LinearSolverParameters const & params,

PCType getPetscSmootherType( LinearSolverParameters::PreconditionerType const & type )
{
static std::map< LinearSolverParameters::PreconditionerType, PCType > const typeMap =
static stdMap< LinearSolverParameters::PreconditionerType, PCType > const typeMap =
{
{ LinearSolverParameters::PreconditionerType::iluk, PCILU },
{ LinearSolverParameters::PreconditionerType::ic, PCICC },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ namespace

string getMLCycleType( LinearSolverParameters::AMG::CycleType const & value )
{
static std::map< LinearSolverParameters::AMG::CycleType, string > const optionMap =
static stdMap< LinearSolverParameters::AMG::CycleType, string > const optionMap =
{
{ LinearSolverParameters::AMG::CycleType::V, "MGV" },
{ LinearSolverParameters::AMG::CycleType::W, "MGW" },
Expand All @@ -94,7 +94,7 @@ string getMLCycleType( LinearSolverParameters::AMG::CycleType const & value )

string getMLSmootherType( LinearSolverParameters::AMG::SmootherType const & value )
{
static std::map< LinearSolverParameters::AMG::SmootherType, string > const optionMap =
static stdMap< LinearSolverParameters::AMG::SmootherType, string > const optionMap =
{
{ LinearSolverParameters::AMG::SmootherType::default_, "Chebyshev" },
{ LinearSolverParameters::AMG::SmootherType::jacobi, "Jacobi" },
Expand All @@ -115,7 +115,7 @@ string getMLSmootherType( LinearSolverParameters::AMG::SmootherType const & valu

string getMLCoarseType( LinearSolverParameters::AMG::CoarseType const & value )
{
static std::map< LinearSolverParameters::AMG::CoarseType, string > const optionMap =
static stdMap< LinearSolverParameters::AMG::CoarseType, string > const optionMap =
{
{ LinearSolverParameters::AMG::CoarseType::default_, "Amesos-KLU" },
{ LinearSolverParameters::AMG::CoarseType::jacobi, "Jacobi" },
Expand All @@ -134,7 +134,7 @@ string getMLCoarseType( LinearSolverParameters::AMG::CoarseType const & value )

string getMLPreOrPostSmoothingType( LinearSolverParameters::AMG::PreOrPost const & value )
{
static std::map< LinearSolverParameters::AMG::PreOrPost, string > const optionMap =
static stdMap< LinearSolverParameters::AMG::PreOrPost, string > const optionMap =
{
{ LinearSolverParameters::AMG::PreOrPost::pre, "pre" },
{ LinearSolverParameters::AMG::PreOrPost::post, "post" },
Expand Down Expand Up @@ -184,7 +184,7 @@ createMLOperator( LinearSolverParameters const & params,

Ifpack::EPrecType getIfpackPrecondType( LinearSolverParameters::PreconditionerType const & type )
{
static std::map< LinearSolverParameters::PreconditionerType, Ifpack::EPrecType > const typeMap =
static stdMap< LinearSolverParameters::PreconditionerType, Ifpack::EPrecType > const typeMap =
{
{ LinearSolverParameters::PreconditionerType::iluk, Ifpack::ILU },
{ LinearSolverParameters::PreconditionerType::ilut, Ifpack::ILUT },
Expand All @@ -203,7 +203,7 @@ Ifpack::EPrecType getIfpackPrecondType( LinearSolverParameters::PreconditionerTy
}
string getIfpackRelaxationType( LinearSolverParameters::PreconditionerType const & type )
{
static std::map< LinearSolverParameters::PreconditionerType, string > const typeMap =
static stdMap< LinearSolverParameters::PreconditionerType, string > const typeMap =
{
{ LinearSolverParameters::PreconditionerType::jacobi, "Jacobi" },
{ LinearSolverParameters::PreconditionerType::fgs, "Gauss-Seidel" },
Expand Down
2 changes: 1 addition & 1 deletion src/coreComponents/mesh/CellElementRegionSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ using ViewKeys = CellElementRegion::viewKeyStruct;

CellElementRegionSelector::CellElementRegionSelector(
Group const & cellBlocks,
std::map< integer, std::set< string > > const & regionsCellBlocks )
stdMap< integer, std::set< string > > const & regionsCellBlocks )
{
// The owners lists need to be initialized so we will be able to verify later that it is not empty.

Expand Down
8 changes: 4 additions & 4 deletions src/coreComponents/mesh/CellElementRegionSelector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CellElementRegionSelector
* @param cellBlocksRegion A map of the cellblocks name lists for each region attributes value.
*/
CellElementRegionSelector( dataRepository::Group const & cellBlocks,
std::map< integer, std::set< string > > const & cellBlocksRegion );
stdMap< integer, std::set< string > > const & cellBlocksRegion );

/**
* @brief Select the mesh cell-blocks for the specified region following the user inputs.
Expand All @@ -67,16 +67,16 @@ class CellElementRegionSelector
static constexpr string_view cellBlockTypeSeparator = "_";

/// @brief A map that link every cell-block name to the CellElementRegion(s) that references it.
std::map< string, stdVector< CellElementRegion const * > > m_cellBlocksOwners;
stdMap< string, stdVector< CellElementRegion const * > > m_cellBlocksOwners;

/// @brief A map that link every region attribute values to the CellElementRegion(s) that references it.
std::map< string, stdVector< CellElementRegion const * > > m_regionAttributesOwners;
stdMap< string, stdVector< CellElementRegion const * > > m_regionAttributesOwners;

/**
* @brief A map of the cellblocks name lists for each region attributes value. Internal attribute type
* is integer to facilitate comparison with cellBlock qualifiers.
*/
std::map< string, std::set< string > const & > m_regionAttributesCellBlocks;
stdMap< string, std::set< string > const & > m_regionAttributesCellBlocks;

/**
* @return A set of the FNMatch pattern from the provided lists.
Expand Down
Loading
Loading