operator=(IndexSet &&is) noexcept;
#ifdef DEAL_II_WITH_TRILINOS
+
+# ifdef DEAL_II_TRILINOS_WITH_TPETRA
+ /**
+ * Constructor from a Trilinos Teuchos::RCP<Tpetra::Map>.
+ */
+ explicit IndexSet(
+ Teuchos::RCP<const Tpetra::Map<int, types::signed_global_dof_index>> map);
+# endif // DEAL_II_TRILINOS_WITH_TPETRA
+
/**
* Constructor from a Trilinos Epetra_BlockMap.
*/
explicit IndexSet(const Epetra_BlockMap &map);
-#endif
+#endif // DEAL_II_WITH_TRILINOS
/**
* Remove all indices from this index set. The index set retains its size,
Tpetra::Map<int, types::signed_global_dof_index>
make_tpetra_map(const MPI_Comm communicator = MPI_COMM_WORLD,
const bool overlapping = false) const;
+
+ Teuchos::RCP<Tpetra::Map<int, types::signed_global_dof_index>>
+ make_tpetra_map_rcp(const MPI_Comm communicator = MPI_COMM_WORLD,
+ const bool overlapping = false) const;
# endif
#endif
const MPI_Comm communicator)
: Subscriptor()
, vector(new Tpetra::Vector<Number, int, types::signed_global_dof_index>(
- Teuchos::rcp(new Tpetra::Map<int, types::signed_global_dof_index>(
- parallel_partitioner.make_tpetra_map(communicator, false)))))
+ parallel_partitioner.make_tpetra_map_rcp(communicator, false)))
{}
const MPI_Comm communicator,
const bool omit_zeroing_entries)
{
- Tpetra::Map<int, types::signed_global_dof_index> input_map =
- parallel_partitioner.make_tpetra_map(communicator, false);
- if (vector->getMap()->isSameAs(input_map) == false)
+ Teuchos::RCP<Tpetra::Map<int, types::signed_global_dof_index>> input_map =
+ parallel_partitioner.make_tpetra_map_rcp(communicator, false);
+ if (vector->getMap()->isSameAs(*input_map) == false)
vector = std::make_unique<
Tpetra::Vector<Number, int, types::signed_global_dof_index>>(
- Teuchos::rcp(
- new Tpetra::Map<int, types::signed_global_dof_index>(input_map)));
+ input_map);
else if (omit_zeroing_entries == false)
{
vector->putScalar(0.);
# endif
# include <Epetra_Map.h>
# include <Epetra_SerialComm.h>
+# ifdef DEAL_II_TRILINOS_WITH_TPETRA
+# include <Tpetra_Map.hpp>
+# endif
#endif
DEAL_II_NAMESPACE_OPEN
#ifdef DEAL_II_WITH_TRILINOS
+# ifdef DEAL_II_TRILINOS_WITH_TPETRA
+
+IndexSet::IndexSet(
+ Teuchos::RCP<const Tpetra::Map<int, types::signed_global_dof_index>> map)
+ : is_compressed(true)
+ , index_space_size(1 + map->getMaxAllGlobalIndex())
+ , largest_range(numbers::invalid_unsigned_int)
+{
+ Assert(map->getMinAllGlobalIndex() == 0,
+ ExcMessage(
+ "The Tpetra::Map does not contain the global index 0, "
+ "which means some entries are not present on any processor."));
+
+ // For a contiguous map, we do not need to go through the whole data...
+ if (map->isContiguous())
+ add_range(size_type(map->getMinGlobalIndex()),
+ size_type(map->getMaxGlobalIndex() + 1));
+ else
+ {
+ const size_type n_indices = map->getLocalNumElements();
+ const types::signed_global_dof_index *indices =
+ map->getMyGlobalIndices().data();
+ add_indices(indices, indices + n_indices);
+ }
+ compress();
+}
+
+# endif // DEAL_II_TRILINOS_WITH_TPETRA
+
+
// the 64-bit path uses a few different names, so put that into a separate
// implementation
Tpetra::Map<int, types::signed_global_dof_index>
IndexSet::make_tpetra_map(const MPI_Comm communicator,
const bool overlapping) const
+{
+ return *make_tpetra_map_rcp(communicator, overlapping);
+}
+
+
+
+Teuchos::RCP<Tpetra::Map<int, types::signed_global_dof_index>>
+IndexSet::make_tpetra_map_rcp(const MPI_Comm communicator,
+ const bool overlapping) const
{
compress();
(void)communicator;
const bool linear =
overlapping ? false : is_ascending_and_one_to_one(communicator);
if (linear)
- return Tpetra::Map<int, types::signed_global_dof_index>(
- size(),
- n_elements(),
- 0,
+ return Teuchos::RCP<Tpetra::Map<int, types::signed_global_dof_index>>(
+ new Tpetra::Map<int, types::signed_global_dof_index>(
+ size(),
+ n_elements(),
+ 0,
# ifdef DEAL_II_WITH_MPI
- Teuchos::rcp(new Teuchos::MpiComm<int>(communicator))
+ Teuchos::rcp(new Teuchos::MpiComm<int>(communicator))
# else
- Teuchos::rcp(new Teuchos::Comm<int>())
+ Teuchos::rcp(new Teuchos::Comm<int>())
# endif
- );
+ ));
else
{
const std::vector<size_type> indices = get_index_vector();
std::copy(indices.begin(), indices.end(), int_indices.begin());
const Teuchos::ArrayView<types::signed_global_dof_index> arr_view(
int_indices);
- return Tpetra::Map<int, types::signed_global_dof_index>(
- size(),
- arr_view,
- 0,
+ return Teuchos::RCP<Tpetra::Map<int, types::signed_global_dof_index>>(
+ new Tpetra::Map<int, types::signed_global_dof_index>(
+ size(),
+ arr_view,
+ 0,
# ifdef DEAL_II_WITH_MPI
- Teuchos::rcp(new Teuchos::MpiComm<int>(communicator))
+ Teuchos::rcp(new Teuchos::MpiComm<int>(communicator))
# else
- Teuchos::rcp(new Teuchos::Comm<int>())
+ Teuchos::rcp(new Teuchos::Comm<int>())
# endif
- );
+ ));
}
}
# endif
comm = std::make_shared<const MPI_Comm>(communicator);
auto vector_space_vector_map =
- Teuchos::rcp(new Tpetra::Map<int, types::signed_global_dof_index>(
- locally_owned_indices.make_tpetra_map(*comm, false)));
+ locally_owned_indices.make_tpetra_map_rcp(*comm, false);
auto read_write_vector_map =
- Teuchos::rcp(new Tpetra::Map<int, types::signed_global_dof_index>(
- ghost_indices.make_tpetra_map(*comm, true)));
+ ghost_indices.make_tpetra_map_rcp(*comm, true);
// Target map is read_write_vector_map
// Source map is vector_space_vector_map. This map must have uniquely