Skip to content

Commit

Permalink
Add BC convenience interface for single plane
Browse files Browse the repository at this point in the history
  • Loading branch information
streeve committed Aug 8, 2024
1 parent b50761c commit 111f2fa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
4 changes: 1 addition & 3 deletions examples/mechanics/kalthoff_winkler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,8 @@ void kalthoffWinklerExample( const std::string filename )
CabanaPD::RegionBoundary<CabanaPD::RectangularPrism> plane(
x_bc - dx, x_bc + dx * 1.25, y_prenotch1 - dx * 0.25,
y_prenotch2 + dx * 0.25, -thickness, thickness );
std::vector<CabanaPD::RegionBoundary<CabanaPD::Rectilinear>> planes = {
plane };
auto bc = createBoundaryCondition( CabanaPD::ForceValueBCTag{}, 0.0,
exec_space{}, *particles, planes );
exec_space{}, *particles, plane );

// ====================================================
// Custom particle initialization
Expand Down
23 changes: 23 additions & 0 deletions src/CabanaPD_Boundary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,29 @@ auto createBoundaryCondition( UserFunctor user_functor, ExecSpace exec_space,
bc_indices, user_functor, force_update );
}

template <class BoundaryType, class BCTag, class ExecSpace, class Particles>
auto createBoundaryCondition( BCTag tag, const double value,
ExecSpace exec_space, Particles particles,
BoundaryType plane,
const double initial_guess = 0.5 )
{
std::vector<BoundaryType> plane_vec = { plane };
return createBoundaryCondition( tag, value, exec_space, particles,
plane_vec, initial_guess );
}

template <class UserFunctor, class BoundaryType, class ExecSpace,
class Particles>
auto createBoundaryCondition( UserFunctor user_functor, ExecSpace exec_space,
Particles particles, BoundaryType plane,
const bool force_update,
const double initial_guess = 0.5 )
{
std::vector<BoundaryType> plane_vec = { plane };
return createBoundaryCondition( user_functor, exec_space, particles,
plane_vec, force_update, initial_guess );
}

} // namespace CabanaPD

#endif

0 comments on commit 111f2fa

Please sign in to comment.