Skip to content

Commit

Permalink
change namespace Field to Example
Browse files Browse the repository at this point in the history
  • Loading branch information
kwitaechong committed Sep 3, 2024
1 parent 67c1634 commit 8b4ee03
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 61 deletions.
6 changes: 3 additions & 3 deletions examples/dam_break.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ void DamBreak()
minimum_halo_size, MPI_COMM_WORLD );

// Make a particle list.
Cabana::ParticleTraits<Field::Stress, ParticleVelocity, Field::Position,
Field::Mass, Field::Pressure, Field::Volume,
Field::DetDefGrad>
Cabana::ParticleTraits<Example::Stress, ParticleVelocity, Example::Position,
Example::Mass, Example::Pressure, Example::Volume,
Example::DetDefGrad>
fields;
auto particles = Cabana::Grid::createParticleList<memory_space>(
"test_particles", fields );
Expand Down
4 changes: 2 additions & 2 deletions examples/sources/Particle_Field.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace Picasso
{

namespace Field
namespace Example
{

struct Mass : Field::Scalar<double>
Expand Down Expand Up @@ -60,7 +60,7 @@ struct DetDefGrad : Field::Scalar<double>

using Position = Picasso::Field::LogicalPosition<3>;

} // namespace Field
} // namespace Example

namespace APIC
{
Expand Down
12 changes: 6 additions & 6 deletions examples/sources/Particle_Init.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ struct ParticleInitFunc
x[1] <= block[4] && block[2] <= x[2] && x[2] <= block[5] )
{

Picasso::get( p, Picasso::Field::Stress() ) = 0.0;
Picasso::get( p, Picasso::Example::Stress() ) = 0.0;
Picasso::get( p, VelocityType() ) = 0.0;
Picasso::get( p, Picasso::Field::DetDefGrad() ) = 1.0;
Picasso::get( p, Picasso::Field::Mass() ) = pv * density;
Picasso::get( p, Picasso::Field::Volume() ) = pv;
Picasso::get( p, Picasso::Field::Pressure() ) = 0.0;
Picasso::get( p, Picasso::Example::DetDefGrad() ) = 1.0;
Picasso::get( p, Picasso::Example::Mass() ) = pv * density;
Picasso::get( p, Picasso::Example::Volume() ) = pv;
Picasso::get( p, Picasso::Example::Pressure() ) = 0.0;

for ( int d = 0; d < 3; ++d )
Picasso::get( p, Picasso::Field::Position(), d ) = x[d];
Picasso::get( p, Picasso::Example::Position(), d ) = x[d];
return true;
}

Expand Down
92 changes: 46 additions & 46 deletions examples/sources/Picasso_ExplicitMomentumUpdate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ struct ComputeGridVelocity
{
// Get the local dependencies.
auto m_i =
local_deps.get( Picasso::FieldLocation::Node(), Field::Mass() );
auto u_i =
local_deps.get( Picasso::FieldLocation::Node(), Field::Velocity() );
local_deps.get( Picasso::FieldLocation::Node(), Example::Mass() );
auto u_i = local_deps.get( Picasso::FieldLocation::Node(),
Example::Velocity() );
auto old_u_i =
local_deps.get( Picasso::FieldLocation::Node(), Field::OldU() );
local_deps.get( Picasso::FieldLocation::Node(), Example::OldU() );

// Compute velocity.
for ( int d = 0; d < 3; ++d )
Expand Down Expand Up @@ -64,16 +64,16 @@ struct ComputeParticlePressure
ParticleViewType& particle ) const
{
// Get particle data.
auto x_p = Picasso::get( particle, Field::Position() );
auto& J_p = Picasso::get( particle, Field::DetDefGrad() );
auto& p_p = Picasso::get( particle, Field::Pressure() );
auto s_p = Picasso::get( particle, Field::Stress() );
auto v_p = Picasso::get( particle, Field::Volume() );
auto m_p = Picasso::get( particle, Field::Mass() );
auto x_p = Picasso::get( particle, Example::Position() );
auto& J_p = Picasso::get( particle, Example::DetDefGrad() );
auto& p_p = Picasso::get( particle, Example::Pressure() );
auto s_p = Picasso::get( particle, Example::Stress() );
auto v_p = Picasso::get( particle, Example::Volume() );
auto m_p = Picasso::get( particle, Example::Mass() );

// Get the gather dependencies.
auto u_i = gather_deps.get( Picasso::FieldLocation::Node(),
Field::Velocity() );
Example::Velocity() );

