Skip to content
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

Don't use 'import' as a member function #11234

Closed
bangerth opened this issue Nov 23, 2020 · 2 comments
Closed

Don't use 'import' as a member function #11234

bangerth opened this issue Nov 23, 2020 · 2 comments
Milestone

Comments

@bangerth
Copy link
Member

import has become a keyword in C++20. Curiously, the authors of the standard have chosen it to be a "context-sensitive keyword" so that it only acts as something related to modules if at the global scope and in certain situations where it could not have been used as the name of a class or function. One may have philosophical qualms about this, but it is what it is.

We should nevertheless think about whether we want to continue using this name. I suspect that the use of the keyword would confuse IDEs and, possibly, readers. I found ~90 uses of the word in our code base (see below). Some should be relatively easy to address if they are just local variables, but some are also member functions -- specifically in the parallel vector interfaces. Maybe we could name these functions import_elements()?

(There is the related question of using module, which is also a context-sensitive keyword in C++20. But we don't seem to be using this name outside the documentation.)

List of places where we seem to be using import:

include/deal.II/lac/trilinos_epetra_communication_pattern.h:      std::unique_ptr<Epetra_Import> import;
include/deal.II/lac/la_parallel_block_vector.templates.h:          rw_vector.import(trilinos_vec.block(i), VectorOperation::insert);
include/deal.II/lac/la_parallel_block_vector.templates.h:          this->block(i).import(rw_vector, VectorOperation::insert);
include/deal.II/lac/la_parallel_block_vector.templates.h:    BlockVector<Number>::import(const LinearAlgebra::ReadWriteVector<Number> &,
include/deal.II/lac/trilinos_vector.h:      import(const LinearAlgebra::ReadWriteVector<double> &rwv,
include/deal.II/lac/cuda_vector.h:      import(
include/deal.II/lac/trilinos_tpetra_vector.templates.h:    Vector<Number>::import(
include/deal.II/lac/la_parallel_vector.h:      import(const Vector<Number, MemorySpace2> &src,
include/deal.II/lac/la_parallel_vector.h:      import(
include/deal.II/lac/vector_operations_internal.h:      import(
include/deal.II/lac/vector_operations_internal.h:      import(const std::shared_ptr<::dealii::parallel::internal::TBBPartitioner>
include/deal.II/lac/vector_operations_internal.h:      import(const std::shared_ptr<::dealii::parallel::internal::TBBPartitioner>
include/deal.II/lac/vector_operations_internal.h:      import(const std::shared_ptr<::dealii::parallel::internal::TBBPartitioner>
include/deal.II/lac/vector_operations_internal.h:      import(const std::shared_ptr<::dealii::parallel::internal::TBBPartitioner>
include/deal.II/lac/trilinos_tpetra_vector.h:      import(
include/deal.II/lac/la_parallel_vector.templates.h:        import(
include/deal.II/lac/la_parallel_vector.templates.h:        import(
include/deal.II/lac/la_parallel_vector.templates.h:        import(const ReadWriteVector<Number> &V,
include/deal.II/lac/la_parallel_vector.templates.h:    Vector<Number, MemorySpaceType>::import(
include/deal.II/lac/la_parallel_vector.templates.h:        functions<Number, Number, MemorySpaceType>::import(
include/deal.II/lac/la_parallel_vector.templates.h:    Vector<Number, MemorySpaceType>::import(
include/deal.II/lac/la_parallel_block_vector.h:      import(
include/deal.II/lac/la_vector.h:    import(
include/deal.II/lac/read_write_vector.templates.h:      import(const std::shared_ptr<const ::dealii::Utilities::MPI::Partitioner>
include/deal.II/lac/read_write_vector.templates.h:      import(const std::shared_ptr<const ::dealii::Utilities::MPI::Partitioner>
include/deal.II/lac/read_write_vector.templates.h:      import(const std::shared_ptr<const ::dealii::Utilities::MPI::Partitioner>
include/deal.II/lac/read_write_vector.templates.h:  ReadWriteVector<Number>::import(
include/deal.II/lac/read_write_vector.templates.h:    internal::read_write_vector_functions<Number, MemorySpace>::import(
include/deal.II/lac/read_write_vector.templates.h:  ReadWriteVector<Number>::import(
include/deal.II/lac/read_write_vector.templates.h:  ReadWriteVector<Number>::import(
include/deal.II/lac/read_write_vector.templates.h:  ReadWriteVector<Number>::import(
include/deal.II/lac/read_write_vector.templates.h:    Epetra_FEVector target_vector(import.TargetMap());
include/deal.II/lac/read_write_vector.templates.h:        const int err = target_vector.Import(multivector, import, Insert);
include/deal.II/lac/read_write_vector.templates.h:        const int err = target_vector.Import(multivector, import, Add);
include/deal.II/lac/read_write_vector.templates.h:        const int err = target_vector.Import(multivector, import, Add);
include/deal.II/lac/read_write_vector.templates.h:        const int err = target_vector.Import(multivector, import, Add);
include/deal.II/lac/read_write_vector.templates.h:  ReadWriteVector<Number>::import(
include/deal.II/lac/read_write_vector.templates.h:    import(trilinos_vec.trilinos_vector(),
include/deal.II/lac/read_write_vector.templates.h:  ReadWriteVector<Number>::import(
include/deal.II/lac/read_write_vector.templates.h:    import(trilinos_vec.trilinos_vector(),
include/deal.II/lac/read_write_vector.templates.h:  ReadWriteVector<Number>::import(
include/deal.II/lac/read_write_vector.templates.h:    import(trilinos_vec.trilinos_vector(),
include/deal.II/lac/read_write_vector.templates.h:  ReadWriteVector<Number>::import(
include/deal.II/lac/vector_space_vector.h:    import(
include/deal.II/lac/la_vector.templates.h:  Vector<Number>::import(const ReadWriteVector<Number> &,
include/deal.II/lac/read_write_vector.h:    import(const distributed::Vector<Number, MemorySpace> &vec,
include/deal.II/lac/read_write_vector.h:    import(const PETScWrappers::MPI::Vector &petsc_vec,
include/deal.II/lac/read_write_vector.h:    import(const TrilinosWrappers::MPI::Vector &trilinos_vec,
include/deal.II/lac/read_write_vector.h:    import(const TpetraWrappers::Vector<Number> &tpetra_vec,
include/deal.II/lac/read_write_vector.h:    import(const EpetraWrappers::Vector &epetra_vec,
include/deal.II/lac/read_write_vector.h:    import(const CUDAWrappers::Vector<Number> &cuda_vec,
include/deal.II/lac/read_write_vector.h:    import(
include/deal.II/lac/read_write_vector.h:    import(const Epetra_MultiVector &multivector,
include/deal.II/lac/trilinos_epetra_vector.h:      import(
include/deal.II/dofs/dof_accessor.templates.h:        read_write_vector.import(values, VectorOperation::insert);
include/deal.II/dofs/dof_accessor.templates.h:        read_write_vector.import(values, VectorOperation::insert);
source/lac/trilinos_epetra_vector.cc:    Vector::import(
source/lac/trilinos_epetra_vector.cc:      Epetra_FEVector source_vector(import.TargetMap());
source/lac/trilinos_epetra_vector.cc:        vector->Export(source_vector, import, Insert);
source/lac/trilinos_epetra_vector.cc:        vector->Export(source_vector, import, Add);
source/lac/trilinos_epetra_vector.cc:        vector->Export(source_vector, import, Epetra_Max);
source/lac/trilinos_epetra_vector.cc:        vector->Export(source_vector, import, Epetra_Min);
source/lac/cuda_vector.cu:    Vector<Number>::import(const ReadWriteVector<Number> &V,
source/lac/read_write_vector.cu:  ReadWriteVector<float>::import(
source/lac/read_write_vector.cu:  ReadWriteVector<float>::import(
source/lac/read_write_vector.cu:  ReadWriteVector<double>::import(
source/lac/read_write_vector.cu:  ReadWriteVector<double>::import(
source/lac/trilinos_epetra_communication_pattern.cc:      import = std::make_unique<Epetra_Import>(read_write_vector_map,
source/lac/la_parallel_vector.cu:    Vector<float, ::dealii::MemorySpace::Host>::import<
source/lac/la_parallel_vector.cu:    Vector<double, ::dealii::MemorySpace::Host>::import<
source/lac/la_parallel_vector.cu:    Vector<float, ::dealii::MemorySpace::CUDA>::import<
source/lac/la_parallel_vector.cu:    Vector<double, ::dealii::MemorySpace::CUDA>::import<
source/lac/la_parallel_vector.cu:    Vector<float, ::dealii::MemorySpace::CUDA>::import<
source/lac/la_parallel_vector.cu:    Vector<double, ::dealii::MemorySpace::CUDA>::import<
source/lac/la_parallel_vector.inst.in:        Vector<SCALAR, ::dealii::MemorySpace::Host>::import<
source/lac/trilinos_vector.cc:    Vector::import(const LinearAlgebra::ReadWriteVector<double> &rwv,
source/lac/trilinos_vector.cc:          "Both vectors need to have the same size for import() to work!"));
source/lac/read_write_vector.cc:  ReadWriteVector<float>::import(
source/lac/read_write_vector.cc:  ReadWriteVector<double>::import(
source/lac/read_write_vector.cc:  ReadWriteVector<std::complex<float>>::import(
source/lac/read_write_vector.cc:  ReadWriteVector<std::complex<double>>::import(
source/grid/grid_in.cc:  Assimp::Importer importer;
source/grid/grid_in.cc:    importer.ReadFile(filename.c_str(),
source/grid/grid_in.cc:  AssertThrow(scene != nullptr, ExcMessage(importer.GetErrorString()));
examples/step-50/step-50.cc:    rwv.import(in, VectorOperation::insert);
examples/step-50/step-50.cc:    out.import(rwv, VectorOperation::insert);
examples/step-50/step-50.cc:    out.import(rwv, VectorOperation::insert);
@peterrum
Copy link
Member

peterrum commented May 1, 2021

Postponing.

@bangerth
Copy link
Member Author

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants