ORNL / CabanaPD

Peridynamics with the Cabana library
BSD 3-Clause "New" or "Revised" License
15 stars 8 forks source link

Read particles from file #9

Open streeve opened 1 year ago

streeve commented 1 year ago
diehlpk commented 1 year ago

I am working to read the discrete PD nodes from a CSV file and extended the code here

https://github.com/diehlpk/CabanaPD/blob/4701a671d01732df25e200419c0c5ab3add8818b/src/CabanaPD_Particles.hpp#L285

However, I get some compilation errors


[ 50%] Building CXX object examples/CMakeFiles/ElasticWave.dir/elastic_wave.cpp.o
In file included from /home/diehlpk/Compile/CabanaPD/src/CabanaPD_Force.hpp:67,
                 from /home/diehlpk/Compile/CabanaPD/src/CabanaPD.hpp:17,
                 from /home/diehlpk/Compile/CabanaPD/examples/elastic_wave.cpp:19:
/home/diehlpk/Compile/CabanaPD/src/CabanaPD_Particles.hpp: In member function ‘void CabanaPD::Particles<DeviceType, CabanaPD::PMB, Dimension>::create_particles_from_csv(const ExecSpace&, std::__cxx11::string)’:
/home/diehlpk/Compile/CabanaPD/src/CabanaPD_Particles.hpp:323:9: error: ‘_aosoa_m’ was not declared in this scope
         _aosoa_m.resize( num_particles );
         ^~~~~~~~
/home/diehlpk/Compile/CabanaPD/src/CabanaPD_Particles.hpp:323:9: note: suggested alternative: ‘_aosoa_x’
         _aosoa_m.resize( num_particles );
         ^~~~~~~~
         _aosoa_x
/home/diehlpk/Compile/CabanaPD/src/CabanaPD_Particles.hpp:324:9: error: ‘_aosoa_theta’ was not declared in this scope
         _aosoa_theta.resize( num_particles );
         ^~~~~~~~~~~~
/home/diehlpk/Compile/CabanaPD/src/CabanaPD_Particles.hpp:324:9: note: suggested alternative: ‘_aosoa_other’
         _aosoa_theta.resize( num_particles );
         ^~~~~~~~~~~~
         _aosoa_other
/home/diehlpk/Compile/CabanaPD/src/CabanaPD_Particles.hpp:335:22: error: there are no arguments to ‘slice_theta’ that depend on a template parameter, so a declaration of ‘slice_theta’ must be available [-fpermissive]
         auto theta = slice_theta();
                      ^~~~~~~~~~~
/home/diehlpk/Compile/CabanaPD/src/CabanaPD_Particles.hpp:335:22: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/home/diehlpk/Compile/CabanaPD/src/CabanaPD_Particles.hpp:337:18: error: there are no arguments to ‘slice_m’ that depend on a template parameter, so a declaration of ‘slice_m’ must be available [-fpermissive]
         auto m = slice_m();
                  ^~~~~~~
make[2]: *** [examples/CMakeFiles/ElasticWave.dir/build.make:76: examples/CMakeFiles/ElasticWave.dir/elastic_wave.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:171: examples/CMakeFiles/ElasticWave.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

I am not sure where _aosoa_m are defined in https://github.com/diehlpk/CabanaPD/blob/4701a671d01732df25e200419c0c5ab3add8818b/src/CabanaPD_Particles.hpp#L202 which I adapted.

streeve commented 1 year ago

That's bad timing on our part having just merged a split of the PMB and LPS models in #18.

If you remove all usage of _aosoa_m and _aosoa_theta (only defined in the inherited LPS class below) you should be okay

diehlpk commented 1 year ago

Thanks. Will give it a try tomorrow.

diehlpk commented 1 year ago

OK, that worked and I can compile the ElasticWave example.

diehlpk commented 1 year ago

refs #33