About the modifyication of the macro YADE_CLASS_BASE_DOC_ATTRS_CTOR in the class of NormPhys and NormshearPhys

Asked by xuanshenyu

Hi, everyone!

I am modifing the macro YADE_CLASS_BASE_DOC_ATTRS_CTOR in the class of NormPhys and NormshearPhys.

And, I add two lines code in NormshearPhys.hpp as below:

#pragma once
#include <core/IPhys.hpp>
namespace yade { // Cannot have #include directive inside.
class NormPhys : public IPhys {
public:
 virtual ~NormPhys() = default;
 // clang-format off
 YADE_CLASS_BASE_DOC_ATTRS_CTOR(NormPhys,IPhys,"Abstract class for interactions that have normal stiffness.",
  ((Real,kn,0,,"Normal stiffness"))
  ((Vector3r,normalForce,Vector3r::Zero(),,"Normal force after previous step (in global coordinates), as sustained by particle #2 (from particle #1)."))
  ((Vector3r,elemnormalForce[15],Vector3r::Zero(),,"normal force for element in notion surface,the 15 merely is a especialy instance with 16 elements on the notion surface")), //first line
  createIndex();
 );
 // clang-format on
 REGISTER_CLASS_INDEX(NormPhys, IPhys);
};
REGISTER_SERIALIZABLE(NormPhys);
class NormShearPhys : public NormPhys {
public:
 virtual ~NormShearPhys() = default;
 // clang-format off
 YADE_CLASS_BASE_DOC_ATTRS_CTOR(NormShearPhys,NormPhys,
  "Abstract class for interactions that have shear stiffnesses, in addition to normal stiffness. This class is used in the PFC3d-style :yref:`stiffness timestepper<GlobalStiffnessTimeStepper>`.",
  ((Real,ks,0,,"Shear stiffness"))
  ((Vector3r,shearForce,Vector3r::Zero(),,"Shear force after previous step (in global coordinates), as sustained by particle #2 (from particle #1)."))
  ((Vector3r,elemshearForce[15],Vector3r::Zero(),,"shear force for element in notion surface,the 15 merely is a especialy instance with 16 elements on the notion surface")),// second line
  createIndex();
 );
 // clang-format on
 REGISTER_CLASS_INDEX(NormShearPhys, NormPhys);
};
REGISTER_SERIALIZABLE(NormShearPhys);
} // namespace yade

