SpatialSimObjectPopulation.cpp

Go to the documentation of this file.
00001 
00011 #include "SpatialSimObjectPopulation.h"
00012 
00013 SpatialSimObjectPopulation::~SpatialSimObjectPopulation()
00014 {
00015 }
00016 
00017 SimObject::ID SpatialSimObjectPopulation::getIdAt( Point3D<double> const &p ) {
00018     return SimObjectPopulation::getID( locations->getIndex( p ) );
00019 }
00020 
00021 SimObject::ID SpatialSimObjectPopulation::getIdAt( double const& x, double const& y, double const& z ) {
00022     return SimObjectPopulation::getID( locations->getIndex( x, y, z ) );
00023 }
00024 
00025 SimObject* SpatialSimObjectPopulation::objectAt( Point3D<double> const& p ) {
00026     return SimObjectPopulation::object( locations->getIndex( p ) );
00027 }
00028 
00029 SimObject* SpatialSimObjectPopulation::objectAt( double const& x, double const& y, double const& z ) {
00030     return SimObjectPopulation::object( locations->getIndex( x, y, z ) );
00031 }
00032 
00033 Point3D<double> SpatialSimObjectPopulation::getLocation( size_t index ) const {
00034     return (*locations)[ index ];
00035 }
00036 
00037 shared_ptr<SpatialSimObjectPopulation> SpatialSimObjectPopulation::subPopulation( SubSpaceConstraint const& cnstr ) {
00038     return shared_ptr<SpatialSimObjectPopulation>( SpatialSimObjectPopulation::new_subset( (*locations->subspace_index( cnstr )) ) );
00039 }
00040 
00041 SpatialSimObjectPopulation* SpatialSimObjectPopulation::new_subset( vector< size_t > const& subindices ) const {
00042     size_t s;
00043     vector<SimObject::ID::Packed> objIDs( subindices.size() );
00044     for( size_t i=0; i<subindices.size(); i++ ) {
00045         s = subindices[i];
00046         objIDs[i] = (*id_vec)[ s ];
00047     }
00048     return new SpatialSimObjectPopulation( *net, objIDs, locations->subset( subindices ) );
00049 }
00050 
00051 
00052 

Generated on Wed Jul 9 16:34:37 2008 for PCSIM by  doxygen 1.5.5