error: wrong number of template arguments (1, should be 2) static MappingQ<dim> m(2);

1,904 views
Skip to first unread message

曾元圆

unread,
Sep 30, 2017, 10:46:13 AM9/30/17
to deal.II User Group
I‘m compiling a source code written by others. And this error occurred.  I know it's because of the version of dealii. And I just want to know what this error really mean and how can I solve such kind of error. Because now I just want to be confirmed that the code work well so I don't want to go deep into the code (It's too time consuming to learn in detail how everything is going inside the code for me now)


/home/dyfluid/DG/dflo/src/claw.cc: In member function ‘const dealii::Mapping<dim>& ConservationLaw<dim>::mapping() const’:
/home/dyfluid/DG/dflo/src/claw.cc:175:26: error: wrong number of template arguments (1, should be 2)
       static MappingQ<dim> m(2);
                          ^
In file included from /home/dyfluid/dealii_lib/deal.II-v8.5.1/include/deal.II/fe/mapping_q1.h:21:0,
                 from /home/dyfluid/DG/dflo/src/claw.cc:26:
/home/dyfluid/dealii_lib/deal.II-v8.5.1/include/deal.II/fe/mapping_q_generic.h:34:26: note: provided for ‘template<int <anonymous>, int <anonymous> > class dealii::MappingQ’
 template <int,int> class MappingQ;
                          ^
/home/dyfluid/DG/dflo/src/claw.cc: In instantiation of ‘ConservationLaw<dim>::ConservationLaw(const char*, unsigned int, const dealii::FE_DGQArbitraryNodes<dim>&) [with int dim = 2]’:
/home/dyfluid/DG/dflo/src/claw.cc:1132:16:   required from here
/home/dyfluid/DG/dflo/src/claw.cc:72:59: warning: unused parameter ‘degree’ [-Wunused-parameter]
                                        const unsigned int degree,
                                                           ^
/home/dyfluid/DG/dflo/src/claw.cc: In instantiation of ‘void ConservationLaw<dim>::run() [with int dim = 2]’:
/home/dyfluid/DG/dflo/src/claw.cc:1132:16:   required from here
/home/dyfluid/DG/dflo/src/claw.cc:1043:20: warning: unused variable ‘nonlin_iter’ [-Wunused-variable]
       unsigned int nonlin_iter = 0;
                    ^
/home/dyfluid/DG/dflo/src/claw.cc: In instantiation of ‘void ConservationLaw<dim>::read_parameters(const char*) [with int dim = 2]’:
/home/dyfluid/DG/dflo/src/claw.cc:1132:16:   required from here
/home/dyfluid/DG/dflo/src/claw.cc:132:19: warning: ‘virtual bool dealii::ParameterHandler::read_input(const string&, bool, bool, const string&)’ is deprecated [-Wdeprecated-declarations]
    prm.read_input (input_filename);
                   ^
In file included from /home/dyfluid/DG/dflo/src/claw.cc:3:0:
/home/dyfluid/dealii_lib/deal.II-v8.5.1/include/deal.II/base/parameter_handler.h:1685:16: note: declared here
   virtual bool read_input (const std::string &filename,
                ^
/home/dyfluid/DG/dflo/src/claw.cc: In instantiation of ‘const dealii::Mapping<dim>& ConservationLaw<dim>::mapping() const [with int dim = 2]’:
/home/dyfluid/DG/dflo/src/claw.cc:1132:16:   required from here
/home/dyfluid/DG/dflo/src/claw.cc:176:14: error: invalid initialization of reference of type ‘const dealii::Mapping<2, 2>&’ from expression of type ‘int’
       return m;
              ^
/home/dyfluid/DG/dflo/src/claw.cc: In instantiation of ‘void ConservationLaw<dim>::setup_system() [with int dim = 2]’:
/home/dyfluid/DG/dflo/src/claw.cc:1132:16:   required from here
/home/dyfluid/DG/dflo/src/claw.cc:344:17: warning: unused variable ‘EPS’ [-Wunused-variable]
    const double EPS = 1.0e-10;
                 ^
CMakeFiles/dflo.dir/build.make:206: recipe for target 'CMakeFiles/dflo.dir/claw.cc.o' failed
make[2]: *** [CMakeFiles/dflo.dir/claw.cc.o] Error 1
CMakeFiles/Makefile2:195: recipe for target 'CMakeFiles/dflo.dir/all' failed
make[1]: *** [CMakeFiles/dflo.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Wolfgang Bangerth

unread,
Oct 1, 2017, 6:27:15 PM10/1/17
to dea...@googlegroups.com
On 09/30/2017 08:46 AM, 曾元圆 wrote:
> I‘m compiling a source code written by others. And this error occurred. I
> know it's because of the version of dealii. And I just want to know what this
> error really mean and how can I solve such kind of error. Because now I just
> want to be confirmed that the code work well so I don't want to go deep into
> the code (It's too time consuming to learn in detail how everything is going
> inside the code for me now)
>
>
> /home/dyfluid/DG/dflo/src/claw.cc: In member function ‘const
> dealii::Mapping<dim>& ConservationLaw<dim>::mapping() const’:
> /home/dyfluid/DG/dflo/src/claw.cc:175:26: error: wrong number of template
> arguments (1, should be 2)
> static MappingQ<dim> m(2);

The problem will go away if you add
#include <deal.II/fe/mapping_q.h>
to the file.

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Reply all
Reply to author
Forward
0 new messages