make_trilinos_map(const MPI_Comm &communicator = MPI_COMM_WORLD,
const bool overlapping = false) const;
- Tpetra::Map<>
+ Tpetra::Map<int, types::global_dof_index>
make_tpetra_map(const MPI_Comm &communicator = MPI_COMM_WORLD,
const bool overlapping = false) const;
#endif
* used directly.
*/
void
- import(const Tpetra::Vector<Number> &tpetra_vector,
- const IndexSet & locally_owned_elements,
- VectorOperation::values operation,
- const MPI_Comm & mpi_comm,
- const std::shared_ptr<const CommunicationPatternBase>
- &communication_pattern);
+ import(
+ const Tpetra::Vector<Number, int, types::global_dof_index> &tpetra_vector,
+ const IndexSet & locally_owned_elements,
+ VectorOperation::values operation,
+ const MPI_Comm & mpi_comm,
+ const std::shared_ptr<const CommunicationPatternBase>
+ &communication_pattern);
/**
* Import all the elements present in the vector's IndexSet from the input
template <typename Number>
void
ReadWriteVector<Number>::import(
- const Tpetra::Vector<Number> &vector,
- const IndexSet & source_elements,
- VectorOperation::values operation,
- const MPI_Comm & mpi_comm,
+ const Tpetra::Vector<Number, int, types::global_dof_index> &vector,
+ const IndexSet & source_elements,
+ VectorOperation::values operation,
+ const MPI_Comm & mpi_comm,
const std::shared_ptr<const CommunicationPatternBase>
&communication_pattern)
{
"LinearAlgebra::TpetraWrappers::CommunicationPattern."));
}
- Tpetra::Export<> tpetra_export(tpetra_comm_pattern->get_tpetra_export());
+ Tpetra::Export<int, types::global_dof_index> tpetra_export(
+ tpetra_comm_pattern->get_tpetra_export());
- Tpetra::Vector<Number> target_vector(tpetra_export.getSourceMap());
+ Tpetra::Vector<Number, int, types::global_dof_index> target_vector(
+ tpetra_export.getSourceMap());
target_vector.doImport(vector, tpetra_export, Tpetra::REPLACE);
const auto *new_values = target_vector.getData().get();
/**
* Return the underlying Tpetra::Import object.
*/
- const Tpetra::Import<> &
+ const Tpetra::Import<int, types::global_dof_index> &
get_tpetra_import() const;
/**
* Return the underlying Tpetra::Export object.
*/
- const Tpetra::Export<> &
+ const Tpetra::Export<int, types::global_dof_index> &
get_tpetra_export() const;
private:
/**
* Shared pointer to the Tpetra::Import object used.
*/
- std::unique_ptr<Tpetra::Import<>> tpetra_import;
+ std::unique_ptr<Tpetra::Import<int, types::global_dof_index>>
+ tpetra_import;
/**
* Shared pointer to the Tpetra::Export object used.
*/
- std::unique_ptr<Tpetra::Export<>> tpetra_export;
+ std::unique_ptr<Tpetra::Export<int, types::global_dof_index>>
+ tpetra_export;
};
} // end of namespace TpetraWrappers
} // end of namespace LinearAlgebra
* Return a const reference to the underlying Trilinos
* Tpetra::Vector class.
*/
- const Tpetra::Vector<Number> &
+ const Tpetra::Vector<Number, int, types::global_dof_index> &
trilinos_vector() const;
/**
* Return a (modifyable) reference to the underlying Trilinos
* Tpetra::Vector class.
*/
- Tpetra::Vector<Number> &
+ Tpetra::Vector<Number, int, types::global_dof_index> &
trilinos_vector();
/**
/**
* Pointer to the actual Tpetra vector object.
*/
- std::unique_ptr<Tpetra::Vector<Number>> vector;
+ std::unique_ptr<Tpetra::Vector<Number, int, types::global_dof_index>>
+ vector;
/**
* IndexSet of the elements of the last imported vector.
LinearAlgebra::TpetraWrappers::Vector<double> &V)
{
// Extract local indices in the vector.
- Tpetra::Vector<double> vector = V.trilinos_vector();
+ Tpetra::Vector<double, int, types::global_dof_index> vector =
+ V.trilinos_vector();
TrilinosWrappers::types::int_type trilinos_i =
vector.getMap()->getLocalElement(
static_cast<TrilinosWrappers::types::int_type>(i));
// We're going to modify the data on host.
vector.modify<Kokkos::HostSpace>();
vector_1d(trilinos_i) += value;
- vector.sync<Tpetra::Vector<double>::device_type::memory_space>();
+ vector.sync<Tpetra::Vector<double, int, types::global_dof_index>::
+ device_type::memory_space>();
}
LinearAlgebra::TpetraWrappers::Vector<float> &V)
{
// Extract local indices in the vector.
- Tpetra::Vector<float> vector = V.trilinos_vector();
+ Tpetra::Vector<float, int, types::global_dof_index> vector =
+ V.trilinos_vector();
TrilinosWrappers::types::int_type trilinos_i =
vector.getMap()->getLocalElement(
static_cast<TrilinosWrappers::types::int_type>(i));
// We're going to modify the data on host.
vector.modify<Kokkos::HostSpace>();
vector_1d(trilinos_i) += value;
- vector.sync<Tpetra::Vector<float>::device_type::memory_space>();
+ vector.sync<Tpetra::Vector<float, int, types::global_dof_index>::
+ device_type::memory_space>();
}
LinearAlgebra::TpetraWrappers::Vector<double> &V)
{
// Extract local indices in the vector.
- Tpetra::Vector<double> vector = V.trilinos_vector();
+ Tpetra::Vector<double, int, types::global_dof_index> vector =
+ V.trilinos_vector();
TrilinosWrappers::types::int_type trilinos_i =
vector.getMap()->getLocalElement(
static_cast<TrilinosWrappers::types::int_type>(i));
// We're going to modify the data on host.
vector.modify<Kokkos::HostSpace>();
vector_1d(trilinos_i) = value;
- vector.sync<Tpetra::Vector<double>::device_type::memory_space>();
+ vector.sync<Tpetra::Vector<double, int, types::global_dof_index>::
+ device_type::memory_space>();
}
LinearAlgebra::TpetraWrappers::Vector<float> &V)
{
// Extract local indices in the vector.
- Tpetra::Vector<float> vector = V.trilinos_vector();
+ Tpetra::Vector<float, int, types::global_dof_index> vector =
+ V.trilinos_vector();
TrilinosWrappers::types::int_type trilinos_i =
vector.getMap()->getLocalElement(
static_cast<TrilinosWrappers::types::int_type>(i));
// We're going to modify the data on host.
vector.modify<Kokkos::HostSpace>();
vector_1d(trilinos_i) = value;
- vector.sync<Tpetra::Vector<float>::device_type::memory_space>();
+ vector.sync<Tpetra::Vector<float, int, types::global_dof_index>::
+ device_type::memory_space>();
}
const types::global_dof_index i)
{
// Extract local indices in the vector.
- Tpetra::Vector<double> vector = V.trilinos_vector();
+ Tpetra::Vector<double, int, types::global_dof_index> vector =
+ V.trilinos_vector();
TrilinosWrappers::types::int_type trilinos_i =
vector.getMap()->getLocalElement(
static_cast<TrilinosWrappers::types::int_type>(i));
const types::global_dof_index i)
{
// Extract local indices in the vector.
- Tpetra::Vector<float> vector = V.trilinos_vector();
+ Tpetra::Vector<float, int, types::global_dof_index> vector =
+ V.trilinos_vector();
TrilinosWrappers::types::int_type trilinos_i =
vector.getMap()->getLocalElement(
static_cast<TrilinosWrappers::types::int_type>(i));
#ifdef DEAL_II_WITH_TRILINOS
-Tpetra::Map<>
+Tpetra::Map<int, types::global_dof_index>
IndexSet::make_tpetra_map(const MPI_Comm &communicator,
const bool overlapping) const
{
const bool linear =
overlapping ? false : is_ascending_and_one_to_one(communicator);
if (linear)
- return Tpetra::Map<>(size(),
- n_elements(),
- 0,
+ return Tpetra::Map<int, types::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
{
std::vector<size_type> indices;
fill_index_vector(indices);
- std::vector<int> int_indices(indices.size());
+ std::vector<types::global_dof_index> int_indices(indices.size());
std::copy(indices.begin(), indices.end(), int_indices.begin());
- const Teuchos::ArrayView<int> arr_view(int_indices);
- return Tpetra::Map<>(size(),
- arr_view,
- 0,
+ const Teuchos::ArrayView<types::global_dof_index> arr_view(int_indices);
+ return Tpetra::Map<int, types::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
);
}
{
comm = std::make_shared<const MPI_Comm>(communicator);
- auto vector_space_vector_map = Teuchos::rcp(new Tpetra::Map<>(
- vector_space_vector_index_set.make_tpetra_map(*comm, false)));
- auto read_write_vector_map = Teuchos::rcp(new Tpetra::Map<>(
- read_write_vector_index_set.make_tpetra_map(*comm, true)));
+ auto vector_space_vector_map =
+ Teuchos::rcp(new Tpetra::Map<int, types::global_dof_index>(
+ vector_space_vector_index_set.make_tpetra_map(*comm, false)));
+ auto read_write_vector_map =
+ Teuchos::rcp(new Tpetra::Map<int, types::global_dof_index>(
+ read_write_vector_index_set.make_tpetra_map(*comm, true)));
// Target map is read_write_vector_map
// Source map is vector_space_vector_map. This map must have uniquely
// owned GID.
tpetra_import =
- std_cxx14::make_unique<Tpetra::Import<>>(read_write_vector_map,
- vector_space_vector_map);
+ std_cxx14::make_unique<Tpetra::Import<int, types::global_dof_index>>(
+ read_write_vector_map, vector_space_vector_map);
tpetra_export =
- std_cxx14::make_unique<Tpetra::Export<>>(read_write_vector_map,
- vector_space_vector_map);
+ std_cxx14::make_unique<Tpetra::Export<int, types::global_dof_index>>(
+ read_write_vector_map, vector_space_vector_map);
}
- const Tpetra::Import<> &
+ const Tpetra::Import<int, types::global_dof_index> &
CommunicationPattern::get_tpetra_import() const
{
return *tpetra_import;
- const Tpetra::Export<> &
+ const Tpetra::Export<int, types::global_dof_index> &
CommunicationPattern::get_tpetra_export() const
{
return *tpetra_export;
{
template <typename Number>
Vector<Number>::Vector()
- : vector(new Tpetra::Vector<Number>(Teuchos::RCP<Tpetra::Map<>>(
- new Tpetra::Map<>(0, 0, Utilities::Trilinos::tpetra_comm_self()))))
+ : vector(new Tpetra::Vector<Number, int, types::global_dof_index>(
+ Teuchos::RCP<Tpetra::Map<int, types::global_dof_index>>(
+ new Tpetra::Map<int, types::global_dof_index>(
+ 0,
+ 0,
+ Utilities::Trilinos::tpetra_comm_self()))))
{}
template <typename Number>
Vector<Number>::Vector(const Vector<Number> &V)
: Subscriptor()
- , vector(new Tpetra::Vector<Number>(V.trilinos_vector(), Teuchos::Copy))
+ , vector(new Tpetra::Vector<Number, int, types::global_dof_index>(
+ V.trilinos_vector(),
+ Teuchos::Copy))
{}
template <typename Number>
Vector<Number>::Vector(const IndexSet ¶llel_partitioner,
const MPI_Comm &communicator)
- : vector(new Tpetra::Vector<Number>(Teuchos::rcp(new Tpetra::Map<>(
- parallel_partitioner.make_tpetra_map(communicator, false)))))
+ : vector(new Tpetra::Vector<Number, int, types::global_dof_index>(
+ Teuchos::rcp(new Tpetra::Map<int, types::global_dof_index>(
+ parallel_partitioner.make_tpetra_map(communicator, false)))))
{}
const MPI_Comm &communicator,
const bool omit_zeroing_entries)
{
- Tpetra::Map<> input_map =
+ Tpetra::Map<int, types::global_dof_index> input_map =
parallel_partitioner.make_tpetra_map(communicator, false);
if (vector->getMap()->isSameAs(input_map) == false)
- vector = std_cxx14::make_unique<Tpetra::Vector<Number>>(
- Teuchos::rcp(new Tpetra::Map<>(input_map)));
+ vector = std_cxx14::make_unique<
+ Tpetra::Vector<Number, int, types::global_dof_index>>(Teuchos::rcp(
+ new Tpetra::Map<int, types::global_dof_index>(input_map)));
else if (omit_zeroing_entries == false)
{
vector->putScalar(0.);
{
if (size() == V.size())
{
- Tpetra::Import<> data_exchange(vector->getMap(),
- V.trilinos_vector().getMap());
+ Tpetra::Import<int, types::global_dof_index> data_exchange(
+ vector->getMap(), V.trilinos_vector().getMap());
vector->doImport(V.trilinos_vector(),
data_exchange,
Tpetra::REPLACE);
}
else
- vector = std_cxx14::make_unique<Tpetra::Vector<Number>>(
+ vector = std_cxx14::make_unique<
+ Tpetra::Vector<Number, int, types::global_dof_index>>(
V.trilinos_vector());
}
"LinearAlgebra::TpetraWrappers::CommunicationPattern."));
}
- Tpetra::Export<> tpetra_export(tpetra_comm_pattern->get_tpetra_export());
- Tpetra::Vector<Number> source_vector(tpetra_export.getSourceMap());
+ Tpetra::Export<int, types::global_dof_index> tpetra_export(
+ tpetra_comm_pattern->get_tpetra_export());
+ Tpetra::Vector<Number, int, types::global_dof_index> source_vector(
+ tpetra_export.getSourceMap());
source_vector.template sync<Kokkos::HostSpace>();
auto x_2d = source_vector.template getLocalView<Kokkos::HostSpace>();
for (size_t k = 0; k < localLength; ++k)
x_1d(k) = *values_it++;
source_vector.template sync<
- typename Tpetra::Vector<Number>::device_type::memory_space>();
+ typename Tpetra::Vector<Number, int, types::global_dof_index>::
+ device_type::memory_space>();
if (operation == VectorOperation::insert)
vector->doExport(source_vector, tpetra_export, Tpetra::REPLACE);
else if (operation == VectorOperation::add)
ExcDimensionMismatch(this->size(), down_V.size()));
// TODO: The code doesn't work as expected so we use a workaround.
- /*Tpetra::Export<> data_exchange(vector->getMap(),
- down_V.trilinos_vector().getMap());
+ /*Tpetra::Export<int, types::global_dof_index>
+ data_exchange(vector->getMap(), down_V.trilinos_vector().getMap());
vector->doExport(down_V.trilinos_vector(),
data_exchange,
Tpetra::ADD);*/
- Tpetra::Vector<Number> dummy(vector->getMap(), false);
- Tpetra::Import<> data_exchange(dummy.getMap(),
- down_V.trilinos_vector().getMap());
+ Tpetra::Vector<Number, int, types::global_dof_index> dummy(
+ vector->getMap(), false);
+ Tpetra::Import<int, types::global_dof_index> data_exchange(
+ dummy.getMap(), down_V.trilinos_vector().getMap());
dummy.doExport(down_V.trilinos_vector(),
data_exchange,
vector_1d(k) += a;
}
vector->template sync<
- typename Tpetra::Vector<Number>::device_type::memory_space>();
+ typename Tpetra::Vector<Number, int, types::global_dof_index>::
+ device_type::memory_space>();
}
template <typename Number>
- const Tpetra::Vector<Number> &
+ const Tpetra::Vector<Number, int, types::global_dof_index> &
Vector<Number>::trilinos_vector() const
{
return *vector;
template <typename Number>
- Tpetra::Vector<Number> &
+ Tpetra::Vector<Number, int, types::global_dof_index> &
Vector<Number>::trilinos_vector()
{
return *vector;