Skip to content

Commit

Permalink
Merge pull request picassodev#98 from kwitaechong/remove_plist
Browse files Browse the repository at this point in the history
remove Picasso::ParticleList
  • Loading branch information
streeve authored Oct 23, 2023
2 parents b021f61 + 87d8102 commit 338a700
Showing 1 changed file with 0 additions and 85 deletions.
85 changes: 0 additions & 85 deletions src/Picasso_ParticleList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,91 +137,6 @@ get( const ParticleType& particle, FieldTag tag )
ParticleType::vector_length );
}

//---------------------------------------------------------------------------//
// Particle List
//---------------------------------------------------------------------------//
template <class Mesh, class... FieldTags>
class ParticleList
{
public:
using mesh_type = Mesh;

using memory_space = typename Mesh::memory_space;

using traits = Cabana::ParticleTraits<FieldTags...>;

using aosoa_type =
Cabana::AoSoA<typename traits::member_types, memory_space>;

using tuple_type = typename aosoa_type::tuple_type;

template <std::size_t M>
using slice_type = typename aosoa_type::template member_slice_type<M>;

using particle_type = Cabana::Particle<FieldTags...>;

using particle_view_type =
Cabana::ParticleView<aosoa_type::vector_length, FieldTags...>;

// Default constructor.
ParticleList( const std::string& label, const std::shared_ptr<Mesh>& mesh )
: _aosoa( label )
, _mesh( mesh )
, _label( label )
{
}

// Get the number of particles in the list.
std::size_t size() const { return _aosoa.size(); }

// Get the AoSoA
aosoa_type& aosoa() { return _aosoa; }
const aosoa_type& aosoa() const { return _aosoa; }

// Get the mesh.
const Mesh& mesh() { return *_mesh; }

// Get the label
const std::string& label() { return _label; }
const std::string& label() const { return _label; }

// Get a slice of a given field.
template <class FieldTag>
slice_type<TypeIndexer<FieldTag, FieldTags...>::index>
slice( FieldTag ) const
{
return Cabana::slice<TypeIndexer<FieldTag, FieldTags...>::index>(
_aosoa, FieldTag::label() );
}

// Redistribute particles to new owning grids. Return true if the
// particles were actually redistributed.
bool redistribute( const bool force_redistribute = false )
{
return Cajita::particleGridMigrate(
*( _mesh->localGrid() ),
this->slice( Field::LogicalPosition<mesh_type::num_space_dim>() ),
_aosoa, _mesh->minimumHaloWidth(), force_redistribute );
}

private:
aosoa_type _aosoa;
std::shared_ptr<Mesh> _mesh;
std::string _label;
};

//---------------------------------------------------------------------------//
// Creation function.
template <class Mesh, class... FieldTags>
std::shared_ptr<ParticleList<Mesh, FieldTags...>>
createParticleList( const std::string& label, const std::shared_ptr<Mesh>& mesh,
Cabana::ParticleTraits<FieldTags...> )
{
return std::make_shared<ParticleList<Mesh, FieldTags...>>( label, mesh );
}

//---------------------------------------------------------------------------//

} // end namespace Picasso

#endif // end PICASSO_PARTICLELIST_HPP

0 comments on commit 338a700

Please sign in to comment.