00001
00011 #ifndef SPATIALFAMILYPOPULATION_H_
00012 #define SPATIALFAMILYPOPULATION_H_
00013
00014 #include <vector>
00015 using std::vector;
00016
00017 #include <boost/shared_ptr.hpp>
00018 using boost::shared_ptr;
00019
00020 #include "SpatialSimObjectPopulation.h"
00021 #include "SpatialFamilyIDGenerator.h"
00022
00024
00043 class SpatialFamilyPopulation : public SpatialSimObjectPopulation {
00044
00045 public:
00047 SpatialFamilyPopulation( SimNetwork & net,
00048 vector< SimObjectFactory* > const& families,
00049 SpatialFamilyIDGenerator const& fidgen,
00050 shared_ptr<Point3DSet> locs );
00051
00053 SpatialFamilyPopulation( SimNetwork & net,
00054 vector< shared_ptr<SimObjectFactory> > const& families,
00055 SpatialFamilyIDGenerator const& fidgen,
00056 shared_ptr<Point3DSet> locs );
00057
00059 SpatialFamilyPopulation( SimNetwork & net, SimObjectFactory * fam0, shared_ptr<Point3DSet> locs );
00060
00062 SpatialFamilyPopulation( vector< shared_ptr<SpatialFamilyPopulation> > const& pops );
00063
00065 virtual ~SpatialFamilyPopulation();
00066
00068 familyid_t getFamilyIdAt( Point3D<double> const& p );
00069
00071 familyid_t getFamilyIdAt( double const& x, double const& y, double const& z);
00072
00074 familyid_t getFamilyID( size_t index );
00075
00077 void setFamilyID( familyid_t newID );
00078
00080
00084 virtual shared_ptr<SpatialFamilyPopulation> subPopulation( vector< familyid_t > const& families );
00085
00087 virtual shared_ptr< vector< shared_ptr<SpatialFamilyPopulation> > > splitFamilies();
00088
00089 protected:
00090
00091 SpatialFamilyPopulation() {};
00092 SpatialFamilyPopulation( SimNetwork & net, shared_ptr<Point3DSet> locs);
00093
00095 SpatialFamilyPopulation( SimNetwork *net,
00096 vector<SimObject::ID::Packed> const& objIDs,
00097 vector<familyid_t> const& famIDs,
00098 shared_ptr<Point3DSet> locs );
00099
00101 virtual SpatialFamilyPopulation* new_subset( vector< size_t > const& indices ) const;
00102
00104 shared_ptr< vector<familyid_t> > familyIDs;
00105
00106 private:
00107
00109 SimObject::ID::Vector populate( vector< SimObjectFactory* > const& families );
00110
00111 };
00112
00113 #endif