glotzerlab / hoomd-blue

Molecular dynamics and Monte Carlo soft matter simulation on GPUs.
http://glotzerlab.engin.umich.edu/hoomd-blue
BSD 3-Clause "New" or "Revised" License
329 stars 127 forks source link

Warnings in MuelerPlatheFlow #193

Closed joaander closed 7 years ago

joaander commented 7 years ago

Original report by me.


A number of warnings are generated in the new flow code. @LudwigSchneider could you please review these and modify your code to compile warning free.

[1180/1359] Building CXX object hoomd/md/CMakeFiles/_md.dir/MuellerPlatheFlow.cc.o
In file included from /home/joaander/devel/hoomd/hoomd/md/MuellerPlatheFlow.cc:5:0:
/home/joaander/devel/hoomd/hoomd/md/MuellerPlatheFlow.h: In constructor ‘MuellerPlatheFlow::MuellerPlatheFlow(std::shared_ptr<SystemDefinition>, std::shared_ptr<ParticleGroup>, std::shared_ptr<Variant>, flow_enu
m::Direction, flow_enum::Direction, unsigned int, unsigned int, unsigned int)’:
/home/joaander/devel/hoomd/hoomd/md/MuellerPlatheFlow.h:138:16: warning: ‘MuellerPlatheFlow::m_flow_epsilon’ will be initialized after [-Wreorder]
         Scalar m_flow_epsilon;
                ^
/home/joaander/devel/hoomd/hoomd/md/MuellerPlatheFlow.h:137:34: warning:   ‘std::shared_ptr<Variant> MuellerPlatheFlow::m_flow_target’ [-Wreorder]
         std::shared_ptr<Variant> m_flow_target;
                                  ^
/home/joaander/devel/hoomd/hoomd/md/MuellerPlatheFlow.cc:17:1: warning:   when initialized here [-Wreorder]
 MuellerPlatheFlow::MuellerPlatheFlow(std::shared_ptr<SystemDefinition> sysdef,
 ^
In file included from /home/joaander/devel/hoomd/hoomd/Messenger.h:17:0,
                 from /home/joaander/devel/hoomd/hoomd/ExecutionConfiguration.h:22,
                 from /home/joaander/devel/hoomd/hoomd/GPUArray.h:26,
                 from /home/joaander/devel/hoomd/hoomd/ParticleData.h:19,
                 from /home/joaander/devel/hoomd/hoomd/SystemDefinition.h:15,
                 from /home/joaander/devel/hoomd/hoomd/ParticleGroup.h:15,
                 from /home/joaander/devel/hoomd/hoomd/md/MuellerPlatheFlow.h:35,
                 from /home/joaander/devel/hoomd/hoomd/md/MuellerPlatheFlow.cc:5:
/home/joaander/devel/hoomd/hoomd/HOOMDMPI.h: In instantiation of ‘void recv(T&, unsigned int, MPI_Comm) [with T = double3; MPI_Comm = ompi_communicator_t*]’:
/home/joaander/devel/hoomd/hoomd/md/MuellerPlatheFlow.cc:402:43:   required from here
/home/joaander/devel/hoomd/hoomd/HOOMDMPI.h:383:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if( rank == src ) //Quick exit if src is dest.
              ^
/home/joaander/devel/hoomd/hoomd/HOOMDMPI.h: In instantiation of ‘void send(const T&, unsigned int, MPI_Comm) [with T = double3; MPI_Comm = ompi_communicator_t*]’:
/home/joaander/devel/hoomd/hoomd/md/MuellerPlatheFlow.cc:406:42:   required from here
/home/joaander/devel/hoomd/hoomd/HOOMDMPI.h:350:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(rank == dest) //Quick exit, if dest is src
             ^
/home/joaander/devel/hoomd/hoomd/md/MuellerPlatheFlow.cc: In member function ‘virtual void MuellerPlatheFlow::search_min_max_velocity()’:
/home/joaander/devel/hoomd/hoomd/md/MuellerPlatheFlow.cc:270:28: warning: ‘vel’ may be used uninitialized in this function [-Wmaybe-uninitialized]
                 vel *= mass; //Use momentum instead of velocity
                            ^
/home/joaander/devel/hoomd/hoomd/md/MuellerPlatheFlow.cc:257:41: warning: ‘index’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             index %= this->get_N_slabs(); //border cases. wrap periodic box
                                         ^
/home/joaander/devel/hoomd/hoomd/md/MuellerPlatheFlow.cc: In member function ‘virtual void MuellerPlatheFlow::update(unsigned int)’:
/home/joaander/devel/hoomd/hoomd/md/MuellerPlatheFlow.cc:80:51: warning: ‘area’ may be used uninitialized in this function [-Wmaybe-uninitialized]
                  this->summed_exchanged_momentum()/area ) > this->get_flow_epsilon()
                                                   ^
joaander commented 7 years ago

Original comment by Ludwig Schneider (Bitbucket: InnocentBug, GitHub: InnocentBug).


I fixed the compiler warnings in PR 255.

joaander commented 7 years ago

Merged in LudwigSchneider/hoomd-blue/flow (pull request #255)

Fixing compiler warnings in MuellerPlatheFlow.

fixes #193