Xuefeng Li
unread,Feb 15, 2025, 10:29:47 PM2/15/25Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to deal.II User Group
Hi, everyone!
I ran into a compiler error that feels strange to me. And I use C++ only occasionally.
/home/li/cbrc01.cc:1378:8: error: no match for ‘operator*=’ (operand types are ‘const dealii::TrilinosWrappers::MPI::Vector’ and ‘int’)
1378 | um *= -1;
| ~~~^~~~~
/home/li/share/dealii-9.6.0/include/deal.II/lac/trilinos_vector.h:1993:5: note: candidate: ‘dealii::TrilinosWrappers::MPI::Vector& dealii::TrilinosWrappers::MPI::Vector::operator*=(dealii::TrilinosScalar)’ (near match)
1993 | Vector::operator*=(const TrilinosScalar a)
| ^~~~~~
/home/li/share/dealii-9.6.0/include/deal.II/lac/trilinos_vector.h:1993:5: note: passing ‘const dealii::TrilinosWrappers::MPI::Vector*’ as ‘this’ argument discards qualifiers
make[2]: *** [CMakeFiles/cbrc01.dir/build.make:76: CMakeFiles/cbrc01.dir/cbrc01.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:90: CMakeFiles/cbrc01.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
According to the above error message, the compiler indeed recognized "um" to be a dealii::TrilinosWrappers::MPI::Vector object. It further suggested that it is a "near match" to the defined operator "Vector::operator*=(const TrilinosScalar a)".
Furthermore, Step-41 used exactly the same operation in method
void ObstacleProblem<dim>::update_solution_and_constraints()
in the line
contact_force *= -1;
I was able to compile and run Step-41 without error. That indicates that my installations of dealii and Trilinos work for the operator *=.
Your help is greatly appreciated. Thanks in advance.
Best,
X. Li