However, when I call cmake to configure the compilation process, inside the build-directory of the above folder structure.
There are the errors as below:
[ 17%] Building CXX object CMakeFiles/pkg_common.dir/pkg/common/Cylinder.cpp.o
In file included from /home/xuan/Desktop/yade_1/trunk/pkg/dem/FrictPhys.hpp:13,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.hpp:9,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.cpp:4:
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp: In constructor ‘yade::NormPhys::NormPhys()’:
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp:13:139: error: expected ‘(’ before ‘[’ token
   13 | YADE_CLASS_BASE_DOC_ATTRS_CTOR(NormPhys,IPhys,"Abstract class for interactions that have normal stiffness.",
      | ^
      | (
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp:13:139: error: expected ‘{’ before ‘[’ token
In file included from /home/xuan/Desktop/yade_1/trunk/pkg/dem/FrictPhys.hpp:13,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.hpp:9,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.cpp:4:
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp: In member function ‘virtual void yade::NormPhys::pyRegisterClass(boost::python::api::object)’:
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp:13: error: use of ‘this’ in a constant expression
   13 | YADE_CLASS_BASE_DOC_ATTRS_CTOR(NormPhys,IPhys,"Abstract class for interactions that have normal stiffness.",
      |
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp:13: error: no matching function for call to ‘boost::python::class_<yade::NormPhys, boost::shared_ptr<yade::NormPhys>, boost::python::bases<yade::IPhys>, boost::noncopyable_::noncopyable>::add_property(const char [20], boost::python::api::object, <unresolved overloaded function type>, const char*)’
In file included from /usr/include/boost/python.hpp:18,
                 from /home/xuan/Desktop/yade_1/trunk/lib/high-precision/RealHPConfig.hpp:35,
                 from /home/xuan/Desktop/yade_1/trunk/lib/high-precision/Real.hpp:231,
                 from /home/xuan/Desktop/yade_1/trunk/lib/base/Math.hpp:12,
                 from /home/xuan/Desktop/yade_1/trunk/core/Bound.hpp:10,
                 from /home/xuan/Desktop/yade_1/trunk/core/Body.hpp:13,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.hpp:5,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.cpp:4:
/usr/include/boost/python/class.hpp:301:11: note: candidate: ‘template<class Get> boost::python::class_<T, X1, X2, X3>::self& boost::python::class_<T, X1, X2, X3>::add_property(const char*, Get, const char*) [with Get = Get; W = yade::NormPhys; X1 = boost::shared_ptr<yade::NormPhys>; X2 = boost::python::bases<yade::IPhys>; X3 = boost::noncopyable_::noncopyable]
  301 | self& add_property(char const* name, Get fget, char const* docstr = 0)
      | ^~~~~~~~~~~~
/usr/include/boost/python/class.hpp:301:11: note: template argument deduction/substitution failed:
In file included from /home/xuan/Desktop/yade_1/trunk/pkg/dem/FrictPhys.hpp:13,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.hpp:9,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.cpp:4:
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp:13: note: candidate expects 3 arguments, 4 provided
   13 | YADE_CLASS_BASE_DOC_ATTRS_CTOR(NormPhys,IPhys,"Abstract class for interactions that have normal stiffness.",
      |
In file included from /usr/include/boost/python.hpp:18,
                 from /home/xuan/Desktop/yade_1/trunk/lib/high-precision/RealHPConfig.hpp:35,
                 from /home/xuan/Desktop/yade_1/trunk/lib/high-precision/Real.hpp:231,
                 from /home/xuan/Desktop/yade_1/trunk/lib/base/Math.hpp:12,
                 from /home/xuan/Desktop/yade_1/trunk/core/Bound.hpp:10,
                 from /home/xuan/Desktop/yade_1/trunk/core/Body.hpp:13,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.hpp:5,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.cpp:4:
/usr/include/boost/python/class.hpp:308:11: note: candidate: ‘template<class Get, class Set> boost::python::class_<T, X1, X2, X3>::self& boost::python::class_<T, X1, X2, X3>::add_property(const char*, Get, Set, const char*) [with Get = Get; Set = Set; W = yade::NormPhys; X1 = boost::shared_ptr<yade::NormPhys>; X2 = boost::python::bases<yade::IPhys>; X3 = boost::noncopyable_::noncopyable]
  308 | self& add_property(char const* name, Get fget, Set fset, char const* docstr = 0)
      | ^~~~~~~~~~~~
/usr/include/boost/python/class.hpp:308:11: note: template argument deduction/substitution failed:
In file included from /home/xuan/Desktop/yade_1/trunk/pkg/dem/FrictPhys.hpp:13,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.hpp:9,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.cpp:4:
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp:13: note: couldn’t deduce template parameter ‘Set’
   13 | YADE_CLASS_BASE_DOC_ATTRS_CTOR(NormPhys,IPhys,"Abstract class for interactions that have normal stiffness.",
      |
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp:13: error: use of ‘this’ in a constant expression
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp:13: error: no matching function for call to ‘boost::python::class_<yade::NormPhys, boost::shared_ptr<yade::NormPhys>, boost::python::bases<yade::IPhys>, boost::noncopyable_::noncopyable>::add_property(const char [20], boost::python::api::object, <unresolved overloaded function type>, const char*)’
In file included from /usr/include/boost/python.hpp:18,
                 from /home/xuan/Desktop/yade_1/trunk/lib/high-precision/RealHPConfig.hpp:35,
                 from /home/xuan/Desktop/yade_1/trunk/lib/high-precision/Real.hpp:231,
                 from /home/xuan/Desktop/yade_1/trunk/lib/base/Math.hpp:12,
                 from /home/xuan/Desktop/yade_1/trunk/core/Bound.hpp:10,
                 from /home/xuan/Desktop/yade_1/trunk/core/Body.hpp:13,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.hpp:5,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.cpp:4:
/usr/include/boost/python/class.hpp:301:11: note: candidate: ‘template<class Get> boost::python::class_<T, X1, X2, X3>::self& boost::python::class_<T, X1, X2, X3>::add_property(const char*, Get, const char*) [with Get = Get; W = yade::NormPhys; X1 = boost::shared_ptr<yade::NormPhys>; X2 = boost::python::bases<yade::IPhys>; X3 = boost::noncopyable_::noncopyable]
  301 | self& add_property(char const* name, Get fget, char const* docstr = 0)
      | ^~~~~~~~~~~~
/usr/include/boost/python/class.hpp:301:11: note: template argument deduction/substitution failed:
In file included from /home/xuan/Desktop/yade_1/trunk/pkg/dem/FrictPhys.hpp:13,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.hpp:9,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.cpp:4:
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp:13: note: candidate expects 3 arguments, 4 provided
   13 | YADE_CLASS_BASE_DOC_ATTRS_CTOR(NormPhys,IPhys,"Abstract class for interactions that have normal stiffness.",
      |
In file included from /usr/include/boost/python.hpp:18,
                 from /home/xuan/Desktop/yade_1/trunk/lib/high-precision/RealHPConfig.hpp:35,
                 from /home/xuan/Desktop/yade_1/trunk/lib/high-precision/Real.hpp:231,
                 from /home/xuan/Desktop/yade_1/trunk/lib/base/Math.hpp:12,
                 from /home/xuan/Desktop/yade_1/trunk/core/Bound.hpp:10,
                 from /home/xuan/Desktop/yade_1/trunk/core/Body.hpp:13,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.hpp:5,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.cpp:4:
/usr/include/boost/python/class.hpp:308:11: note: candidate: ‘template<class Get, class Set> boost::python::class_<T, X1, X2, X3>::self& boost::python::class_<T, X1, X2, X3>::add_property(const char*, Get, Set, const char*) [with Get = Get; Set = Set; W = yade::NormPhys; X1 = boost::shared_ptr<yade::NormPhys>; X2 = boost::python::bases<yade::IPhys>; X3 = boost::noncopyable_::noncopyable]
  308 | self& add_property(char const* name, Get fget, Set fset, char const* docstr = 0)
      | ^~~~~~~~~~~~
/usr/include/boost/python/class.hpp:308:11: note: template argument deduction/substitution failed:
In file included from /home/xuan/Desktop/yade_1/trunk/pkg/dem/FrictPhys.hpp:13,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.hpp:9,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.cpp:4:
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp:13: note: couldn’t deduce template parameter ‘Set’
   13 | YADE_CLASS_BASE_DOC_ATTRS_CTOR(NormPhys,IPhys,"Abstract class for interactions that have normal stiffness.",
      |
In file included from /home/xuan/Desktop/yade_1/trunk/pkg/dem/FrictPhys.hpp:13,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.hpp:9,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.cpp:4:
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp: In constructor ‘yade::NormShearPhys::NormShearPhys()’:
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp:28:140: error: expected ‘(’ before ‘[’ token
   28 | YADE_CLASS_BASE_DOC_ATTRS_CTOR(NormShearPhys,NormPhys,
      | ^
      | (
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp:28:140: error: expected ‘{’ before ‘[’ token
In file included from /home/xuan/Desktop/yade_1/trunk/pkg/dem/FrictPhys.hpp:13,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.hpp:9,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.cpp:4:
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp: In member function ‘virtual void yade::NormShearPhys::pyRegisterClass(boost::python::api::object)’:
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp:28: error: use of ‘this’ in a constant expression
   28 | YADE_CLASS_BASE_DOC_ATTRS_CTOR(NormShearPhys,NormPhys,
      |
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp:28: error: no matching function for call to ‘boost::python::class_<yade::NormShearPhys, boost::shared_ptr<yade::NormShearPhys>, boost::python::bases<yade::NormPhys>, boost::noncopyable_::noncopyable>::add_property(const char [19], boost::python::api::object, <unresolved overloaded function type>, const char*)’
In file included from /usr/include/boost/python.hpp:18,
                 from /home/xuan/Desktop/yade_1/trunk/lib/high-precision/RealHPConfig.hpp:35,
                 from /home/xuan/Desktop/yade_1/trunk/lib/high-precision/Real.hpp:231,
                 from /home/xuan/Desktop/yade_1/trunk/lib/base/Math.hpp:12,
                 from /home/xuan/Desktop/yade_1/trunk/core/Bound.hpp:10,
                 from /home/xuan/Desktop/yade_1/trunk/core/Body.hpp:13,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.hpp:5,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.cpp:4:
/usr/include/boost/python/class.hpp:301:11: note: candidate: ‘template<class Get> boost::python::class_<T, X1, X2, X3>::self& boost::python::class_<T, X1, X2, X3>::add_property(const char*, Get, const char*) [with Get = Get; W = yade::NormShearPhys; X1 = boost::shared_ptr<yade::NormShearPhys>; X2 = boost::python::bases<yade::NormPhys>; X3 = boost::noncopyable_::noncopyable]
  301 | self& add_property(char const* name, Get fget, char const* docstr = 0)
      | ^~~~~~~~~~~~
/usr/include/boost/python/class.hpp:301:11: note: template argument deduction/substitution failed:
In file included from /home/xuan/Desktop/yade_1/trunk/pkg/dem/FrictPhys.hpp:13,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.hpp:9,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.cpp:4:
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp:28: note: candidate expects 3 arguments, 4 provided
   28 | YADE_CLASS_BASE_DOC_ATTRS_CTOR(NormShearPhys,NormPhys,
      |
In file included from /usr/include/boost/python.hpp:18,
                 from /home/xuan/Desktop/yade_1/trunk/lib/high-precision/RealHPConfig.hpp:35,
                 from /home/xuan/Desktop/yade_1/trunk/lib/high-precision/Real.hpp:231,
                 from /home/xuan/Desktop/yade_1/trunk/lib/base/Math.hpp:12,
                 from /home/xuan/Desktop/yade_1/trunk/core/Bound.hpp:10,
                 from /home/xuan/Desktop/yade_1/trunk/core/Body.hpp:13,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.hpp:5,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.cpp:4:
/usr/include/boost/python/class.hpp:308:11: note: candidate: ‘template<class Get, class Set> boost::python::class_<T, X1, X2, X3>::self& boost::python::class_<T, X1, X2, X3>::add_property(const char*, Get, Set, const char*) [with Get = Get; Set = Set; W = yade::NormShearPhys; X1 = boost::shared_ptr<yade::NormShearPhys>; X2 = boost::python::bases<yade::NormPhys>; X3 = boost::noncopyable_::noncopyable]
  308 | self& add_property(char const* name, Get fget, Set fset, char const* docstr = 0)
      | ^~~~~~~~~~~~
/usr/include/boost/python/class.hpp:308:11: note: template argument deduction/substitution failed:
In file included from /home/xuan/Desktop/yade_1/trunk/pkg/dem/FrictPhys.hpp:13,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.hpp:9,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.cpp:4:
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp:28: note: couldn’t deduce template parameter ‘Set’
   28 | YADE_CLASS_BASE_DOC_ATTRS_CTOR(NormShearPhys,NormPhys,
      |
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp:28: error: use of ‘this’ in a constant expression
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp:28: error: no matching function for call to ‘boost::python::class_<yade::NormShearPhys, boost::shared_ptr<yade::NormShearPhys>, boost::python::bases<yade::NormPhys>, boost::noncopyable_::noncopyable>::add_property(const char [19], boost::python::api::object, <unresolved overloaded function type>, const char*)’
In file included from /usr/include/boost/python.hpp:18,
                 from /home/xuan/Desktop/yade_1/trunk/lib/high-precision/RealHPConfig.hpp:35,
                 from /home/xuan/Desktop/yade_1/trunk/lib/high-precision/Real.hpp:231,
                 from /home/xuan/Desktop/yade_1/trunk/lib/base/Math.hpp:12,
                 from /home/xuan/Desktop/yade_1/trunk/core/Bound.hpp:10,
                 from /home/xuan/Desktop/yade_1/trunk/core/Body.hpp:13,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.hpp:5,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.cpp:4:
/usr/include/boost/python/class.hpp:301:11: note: candidate: ‘template<class Get> boost::python::class_<T, X1, X2, X3>::self& boost::python::class_<T, X1, X2, X3>::add_property(const char*, Get, const char*) [with Get = Get; W = yade::NormShearPhys; X1 = boost::shared_ptr<yade::NormShearPhys>; X2 = boost::python::bases<yade::NormPhys>; X3 = boost::noncopyable_::noncopyable]
  301 | self& add_property(char const* name, Get fget, char const* docstr = 0)
      | ^~~~~~~~~~~~
/usr/include/boost/python/class.hpp:301:11: note: template argument deduction/substitution failed:
In file included from /home/xuan/Desktop/yade_1/trunk/pkg/dem/FrictPhys.hpp:13,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.hpp:9,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.cpp:4:
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp:28: note: candidate expects 3 arguments, 4 provided
   28 | YADE_CLASS_BASE_DOC_ATTRS_CTOR(NormShearPhys,NormPhys,
      |
In file included from /usr/include/boost/python.hpp:18,
                 from /home/xuan/Desktop/yade_1/trunk/lib/high-precision/RealHPConfig.hpp:35,
                 from /home/xuan/Desktop/yade_1/trunk/lib/high-precision/Real.hpp:231,
                 from /home/xuan/Desktop/yade_1/trunk/lib/base/Math.hpp:12,
                 from /home/xuan/Desktop/yade_1/trunk/core/Bound.hpp:10,
                 from /home/xuan/Desktop/yade_1/trunk/core/Body.hpp:13,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.hpp:5,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.cpp:4:
/usr/include/boost/python/class.hpp:308:11: note: candidate: ‘template<class Get, class Set> boost::python::class_<T, X1, X2, X3>::self& boost::python::class_<T, X1, X2, X3>::add_property(const char*, Get, Set, const char*) [with Get = Get; Set = Set; W = yade::NormShearPhys; X1 = boost::shared_ptr<yade::NormShearPhys>; X2 = boost::python::bases<yade::NormPhys>; X3 = boost::noncopyable_::noncopyable]
  308 | self& add_property(char const* name, Get fget, Set fset, char const* docstr = 0)
      | ^~~~~~~~~~~~
/usr/include/boost/python/class.hpp:308:11: note: template argument deduction/substitution failed:
In file included from /home/xuan/Desktop/yade_1/trunk/pkg/dem/FrictPhys.hpp:13,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.hpp:9,
                 from /home/xuan/Desktop/yade_1/trunk/pkg/common/Cylinder.cpp:4:
/home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp:28: note: couldn’t deduce template parameter ‘Set’
   28 | YADE_CLASS_BASE_DOC_ATTRS_CTOR(NormShearPhys,NormPhys,
      |
make[2]: *** [CMakeFiles/pkg_common.dir/build.make:89: CMakeFiles/pkg_common.dir/pkg/common/Cylinder.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:281: CMakeFiles/pkg_common.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
xuan@ubuntu:~/Desktop/yade_1/build$

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
xuanshenyu
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hello,

> I add two lines code

please emphasize the two lines / the change / diff /...
This way it is not very convenient to search the changes..

> There are the errors as below:
> /home/xuan/Desktop/yade_1/trunk/pkg/common/NormShearPhys.hpp:13:139: error: expected ‘(’ before ‘[’ token

even they may look a bit cryptic, usually the most important errors are at the top.
In this case it seems like some syntax problem.
Maybe "elemnormalForce[15]"? What should it do? The field is attribute name "[15]" does not make sense..

Cheers
Jan

Revision history for this message
xuanshenyu (shenyuxuan) said :
#2

Hi, Jan! Thanks for kind reply.

I am modifing the cohesiveFrictioncontactLaw model by deviding the contact surface of sphere-sphere into some elements, maybe 8 or 16, whatever there are a lot of problems to solve here.

##((Vector3r,elemnormalForce[15],Vector3r::Zero(),,"normal force for element in notion surface,the 15 merely is a especialy instance with 16 elements on the notion surface")), ##

The first line code was used to save the normalForce of 16 elements in contact surface or notion surface by a vector array.

Could you give me some advices for this?

Thanks for your help in advance.

Revision history for this message
Jan Stránský (honzik) said :
#3

Have a look at documentation [1].

If it should be array of Vector3r, then it must have different type then Vector3r, the easiest is probably vector<Vector3r>
The name must be valid C++/python variable name (i.e. without brackets).

Or you can make it C++ only, and then expose the name as a property as e.g. state.pos [2]

Or ... many more options, depending on your needs.

Cheers
Jan

[1] https://yade-dem.org/doc/prog.html#yade-class-base-doc-macro-family
[2] https://gitlab.com/yade-dev/trunk/-/blob/master/core/State.hpp#L87

Revision history for this message
xuanshenyu (shenyuxuan) said :
#4

Thanks Jan, your reply is conducive to solves my problems, adding Phys attribute in NormshearPhys.

However, there are some confusions about the self-defined geomtric parameters in Ig2_Sphere_Sphere_ScGeom.cpp or hpp. What should I do with these self-defined parameters so that they can be called in other code files (such as CohesiveFrictionContactLaw.cpp) in the same way that yade usually do?

Firstly, I modified the Ig2_Sphere_Sphere_ScGeom.cpp as below (merely a portion):
  ############Ig2_Sphere_Sphere_ScGeom.cpp (modified)############
 Vector3r normal = (se32.position + shift2) - se31.position;
    Real norm = normal.norm();
                                            normal /= norm;
    Real flatR = 0.5 * s1->radius; ####### (Parameters added by myselves)
    Real flatArea = (Pi * pow(flatR, 2)); #######
    const static int NR = 2; #######
    double delR = flatR / NR; #######
    const static int NC = 8; #######
    Real delC = 2 * Pi / NC; #######
    const static int TotElem = NR * NC; #######
    const static int totelem = TotElem-1; #######
    Real elemradius2=pow(pow(s2,2)+pow(t2,2),0.5);
 if (!c->isReal() && !force) { //don't fast-check distance if geometry will be updated anyway
  Real penetrationDepthSq = pow(interactionDetectionFactor * (s1->radius + s2->radius), 2) - normal.squaredNorm();
  if (penetrationDepthSq <= 0.01) {
   TIMING_DELTAS_CHECKPOINT("Ig2_Sphere_Sphere_ScGeom");
   return false;
  }
 }
 shared_ptr<ScGeom> scm;
 bool isNew = !c->geom;
    Vector3r elem11[totelem], elem21[totelem]; ##### (Parameters added by myselves)
    Vector3r elem12[totelem], elem22[totelem]; #####
    Vector3r elem13[totelem], elem23[totelem]; #####
#######################end#################

Revision history for this message
Jan Stránský (honzik) said :
#5

> However, there are some confusions about the self-defined geomtric parameters in Ig2_Sphere_Sphere_ScGeom.cpp or hpp.

what are "self-defined parameters"?

> What should I do with these self-defined parameters so that they can be called in other code files (such as CohesiveFrictionContactLaw.cpp) in the same way that yade usually do?

do it "the same way that yade usually do"?

Sorry, I really did not get the last post, please be more specific.

Cheers
Jan

Revision history for this message
xuanshenyu (shenyuxuan) said :
#6

Thanks Jan, I have been to your trouble so many times :).
>what are "self-defined parameters"?

I have a brief introdution about my work in #2, which I plan to add two notion surfaces,respectively, on two particles based on a
contact of sphere A - sphere B particles. Then the notion surfaces will be divided into some elements(A-e1,A-e2... A-en and B-e1,B-e2...B-en), and using the centroid coordinates of each elements (A-e1-c,A-e2-c... A-en-c and B-e1-c,B-e2-c...B-en-c) to calculate displeaces and forces between A-en and B-en.

So, there will be many parameters needed to be defined here. For example, the centroid coordinatr of elememt in notion surface , sphere particle and geodetic coordinates system.

>do it "the same way that yade usually do"?

And I plan to develop the geomtric relationship of this work based on the Ig2_Sphere_Sphere_ScGeom(.cpp and .hpp) and ScGeom(.cpp and .hpp) file etc. Due to my weeek C++ skills, I don't konw how to add these parameters into code file properly.

Thanks for your help in advance.

Revision history for this message
Jan Stránský (honzik) said :
#7

I see a few approaches here:

1) learn more C++ to make your C++ skills stronger, then this type of questions should not be needed or would be a different kind ("like which of these approaches is better?")

2) do "copy-paste" approach, get an existing quantity that is treated the same way you need and you "copy-paste" the quantity usage (initialization, storage, calls, ...) to your new code.

3) [3]

All options has unpredictable time resources (so ti is difficult to tell which is better)

Cheers
Jan

[3] https://yade-dem.org/doc/consulting.html

Revision history for this message
xuanshenyu (shenyuxuan) said :
#8

ok, thanks