// update strain rate
auto spline = Picasso::createSpline(
Expand Down Expand Up @@ -114,13 +114,13 @@ struct ComputeGridVelocityChangeStress
const LocalDependencies&, ParticleViewType& particle ) const
{
// Get particle data.
auto v_p = Picasso::get( particle, Field::Volume() );
auto x_p = Picasso::get( particle, Field::Position() );
auto s_p = Picasso::get( particle, Field::Stress() );
auto v_p = Picasso::get( particle, Example::Volume() );
auto x_p = Picasso::get( particle, Example::Position() );
auto s_p = Picasso::get( particle, Example::Stress() );

// Get the scatter dependencies.
auto delta_u_s_i = scatter_deps.get( Picasso::FieldLocation::Node(),
Field::DeltaUStress() );
Example::DeltaUStress() );

// Node interpolant.
auto spline = Picasso::createSpline(
Expand Down Expand Up @@ -151,12 +151,12 @@ struct ComputeGridVelocityChangeGravity
const LocalDependencies&, ParticleViewType& particle ) const
{
// Get particle data.
auto m_p = Picasso::get( particle, Field::Mass() );
auto x_p = Picasso::get( particle, Field::Position() );
auto m_p = Picasso::get( particle, Example::Mass() );
auto x_p = Picasso::get( particle, Example::Position() );

// Get the scatter dependencies.
auto delta_u_g_i = scatter_deps.get( Picasso::FieldLocation::Node(),
Field::DeltaUGravity() );
Example::DeltaUGravity() );

// Node interpolant.
auto spline = Picasso::createSpline(
Expand Down Expand Up @@ -190,14 +190,14 @@ struct UpdateGridVelocity
{
// Get the local dependencies.
auto m_i =
gather_deps.get( Picasso::FieldLocation::Node(), Field::Mass() );
gather_deps.get( Picasso::FieldLocation::Node(), Example::Mass() );
auto u_i = gather_deps.get( Picasso::FieldLocation::Node(),
Field::Velocity() );
Example::Velocity() );
auto delta_u_s_i = gather_deps.get( Picasso::FieldLocation::Node(),
Field::DeltaUStress() );
Example::DeltaUStress() );

auto delta_u_g_i = gather_deps.get( Picasso::FieldLocation::Node(),
Field::DeltaUGravity() );
Example::DeltaUGravity() );

// Compute velocity.
Picasso::Vec3<double> zeros = { 0.0, 0.0, 0.0 };
Expand Down Expand Up @@ -239,13 +239,13 @@ struct Grid2ParticleVelocity<InterpolationOrder, APIC::APicTag>
{
// Get particle data.
auto f_p = Picasso::get( particle, APIC::Field::Velocity() );
auto x_p = Picasso::get( particle, Field::Position() );
auto x_p = Picasso::get( particle, Example::Position() );

// Get the gather dependencies.
auto m_i =
gather_deps.get( Picasso::FieldLocation::Node(), Field::Mass() );
gather_deps.get( Picasso::FieldLocation::Node(), Example::Mass() );
auto u_i = gather_deps.get( Picasso::FieldLocation::Node(),
Field::Velocity() );
Example::Velocity() );
// Get the local dependencies for getting physcial location of node
auto x_i = local_deps.get( Picasso::FieldLocation::Node(),
Picasso::Field::PhysicalPosition<3>() );
Expand All @@ -257,7 +257,7 @@ struct Grid2ParticleVelocity<InterpolationOrder, APIC::APicTag>
Picasso::SplineValue(), Picasso::SplineDistance(),
Picasso::SplineGradient() );

// Update particle velocity using a PolyPIC update.
// Update particle velocity using a APIC update.
Picasso::APIC::g2p( u_i, f_p, spline );

// Update particle position.
Expand Down Expand Up @@ -293,16 +293,16 @@ struct Grid2ParticleVelocity<InterpolationOrder, FlipTag>
ParticleViewType& particle ) const
{
// Get particle data.
auto u_p = Picasso::get( particle, Field::Velocity() );
auto x_p = Picasso::get( particle, Field::Position() );
auto u_p = Picasso::get( particle, Example::Velocity() );
auto x_p = Picasso::get( particle, Example::Position() );

// Get the gather dependencies.
auto m_i =
gather_deps.get( Picasso::FieldLocation::Node(), Field::Mass() );
gather_deps.get( Picasso::FieldLocation::Node(), Example::Mass() );
auto u_i = gather_deps.get( Picasso::FieldLocation::Node(),
Field::Velocity() );
Example::Velocity() );
auto old_u_i =
gather_deps.get( Picasso::FieldLocation::Node(), Field::OldU() );
gather_deps.get( Picasso::FieldLocation::Node(), Example::OldU() );

