I am trying to write a specific rheological creep law for my research, and I put the .h and .cc file in the include/material_model/rheology and source/material_model/rheology folder, respectively.
Like any other file, the .cc file ends with a MACRO command, like:
Why is there a .so file? If you add new files to include/ and source/ you just need to run cmake and make in the build directory of ASPECT.
You can check using c++filt _ZN6aspect13MaterialModel8Rheology30TestRheologyILi2EEC1Ev what symbol is behind this cryptic (“mangled”) name. You will need to implement it. I assume your constructor is not implemented in your cc file.
the .so is a plugin that I wrote, I tried to run cmake and make in the build folder, and this time I got an error like:
In file included from /home/chris/ASPECT/aspect/build/CMakeFiles/aspect.dir/Unity/unity_14_cxx.cxx:6:
/home/chris/ASPECT/aspect/source/material_model/rheology/TestRheology.cc:18:4: error: redeclaration of ‘const aspect::MaterialModel::Rheology::TestRheologyParameters aspect::MaterialModel::Rheology::TestRheology::compute_creep_parameters(unsigned int, const std::vector<double, std::allocator >&, const std::vector&) const’ may not have default arguments [-fpermissive]
18 | TestRheology::compute_creep_parameters(const unsigned int composition,
| ^~~~~~~~~~~~~~~~~~~
In file included from /home/chris/ASPECT/aspect/build/CMakeFiles/aspect.dir/Unity/unity_14_cxx.cxx:6:
/home/chris/ASPECT/aspect/source/material_model/rheology/TestRheology.cc:53:11: error: redeclaration of ‘double aspect::MaterialModel::Rheology::TestRheology::compute_viscosity(double, double, unsigned int, const std::vector<double, std::allocator >&, const std::vector&) const’ may not have default arguments [-fpermissive]
53 | double TestRheology::compute_viscosity(const double strain_rate_II,
| ^~~~~~~~~~~~~~~~~~~
/home/chris/ASPECT/aspect/source/material_model/rheology/TestRheology.cc:91:11: error: redeclaration of ‘double aspect::MaterialModel::Rheology::TestRheology::get_reference_viscosity_dislocation(unsigned int, const std::vector<double, std::allocator >&, const std::vector&) const’ may not have default arguments [-fpermissive]
91 | double TestRheology::get_reference_viscosity(const unsigned int composition,
| ^~~~~~~~~~~~~~~~~~~
/home/chris/ASPECT/aspect/source/material_model/rheology/TestRheology.cc:136:9: error: redeclaration of ‘void aspect::MaterialModel::Rheology::TestRheology::parse_parameters(dealii::ParameterHandler&, const std::shared_ptr<std::vector >&)’ may not have default arguments [-fpermissive]
136 | void TestRheology::parse_parameters(ParameterHandler &prm,
Sorry for the typographical mess, but it looks like these errors all involve a keyword: redeclaration
then the compiler will complain about the fact that you provide a default value (the “=4”) for argument “i” in the definition (the last line) when you have already done so in the declaration (line 2). C++ just doesn’t allow that. You have to pick one place or the other, but not both.