7
7
#include < ecell4/core/Real3.hpp>
8
8
#include < ecell4/core/Integer3.hpp>
9
9
#include < ecell4/core/PeriodicRTree.hpp>
10
+ #include < ecell4/core/exceptions.hpp>
10
11
11
12
#ifdef WITH_HDF5
12
13
#include < ecell4/core/ParticleSpaceHDF5Writer.hpp>
@@ -82,17 +83,7 @@ class ParticleSpaceRTreeImpl
82
83
83
84
const particle_container_type& particles () const override
84
85
{
85
- // Since PeriodicRTree manages particles as their index, the container
86
- // can occasionally contains "already-erased" particles marked as
87
- // "overwritable", like a colony (P0447R1). Because of this, the raw
88
- // reference may contain an invalid particle that is already removed
89
- // from the space. It may invalidates subsequent operation.
90
- // To avoid confusion, this method throws an exception. This will
91
- // never be implemented, so it throws a `NotSupported`, not a
92
- // `NotImplemented`. Since the default implementation of `list_species()`
93
- // uses this function, it is overriden later.
94
- throw NotSupported (" ParticleSpaceRTreeImpl does not support "
95
- " `particle_container_type const& particles()`" );
86
+ return rtree_.list_objects ();
96
87
}
97
88
98
89
// ParticleSpace has the default list_species implementation.
@@ -104,10 +95,8 @@ class ParticleSpaceRTreeImpl
104
95
{
105
96
if (!rtree_.has (pid))
106
97
{
107
- std::ostringstream oss;
108
- oss << " ParticleSpaceRTreeImpl::get_particle: No such particle ("
109
- << pid << " )." ;
110
- throw NotFound (oss.str ());
98
+ throw_exception<NotFound>(" ParticleSpaceRTreeImpl::get_particle: "
99
+ " No such particle (" , pid, " )." );
111
100
}
112
101
return rtree_.get (pid);
113
102
}
@@ -143,10 +132,8 @@ class ParticleSpaceRTreeImpl
143
132
{
144
133
if (!rtree_.has (pid))
145
134
{
146
- std::ostringstream oss;
147
- oss << " ParticleSpaceRTreeImpl::remove_particle: No such particle ("
148
- << pid << " )." ;
149
- throw NotFound (oss.str ());
135
+ throw_exception<NotFound>(" ParticleSpaceRTreeImpl::remove_particle:"
136
+ " No such particle (" , pid, " )." );
150
137
}
151
138
const auto & p = rtree_.get (pid).second ;
152
139
particle_pool_[p.species_serial ()].erase (pid);
0 commit comments