// Get the local dependencies for getting physcial location of node
auto x_i = local_deps.get( Picasso::FieldLocation::Node(),
Expand Down Expand Up @@ -394,12 +394,12 @@ struct Particle2Grid<InterpolationOrder, ParticleFieldType, OldFieldType,
{
// Get particle data.
auto f_p = Picasso::get( particle, ParticleFieldType() );
auto m_p = Picasso::get( particle, Field::Mass() );
auto x_p = Picasso::get( particle, Field::Position() );
auto m_p = Picasso::get( particle, Example::Mass() );
auto x_p = Picasso::get( particle, Example::Position() );

// Get the scatter dependencies.
auto m_i =
scatter_deps.get( Picasso::FieldLocation::Node(), Field::Mass() );
scatter_deps.get( Picasso::FieldLocation::Node(), Example::Mass() );
auto f_i =
scatter_deps.get( Picasso::FieldLocation::Node(), OldFieldType() );

Expand Down Expand Up @@ -436,12 +436,12 @@ struct Particle2Grid<InterpolationOrder, ParticleFieldType, OldFieldType,
{
// Get particle data.
auto f_p = Picasso::get( particle, ParticleFieldType() );
auto m_p = Picasso::get( particle, Field::Mass() );
auto x_p = Picasso::get( particle, Field::Position() );
auto m_p = Picasso::get( particle, Example::Mass() );
auto x_p = Picasso::get( particle, Example::Position() );

// Get the scatter dependencies.
auto m_i =
scatter_deps.get( Picasso::FieldLocation::Node(), Field::Mass() );
scatter_deps.get( Picasso::FieldLocation::Node(), Example::Mass() );
auto f_i =
scatter_deps.get( Picasso::FieldLocation::Node(), OldFieldType() );

Expand All @@ -467,15 +467,15 @@ class ExplicitMomentumIntegrator
{
public:
using mass_type =
Picasso::FieldLayout<Picasso::FieldLocation::Node, Field::Mass>;
Picasso::FieldLayout<Picasso::FieldLocation::Node, Example::Mass>;
using velocity_type =
Picasso::FieldLayout<Picasso::FieldLocation::Node, Field::Velocity>;
Picasso::FieldLayout<Picasso::FieldLocation::Node, Example::Velocity>;
using old_u_type =
Picasso::FieldLayout<Picasso::FieldLocation::Node, Field::OldU>;
using delta_u_s_type =
Picasso::FieldLayout<Picasso::FieldLocation::Node, Field::DeltaUStress>;
Picasso::FieldLayout<Picasso::FieldLocation::Node, Example::OldU>;
using delta_u_s_type = Picasso::FieldLayout<Picasso::FieldLocation::Node,
Example::DeltaUStress>;
using delta_u_g_type = Picasso::FieldLayout<Picasso::FieldLocation::Node,
Field::DeltaUGravity>;
Example::DeltaUGravity>;
using grid_type = Picasso::FieldLayout<Picasso::FieldLocation::Node,
Picasso::Field::PhysicalPosition<3>>;

Expand Down Expand Up @@ -580,7 +580,7 @@ class ExplicitMomentumIntegrator
const int spline_order = 1;

// P2G
Particle2Grid<spline_order, interpolation_variable, Field::OldU,
Particle2Grid<spline_order, interpolation_variable, Example::OldU,
interpolation_type>
p2g_func{ _dt };
_p2g_momentum.apply( "Picasso::p2g_U",
Expand Down Expand Up @@ -620,7 +620,7 @@ class ExplicitMomentumIntegrator
update_u_func );

// Apply boundary condition.
ApplyBoundaryCondition<BCType, Field::Velocity> apply_bc{ bc };
ApplyBoundaryCondition<BCType, Example::Velocity> apply_bc{ bc };
_apply_bc_momentum.apply( "Picasso::BC_U",
Picasso::FieldLocation::Node(), exec_space,
fm, apply_bc );
Expand All @@ -633,7 +633,7 @@ class ExplicitMomentumIntegrator
particles, g2p_func );

// Do not force particles redistribution
particles.redistribute( local_grid, Field::Position() );
particles.redistribute( local_grid, Example::Position() );

_total_time += _dt;
_total_steps += 1;
Expand Down
8 changes: 4 additions & 4 deletions examples/sources/Picasso_Output.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ void outputParticles( MPI_Comm comm, ExecutionSpace, ParticleVelocity,
{
auto h5_config = Impl::setupHDF5Config();

auto x = particles.slice( Picasso::Field::Position() );
auto p_p = particles.slice( Picasso::Field::Pressure() );
auto x = particles.slice( Picasso::Example::Position() );
auto p_p = particles.slice( Picasso::Example::Pressure() );
auto vel_p = particles.slice( ParticleVelocity() );
auto m_p = particles.slice( Picasso::Field::Mass() );
auto v_p = particles.slice( Picasso::Field::Volume() );
auto m_p = particles.slice( Picasso::Example::Mass() );
auto v_p = particles.slice( Picasso::Example::Volume() );

std::string prefix = "particles";
Cabana::Experimental::HDF5ParticleOutput::writeTimeStep(
Expand Down

0 comments on commit 8b4ee03

Please sign in to comment.