Skip to content

Commit

Permalink
Merge pull request #147 from streeve/fixup_thermal_particle_creation
Browse files Browse the repository at this point in the history
Enable createParticles for thermal examples
  • Loading branch information
streeve authored Nov 18, 2024
2 parents ab172a1 + 9b2a33f commit 84adbc0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ void thermalDeformationHeatTransferExample( const std::string filename )
// ====================================================
// Does not set displacements, velocities, etc.
auto particles =
std::make_shared<CabanaPD::Particles<memory_space, model_type,
typename thermal_type::base_type>>(
CabanaPD::createParticles<memory_space, model_type, thermal_type>(
exec_space(), low_corner, high_corner, num_cells, halo_width );

// ====================================================
Expand Down
19 changes: 8 additions & 11 deletions src/CabanaPD_Particles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -834,18 +834,15 @@ auto createParticles( const ExecSpace& exec_space,

template <typename MemorySpace, typename ModelType, typename ThermalType,
typename ExecSpace, std::size_t Dim>
auto createParticles( const ExecSpace& exec_space,
std::array<double, Dim> low_corner,
std::array<double, Dim> high_corner,
const std::array<int, Dim> num_cells,
const int max_halo_width,
typename std::enable_if<
(std::is_same_v<ThermalType, TemperatureDependent> ||
std::is_same_v<ThermalType, TemperatureIndependent>),
int>::type* = 0 )
auto createParticles(
const ExecSpace& exec_space, std::array<double, Dim> low_corner,
std::array<double, Dim> high_corner, const std::array<int, Dim> num_cells,
const int max_halo_width,
typename std::enable_if<( is_temperature_dependent<ThermalType>::value ),
int>::type* = 0 )
{
return std::make_shared<
CabanaPD::Particles<MemorySpace, ModelType, ThermalType>>(
return std::make_shared<CabanaPD::Particles<
MemorySpace, ModelType, typename ThermalType::base_type>>(
exec_space, low_corner, high_corner, num_cells, max_halo_width );
}

Expand Down
2 changes: 2 additions & 0 deletions src/CabanaPD_Types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ struct Fracture
// Thermal types.
struct TemperatureIndependent
{
using base_type = TemperatureIndependent;
};
struct TemperatureDependent
{
using base_type = TemperatureDependent;
};
struct DynamicTemperature : public TemperatureDependent
{
Expand Down

0 comments on commit 84adbc0

Please sign in to comment.