// ----------------------------------------------------------------------
 void
 UniformAutoPointGenerator::
 pre_generate( shawn::SimulationController& sc,
               reading::ConstBoolReadingHandle rh ) 
    throw( std::runtime_error )
 {
    assert( pg2_.is_not_null() );
    assert( pg25_.is_not_null() );
    assert( pg3_.is_not_null() );
    
    if( dynamic_cast<const Topology2D*>(rh.get()) != NULL )
       active_=pg2_;
    else if( dynamic_cast<const Topology25D*>(rh.get()) != NULL )
       active_=pg25_;
    else if( dynamic_cast<const Topology3D*>(rh.get()) != NULL )
       active_=pg3_;
    else {
       active_=pg3_;
       WARN( logger(),
             string("Don't know type of topology '") +
             rh->name() + 
             string("' -- falling back to ") +
             active_->name());
    }
    active_->pre_generate(sc,rh);
 }
Example #2
0
 // ----------------------------------------------------------------------
 void
 Uniform25DPointGenerator::
 pre_generate( shawn::SimulationController& sc,
               reading::ConstBoolReadingHandle br )
    throw( std::runtime_error )
 {
    RandomProcessPointGenerator::pre_generate(sc,br);
    assert( br.is_not_null() );
    const Topology25D* topo = dynamic_cast<const Topology25D*>(br.get());
    if( topo == NULL )
       throw std::runtime_error(std::string("cannot use uniform_25d on '") +
                                br->name() +
                                std::string("': it is no 2.5D topology"));
    lower_ = &topo->elevation();
    upper_ = &topo->upper_elevation();
    assert( lower_ != NULL );
    assert( upper_ != NULL );
 }