yade namespace
The conflict is between YADE Sphere
class, GenGeo::Sphere
class and SpherePadder::Sphere
class. Without proper namespaces, the GenGeo module tries to use YADE's Sphere
which of course leads to a crash.
We have this in https://gitlab.com/yade-dev/trunk/blob/master/pkg/common/Sphere.hpp :
namespace yade{
class Sphere: public Shape{
……
};
}
using namespace yade;
REGISTER_SERIALIZABLE(Sphere);
Which was introduced because GenGeo had a class Sphere without any namespace ( https://bugs.launchpad.net/yade/+bug/528509 ) and there was a crash.
I add this issue to discuss if we should put all our stuff inside yade namespace, and not put using namespace yade;
in .hpp, but rather in .cpp. If done right this would change nothing functionally in the code (only one or two more lines), and would help us avoid such strange crashes in the future.
In fact this is already inconsistently present in some of our files, since grep -E "\<namespace.*yade" . -rn --include='*pp' --color
shows:
./lib/serialization/Serializable.hpp:28:namespace yade{
./lib/serialization/Serializable.hpp:34:using namespace yade;
./lib/serialization/Serializable.hpp:58:namespace yade{
./lib/serialization/ObjectIO.hpp:18:namespace yade{
./pkg/common/Sphere.hpp:7:namespace yade{
./pkg/common/Sphere.hpp:22:using namespace yade;
./pkg/dem/PotentialBlock.hpp:11:namespace yade{
./pkg/dem/PotentialBlock.hpp:112:using namespace yade;
./pkg/dem/deformablecohesive/Lin4NodeTetra_Lin4NodeTetra_InteractionElement.hpp:43:using namespace yade;
./pkg/dem/deformablecohesive/Lin4NodeTetra.hpp:20:namespace yade{
./pkg/dem/deformablecohesive/Lin4NodeTetra.hpp:101:using namespace yade;
./pkg/dem/deformablecohesive/Node.hpp:14:namespace yade{
./pkg/dem/deformablecohesive/Node.hpp:30:using namespace yade;
./pkg/dem/deformablecohesive/DeformableCohesiveElement.hpp:83:using namespace yade;
./pkg/dem/deformablecohesive/DeformableElement.hpp:29:namespace yade{
./pkg/dem/deformablecohesive/DeformableElement.hpp:91:using namespace yade;
./pkg/dem/PotentialParticle.hpp:12:namespace yade {
./pkg/dem/PotentialParticle.hpp:57:using namespace yade;