diff --git a/multiphenicsx/cpp/multiphenicsx/fem/DofMapRestriction.cpp b/multiphenicsx/cpp/multiphenicsx/fem/DofMapRestriction.cpp index 6084817..f17218f 100644 --- a/multiphenicsx/cpp/multiphenicsx/fem/DofMapRestriction.cpp +++ b/multiphenicsx/cpp/multiphenicsx/fem/DofMapRestriction.cpp @@ -50,8 +50,8 @@ DofMapRestriction::DofMapRestriction( //----------------------------------------------------------------------------- void DofMapRestriction::_compute_cell_dofs(std::shared_ptr dofmap) { - // Fill in cell dofs first into a temporary std::map - std::map> restricted_cell_dofs; + // Fill in cell dofs first into a temporary std::unordered_map + std::unordered_map> restricted_cell_dofs; std::size_t restricted_cell_dofs_total_size = 0; auto unrestricted_cell_dofs = dofmap->map(); const int num_cells = unrestricted_cell_dofs.extent(0); @@ -82,7 +82,7 @@ void DofMapRestriction::_compute_cell_dofs(std::shared_ptr dofmap) } } - // Flatten std::map into the std::vector dof_array, and store start/end + // Flatten std::unordered_map into the std::vector dof_array, and store start/end // indices associated to each cell in cell_bounds _dof_array.reserve(restricted_cell_dofs_total_size); _cell_bounds.reserve(num_cells + 1); diff --git a/multiphenicsx/cpp/multiphenicsx/fem/DofMapRestriction.h b/multiphenicsx/cpp/multiphenicsx/fem/DofMapRestriction.h index 80be478..696f1ca 100644 --- a/multiphenicsx/cpp/multiphenicsx/fem/DofMapRestriction.h +++ b/multiphenicsx/cpp/multiphenicsx/fem/DofMapRestriction.h @@ -8,7 +8,7 @@ #include #include -#include +#include #include namespace multiphenicsx @@ -59,13 +59,13 @@ class DofMapRestriction std::shared_ptr dofmap() const { return _dofmap; } /// Return map from unrestricted dofs to restricted dofs - const std::map& unrestricted_to_restricted() const + const std::unordered_map& unrestricted_to_restricted() const { return _unrestricted_to_restricted; } /// Map from restricted dofs to unrestricted dofs - const std::map& restricted_to_unrestricted() const + const std::unordered_map& restricted_to_unrestricted() const { return _restricted_to_unrestricted; } @@ -94,10 +94,10 @@ class DofMapRestriction std::shared_ptr _dofmap; // Map from unrestricted dofs to restricted dofs - std::map _unrestricted_to_restricted; + std::unordered_map _unrestricted_to_restricted; // Map from restricted dofs to unrestricted dofs - std::map _restricted_to_unrestricted; + std::unordered_map _restricted_to_unrestricted; // Cell-local-to-dof map after restriction has been carried out std::vector _dof_array; diff --git a/multiphenicsx/cpp/multiphenicsx/la/petsc.cpp b/multiphenicsx/cpp/multiphenicsx/la/petsc.cpp index 55d16d5..0f5b6b1 100644 --- a/multiphenicsx/cpp/multiphenicsx/la/petsc.cpp +++ b/multiphenicsx/cpp/multiphenicsx/la/petsc.cpp @@ -138,7 +138,7 @@ MatSubMatrixWrapper::MatSubMatrixWrapper(Mat A, std::array index_sets) MatSubMatrixWrapper::MatSubMatrixWrapper( Mat A, std::array unrestricted_index_sets, std::array restricted_index_sets, - std::array, 2> + std::array, 2> unrestricted_to_restricted, std::array unrestricted_to_restricted_bs) : MatSubMatrixWrapper(A, restricted_index_sets) @@ -348,7 +348,7 @@ VecSubVectorReadWrapper::VecSubVectorReadWrapper(Vec x, IS index_set, //----------------------------------------------------------------------------- VecSubVectorReadWrapper::VecSubVectorReadWrapper( Vec x, IS unrestricted_index_set, IS restricted_index_set, - const std::map& unrestricted_to_restricted, + const std::unordered_map& unrestricted_to_restricted, int unrestricted_to_restricted_bs, bool ghosted) : _ghosted(ghosted) { @@ -446,7 +446,7 @@ VecSubVectorWrapper::VecSubVectorWrapper(Vec x, IS index_set, bool ghosted) //----------------------------------------------------------------------------- VecSubVectorWrapper::VecSubVectorWrapper( Vec x, IS unrestricted_index_set, IS restricted_index_set, - const std::map& unrestricted_to_restricted, + const std::unordered_map& unrestricted_to_restricted, int unrestricted_to_restricted_bs, bool ghosted) : VecSubVectorReadWrapper(x, unrestricted_index_set, restricted_index_set, unrestricted_to_restricted, diff --git a/multiphenicsx/cpp/multiphenicsx/la/petsc.h b/multiphenicsx/cpp/multiphenicsx/la/petsc.h index 37ab8bc..2131451 100644 --- a/multiphenicsx/cpp/multiphenicsx/la/petsc.h +++ b/multiphenicsx/cpp/multiphenicsx/la/petsc.h @@ -7,7 +7,7 @@ #pragma once #include -#include +#include #include #include #include @@ -65,7 +65,7 @@ class MatSubMatrixWrapper /// Constructor (for cases with restriction) MatSubMatrixWrapper(Mat A, std::array unrestricted_index_sets, std::array restricted_index_sets, - std::array, 2> + std::array, 2> unrestricted_to_restricted, std::array unrestricted_to_restricted_bs); @@ -107,7 +107,7 @@ class VecSubVectorReadWrapper /// Constructor (for cases with restriction) VecSubVectorReadWrapper(Vec x, IS unrestricted_index_set, IS restricted_index_set, - const std::map& + const std::unordered_map& unrestricted_to_restricted, int unrestricted_to_restricted_bs, bool ghosted = true); @@ -146,7 +146,7 @@ class VecSubVectorWrapper : public VecSubVectorReadWrapper /// Constructor (for cases with restriction) VecSubVectorWrapper(Vec x, IS unrestricted_index_set, IS restricted_index_set, - const std::map& + const std::unordered_map& unrestricted_to_restricted, int unrestricted_to_restricted_bs, bool ghosted = true); @@ -172,7 +172,7 @@ class VecSubVectorWrapper : public VecSubVectorReadWrapper private: Vec _global_vector; IS _is; - std::map _restricted_to_unrestricted; + std::unordered_map _restricted_to_unrestricted; }; } // namespace petsc diff --git a/multiphenicsx/cpp/multiphenicsx/wrappers/fem.cpp b/multiphenicsx/cpp/multiphenicsx/wrappers/fem.cpp index 08879a6..d52c5bf 100644 --- a/multiphenicsx/cpp/multiphenicsx/wrappers/fem.cpp +++ b/multiphenicsx/cpp/multiphenicsx/wrappers/fem.cpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/multiphenicsx/cpp/multiphenicsx/wrappers/la.cpp b/multiphenicsx/cpp/multiphenicsx/wrappers/la.cpp index 2af73ea..b0b6b0b 100644 --- a/multiphenicsx/cpp/multiphenicsx/wrappers/la.cpp +++ b/multiphenicsx/cpp/multiphenicsx/wrappers/la.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include @@ -38,7 +38,7 @@ void la_petsc_module(nb::module_& m) .def(nb::init>(), nb::arg("A"), nb::arg("index_sets")) .def(nb::init, std::array, - std::array, 2>, + std::array, 2>, std::array>(), nb::arg("A"), nb::arg("unrestricted_index_sets"), nb::arg("restricted_index_sets"), @@ -57,7 +57,7 @@ void la_petsc_module(nb::module_& m) m, "VecSubVectorReadWrapper") .def(nb::init(), nb::arg("x"), nb::arg("index_set"), nb::arg("ghosted") = true) - .def(nb::init&, + .def(nb::init&, int, bool>(), nb::arg("x"), nb::arg("unrestricted_index_set"), nb::arg("restricted_index_set"), @@ -78,7 +78,7 @@ void la_petsc_module(nb::module_& m) m, "VecSubVectorWrapper") .def(nb::init(), nb::arg("x"), nb::arg("index_set"), nb::arg("ghosted") = true) - .def(nb::init&, + .def(nb::init&, int, bool>(), nb::arg("x"), nb::arg("unrestricted_index_set"), nb::arg("restricted_index_set"),